var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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);

// ../../node_modules/.pnpm/big-integer@1.6.52/node_modules/big-integer/BigInteger.js
var require_BigInteger = __commonJS({
  "../../node_modules/.pnpm/big-integer@1.6.52/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 x5 = new Array(length);
        var i5 = -1;
        while (++i5 < length) {
          x5[i5] = 0;
        }
        return x5;
      }
      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(x5, n2) {
        var r3 = [];
        while (n2-- > 0)
          r3.push(0);
        return r3.concat(x5);
      }
      function multiplyKaratsuba(x5, y5) {
        var n2 = Math.max(x5.length, y5.length);
        if (n2 <= 30)
          return multiplyLong(x5, y5);
        n2 = Math.ceil(n2 / 2);
        var b4 = x5.slice(n2), a5 = x5.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, x5, 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));
        }
        x5 = this;
        y5 = Integer[1];
        while (true) {
          if (b4 & true) {
            y5 = y5.times(x5);
            --b4;
          }
          if (b4 === 0)
            break;
          b4 /= 2;
          x5 = x5.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 x5 = this;
        var y5 = Integer[1];
        while (true) {
          if ((b4 & _1) === _1) {
            y5 = y5.times(x5);
            --b4;
          }
          if (b4 === _0)
            break;
          b4 /= _22;
          x5 = x5.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, x5;
        while (b4.isEven())
          b4 = b4.divide(2), r3++;
        next:
          for (i5 = 0; i5 < a5.length; i5++) {
            if (n2.lesser(a5[i5]))
              continue;
            x5 = bigInt(a5[i5]).modPow(b4, n2);
            if (x5.isUnit() || x5.equals(nPrev))
              continue;
            for (d5 = r3 - 1; d5 != 0; d5--) {
              x5 = x5.square().mod(n2);
              if (x5.isUnit())
                return false;
              if (x5.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(x5, y5, fn2) {
        y5 = parseValue(y5);
        var xSign = x5.isNegative(), ySign = y5.isNegative();
        var xRem = xSign ? x5.not() : x5, 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, x5 = typeof v3 === "number" ? v3 | LOBMASK_I : typeof v3 === "bigint" ? v3 | BigInt(LOBMASK_I) : v3[0] + v3[1] * BASE | LOBMASK_BI;
        return x5 & -x5;
      }
      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(x5) {
          return stringify(x5, 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 || alphabet)
          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 || alphabet)
          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 x5 = +v3;
          if (x5 === truncate(x5))
            return supportsNativeBigInt ? new NativeBigInt(BigInt(x5)) : new SmallInteger(x5);
          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(x5) {
        return x5 instanceof BigInteger || x5 instanceof SmallInteger || x5 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(x5) {
            return x5;
          })(
            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, match6, 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") {
              match6 = parse_tree[i4];
              if (match6[2]) {
                arg = argv[cursor];
                for (k5 = 0; k5 < match6[2].length; k5++) {
                  if (!arg.hasOwnProperty(match6[2][k5])) {
                    throw sprintf('[sprintf] property "%s" does not exist', match6[2][k5]);
                  }
                  arg = arg[match6[2][k5]];
                }
              } else if (match6[1]) {
                arg = argv[match6[1]];
              } else {
                arg = argv[cursor++];
              }
              if (/[^s]/.test(match6[8]) && get_type(arg) != "number") {
                throw sprintf("[sprintf] expecting number but found %s", get_type(arg));
              }
              if (typeof arg == "undefined" || arg === null) {
                arg = "";
              }
              switch (match6[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 = match6[7] ? arg.toExponential(match6[7]) : arg.toExponential();
                  break;
                case "f":
                  arg = match6[7] ? parseFloat(arg).toFixed(match6[7]) : parseFloat(arg);
                  break;
                case "o":
                  arg = arg.toString(8);
                  break;
                case "s":
                  arg = (arg = String(arg)) && match6[7] ? arg.substring(0, match6[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(match6[8]) && match6[3] && arg >= 0 ? "+" + arg : arg;
              pad_character = match6[4] ? match6[4] == "0" ? "0" : match6[4].charAt(1) : " ";
              pad_length = match6[6] - String(arg).length;
              pad = match6[6] ? str_repeat(pad_character, pad_length) : "";
              output.push(match6[5] ? arg + pad : pad + arg);
            }
          }
          return output.join("");
        };
        str_format.cache = {};
        str_format.parse = function(fmt) {
          var _fmt = fmt, match6 = [], parse_tree = [], arg_names = 0;
          while (_fmt) {
            if ((match6 = /^[^\x25]+/.exec(_fmt)) !== null) {
              parse_tree.push(match6[0]);
            } else if ((match6 = /^\x25{2}/.exec(_fmt)) !== null) {
              parse_tree.push("%");
            } else if ((match6 = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {
              if (match6[2]) {
                arg_names |= 1;
                var field_list = [], replacement_field = match6[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?";
                }
                match6[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(match6);
            } else {
              throw "[sprintf] huh?";
            }
            _fmt = _fmt.substring(match6[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, match6, col, lines;
              if (!this._more) {
                this.yytext = "";
                this.match = "";
              }
              var rules = this._currentRules();
              for (var i4 = 0; i4 < rules.length; i4++) {
                match6 = this._input.match(this.rules[rules[i4]]);
                if (match6) {
                  lines = match6[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 + match6[0].length
                  };
                  this.yytext += match6[0];
                  this.match += match6[0];
                  this.matches = match6;
                  this.yyleng = this.yytext.length;
                  this._more = false;
                  this._input = this._input.slice(match6[0].length);
                  this.matched += match6[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, x5 = i4 && i4.__k || e, C3 = x5.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 = x5[h5]) || d5 && k5.key == d5.key && k5.type === d5.type)
        x5[h5] = void 0;
      else
        for (y5 = 0; y5 < C3; y5++) {
          if ((d5 = x5[y5]) && k5.key == d5.key && k5.type === d5.type) {
            x5[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, x5, 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 != x5[h5] && N(x5[h5], x5[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 x(n2, l3) {
  return l3 = l3 || [], null == n2 || "boolean" == typeof n2 || (Array.isArray(n2) ? n2.some(function(n3) {
    x(n3, l3);
  }) : l3.push(n2)), l3;
}
function 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, x5, 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], x5 = 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, x5) : (u4.__c = h5 = new d(g4, x5), h5.constructor = T5, h5.render = O), m5 && m5.sub(h5), h5.props = g4, h5.state || (h5.state = {}), h5.context = x5, 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, x5), !h5.__e && null != h5.shouldComponentUpdate && false === h5.shouldComponentUpdate(g4, h5.__s, x5) || 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, x5), null != h5.componentDidUpdate && h5.__h.push(function() {
            h5.componentDidUpdate(y5, _3, k5);
          });
        }
        if (h5.context = x5, 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 x2(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: () => O2,
  Component: () => d,
  Fragment: () => p2,
  PureComponent: () => w3,
  StrictMode: () => vn2,
  Suspense: () => D3,
  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: () => k3,
  hydrate: () => q3,
  isValidElement: () => ln,
  lazy: () => M3,
  memo: () => R,
  render: () => Y2,
  startTransition: () => dn,
  unmountComponentAtNode: () => fn,
  unstable_batchedUpdates: () => sn,
  useCallback: () => T2,
  useContext: () => q2,
  useDebugValue: () => x2,
  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 E(n2, t4) {
  return n2 === t4 && (0 !== n2 || 1 / n2 == 1 / t4) || n2 != n2 && t4 != t4;
}
function w3(n2) {
  this.props = n2;
}
function R(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 k3(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 L3(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 L3(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 D3() {
  this.__u = 0, this.t = null, this.__b = null;
}
function F2(n2) {
  var t4 = n2.__.__c;
  return t4 && t4.__a && t4.__a(n2);
}
function M3(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 Y2(n2, t4, e4) {
  return null == t4.__k && (t4.textContent = ""), P(n2, t4), "function" == typeof e4 && e4(), n2 ? n2.__c : null;
}
function q3(n2, t4, e4) {
  return S2(n2, t4), "function" == typeof e4 && e4(), n2 ? n2.__c : null;
}
function J() {
}
function K3() {
  return this.cancelBubble;
}
function Q() {
  return this.defaultPrevented;
}
function on(n2) {
  return h.bind(null, n2);
}
function ln(n2) {
  return !!n2 && n2.$$typeof === z3;
}
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, E(u4.__, t4()) || o3({ h: u4 });
  }, [n2, e4, t4]), h2(function() {
    return E(u4.__, u4.v()) || o3({ h: u4 }), n2(function() {
      E(u4.__, u4.v()) || o3({ h: u4 });
    });
  }, [n2]), e4;
}
var x3, N2, A4, O2, T3, I3, W, z3, B3, H2, Z2, G, X2, 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();
    (w3.prototype = new d()).isPureReactComponent = true, w3.prototype.shouldComponentUpdate = function(n2, t4) {
      return C2(this.props, n2) || C2(this.state, t4);
    };
    x3 = l.__b;
    l.__b = function(n2) {
      n2.type && n2.type.__f && n2.ref && (n2.props.ref = n2.ref, n2.ref = null), x3 && x3(n2);
    };
    N2 = "undefined" != typeof Symbol && Symbol.for && Symbol.for("react.forward_ref") || 3911;
    A4 = function(n2, t4) {
      return null == n2 ? null : x(x(n2).map(t4));
    };
    O2 = { map: A4, forEach: A4, count: function(n2) {
      return n2 ? x(n2).length : 0;
    }, only: function(n2) {
      var t4 = x(n2);
      if (1 !== t4.length)
        throw "Children.only";
      return t4[0];
    }, toArray: x };
    T3 = 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);
      }
      T3(n2, t4, e4, r3);
    };
    I3 = l.unmount;
    l.unmount = function(n2) {
      var t4 = n2.__c;
      t4 && t4.__R && t4.__R(), t4 && true === n2.__h && (n2.type = null), I3 && I3(n2);
    }, (D3.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);
    }, D3.prototype.componentWillUnmount = function() {
      this.t = [];
    }, D3.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] = L3(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 = x(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);
      });
    };
    z3 = "undefined" != typeof Symbol && Symbol.for && Symbol.for("react.element") || 60103;
    B3 = /^(?: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]/;
    H2 = "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 });
      } });
    });
    G = l.event;
    l.event = function(n2) {
      return G && (n2 = G(n2)), n2.persist = J, n2.isPropagationStopped = K3, n2.isDefaultPrevented = Q, 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];
          H2 && "children" === i4 && "noscript" === t4 || "value" === i4 && "defaultValue" in e4 && null == l3 || ("defaultValue" === i4 && "value" in e4 && null == e4.value ? i4 = "value" : "download" === i4 && true === l3 ? l3 = "" : /ondoubleclick/i.test(i4) ? i4 = "ondblclick" : /^onchange(textarea|input)/i.test(i4 + t4) && !Z2(e4.type) ? i4 = "oninput" : /^onfocus$/i.test(i4) ? i4 = "onfocusin" : /^onblur$/i.test(i4) ? i4 = "onfocusout" : /^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(i4) ? i4 = i4.toLowerCase() : o3 && B3.test(i4) ? i4 = i4.replace(/[A-Z0-9]/g, "-$&").toLowerCase() : null === l3 && (l3 = void 0), /^oninput$/i.test(i4) && (i4 = i4.toLowerCase(), u4[i4] && (i4 = "oninputCapture")), u4[i4] = l3);
        }
        "select" == t4 && u4.multiple && Array.isArray(u4.value) && (u4.value = x(e4.children).forEach(function(n3) {
          n3.props.selected = -1 != u4.value.indexOf(n3.props.value);
        })), "select" == t4 && null != u4.defaultValue && (u4.value = x(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 = z3, tn && tn(n2);
    };
    en = l.__r;
    l.__r = function(n2) {
      en && en(n2), X2 = n2.__c;
    };
    rn = { ReactCurrentDispatcher: { current: { readContext: function(n2) {
      return X2.__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: x2, version: "17.0.2", Children: O2, render: Y2, hydrate: q3, unmountComponentAtNode: fn, createPortal: j3, createElement: h, createContext: B, createFactory: on, cloneElement: cn, createRef: y, Fragment: p2, isValidElement: ln, findDOMNode: an, Component: d, PureComponent: w3, memo: R, forwardRef: k3, flushSync: hn, unstable_batchedUpdates: sn, StrictMode: vn2, Suspense: D3, SuspenseList: V2, lazy: M3, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: rn };
  }
});

// ../../node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.3.1/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.3.1/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.3.1/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.3.1/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(match6, number2, quote, subString) {
        result.push(quote ? subString.replace(reEscapeChar, "$1") : number2 || match6);
      });
      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(/* @__PURE__ */ 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 convert4 = mapToArray;
        case setTag:
          var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
          convert4 || (convert4 = 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(convert4(object2), convert4(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 += '<table style="';
          qrHtml += " border-width: 0px; border-style: none;";
          qrHtml += " border-collapse: collapse;";
          qrHtml += " padding: 0px; margin: " + margin + "px;";
          qrHtml += '">';
          qrHtml += "<tbody>";
          for (var r3 = 0; r3 < _this.getModuleCount(); r3 += 1) {
            qrHtml += "<tr>";
            for (var c4 = 0; c4 < _this.getModuleCount(); c4 += 1) {
              qrHtml += '<td style="';
              qrHtml += " border-width: 0px; border-style: none;";
              qrHtml += " border-collapse: collapse;";
              qrHtml += " padding: 0px; margin: 0px;";
              qrHtml += " width: " + cellSize + "px;";
              qrHtml += " height: " + cellSize + "px;";
              qrHtml += " background-color: ";
              qrHtml += _this.isDark(r3, c4) ? "#000000" : "#ffffff";
              qrHtml += ";";
              qrHtml += '"/>';
            }
            qrHtml += "</tr>";
          }
          qrHtml += "</tbody>";
          qrHtml += "</table>";
          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 += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"';
          qrSvg += !opts.scalable ? ' width="' + size + 'px" height="' + size + 'px"' : "";
          qrSvg += ' viewBox="0 0 ' + size + " " + size + '" ';
          qrSvg += ' preserveAspectRatio="xMinYMin meet"';
          qrSvg += title.text || alt.text ? ' role="img" aria-labelledby="' + escapeXml([title.id, alt.id].join(" ").trim()) + '"' : "";
          qrSvg += ">";
          qrSvg += title.text ? '<title id="' + escapeXml(title.id) + '">' + escapeXml(title.text) + "</title>" : "";
          qrSvg += alt.text ? '<description id="' + escapeXml(alt.id) + '">' + escapeXml(alt.text) + "</description>" : "";
          qrSvg += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>';
          qrSvg += '<path d="';
          for (r3 = 0; r3 < _this.getModuleCount(); r3 += 1) {
            mr = r3 * cellSize + margin;
            for (c4 = 0; c4 < _this.getModuleCount(); c4 += 1) {
              if (_this.isDark(r3, c4)) {
                mc = c4 * cellSize + margin;
                qrSvg += "M" + mc + "," + mr + rect;
              }
            }
          }
          qrSvg += '" stroke="transparent" fill="black"/>';
          qrSvg += "</svg>";
          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(x5, y5) {
            if (min <= x5 && x5 < max && min <= y5 && y5 < max) {
              var c4 = Math.floor((x5 - 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 += "<img";
          img += ' src="';
          img += _this.createDataURL(cellSize, margin);
          img += '"';
          img += ' width="';
          img += size;
          img += '"';
          img += ' height="';
          img += size;
          img += '"';
          if (alt) {
            img += ' alt="';
            img += escapeXml(alt);
            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 += "&lt;";
                break;
              case ">":
                escaped += "&gt;";
                break;
              case "&":
                escaped += "&amp;";
                break;
              case '"':
                escaped += "&quot;";
                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, x5, 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 (x5 = 0; x5 < size; x5 += 1) {
              p4 = "\u2588";
              if (min <= x5 && x5 < max && min <= y5 && y5 < max && _this.isDark(r1, Math.floor((x5 - min) / cellSize))) {
                p4 = " ";
              }
              if (min <= x5 && x5 < max && min <= y5 + 1 && y5 + 1 < max && _this.isDark(r22, Math.floor((x5 - 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, x5, 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 (x5 = 0; x5 < size; x5 += 1) {
              p4 = 1;
              if (min <= x5 && x5 < max && min <= y5 && y5 < max && _this.isDark(r3, Math.floor((x5 - 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(x5, y5, pixel) {
          _data[y5 * _width + x5] = 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 x5 = 0; x5 < width; x5 += 1) {
            gif.setPixel(x5, y5, getPixel(x5, 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(x5, 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(x5, i4, h5, l3) {
  x5[i4] = h5 >> 24 & 255;
  x5[i4 + 1] = h5 >> 16 & 255;
  x5[i4 + 2] = h5 >> 8 & 255;
  x5[i4 + 3] = h5 & 255;
  x5[i4 + 4] = l3 >> 24 & 255;
  x5[i4 + 5] = l3 >> 16 & 255;
  x5[i4 + 6] = l3 >> 8 & 255;
  x5[i4 + 7] = l3 & 255;
}
function vn(x5, xi, y5, yi, n2) {
  let i4, d5 = 0;
  for (i4 = 0; i4 < n2; i4++)
    d5 |= x5[xi + i4] ^ y5[yi + i4];
  return (1 & d5 - 1 >>> 8) - 1;
}
function crypto_verify_32(x5, xi, y5, yi) {
  return vn(x5, 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 x5 = 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++)
    x5[i4] = m5[b4 - n2 + i4];
  x5[n2] = 128;
  n2 = 256 - 128 * (n2 < 112 ? 1 : 0);
  x5[n2 - 9] = 0;
  ts64(x5, n2 - 8, b4 / 536870912 | 0, b4 << 3);
  crypto_hashblocks_hl(hh, hl, x5, 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 x5 = new Uint8Array(256);
    const b4 = this.total;
    for (let i4 = 0; i4 < n2; i4++)
      x5[i4] = this.next[i4];
    x5[n2] = 128;
    n2 = 256 - 128 * (n2 < 112 ? 1 : 0);
    x5[n2 - 9] = 0;
    ts64(x5, n2 - 8, b4 / 536870912 | 0, b4 << 3);
    crypto_hashblocks_hl(this.hh, this.hl, x5, 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, x5) {
  let carry, i4, j4, k5;
  for (i4 = 63; i4 >= 32; --i4) {
    carry = 0;
    for (j4 = i4 - 32, k5 = i4 - 12; j4 < k5; ++j4) {
      x5[j4] += carry - 16 * x5[i4] * L[j4 - (i4 - 32)];
      carry = Math.floor((x5[j4] + 128) / 256);
      x5[j4] -= carry * 256;
    }
    x5[j4] += carry;
    x5[i4] = 0;
  }
  carry = 0;
  for (j4 = 0; j4 < 32; j4++) {
    x5[j4] += carry - (x5[31] >> 4) * L[j4];
    carry = x5[j4] >> 8;
    x5[j4] &= 255;
  }
  for (j4 = 0; j4 < 32; j4++)
    x5[j4] -= carry * L[j4];
  for (i4 = 0; i4 < 32; i4++) {
    x5[i4 + 1] += x5[i4] >> 8;
    r3[i4] = x5[i4] & 255;
  }
}
function reduce(r3) {
  const x5 = new Float64Array(64);
  for (let i4 = 0; i4 < 64; i4++)
    x5[i4] = r3[i4];
  for (let i4 = 0; i4 < 64; i4++)
    r3[i4] = 0;
  modL(r3, x5);
}
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(x5) {
  const len = x5.length;
  const z5 = new Float64Array(64);
  for (let i4 = 0; i4 < len; i4++)
    z5[i4] = x5[i4];
  const o3 = new Uint8Array(32);
  modL(o3, z5);
  return o3;
}
function crypto_core_ed25519_scalar_sub(x5, y5) {
  const z5 = new Float64Array(64);
  for (let i4 = 0; i4 < 32; i4++) {
    z5[i4] = x5[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 x5 = 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++)
    x5[i4] = 0;
  for (i4 = 0; i4 < 32; i4++)
    x5[i4] = r3[i4];
  for (i4 = 0; i4 < 32; i4++) {
    for (j4 = 0; j4 < 32; j4++) {
      x5[i4 + j4] += h5[i4] * skx[j4];
    }
  }
  modL(sm.subarray(32), x5);
  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(x5, 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++)
      x5[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_TOKEN_PERMISSION_INSUFFICIENT"] = 16] = "GENERIC_TOKEN_PERMISSION_INSUFFICIENT";
  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_COMPRESSION_INVALID"] = 28] = "GENERIC_COMPRESSION_INVALID";
  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_UNAUTHORIZED"] = 40] = "GENERIC_UNAUTHORIZED";
  TalerErrorCode2[TalerErrorCode2["GENERIC_TOKEN_UNKNOWN"] = 41] = "GENERIC_TOKEN_UNKNOWN";
  TalerErrorCode2[TalerErrorCode2["GENERIC_TOKEN_EXPIRED"] = 42] = "GENERIC_TOKEN_EXPIRED";
  TalerErrorCode2[TalerErrorCode2["GENERIC_TOKEN_MALFORMED"] = 43] = "GENERIC_TOKEN_MALFORMED";
  TalerErrorCode2[TalerErrorCode2["GENERIC_FORBIDDEN"] = 44] = "GENERIC_FORBIDDEN";
  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_COIN_UNKNOWN"] = 1019] = "EXCHANGE_GENERIC_COIN_UNKNOWN";
  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_GENERIC_KYC_CONVERTER_FAILED"] = 1037] = "EXCHANGE_GENERIC_KYC_CONVERTER_FAILED";
  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_COIN_HISTORY_BAD_SIGNATURE"] = 1251] = "EXCHANGE_COIN_HISTORY_BAD_SIGNATURE";
  TalerErrorCode2[TalerErrorCode2["EXCHANGE_RESERVE_HISTORY_BAD_SIGNATURE"] = 1252] = "EXCHANGE_RESERVE_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_KYC_CHECK_REQUEST_UNKNOWN"] = 1939] = "EXCHANGE_KYC_CHECK_REQUEST_UNKNOWN";
  TalerErrorCode2[TalerErrorCode2["EXCHANGE_KYC_CHECK_AUTHORIZATION_KEY_UNKNOWN"] = 1940] = "EXCHANGE_KYC_CHECK_AUTHORIZATION_KEY_UNKNOWN";
  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_CATEGORY_UNKNOWN"] = 2003] = "MERCHANT_GENERIC_CATEGORY_UNKNOWN";
  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_REWARD_ID_UNKNOWN"] = 2007] = "MERCHANT_GENERIC_REWARD_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_GENERIC_OTP_DEVICE_UNKNOWN"] = 2021] = "MERCHANT_GENERIC_OTP_DEVICE_UNKNOWN";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_ACCOUNT_UNKNOWN"] = 2022] = "MERCHANT_GENERIC_ACCOUNT_UNKNOWN";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_H_WIRE_MALFORMED"] = 2023] = "MERCHANT_GENERIC_H_WIRE_MALFORMED";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_GENERIC_CURRENCY_MISMATCH"] = 2024] = "MERCHANT_GENERIC_CURRENCY_MISMATCH";
  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_PAY_CHOICE_INDEX_MISSING"] = 2176] = "MERCHANT_POST_ORDERS_ID_PAY_CHOICE_INDEX_MISSING";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_CHOICE_INDEX_OUT_OF_BOUNDS"] = 2177] = "MERCHANT_POST_ORDERS_ID_PAY_CHOICE_INDEX_OUT_OF_BOUNDS";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_INPUT_TOKENS_MISMATCH"] = 2178] = "MERCHANT_POST_ORDERS_ID_PAY_INPUT_TOKENS_MISMATCH";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_TOKEN_ISSUE_SIG_INVALID"] = 2179] = "MERCHANT_POST_ORDERS_ID_PAY_TOKEN_ISSUE_SIG_INVALID";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_TOKEN_USE_SIG_INVALID"] = 2180] = "MERCHANT_POST_ORDERS_ID_PAY_TOKEN_USE_SIG_INVALID";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_TOKEN_COUNT_MISMATCH"] = 2181] = "MERCHANT_POST_ORDERS_ID_PAY_TOKEN_COUNT_MISMATCH";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_TOKEN_ENVELOPE_COUNT_MISMATCH"] = 2182] = "MERCHANT_POST_ORDERS_ID_PAY_TOKEN_ENVELOPE_COUNT_MISMATCH";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_POST_ORDERS_ID_PAY_TOKEN_INVALID"] = 2183] = "MERCHANT_POST_ORDERS_ID_PAY_TOKEN_INVALID";
  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_TOKEN_FAMILY_CONFLICT"] = 2225] = "MERCHANT_POST_TOKEN_FAMILY_CONFLICT";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_PATCH_TOKEN_FAMILY_NOT_FOUND"] = 2226] = "MERCHANT_PATCH_TOKEN_FAMILY_NOT_FOUND";
  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_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_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_REWARD_PICKUP_UNBLIND_FAILURE"] = 2400] = "MERCHANT_REWARD_PICKUP_UNBLIND_FAILURE";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_REWARD_PICKUP_EXCHANGE_ERROR"] = 2403] = "MERCHANT_REWARD_PICKUP_EXCHANGE_ERROR";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_REWARD_PICKUP_SUMMATION_FAILED"] = 2404] = "MERCHANT_REWARD_PICKUP_SUMMATION_FAILED";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_REWARD_PICKUP_HAS_EXPIRED"] = 2405] = "MERCHANT_REWARD_PICKUP_HAS_EXPIRED";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_REWARD_PICKUP_AMOUNT_EXCEEDS_REWARD_REMAINING"] = 2406] = "MERCHANT_REWARD_PICKUP_AMOUNT_EXCEEDS_REWARD_REMAINING";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_REWARD_PICKUP_DENOMINATION_UNKNOWN"] = 2407] = "MERCHANT_REWARD_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_ORDERS_TOKEN_FAMILY_SLUG_UNKNOWN"] = 2533] = "MERCHANT_PRIVATE_POST_ORDERS_TOKEN_FAMILY_SLUG_UNKNOWN";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_ORDERS_TOKEN_FAMILY_NOT_VALID"] = 2534] = "MERCHANT_PRIVATE_POST_ORDERS_TOKEN_FAMILY_NOT_VALID";
  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_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_POST_CATEGORIES_CONFLICT_CATEGORY_EXISTS"] = 2651] = "MERCHANT_PRIVATE_POST_CATEGORIES_CONFLICT_CATEGORY_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_REWARDS_NOT_ALLOWED"] = 2701] = "MERCHANT_PRIVATE_POST_RESERVES_REWARDS_NOT_ALLOWED";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_DELETE_RESERVES_NO_SUCH_RESERVE"] = 2710] = "MERCHANT_PRIVATE_DELETE_RESERVES_NO_SUCH_RESERVE";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_EXPIRED"] = 2750] = "MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_EXPIRED";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_UNKNOWN"] = 2751] = "MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_UNKNOWN";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_INSUFFICIENT_FUNDS"] = 2752] = "MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_INSUFFICIENT_FUNDS";
  TalerErrorCode2[TalerErrorCode2["MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_NOT_FOUND"] = 2753] = "MERCHANT_PRIVATE_POST_REWARD_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_PRIVATE_POST_OTP_DEVICES_CONFLICT_OTP_DEVICE_EXISTS"] = 2851] = "MERCHANT_PRIVATE_POST_OTP_DEVICES_CONFLICT_OTP_DEVICE_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_GENERIC_UNAUTHORIZED"] = 3001] = "AUDITOR_GENERIC_UNAUTHORIZED";
  TalerErrorCode2[TalerErrorCode2["AUDITOR_GENERIC_METHOD_NOT_ALLOWED"] = 3002] = "AUDITOR_GENERIC_METHOD_NOT_ALLOWED";
  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["AUDITOR_RESOURCE_NOT_FOUND"] = 3102] = "AUDITOR_RESOURCE_NOT_FOUND";
  TalerErrorCode2[TalerErrorCode2["AUDITOR_URI_MISSING_PATH_COMPONENT"] = 3103] = "AUDITOR_URI_MISSING_PATH_COMPONENT";
  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_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["BANK_RESERVED_USERNAME_CONFLICT"] = 5120] = "BANK_RESERVED_USERNAME_CONFLICT";
  TalerErrorCode2[TalerErrorCode2["BANK_REGISTER_USERNAME_REUSE"] = 5121] = "BANK_REGISTER_USERNAME_REUSE";
  TalerErrorCode2[TalerErrorCode2["BANK_REGISTER_PAYTO_URI_REUSE"] = 5122] = "BANK_REGISTER_PAYTO_URI_REUSE";
  TalerErrorCode2[TalerErrorCode2["BANK_ACCOUNT_BALANCE_NOT_ZERO"] = 5123] = "BANK_ACCOUNT_BALANCE_NOT_ZERO";
  TalerErrorCode2[TalerErrorCode2["BANK_UNKNOWN_CREDITOR"] = 5124] = "BANK_UNKNOWN_CREDITOR";
  TalerErrorCode2[TalerErrorCode2["BANK_UNKNOWN_DEBTOR"] = 5125] = "BANK_UNKNOWN_DEBTOR";
  TalerErrorCode2[TalerErrorCode2["BANK_ACCOUNT_IS_EXCHANGE"] = 5126] = "BANK_ACCOUNT_IS_EXCHANGE";
  TalerErrorCode2[TalerErrorCode2["BANK_ACCOUNT_IS_NOT_EXCHANGE"] = 5127] = "BANK_ACCOUNT_IS_NOT_EXCHANGE";
  TalerErrorCode2[TalerErrorCode2["BANK_BAD_CONVERSION"] = 5128] = "BANK_BAD_CONVERSION";
  TalerErrorCode2[TalerErrorCode2["BANK_MISSING_TAN_INFO"] = 5129] = "BANK_MISSING_TAN_INFO";
  TalerErrorCode2[TalerErrorCode2["BANK_CONFIRM_INCOMPLETE"] = 5130] = "BANK_CONFIRM_INCOMPLETE";
  TalerErrorCode2[TalerErrorCode2["BANK_TAN_RATE_LIMITED"] = 5131] = "BANK_TAN_RATE_LIMITED";
  TalerErrorCode2[TalerErrorCode2["BANK_TAN_CHANNEL_NOT_SUPPORTED"] = 5132] = "BANK_TAN_CHANNEL_NOT_SUPPORTED";
  TalerErrorCode2[TalerErrorCode2["BANK_TAN_CHANNEL_SCRIPT_FAILED"] = 5133] = "BANK_TAN_CHANNEL_SCRIPT_FAILED";
  TalerErrorCode2[TalerErrorCode2["BANK_TAN_CHALLENGE_FAILED"] = 5134] = "BANK_TAN_CHALLENGE_FAILED";
  TalerErrorCode2[TalerErrorCode2["BANK_NON_ADMIN_PATCH_LEGAL_NAME"] = 5135] = "BANK_NON_ADMIN_PATCH_LEGAL_NAME";
  TalerErrorCode2[TalerErrorCode2["BANK_NON_ADMIN_PATCH_DEBT_LIMIT"] = 5136] = "BANK_NON_ADMIN_PATCH_DEBT_LIMIT";
  TalerErrorCode2[TalerErrorCode2["BANK_NON_ADMIN_PATCH_MISSING_OLD_PASSWORD"] = 5137] = "BANK_NON_ADMIN_PATCH_MISSING_OLD_PASSWORD";
  TalerErrorCode2[TalerErrorCode2["BANK_PATCH_BAD_OLD_PASSWORD"] = 5138] = "BANK_PATCH_BAD_OLD_PASSWORD";
  TalerErrorCode2[TalerErrorCode2["BANK_PATCH_ADMIN_EXCHANGE"] = 5139] = "BANK_PATCH_ADMIN_EXCHANGE";
  TalerErrorCode2[TalerErrorCode2["BANK_NON_ADMIN_PATCH_CASHOUT"] = 5140] = "BANK_NON_ADMIN_PATCH_CASHOUT";
  TalerErrorCode2[TalerErrorCode2["BANK_NON_ADMIN_PATCH_CONTACT"] = 5141] = "BANK_NON_ADMIN_PATCH_CONTACT";
  TalerErrorCode2[TalerErrorCode2["BANK_ADMIN_CREDITOR"] = 5142] = "BANK_ADMIN_CREDITOR";
  TalerErrorCode2[TalerErrorCode2["BANK_CHALLENGE_NOT_FOUND"] = 5143] = "BANK_CHALLENGE_NOT_FOUND";
  TalerErrorCode2[TalerErrorCode2["BANK_TAN_CHALLENGE_EXPIRED"] = 5144] = "BANK_TAN_CHALLENGE_EXPIRED";
  TalerErrorCode2[TalerErrorCode2["BANK_NON_ADMIN_SET_TAN_CHANNEL"] = 5145] = "BANK_NON_ADMIN_SET_TAN_CHANNEL";
  TalerErrorCode2[TalerErrorCode2["BANK_NON_ADMIN_SET_MIN_CASHOUT"] = 5146] = "BANK_NON_ADMIN_SET_MIN_CASHOUT";
  TalerErrorCode2[TalerErrorCode2["BANK_CONVERSION_AMOUNT_TO_SMALL"] = 5147] = "BANK_CONVERSION_AMOUNT_TO_SMALL";
  TalerErrorCode2[TalerErrorCode2["BANK_AMOUNT_DIFFERS"] = 5148] = "BANK_AMOUNT_DIFFERS";
  TalerErrorCode2[TalerErrorCode2["BANK_AMOUNT_REQUIRED"] = 5149] = "BANK_AMOUNT_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_REWARD_COIN_SIGNATURE_INVALID"] = 7016] = "WALLET_REWARD_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["WALLET_EXCHANGE_UNAVAILABLE"] = 7032] = "WALLET_EXCHANGE_UNAVAILABLE";
  TalerErrorCode2[TalerErrorCode2["WALLET_EXCHANGE_ENTRY_USED"] = 7033] = "WALLET_EXCHANGE_ENTRY_USED";
  TalerErrorCode2[TalerErrorCode2["WALLET_DB_UNAVAILABLE"] = 7034] = "WALLET_DB_UNAVAILABLE";
  TalerErrorCode2[TalerErrorCode2["WALLET_TALER_URI_MALFORMED"] = 7035] = "WALLET_TALER_URI_MALFORMED";
  TalerErrorCode2[TalerErrorCode2["WALLET_CORE_REQUEST_CANCELLED"] = 7036] = "WALLET_CORE_REQUEST_CANCELLED";
  TalerErrorCode2[TalerErrorCode2["WALLET_EXCHANGE_TOS_NOT_ACCEPTED"] = 7037] = "WALLET_EXCHANGE_TOS_NOT_ACCEPTED";
  TalerErrorCode2[TalerErrorCode2["WALLET_EXCHANGE_ENTRY_UPDATE_CONFLICT"] = 7038] = "WALLET_EXCHANGE_ENTRY_UPDATE_CONFLICT";
  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["DONAU_GENERIC_KEYS_MISSING"] = 8607] = "DONAU_GENERIC_KEYS_MISSING";
  TalerErrorCode2[TalerErrorCode2["DONAU_CHARITY_SIGNATURE_INVALID"] = 8608] = "DONAU_CHARITY_SIGNATURE_INVALID";
  TalerErrorCode2[TalerErrorCode2["DONAU_CHARITY_NOT_FOUND"] = 8609] = "DONAU_CHARITY_NOT_FOUND";
  TalerErrorCode2[TalerErrorCode2["DONAU_EXCEEDING_DONATION_LIMIT"] = 8610] = "DONAU_EXCEEDING_DONATION_LIMIT";
  TalerErrorCode2[TalerErrorCode2["DONAU_GENERIC_DONATION_UNIT_UNKNOWN"] = 8611] = "DONAU_GENERIC_DONATION_UNIT_UNKNOWN";
  TalerErrorCode2[TalerErrorCode2["DONAU_DONATION_UNIT_HELPER_UNAVAILABLE"] = 8612] = "DONAU_DONATION_UNIT_HELPER_UNAVAILABLE";
  TalerErrorCode2[TalerErrorCode2["DONAU_SIGNKEY_HELPER_UNAVAILABLE"] = 8613] = "DONAU_SIGNKEY_HELPER_UNAVAILABLE";
  TalerErrorCode2[TalerErrorCode2["DONAU_SIGNKEY_HELPER_BUG"] = 8614] = "DONAU_SIGNKEY_HELPER_BUG";
  TalerErrorCode2[TalerErrorCode2["DONAU_GENERIC_WRONG_NUMBER_OF_SEGMENTS"] = 8615] = "DONAU_GENERIC_WRONG_NUMBER_OF_SEGMENTS";
  TalerErrorCode2[TalerErrorCode2["DONAU_DONATION_RECEIPT_SIGNATURE_INVALID"] = 8616] = "DONAU_DONATION_RECEIPT_SIGNATURE_INVALID";
  TalerErrorCode2[TalerErrorCode2["DONAU_DONOR_IDENTIFIER_NONCE_REUSE"] = 8617] = "DONAU_DONOR_IDENTIFIER_NONCE_REUSE";
  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["CHALLENGER_MISSING_ADDRESS"] = 9759] = "CHALLENGER_MISSING_ADDRESS";
  TalerErrorCode2[TalerErrorCode2["END"] = 9999] = "END";
})(TalerErrorCode || (TalerErrorCode = {}));

// ../taler-util/lib/CancellationToken.js
var NOOP = () => {
};
var CancellationToken = class _CancellationToken {
  /**
   * 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) {
    if (!this.canBeCancelled) {
      return NOOP;
    }
    if (this.isCancelled) {
      cb(this.reason);
      return NOOP;
    }
    this._callbacks?.add(cb);
    return () => this._callbacks?.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) => {
      if (token._isCancelled)
        return;
      token._isCancelled = true;
      token._reason = reason;
      token._callbacks?.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 timer2;
    timer2 = setTimeout(() => originalCancel(`CancellationToken.timeout ${ms}`), ms);
    const disposeTimer = () => {
      if (timer2 == null)
        return;
      clearTimeout(timer2);
      timer2 = 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<T>.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<T>.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/amounts.js
var amountFractionalBase = 1e8;
var amountFractionalLength = 8;
var amountMaxValue = 2 ** 52;
var FRAC_SEPARATOR = ".";
var Amount = class _Amount {
  static from(a5) {
    return new _Amount(Amounts.parseOrThrow(a5), 0);
  }
  static zeroOfCurrency(currency) {
    return new _Amount(Amounts.zeroOfCurrency(currency), 0);
  }
  add(...a5) {
    if (this.saturated) {
      return this;
    }
    const r3 = Amounts.add(this.val, ...a5);
    return new _Amount(r3.amount, r3.saturated ? 1 : 0);
  }
  mult(n2) {
    if (this.saturated) {
      return this;
    }
    const r3 = Amounts.mult(this, n2);
    return new _Amount(r3.amount, r3.saturated ? 1 : 0);
  }
  toJson() {
    return { ...this.val };
  }
  toString() {
    return Amounts.stringify(this.val);
  }
  constructor(val, saturated) {
    this.val = val;
    this.saturated = saturated;
  }
};
function codecForAmountString() {
  return {
    decode(x5, c4) {
      if (typeof x5 !== "string") {
        throw new DecodingError(`expected string at ${renderContext(c4)} but got ${typeof x5}`);
      }
      if (Amounts.parse(x5) === void 0) {
        throw new DecodingError(`invalid amount at ${renderContext(c4)} got "${x5}"`);
      }
      return x5;
    }
  };
}
var Amounts = class _Amounts {
  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);
    }
    if (amt instanceof Amount) {
      return amt.toJson();
    }
    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((x5) => _Amounts.jsonifyAmount(x5));
    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((x5) => _Amounts.jsonifyAmount(x5));
    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 x5 of rest) {
      const xJ = _Amounts.jsonifyAmount(x5);
      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;
  }
  /**
   * Check whether a string is a valid currency for a Taler amount.
   */
  static isCurrency(s5) {
    return /^[a-zA-Z]{1,11}$/.test(s5);
  }
  /**
   * Parse an amount like 'EUR:20.5' for 20 Euros and 50 ct.
   *
   * Currency name size limit is 11 of ASCII letters
   * Fraction size limit is 8
   */
  static parse(s5) {
    const res = s5.match(/^([a-zA-Z]{1,11}):([0-9]+)([.][0-9]{1,8})?$/);
    if (!res) {
      return void 0;
    }
    const tail = res[3] || FRAC_SEPARATOR + "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 (s5 instanceof Amount) {
      return s5.toJson();
    }
    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 multiplied 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 x5 = 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, x5);
        if (r23.saturated) {
          return r23;
        }
        acc = r23.amount;
      }
      const r22 = _Amounts.add(x5, x5);
      if (r22.saturated) {
        return r22;
      }
      x5 = r22.amount;
    }
    return _Amounts.add(acc, x5);
  }
  /**
   * 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 {
      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 amountHasSameCurrency(a1, a22) {
    const x1 = this.jsonifyAmount(a1);
    const x22 = this.jsonifyAmount(a22);
    return x1.currency.toUpperCase() === x22.currency.toUpperCase();
  }
  static isSameCurrency(curr1, curr2) {
    return curr1.toLowerCase() === curr2.toLowerCase();
  }
  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 + FRAC_SEPARATOR;
      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;
  }
  static stringifyValueWithSpec(value, spec) {
    const strValue = _Amounts.stringifyValue(value);
    const pos = strValue.indexOf(FRAC_SEPARATOR);
    const originalPosition = pos < 0 ? strValue.length : pos;
    let currency = value.currency;
    const names2 = Object.keys(spec.alt_unit_names);
    let FRAC_POS_NEW_POSITION = originalPosition;
    if (names2.length > 0) {
      let unitIndex = "0";
      names2.forEach((index) => {
        const i4 = Number.parseInt(index, 10);
        if (Number.isNaN(i4))
          return;
        if (originalPosition - i4 <= 0)
          return;
        if (originalPosition - i4 < FRAC_POS_NEW_POSITION) {
          FRAC_POS_NEW_POSITION = originalPosition - i4;
          unitIndex = index;
        }
      });
      currency = spec.alt_unit_names[unitIndex];
    }
    if (originalPosition === FRAC_POS_NEW_POSITION) {
      const { normal: normal2, small: small2 } = splitNormalAndSmall(strValue, originalPosition, spec);
      return { currency, normal: normal2, small: small2 };
    }
    const intPart = strValue.substring(0, originalPosition);
    const fracPArt = strValue.substring(originalPosition + 1);
    const newValue = intPart.substring(0, FRAC_POS_NEW_POSITION) + FRAC_SEPARATOR + intPart.substring(FRAC_POS_NEW_POSITION) + fracPArt;
    const { normal, small } = splitNormalAndSmall(newValue, FRAC_POS_NEW_POSITION, spec);
    return { currency, normal, small };
  }
};
function splitNormalAndSmall(decimal, fracSeparatorIndex, spec) {
  let normal;
  let small;
  if (decimal.length - fracSeparatorIndex - 1 > spec.num_fractional_normal_digits) {
    const limit = fracSeparatorIndex + spec.num_fractional_normal_digits + 1;
    normal = decimal.substring(0, limit);
    small = decimal.substring(limit);
  } else {
    normal = decimal;
    small = void 0;
  }
  return { normal, small };
}

// ../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 <https://mathiasbynens.be/notes/javascript-encoding>
   * @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] >= 256 ** (5 - numbers.length)) {
    return failure;
  }
  let ipv4 = numbers.pop();
  let counter2 = 0;
  for (const n2 of numbers) {
    ipv4 += n2 * 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 > 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 {
  //Include URL type for "url" and "base" params.
  constructor(url, base2) {
    let parsedBase = null;
    if (base2 !== void 0) {
      if (base2 instanceof URL) {
        base2 = base2.href;
      }
      parsedBase = basicURLParse(base2);
      if (parsedBase === null) {
        throw new TypeError(`Invalid base URL: ${base2}`);
      }
    }
    if (url instanceof URL) {
      url = url.href;
    }
    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 URLSearchParams2 = _URLSearchParams;

// ../taler-util/lib/helpers.js
function canonicalizeBaseUrl(url) {
  if (!url.startsWith("http") && !url.startsWith("https")) {
    url = "https://" + url;
  }
  const x5 = new URL2(url);
  if (!x5.pathname.endsWith("/")) {
    x5.pathname = x5.pathname + "/";
  }
  x5.search = "";
  x5.hash = "";
  return x5.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;
}
function j2s(x5) {
  return JSON.stringify(x5, void 0, 2);
}

// ../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 = {};
var nativeLogging = false;
Error.prototype.toString = function() {
  if (this === null || typeof this !== "object" && typeof this !== "function") {
    throw new TypeError();
  }
  let name = this.name;
  name = name === void 0 ? "Error" : `${name}`;
  let msg = this.message;
  msg = msg === void 0 ? "" : `${msg}`;
  let cause = "";
  if ("cause" in this) {
    cause = `
 Caused by: ${this.cause}`;
  }
  return `${name}: ${msg}${cause}`;
};
function writeNativeLog(message, tag, level, args) {
  const logFn = globalThis.__nativeLog;
  if (logFn) {
    let m5;
    if (args.length == 0) {
      m5 = message;
    } else {
      m5 = message + " " + args.toString();
    }
    logFn(level, tag, message);
  }
}
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() {
    const level = byTagLogLevel[this.tag] ?? 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() {
    const level = byTagLogLevel[this.tag] ?? 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() {
    const level = byTagLogLevel[this.tag] ?? 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() {
    const level = byTagLogLevel[this.tag] ?? 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 (nativeLogging) {
      writeNativeLog(message, this.tag, 2, args);
      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 (nativeLogging) {
      writeNativeLog(message, this.tag, 3, args);
      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 (nativeLogging) {
      writeNativeLog(message, this.tag, 4, args);
      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 (nativeLogging) {
      writeNativeLog(message, this.tag, 1, args);
      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/codec.js
var logger = new Logger("codec.ts");
var DecodingError = class _DecodingError extends Error {
  constructor(message) {
    super(message);
    Object.setPrototypeOf(this, _DecodingError.prototype);
    this.name = "DecodingError";
  }
};
function renderContext(c4) {
  const p4 = c4?.path;
  if (p4) {
    return p4.join(".");
  } else {
    return "(unknown)";
  }
}
function joinContext(c4, part) {
  const path = c4?.path ?? [];
  return {
    path: path.concat([part])
  };
}
var ObjectCodecBuilder = class {
  constructor() {
    this.propList = [];
  }
  /**
   * Define a property for the object.
   */
  property(x5, codec) {
    if (!codec) {
      throw Error("inner codec must be defined");
    }
    this.propList.push({ name: x5, 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(x5, c4) {
        if (!c4) {
          c4 = {
            path: [`(${objectDisplayName})`]
          };
        }
        if (typeof x5 !== "object") {
          throw new DecodingError(`expected object for ${objectDisplayName} at ${renderContext(c4)} but got ${typeof x5}`);
        }
        const obj = {};
        for (const prop of propList) {
          const propRawVal = x5[prop.name];
          const propVal = prop.codec.decode(propRawVal, joinContext(c4, prop.name));
          obj[prop.name] = propVal;
        }
        return obj;
      }
    };
  }
};
var UnionCodecBuilder = class {
  constructor(discriminator, baseCodec) {
    this.discriminator = discriminator;
    this.baseCodec = baseCodec;
    this.alternatives = /* @__PURE__ */ new Map();
  }
  /**
   * Define a property for the object.
   */
  alternative(tagValue, codec) {
    if (!codec) {
      throw Error("inner codec must be defined");
    }
    this.alternatives.set(tagValue, { codec, tagValue });
    return this;
  }
  /**
   * Return the built codec.
   *
   * @param objectDisplayName name of the object that this codec operates on,
   *   used in error messages.
   */
  build(objectDisplayName) {
    const alternatives = this.alternatives;
    const discriminator = this.discriminator;
    const baseCodec = this.baseCodec;
    return {
      decode(x5, c4) {
        if (!c4) {
          c4 = {
            path: [`(${objectDisplayName})`]
          };
        }
        const d5 = x5[discriminator];
        if (d5 === void 0) {
          throw new DecodingError(`expected tag for ${objectDisplayName} at ${renderContext(c4)}.${String(discriminator)}`);
        }
        const alt = alternatives.get(d5);
        if (!alt) {
          throw new DecodingError(`unknown tag for ${objectDisplayName} ${d5} at ${renderContext(c4)}.${String(discriminator)}`);
        }
        const altDecoded = alt.codec.decode(x5);
        if (baseCodec) {
          const baseDecoded = baseCodec.decode(x5, c4);
          return { ...baseDecoded, ...altDecoded };
        } else {
          return altDecoded;
        }
      }
    };
  }
};
var UnionCodecPreBuilder = class {
  discriminateOn(discriminator, baseCodec) {
    return new UnionCodecBuilder(discriminator, baseCodec);
  }
};
function buildCodecForObject() {
  return new ObjectCodecBuilder();
}
function buildCodecForUnion() {
  return new UnionCodecPreBuilder();
}
function codecForMap(innerCodec) {
  if (!innerCodec) {
    throw Error("inner codec must be defined");
  }
  return {
    decode(x5, c4) {
      const map3 = {};
      if (typeof x5 !== "object") {
        throw new DecodingError(`expected object at ${renderContext(c4)}`);
      }
      for (const i4 in x5) {
        map3[i4] = innerCodec.decode(x5[i4], joinContext(c4, `[${i4}]`));
      }
      return map3;
    }
  };
}
function codecForList(innerCodec) {
  if (!innerCodec) {
    throw Error("inner codec must be defined");
  }
  return {
    decode(x5, c4) {
      const arr = [];
      if (!Array.isArray(x5)) {
        throw new DecodingError(`expected array at ${renderContext(c4)}`);
      }
      for (const i4 in x5) {
        arr.push(innerCodec.decode(x5[i4], joinContext(c4, `[${i4}]`)));
      }
      return arr;
    }
  };
}
function codecForNumber() {
  return {
    decode(x5, c4) {
      if (typeof x5 === "number") {
        return x5;
      }
      throw new DecodingError(`expected number at ${renderContext(c4)} but got ${typeof x5}`);
    }
  };
}
function codecForBoolean() {
  return {
    decode(x5, c4) {
      if (typeof x5 === "boolean") {
        return x5;
      }
      throw new DecodingError(`expected boolean at ${renderContext(c4)} but got ${typeof x5}`);
    }
  };
}
function codecForString() {
  return {
    decode(x5, c4) {
      if (typeof x5 === "string") {
        return x5;
      }
      throw new DecodingError(`expected string at ${renderContext(c4)} but got ${typeof x5}`);
    }
  };
}
function codecForStringURL(shouldEndWithSlash) {
  return {
    decode(x5, c4) {
      if (typeof x5 !== "string") {
        throw new DecodingError(`expected string at ${renderContext(c4)} but got ${typeof x5}`);
      }
      if (shouldEndWithSlash && !x5.endsWith("/")) {
        throw new DecodingError(`expected URL string that ends with slash at ${renderContext(c4)} but got ${x5}`);
      }
      try {
        const url = new URL(x5);
        return x5;
      } catch (e4) {
        if (e4 instanceof Error) {
          throw new DecodingError(e4.message);
        } else {
          throw new DecodingError(`expected an URL string at ${renderContext(c4)} but got "${x5}"`);
        }
      }
    }
  };
}
function codecForURL(shouldEndWithSlash) {
  return {
    decode(x5, c4) {
      if (typeof x5 !== "string") {
        throw new DecodingError(`expected string at ${renderContext(c4)} but got ${typeof x5}`);
      }
      if (shouldEndWithSlash && !x5.endsWith("/")) {
        throw new DecodingError(`expected URL string that ends with slash at ${renderContext(c4)} but got ${x5}`);
      }
      try {
        const url = new URL(x5);
        return url;
      } catch (e4) {
        if (e4 instanceof Error) {
          throw new DecodingError(e4.message);
        } else {
          throw new DecodingError(`expected an URL string at ${renderContext(c4)} but got "${x5}"`);
        }
      }
    }
  };
}
function codecForAny() {
  return {
    decode(x5, c4) {
      return x5;
    }
  };
}
function codecForConstString(s5) {
  return {
    decode(x5, c4) {
      if (x5 === s5) {
        return x5;
      }
      if (typeof x5 !== "string") {
        throw new DecodingError(`expected string constant "${s5}" at ${renderContext(c4)} but got ${typeof x5}`);
      }
      throw new DecodingError(`expected string constant "${s5}" at ${renderContext(c4)} but got string value "${x5}"`);
    }
  };
}
function codecForConstNumber(n2) {
  return {
    decode(x5, c4) {
      if (x5 === n2) {
        return x5;
      }
      throw new DecodingError(`expected number constant "${n2}" at ${renderContext(c4)}  but got ${typeof x5}`);
    }
  };
}
function codecOptional(innerCodec) {
  return {
    decode(x5, c4) {
      if (x5 === void 0 || x5 === null) {
        return void 0;
      }
      return innerCodec.decode(x5, c4);
    }
  };
}
function codecForEither(...alts) {
  return {
    decode(x5, c4) {
      for (const alt of alts) {
        try {
          return alt.decode(x5, c4);
        } catch (e4) {
          continue;
        }
      }
      if (logger.shouldLogTrace()) {
        logger.trace(`offending value: ${j2s(x5)}`);
      }
      throw new DecodingError(`No alternative matched at at ${renderContext(c4)}`);
    }
  };
}

// ../taler-util/lib/taler-crypto.js
var import_big_integer = __toESM(require_BigInteger(), 1);

// ../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 reuse 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/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 / 1e3) * 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;
  function fromSpec(spec) {
    let d_ms = 0;
    d_ms += (spec.seconds ?? 0) * SECONDS;
    d_ms += (spec.minutes ?? 0) * MINUTES;
    d_ms += (spec.hours ?? 0) * HOURS;
    d_ms += (spec.days ?? 0) * DAYS;
    d_ms += (spec.months ?? 0) * MONTHS;
    d_ms += (spec.years ?? 0) * YEARS;
    return { d_ms };
  }
  Duration2.fromSpec = fromSpec;
  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(AbsoluteTime3) {
  function getStampMsNow() {
    return (/* @__PURE__ */ new Date()).getTime();
  }
  AbsoluteTime3.getStampMsNow = getStampMsNow;
  function getStampMsNever() {
    return Number.MAX_SAFE_INTEGER;
  }
  AbsoluteTime3.getStampMsNever = getStampMsNever;
  function now2() {
    return {
      t_ms: (/* @__PURE__ */ new Date()).getTime() + timeshift,
      [opaque_AbsoluteTime]: true
    };
  }
  AbsoluteTime3.now = now2;
  function never() {
    return {
      t_ms: "never",
      [opaque_AbsoluteTime]: true
    };
  }
  AbsoluteTime3.never = never;
  function fromMilliseconds(ms) {
    return {
      t_ms: ms,
      [opaque_AbsoluteTime]: true
    };
  }
  AbsoluteTime3.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;
  }
  AbsoluteTime3.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 };
  }
  AbsoluteTime3.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 };
  }
  AbsoluteTime3.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) };
  }
  AbsoluteTime3.difference = difference2;
  function isExpired(t4) {
    return cmp(t4, now2()) <= 0;
  }
  AbsoluteTime3.isExpired = isExpired;
  function isNever(t4) {
    return t4.t_ms === "never";
  }
  AbsoluteTime3.isNever = isNever;
  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
    };
  }
  AbsoluteTime3.fromProtocolTimestamp = fromProtocolTimestamp;
  function fromStampMs(stampMs) {
    return {
      t_ms: stampMs,
      [opaque_AbsoluteTime]: true
    };
  }
  AbsoluteTime3.fromStampMs = fromStampMs;
  function fromPreciseTimestamp(t4) {
    if (t4.t_s === "never") {
      return { t_ms: "never", [opaque_AbsoluteTime]: true };
    }
    const offsetUs = t4.off_us ?? 0;
    return {
      t_ms: t4.t_s * 1e3 + Math.floor(offsetUs / 1e3),
      [opaque_AbsoluteTime]: true
    };
  }
  AbsoluteTime3.fromPreciseTimestamp = fromPreciseTimestamp;
  function toStampMs(at2) {
    if (at2.t_ms === "never") {
      return Number.MAX_SAFE_INTEGER;
    }
    return at2.t_ms;
  }
  AbsoluteTime3.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
    };
  }
  AbsoluteTime3.toPreciseTimestamp = toPreciseTimestamp;
  function toProtocolTimestamp(at2) {
    if (at2.t_ms === "never") {
      return { t_s: "never" };
    }
    return {
      t_s: Math.floor(at2.t_ms / 1e3)
    };
  }
  AbsoluteTime3.toProtocolTimestamp = toProtocolTimestamp;
  function isBetween(t4, start, end) {
    if (cmp(t4, start) < 0) {
      return false;
    }
    if (cmp(t4, end) > 0) {
      return false;
    }
    return true;
  }
  AbsoluteTime3.isBetween = isBetween;
  function toIsoString(t4) {
    if (t4.t_ms === "never") {
      return "<never>";
    } else {
      return new Date(t4.t_ms).toISOString();
    }
  }
  AbsoluteTime3.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 };
  }
  AbsoluteTime3.addDuration = addDuration;
  function remaining(t1) {
    if (t1.t_ms === "never") {
      return Duration.getForever();
    }
    const stampNow = now2();
    if (stampNow.t_ms === "never") {
      throw Error("invariant violated");
    }
    return Duration.fromMilliseconds(Math.max(0, t1.t_ms - stampNow.t_ms));
  }
  AbsoluteTime3.remaining = remaining;
  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 };
  }
  AbsoluteTime3.subtractDuraction = subtractDuraction;
  function stringify(t4) {
    if (t4.t_ms === "never") {
      return "never";
    }
    return new Date(t4.t_ms).toISOString();
  }
  AbsoluteTime3.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 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 codecForAbsoluteTime = {
  decode(x5, c4) {
    if (x5 === void 0) {
      throw Error(`got undefined and expected absolute time at ${renderContext(c4)}`);
    }
    const t_ms = x5.t_ms;
    if (typeof t_ms === "string") {
      if (t_ms === "never") {
        return { t_ms: "never", [opaque_AbsoluteTime]: true };
      }
    } else if (typeof t_ms === "number") {
      return { t_ms, [opaque_AbsoluteTime]: true };
    }
    throw Error(`expected timestamp at ${renderContext(c4)}`);
  }
};
var codecForTimestamp = {
  decode(x5, c4) {
    if (x5 === void 0) {
      throw Error(`got undefined and expected timestamp at ${renderContext(c4)}`);
    }
    const t_ms = x5.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 = x5.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 protocol timestamp at ${renderContext(c4)}`);
  }
};
var codecForDuration = {
  decode(x5, c4) {
    const d_us = x5.d_us;
    if (typeof d_us === "string") {
      if (d_us === "forever") {
        return { d_us: "forever" };
      }
      throw Error(`expected duration at ${renderContext(c4)}`);
    }
    if (typeof d_us === "number") {
      return { d_us };
    }
    throw Error(`expected duration 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) {
    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 ((p1.age_mask ?? 0) < (p22.age_mask ?? 0)) {
        return -1;
      } else if ((p1.age_mask ?? 0) > (p22.age_mask ?? 0)) {
        return 1;
      }
      return strcmp(p1.rsa_public_key, p22.rsa_public_key);
    } else if (p1.cipher === DenomKeyType.ClauseSchnorr && p22.cipher === DenomKeyType.ClauseSchnorr) {
      if ((p1.age_mask ?? 0) < (p22.age_mask ?? 0)) {
        return -1;
      } else if ((p1.age_mask ?? 0) > (p22.age_mask ?? 0)) {
        return 1;
      }
      return strcmp(p1.cs_public_key, p22.cs_public_key);
    } else {
      throw Error("unsupported cipher");
    }
  }
  DenominationPubKey2.cmp = cmp;
})(DenominationPubKey || (DenominationPubKey = {}));
var codecForLocation = () => buildCodecForObject().property("country", codecOptional(codecForString())).property("country_subdivision", codecOptional(codecForString())).property("building_name", codecOptional(codecForString())).property("building_number", codecOptional(codecForString())).property("district", codecOptional(codecForString())).property("street", codecOptional(codecForString())).property("post_code", codecOptional(codecForString())).property("town", codecOptional(codecForString())).property("town_location", codecOptional(codecForString())).property("address_lines", codecOptional(codecForList(codecForString()))).build("Location");
var codecForInternationalizedString = () => codecForMap(codecForString());
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/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 _EncodingError 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 ?? new Uint8Array(64);
  const prk = hmacSha512(salt, ikm);
  info = 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 logger2 = 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_RESERVE_HISTORY"] = 1208] = "WALLET_RESERVE_HISTORY";
  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["WALLET_COIN_HISTORY"] = 1209] = "WALLET_COIN_HISTORY";
  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(x5, size) {
  const byteArr = new Uint8Array(size);
  const arr = x5.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);
  async function keyCreateFromSeed(seed) {
    return crypto_edx25519_private_key_create_from_seed(seed);
  }
  Edx255192.keyCreateFromSeed = keyCreateFromSeed;
  async function keyCreate() {
    return crypto_edx25519_private_key_create();
  }
  Edx255192.keyCreate = keyCreate;
  async function getPublic(priv) {
    return crypto_edx25519_get_public(priv);
  }
  Edx255192.getPublic = getPublic;
  function sign(msg, key) {
    throw Error("not implemented");
  }
  Edx255192.sign = sign;
  async function deriveFactor(pub, seed) {
    const res = kdfKw({
      outputLength: 64,
      salt: seed,
      ikm: pub,
      info: stringToBytes("edx25519-derivation")
    });
    return res;
  }
  async function privateKeyDerive(priv, seed) {
    const pub = await getPublic(priv);
    const privDec = priv;
    const a5 = bigintFromNaclArr(privDec.subarray(0, 32));
    const factorEnc = await 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;
  async function publicKeyDerive(pub, seed) {
    const factorEnc = await 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;
  async function restrictionCommit(ageMask, age) {
    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 = await Edx25519.keyCreate();
      const pub = await Edx25519.getPublic(priv);
      pubs.push(pub);
      if (i4 < numPrivs) {
        privs.push(priv);
      }
    }
    return {
      commitment: {
        mask: ageMask,
        publicKeys: pubs.map((x5) => encodeCrock(x5))
      },
      proof: {
        privateKeys: privs.map((x5) => encodeCrock(x5))
      }
    };
  }
  AgeRestriction2.restrictionCommit = restrictionCommit;
  const PublishedAgeRestrictionBaseKey = decodeCrock("CH0VKFDZ2GWRWHQBBGEK9MWV5YDQVJ0RXEE0KYT3NMB69F0R96TG");
  async function restrictionCommitSeeded(ageMask, age, seed) {
    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 = await kdfKw({
        outputLength: 32,
        ikm: seed,
        info: stringToBytes("age-commitment"),
        salt: bufferForUint32(i4)
      });
      const priv = await Edx25519.keyCreateFromSeed(privSeed);
      const pub = await Edx25519.getPublic(priv);
      pubs.push(pub);
      privs.push(priv);
    }
    for (let i4 = numPrivs; i4 < numPubs; i4++) {
      const deriveSeed = await kdfKw({
        outputLength: 32,
        ikm: seed,
        info: stringToBytes("age-factor"),
        salt: bufferForUint32(i4)
      });
      const pub = await Edx25519.publicKeyDerive(PublishedAgeRestrictionBaseKey, deriveSeed);
      pubs.push(pub);
    }
    return {
      commitment: {
        mask: ageMask,
        publicKeys: pubs.map((x5) => encodeCrock(x5))
      },
      proof: {
        privateKeys: privs.map((x5) => encodeCrock(x5))
      }
    };
  }
  AgeRestriction2.restrictionCommitSeeded = restrictionCommitSeeded;
  async function commitCompare(c1, c22, salt) {
    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 = await Edx25519.publicKeyDerive(decodeCrock(c22.publicKeys[i4]), salt);
      if (k1 != k22) {
        return false;
      }
    }
    return true;
  }
  AgeRestriction2.commitCompare = commitCompare;
  async function commitmentDerive(commitmentProof, salt) {
    const newPrivs = [];
    const newPubs = [];
    for (const oldPub of commitmentProof.commitment.publicKeys) {
      newPubs.push(await Edx25519.publicKeyDerive(decodeCrock(oldPub), salt));
    }
    for (const oldPriv of commitmentProof.proof.privateKeys) {
      newPrivs.push(await Edx25519.privateKeyDerive(decodeCrock(oldPriv), salt));
    }
    return {
      commitment: {
        mask: commitmentProof.commitment.mask,
        publicKeys: newPubs.map((x5) => encodeCrock(x5))
      },
      proof: {
        privateKeys: newPrivs.map((x5) => encodeCrock(x5))
      }
    };
  }
  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 {
  }
  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
function codecForPaytoString() {
  return {
    decode(x5, c4) {
      if (typeof x5 !== "string") {
        throw new DecodingError(`expected string at ${renderContext(c4)} but got ${typeof x5}`);
      }
      if (!x5.startsWith(paytoPfx)) {
        throw new DecodingError(`expected start with payto at ${renderContext(c4)} but got "${x5}"`);
      }
      return x5;
    }
  };
}
var paytoPfx = "payto://";
function encodeRFC3986URIComponent(str) {
  return encodeURIComponent(str).replace(/[!'()*]/g, (c4) => `%${c4.charCodeAt(0).toString(16).toUpperCase()}`);
}
var rfc3986 = encodeRFC3986URIComponent;
function createSearchParams(paramList) {
  return paramList.map(([key, value]) => `${rfc3986(key)}=${rfc3986(value)}`).join("&");
}
function stringifyPaytoUri(p4) {
  const url = new URL(`${paytoPfx}${p4.targetType}/${p4.targetPath}`);
  const paramList = !p4.params ? [] : Object.entries(p4.params);
  url.search = createSearchParams(paramList);
  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 URLSearchParams2(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].toUpperCase();
    }
    if (parts.length === 2) {
      bic = parts[0];
      iban = parts[1].toUpperCase();
    } else {
      iban = targetPath.toUpperCase();
    }
    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 uppercased = targetType.toUpperCase();
    const result = {
      isKnown: true,
      targetPath,
      targetType,
      address: uppercased,
      params,
      segwitAddrs
    };
    return result;
  }
  return {
    targetPath,
    targetType,
    params,
    isKnown: false
  };
}
var codecForAccountLetter = () => buildCodecForObject().property("infoURL", codecForStringURL(true)).property("accountURI", codecForPaytoString()).property("accountToken", codecOptional(codecForAccessToken())).build("AccountLetter");

// ../taler-util/lib/http-common.js
var textEncoder = new TextEncoder();
var logger3 = new Logger("http.ts");
var DEFAULT_REQUEST_TIMEOUT_MS = 6e4;
var Headers2 = class {
  constructor() {
    this.headerMap = /* @__PURE__ */ new Map();
  }
  get(name) {
    const r3 = this.headerMap.get(name.toLowerCase());
    if (r3) {
      return r3;
    }
    return null;
  }
  set(name, value) {
    const normalizedName = name.toLowerCase();
    const existing = this.headerMap.get(normalizedName);
    if (existing !== void 0) {
      this.headerMap.set(normalizedName, existing + "," + value);
    } else {
      this.headerMap.set(normalizedName, value);
    }
  }
  toJSON() {
    const m5 = {};
    this.headerMap.forEach((v3, k5) => m5[k5] = v3);
    return m5;
  }
};
async function readTalerErrorResponse(httpResponse) {
  const contentType = httpResponse.headers.get("content-type");
  if (contentType !== "application/json") {
    throw TalerError.fromDetail(TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE, {
      requestUrl: httpResponse.requestUrl,
      requestMethod: httpResponse.requestMethod,
      httpStatusCode: httpResponse.status,
      contentType: contentType || "<null>"
    }, "Error response did not even contain JSON. The request URL might be wrong or the service might be unavailable.");
  }
  let errJson;
  try {
    errJson = await httpResponse.json();
  } catch (e4) {
    throw TalerError.fromDetail(TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE, {
      requestUrl: httpResponse.requestUrl,
      requestMethod: httpResponse.requestMethod,
      httpStatusCode: httpResponse.status,
      response: await httpResponse.text(),
      validationError: e4.toString()
    }, "Couldn't parse JSON format from error response");
  }
  const talerErrorCode = errJson.code;
  if (typeof talerErrorCode !== "number") {
    logger3.warn(`malformed error response (status ${httpResponse.status}): ${j2s(errJson)}`);
    throw TalerError.fromDetail(TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE, {
      requestUrl: httpResponse.requestUrl,
      requestMethod: httpResponse.requestMethod,
      httpStatusCode: httpResponse.status,
      response: await httpResponse.text()
    }, "Error response did not contain error code");
  }
  return errJson;
}
async function readSuccessResponseJsonOrErrorCode(httpResponse, codec) {
  if (!(httpResponse.status >= 200 && httpResponse.status < 300)) {
    return {
      isError: true,
      talerErrorResponse: await readTalerErrorResponse(httpResponse)
    };
  }
  let respJson;
  try {
    respJson = await httpResponse.json();
  } catch (e4) {
    throw TalerError.fromDetail(TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE, {
      requestUrl: httpResponse.requestUrl,
      requestMethod: httpResponse.requestMethod,
      httpStatusCode: httpResponse.status,
      response: await httpResponse.text(),
      validationError: e4.toString()
    }, "Couldn't parse JSON format from response");
  }
  let parsedResponse;
  try {
    parsedResponse = codec.decode(respJson);
  } catch (e4) {
    throw TalerError.fromDetail(TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE, {
      requestUrl: httpResponse.requestUrl,
      requestMethod: httpResponse.requestMethod,
      httpStatusCode: httpResponse.status,
      response: await httpResponse.text(),
      validationError: e4.toString()
    }, "Response invalid");
  }
  return {
    isError: false,
    response: parsedResponse
  };
}
async function readResponseJsonOrErrorCode(httpResponse, codec) {
  let respJson;
  try {
    respJson = await httpResponse.json();
  } catch (e4) {
    throw TalerError.fromDetail(TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE, {
      requestUrl: httpResponse.requestUrl,
      requestMethod: httpResponse.requestMethod,
      httpStatusCode: httpResponse.status,
      response: await httpResponse.text(),
      validationError: e4.toString()
    }, "Couldn't parse JSON format from response");
  }
  let parsedResponse;
  try {
    parsedResponse = codec.decode(respJson);
  } catch (e4) {
    throw TalerError.fromDetail(TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE, {
      requestUrl: httpResponse.requestUrl,
      requestMethod: httpResponse.requestMethod,
      httpStatusCode: httpResponse.status,
      response: await httpResponse.text(),
      validationError: e4.toString()
    }, "Response invalid");
  }
  return {
    isError: !(httpResponse.status >= 200 && httpResponse.status < 300),
    response: parsedResponse
  };
}
function throwUnexpectedRequestError(httpResponse, talerErrorResponse) {
  throw TalerError.fromDetail(TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR, {
    requestUrl: httpResponse.requestUrl,
    requestMethod: httpResponse.requestMethod,
    httpStatusCode: httpResponse.status,
    errorResponse: talerErrorResponse
  }, `Unexpected HTTP status ${httpResponse.status} in response`);
}
async function readSuccessResponseJsonOrThrow(httpResponse, codec) {
  const r3 = await readSuccessResponseJsonOrErrorCode(httpResponse, codec);
  if (!r3.isError) {
    return r3.response;
  }
  throwUnexpectedRequestError(httpResponse, r3.talerErrorResponse);
}
function encodeBody(body) {
  if (body == null) {
    return new ArrayBuffer(0);
  }
  if (typeof body === "string") {
    return textEncoder.encode(body).buffer;
  } else if (ArrayBuffer.isView(body)) {
    return body.buffer;
  } else if (body instanceof ArrayBuffer) {
    return body;
  } else if (typeof body === "object") {
    return textEncoder.encode(JSON.stringify(body)).buffer;
  }
  throw new TypeError("unsupported request body type");
}
function getDefaultHeaders(method) {
  const headers = {};
  if (method === "POST" || method === "PUT" || method === "PATCH") {
    headers["Content-Type"] = "application/json";
  }
  headers["Accept"] = "application/json";
  return headers;
}
function makeBasicAuthHeader(username, password) {
  const auth = `${username}:${password}`;
  const authEncoded = base64FromArrayBuffer(stringToBytes(auth));
  return `Basic ${authEncoded}`;
}

// ../taler-util/lib/operation.js
async function opSuccessFromHttp(resp, codec) {
  const body = await readSuccessResponseJsonOrThrow(resp, codec);
  return { type: "ok", body };
}
function opFixedSuccess(body) {
  return { type: "ok", body };
}
function opEmptySuccess(resp) {
  return { type: "ok", body: void 0 };
}
async function opKnownAlternativeFailure(resp, s5, codec) {
  const body = (await readResponseJsonOrErrorCode(resp, codec)).response;
  return { type: "fail", case: s5, body };
}
async function opKnownHttpFailure(s5, resp) {
  const detail = await readTalerErrorResponse(resp);
  return { type: "fail", case: s5, detail };
}
function opKnownTalerFailure(s5, detail) {
  return { type: "fail", case: s5, detail };
}
function opUnknownFailure(resp, error2) {
  throw TalerError.fromDetail(TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR, {
    requestUrl: resp.requestUrl,
    requestMethod: resp.requestMethod,
    httpStatusCode: resp.status,
    errorResponse: error2
  }, `Unexpected HTTP status ${resp.status} in response`);
}

// ../taler-util/lib/taleruri.js
function codecForTalerUriString() {
  return {
    decode(x5, c4) {
      if (typeof x5 !== "string") {
        throw new DecodingError(`expected string at ${renderContext(c4)} but got ${typeof x5}`);
      }
      if (parseTalerUri(x5) === void 0) {
        throw new DecodingError(`invalid taler URI at ${renderContext(c4)} but got "${x5}"`);
      }
      return x5;
    }
  };
}
function parseWithdrawUriWithError(s5) {
  const pi = parseProtoInfoWithError(s5, "withdraw");
  if (pi.type === "fail") {
    return pi;
  }
  const c4 = pi.body.rest.split("?", 2);
  const path = c4[0];
  const q5 = new URLSearchParams2(c4[1] ?? "");
  const parts = path.split("/");
  if (parts.length < 2) {
    return opKnownTalerFailure(TalerErrorCode.WALLET_TALER_URI_MALFORMED, {
      code: TalerErrorCode.WALLET_TALER_URI_MALFORMED
    });
  }
  const host = parts[0].toLowerCase();
  const pathSegments = parts.slice(1, parts.length - 1);
  const withdrawId = parts[parts.length - 1];
  const p4 = [host, ...pathSegments].join("/");
  const result = {
    type: TalerUriAction.Withdraw,
    bankIntegrationApiBaseUrl: canonicalizeBaseUrl(`${pi.body.innerProto}://${p4}/`),
    withdrawalOperationId: withdrawId,
    externalConfirmation: q5.get("external-confirmation") == "1"
  };
  return opFixedSuccess(result);
}
function parseWithdrawUri(s5) {
  const r3 = parseWithdrawUriWithError(s5);
  if (r3.type === "fail")
    return void 0;
  return r3.body;
}
function parseAddExchangeUriWithError(s5) {
  const pi = parseProtoInfoWithError(s5, "add-exchange");
  if (pi.type === "fail") {
    return pi;
  }
  const parts = pi.body.rest.split("/");
  if (parts.length < 2) {
    return opKnownTalerFailure(TalerErrorCode.WALLET_TALER_URI_MALFORMED, {
      code: TalerErrorCode.WALLET_TALER_URI_MALFORMED
    });
  }
  const host = parts[0].toLowerCase();
  const pathSegments = parts.slice(1, parts.length - 1);
  const p4 = [host, ...pathSegments].join("/");
  const result = {
    type: TalerUriAction.AddExchange,
    exchangeBaseUrl: canonicalizeBaseUrl(`${pi.body.innerProto}://${p4}/`)
  };
  return opFixedSuccess(result);
}
function parseAddExchangeUri(s5) {
  const r3 = parseAddExchangeUriWithError(s5);
  if (r3.type === "fail")
    return void 0;
  return r3.body;
}
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 TalerUriAction;
(function(TalerUriAction2) {
  TalerUriAction2["Pay"] = "pay";
  TalerUriAction2["Withdraw"] = "withdraw";
  TalerUriAction2["Refund"] = "refund";
  TalerUriAction2["PayPull"] = "pay-pull";
  TalerUriAction2["PayPush"] = "pay-push";
  TalerUriAction2["PayTemplate"] = "pay-template";
  TalerUriAction2["Restore"] = "restore";
  TalerUriAction2["DevExperiment"] = "dev-experiment";
  TalerUriAction2["WithdrawExchange"] = "withdraw-exchange";
  TalerUriAction2["AddExchange"] = "add-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;
  }
}
function parseProtoInfoWithError(s5, action) {
  if (!s5.toLowerCase().startsWith("taler://") && !s5.toLowerCase().startsWith("taler+http://")) {
    return opKnownTalerFailure(TalerErrorCode.WALLET_TALER_URI_MALFORMED, {
      code: TalerErrorCode.WALLET_TALER_URI_MALFORMED
    });
  }
  const pfxPlain = `taler://${action}/`;
  const pfxHttp = `taler+http://${action}/`;
  if (s5.toLowerCase().startsWith(pfxPlain)) {
    return opFixedSuccess({
      innerProto: "https",
      rest: s5.substring(pfxPlain.length)
    });
  } else if (s5.toLowerCase().startsWith(pfxHttp)) {
    return opFixedSuccess({
      innerProto: "http",
      rest: s5.substring(pfxHttp.length)
    });
  } else {
    return opKnownTalerFailure(TalerErrorCode.WALLET_TALER_URI_MALFORMED, {
      code: TalerErrorCode.WALLET_TALER_URI_MALFORMED
    });
  }
}
var parsers = {
  [TalerUriAction.Pay]: parsePayUri,
  [TalerUriAction.PayPull]: parsePayPullUri,
  [TalerUriAction.PayPush]: parsePayPushUri,
  [TalerUriAction.PayTemplate]: parsePayTemplateUri,
  [TalerUriAction.Restore]: parseRestoreUri,
  [TalerUriAction.Refund]: parseRefundUri,
  [TalerUriAction.Withdraw]: parseWithdrawUri,
  [TalerUriAction.DevExperiment]: parseDevExperimentUri,
  [TalerUriAction.WithdrawExchange]: parseWithdrawExchangeUri,
  [TalerUriAction.AddExchange]: parseAddExchangeUri
};
function parseTalerUri(string2) {
  const https = string2.startsWith("taler://");
  const http = string2.startsWith("taler+http://");
  if (!https && !http)
    return void 0;
  const actionStart = https ? 8 : 13;
  const actionEnd = string2.indexOf("/", actionStart + 1);
  const action = string2.substring(actionStart, actionEnd);
  const found = Object.values(TalerUriAction).find((x5) => x5 === action);
  if (!found)
    return void 0;
  return parsers[found](string2);
}
function stringifyTalerUri(uri) {
  switch (uri.type) {
    case TalerUriAction.DevExperiment: {
      return stringifyDevExperimentUri(uri);
    }
    case TalerUriAction.Pay: {
      return stringifyPayUri(uri);
    }
    case TalerUriAction.PayPull: {
      return stringifyPayPullUri(uri);
    }
    case TalerUriAction.PayPush: {
      return stringifyPayPushUri(uri);
    }
    case TalerUriAction.PayTemplate: {
      return stringifyPayTemplateUri(uri);
    }
    case TalerUriAction.Restore: {
      return stringifyRestoreUri(uri);
    }
    case TalerUriAction.Refund: {
      return stringifyRefundUri(uri);
    }
    case TalerUriAction.Withdraw: {
      return stringifyWithdrawUri(uri);
    }
    case TalerUriAction.WithdrawExchange: {
      return stringifyWithdrawExchange(uri);
    }
    case TalerUriAction.AddExchange: {
      return stringifyAddExchange(uri);
    }
  }
}
function parsePayUri(s5) {
  const pi = parseProtoInfo(s5, "pay");
  if (!pi) {
    return void 0;
  }
  const c4 = pi?.rest.split("?");
  const q5 = new URLSearchParams2(c4[1] ?? "");
  const claimToken = q5.get("c") ?? void 0;
  const noncePriv = q5.get("n") ?? 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) {
  const pi = parseProtoInfo(uriString, TalerUriAction.PayTemplate);
  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 URLSearchParams2(c4[1] ?? "");
  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
  };
}
function parsePayPushUri(s5) {
  const pi = parseProtoInfo(s5, TalerUriAction.PayPush);
  if (!pi) {
    return void 0;
  }
  const c4 = 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, TalerUriAction.PayPull);
  if (!pi) {
    return void 0;
  }
  const c4 = 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 parseWithdrawExchangeUri(s5) {
  const pi = parseProtoInfo(s5, "withdraw-exchange");
  if (!pi) {
    return void 0;
  }
  const c4 = pi?.rest.split("?");
  const parts = c4[0].split("/");
  if (parts.length < 1) {
    return void 0;
  }
  const host = parts[0].toLowerCase();
  const lastPathComponent = parts.length > 1 ? parts[parts.length - 1] : void 0;
  if (lastPathComponent) {
    return void 0;
  }
  const pathSegments = parts.slice(1, parts.length - 1);
  const hostAndSegments = [host, ...pathSegments].join("/");
  const exchangeBaseUrl = canonicalizeBaseUrl(`${pi.innerProto}://${hostAndSegments}/`);
  const q5 = new URLSearchParams2(c4[1] ?? "");
  const amount = q5.get("a") ?? void 0;
  return {
    type: TalerUriAction.WithdrawExchange,
    exchangeBaseUrl,
    amount
  };
}
function parseRefundUri(s5) {
  const pi = parseProtoInfo(s5, "refund");
  if (!pi) {
    return void 0;
  }
  const c4 = 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?.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 stringifyPayUri({ merchantBaseUrl, orderId, sessionId, claimToken, noncePriv }) {
  const { proto, path, query } = getUrlInfo(merchantBaseUrl, {
    c: claimToken,
    n: noncePriv
  });
  return `${proto}://pay/${path}${orderId}/${sessionId}${query}`;
}
function stringifyPayPullUri({ contractPriv, exchangeBaseUrl }) {
  const { proto, path } = getUrlInfo(exchangeBaseUrl);
  return `${proto}://pay-pull/${path}${contractPriv}`;
}
function stringifyPayPushUri({ contractPriv, exchangeBaseUrl }) {
  const { proto, path } = getUrlInfo(exchangeBaseUrl);
  return `${proto}://pay-push/${path}${contractPriv}`;
}
function stringifyRestoreUri({ providers, walletRootPriv }) {
  const list = providers.map((url) => `${encodeURIComponent(new URL2(url).href)}`).join(",");
  return `taler://restore/${walletRootPriv}/${list}`;
}
function stringifyWithdrawExchange({ exchangeBaseUrl, amount }) {
  const { proto, path, query } = getUrlInfo(exchangeBaseUrl, {
    a: amount
  });
  return `${proto}://withdraw-exchange/${path}${query}`;
}
function stringifyAddExchange({ exchangeBaseUrl }) {
  const { proto, path } = getUrlInfo(exchangeBaseUrl);
  return `${proto}://add-exchange/${path}`;
}
function stringifyDevExperimentUri({ devExperimentId }) {
  return `taler://dev-experiment/${devExperimentId}`;
}
function stringifyPayTemplateUri({ merchantBaseUrl, templateId }) {
  const { proto, path, query } = getUrlInfo(merchantBaseUrl);
  return `${proto}://pay-template/${path}${templateId}${query}`;
}
function stringifyRefundUri({ merchantBaseUrl, orderId }) {
  const { proto, path } = getUrlInfo(merchantBaseUrl);
  return `${proto}://refund/${path}${orderId}/`;
}
function stringifyWithdrawUri({ bankIntegrationApiBaseUrl, withdrawalOperationId }) {
  const { proto, path } = getUrlInfo(bankIntegrationApiBaseUrl);
  return `${proto}://withdraw/${path}${withdrawalOperationId}`;
}
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 URLSearchParams2();
  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/http-client/types.js
function createRFC8959AccessTokenEncoded(token) {
  return token.startsWith("secret-token:") ? token : `secret-token:${encodeURIComponent(token)}`;
}
function createRFC8959AccessTokenPlain(token) {
  return token.startsWith("secret-token:") ? token : `secret-token:${token}`;
}
var codecForAccessToken = codecForString;
var codecForTokenSuccessResponse = () => buildCodecForObject().property("access_token", codecForAccessToken()).property("expiration", codecForTimestamp).build("TalerAuthentication.TokenSuccessResponse");
var codecForTokenSuccessResponseMerchant = () => buildCodecForObject().property("token", codecForAccessToken()).property("expiration", codecForTimestamp).build("TalerAuthentication.TokenSuccessResponseMerchant");
var codecForCurrencySpecificiation = () => buildCodecForObject().property("name", codecForString()).property("num_fractional_input_digits", codecForNumber()).property("num_fractional_normal_digits", codecForNumber()).property("num_fractional_trailing_zero_digits", codecForNumber()).property("alt_unit_names", codecForMap(codecForString())).build("CurrencySpecification");
var codecForIntegrationBankConfig = () => buildCodecForObject().property("name", codecForConstString("taler-bank-integration")).property("version", codecForString()).property("currency", codecForString()).property("currency_specification", codecForCurrencySpecificiation()).build("TalerCorebankApi.IntegrationConfig");
var codecForExchangeConfigInfo = () => buildCodecForObject().property("base_url", codecForString()).property("currency", codecForString()).property("master_pub", codecForString()).build("TalerMerchantApi.ExchangeConfigInfo");
var codecForMerchantConfig = () => buildCodecForObject().property("name", codecForConstString("taler-merchant")).property("currency", codecForString()).property("version", codecForString()).property("currencies", codecForMap(codecForCurrencySpecificiation())).property("exchanges", codecForList(codecForExchangeConfigInfo())).build("TalerMerchantApi.VersionResponse");
var codecForClaimResponse = () => buildCodecForObject().property("contract_terms", codecForContractTerms()).property("sig", codecForString()).build("TalerMerchantApi.ClaimResponse");
var codecForPaymentResponse = () => buildCodecForObject().property("pos_confirmation", codecOptional(codecForString())).property("sig", codecForString()).build("TalerMerchantApi.PaymentResponse");
var codecForStatusPaid = () => buildCodecForObject().property("refund_amount", codecForAmountString()).property("refund_pending", codecForBoolean()).property("refund_taken", codecForAmountString()).property("refunded", codecForBoolean()).property("type", codecForConstString("paid")).build("TalerMerchantApi.StatusPaid");
var codecForStatusGoto = () => buildCodecForObject().property("public_reorder_url", codecForURL2()).property("type", codecForConstString("goto")).build("TalerMerchantApi.StatusGotoResponse");
var codecForStatusStatusUnpaid = () => buildCodecForObject().property("type", codecForConstString("unpaid")).property("already_paid_order_id", codecOptional(codecForString())).property("fulfillment_url", codecOptional(codecForString())).property("taler_pay_uri", codecForTalerUriString()).build("TalerMerchantApi.PaymentResponse");
var codecForPaidRefundStatusResponse = () => buildCodecForObject().property("pos_confirmation", codecOptional(codecForString())).property("refunded", codecForBoolean()).build("TalerMerchantApi.PaidRefundStatusResponse");
var codecForMerchantAbortPayRefundSuccessStatus = () => buildCodecForObject().property("exchange_pub", codecForString()).property("exchange_sig", codecForString()).property("exchange_status", codecForConstNumber(200)).property("type", codecForConstString("success")).build("TalerMerchantApi.MerchantAbortPayRefundSuccessStatus");
var codecForMerchantAbortPayRefundFailureStatus = () => buildCodecForObject().property("exchange_code", codecForNumber()).property("exchange_reply", codecForAny()).property("exchange_status", codecForNumber()).property("type", codecForConstString("failure")).build("TalerMerchantApi.MerchantAbortPayRefundFailureStatus");
var codecForMerchantAbortPayRefundStatus = () => buildCodecForUnion().discriminateOn("type").alternative("success", codecForMerchantAbortPayRefundSuccessStatus()).alternative("failure", codecForMerchantAbortPayRefundFailureStatus()).build("TalerMerchantApi.MerchantAbortPayRefundStatus");
var codecForAbortResponse = () => buildCodecForObject().property("refunds", codecForList(codecForMerchantAbortPayRefundStatus())).build("TalerMerchantApi.AbortResponse");
var codecForWalletRefundResponse = () => buildCodecForObject().property("merchant_pub", codecForString()).property("refund_amount", codecForAmountString()).property("refunds", codecForList(codecForMerchantCoinRefundStatus())).build("TalerMerchantApi.AbortResponse");
var codecForMerchantCoinRefundSuccessStatus = () => buildCodecForObject().property("type", codecForConstString("success")).property("coin_pub", codecForString()).property("exchange_status", codecForConstNumber(200)).property("exchange_sig", codecForString()).property("rtransaction_id", codecForNumber()).property("refund_amount", codecForAmountString()).property("exchange_pub", codecForString()).property("execution_time", codecForTimestamp).build("TalerMerchantApi.MerchantCoinRefundSuccessStatus");
var codecForMerchantCoinRefundFailureStatus = () => buildCodecForObject().property("type", codecForConstString("failure")).property("coin_pub", codecForString()).property("exchange_status", codecForNumber()).property("rtransaction_id", codecForNumber()).property("refund_amount", codecForAmountString()).property("exchange_code", codecOptional(codecForNumber())).property("exchange_reply", codecOptional(codecForAny())).property("execution_time", codecForTimestamp).build("TalerMerchantApi.MerchantCoinRefundFailureStatus");
var codecForMerchantCoinRefundStatus = () => buildCodecForUnion().discriminateOn("type").alternative("success", codecForMerchantCoinRefundSuccessStatus()).alternative("failure", codecForMerchantCoinRefundFailureStatus()).build("TalerMerchantApi.MerchantCoinRefundStatus");
var codecForQueryInstancesResponse = () => buildCodecForObject().property("name", codecForString()).property("user_type", codecForString()).property("email", codecOptional(codecForString())).property("website", codecOptional(codecForString())).property("logo", codecOptional(codecForString())).property("merchant_pub", codecForString()).property("address", codecForLocation()).property("jurisdiction", codecForLocation()).property("use_stefan", codecForBoolean()).property("default_wire_transfer_delay", codecForDuration).property("default_pay_delay", codecForDuration).property("auth", buildCodecForObject().property("method", codecForEither(codecForConstString("token"), codecForConstString("external"))).build("TalerMerchantApi.QueryInstancesResponse.auth")).build("TalerMerchantApi.QueryInstancesResponse");
var codecForAccountKycRedirects = () => buildCodecForObject().property("pending_kycs", codecForList(codecForMerchantAccountKycRedirect())).property("timeout_kycs", codecForList(codecForExchangeKycTimeout())).build("TalerMerchantApi.AccountKycRedirects");
var codecForMerchantAccountKycRedirect = () => buildCodecForObject().property("kyc_url", codecForURL2()).property("aml_status", codecForNumber()).property("exchange_url", codecForURL2()).property("payto_uri", codecForPaytoString()).build("TalerMerchantApi.MerchantAccountKycRedirect");
var codecForExchangeKycTimeout = () => buildCodecForObject().property("exchange_url", codecForURL2()).property("exchange_code", codecForNumber()).property("exchange_http_status", codecForNumber()).build("TalerMerchantApi.ExchangeKycTimeout");
var codecForAccountAddResponse = () => buildCodecForObject().property("h_wire", codecForString()).property("salt", codecForString()).build("TalerMerchantApi.AccountAddResponse");
var codecForAccountsSummaryResponse = () => buildCodecForObject().property("accounts", codecForList(codecForBankAccountEntry())).build("TalerMerchantApi.AccountsSummaryResponse");
var codecForBankAccountEntry = () => buildCodecForObject().property("payto_uri", codecForPaytoString()).property("h_wire", codecForString()).property("active", codecOptional(codecForBoolean())).build("TalerMerchantApi.BankAccountEntry");
var codecForBankAccountDetail = () => buildCodecForObject().property("payto_uri", codecForPaytoString()).property("h_wire", codecForString()).property("salt", codecForString()).property("credit_facade_url", codecOptional(codecForURL2())).property("active", codecOptional(codecForBoolean())).build("TalerMerchantApi.BankAccountEntry");
var codecForInventorySummaryResponse = () => buildCodecForObject().property("products", codecForList(codecForInventoryEntry())).build("TalerMerchantApi.InventorySummaryResponse");
var codecForInventoryEntry = () => buildCodecForObject().property("product_id", codecForString()).property("product_serial", codecForNumber()).build("TalerMerchantApi.InventoryEntry");
var codecForMerchantPosProductDetail = () => buildCodecForObject().property("product_serial", codecForNumber()).property("product_id", codecOptional(codecForString())).property("categories", codecForList(codecForNumber())).property("description", codecForString()).property("description_i18n", codecForInternationalizedString()).property("unit", codecForString()).property("price", codecForAmountString()).property("image", codecForString()).property("taxes", codecOptional(codecForList(codecForTax()))).property("total_stock", codecForNumber()).property("minimum_age", codecOptional(codecForNumber())).build("TalerMerchantApi.MerchantPosProductDetail");
var codecForProductDetail = () => buildCodecForObject().property("description", codecForString()).property("description_i18n", codecForInternationalizedString()).property("unit", codecForString()).property("price", codecForAmountString()).property("image", codecForString()).property("taxes", codecOptional(codecForList(codecForTax()))).property("address", codecOptional(codecForLocation())).property("next_restock", codecOptional(codecForTimestamp)).property("total_stock", codecForNumber()).property("total_sold", codecForNumber()).property("total_lost", codecForNumber()).property("minimum_age", codecOptional(codecForNumber())).build("TalerMerchantApi.ProductDetail");
var codecForTax = () => buildCodecForObject().property("name", codecForString()).property("tax", codecForAmountString()).build("TalerMerchantApi.Tax");
var codecForPostOrderResponse = () => buildCodecForObject().property("order_id", codecForString()).property("token", codecOptional(codecForString())).build("TalerMerchantApi.PostOrderResponse");
var codecForOutOfStockResponse = () => buildCodecForObject().property("product_id", codecForString()).property("available_quantity", codecForNumber()).property("requested_quantity", codecForNumber()).property("restock_expected", codecForTimestamp).build("TalerMerchantApi.OutOfStockResponse");
var codecForOrderHistory = () => buildCodecForObject().property("orders", codecForList(codecForOrderHistoryEntry())).build("TalerMerchantApi.OrderHistory");
var codecForOrderHistoryEntry = () => buildCodecForObject().property("order_id", codecForString()).property("row_id", codecForNumber()).property("timestamp", codecForTimestamp).property("amount", codecForAmountString()).property("summary", codecForString()).property("refundable", codecForBoolean()).property("paid", codecForBoolean()).build("TalerMerchantApi.OrderHistoryEntry");
var codecForMerchant = () => buildCodecForObject().property("name", codecForString()).property("email", codecOptional(codecForString())).property("logo", codecOptional(codecForString())).property("website", codecOptional(codecForString())).property("address", codecOptional(codecForLocation())).property("jurisdiction", codecOptional(codecForLocation())).build("TalerMerchantApi.MerchantInfo");
var codecForExchange = () => buildCodecForObject().property("master_pub", codecForString()).property("priority", codecForNumber()).property("url", codecForString()).build("TalerMerchantApi.Exchange");
var codecForContractTerms = () => buildCodecForObject().property("order_id", codecForString()).property("fulfillment_url", codecOptional(codecForString())).property("fulfillment_message", codecOptional(codecForString())).property("fulfillment_message_i18n", codecOptional(codecForInternationalizedString())).property("merchant_base_url", codecForString()).property("h_wire", codecForString()).property("auto_refund", codecOptional(codecForDuration)).property("wire_method", codecForString()).property("summary", codecForString()).property("summary_i18n", codecOptional(codecForInternationalizedString())).property("nonce", codecForString()).property("amount", codecForAmountString()).property("pay_deadline", codecForTimestamp).property("refund_deadline", codecForTimestamp).property("wire_transfer_deadline", codecForTimestamp).property("timestamp", codecForTimestamp).property("delivery_location", codecOptional(codecForLocation())).property("delivery_date", codecOptional(codecForTimestamp)).property("max_fee", codecForAmountString()).property("merchant", codecForMerchant()).property("merchant_pub", codecForString()).property("exchanges", codecForList(codecForExchange())).property("products", codecForList(codecForProduct())).property("extra", codecForAny()).build("TalerMerchantApi.ContractTerms");
var codecForProduct = () => buildCodecForObject().property("product_id", codecOptional(codecForString())).property("description", codecForString()).property("description_i18n", codecOptional(codecForInternationalizedString())).property("quantity", codecOptional(codecForNumber())).property("unit", codecOptional(codecForString())).property("price", codecOptional(codecForAmountString())).property("image", codecOptional(codecForString())).property("taxes", codecOptional(codecForList(codecForTax()))).property("delivery_date", codecOptional(codecForTimestamp)).build("TalerMerchantApi.Product");
var codecForCheckPaymentPaidResponse = () => buildCodecForObject().property("order_status", codecForConstString("paid")).property("refunded", codecForBoolean()).property("refund_pending", codecForBoolean()).property("wired", codecForBoolean()).property("deposit_total", codecForAmountString()).property("exchange_code", codecForNumber()).property("exchange_http_status", codecForNumber()).property("refund_amount", codecForAmountString()).property("contract_terms", codecForContractTerms()).property("wire_reports", codecForList(codecForTransactionWireReport())).property("wire_details", codecForList(codecForTransactionWireTransfer())).property("refund_details", codecForList(codecForRefundDetails())).property("order_status_url", codecForURL2()).build("TalerMerchantApi.CheckPaymentPaidResponse");
var codecForCheckPaymentUnpaidResponse = () => buildCodecForObject().property("order_status", codecForConstString("unpaid")).property("taler_pay_uri", codecForTalerUriString()).property("creation_time", codecForTimestamp).property("summary", codecForString()).property("total_amount", codecForAmountString()).property("already_paid_order_id", codecOptional(codecForString())).property("already_paid_fulfillment_url", codecOptional(codecForString())).property("order_status_url", codecForString()).build("TalerMerchantApi.CheckPaymentPaidResponse");
var codecForCheckPaymentClaimedResponse = () => buildCodecForObject().property("order_status", codecForConstString("claimed")).property("contract_terms", codecForContractTerms()).build("TalerMerchantApi.CheckPaymentClaimedResponse");
var codecForMerchantOrderPrivateStatusResponse = () => buildCodecForUnion().discriminateOn("order_status").alternative("paid", codecForCheckPaymentPaidResponse()).alternative("unpaid", codecForCheckPaymentUnpaidResponse()).alternative("claimed", codecForCheckPaymentClaimedResponse()).build("TalerMerchantApi.MerchantOrderStatusResponse");
var codecForRefundDetails = () => buildCodecForObject().property("reason", codecForString()).property("pending", codecForBoolean()).property("timestamp", codecForTimestamp).property("amount", codecForAmountString()).build("TalerMerchantApi.RefundDetails");
var codecForTransactionWireTransfer = () => buildCodecForObject().property("exchange_url", codecForURL2()).property("wtid", codecForString()).property("execution_time", codecForTimestamp).property("amount", codecForAmountString()).property("confirmed", codecForBoolean()).build("TalerMerchantApi.TransactionWireTransfer");
var codecForTransactionWireReport = () => buildCodecForObject().property("code", codecForNumber()).property("hint", codecForString()).property("exchange_code", codecForNumber()).property("exchange_http_status", codecForNumber()).property("coin_pub", codecForString()).build("TalerMerchantApi.TransactionWireReport");
var codecForMerchantRefundResponse = () => buildCodecForObject().property("taler_refund_uri", codecForTalerUriString()).property("h_contract", codecForString()).build("TalerMerchantApi.MerchantRefundResponse");
var codecForTansferList = () => buildCodecForObject().property("transfers", codecForList(codecForTransferDetails())).build("TalerMerchantApi.TransferList");
var codecForTransferDetails = () => buildCodecForObject().property("credit_amount", codecForAmountString()).property("wtid", codecForString()).property("payto_uri", codecForPaytoString()).property("exchange_url", codecForURL2()).property("transfer_serial_id", codecForNumber()).property("execution_time", codecOptional(codecForTimestamp)).property("verified", codecOptional(codecForBoolean())).property("confirmed", codecOptional(codecForBoolean())).build("TalerMerchantApi.TransferDetails");
var codecForOtpDeviceSummaryResponse = () => buildCodecForObject().property("otp_devices", codecForList(codecForOtpDeviceEntry())).build("TalerMerchantApi.OtpDeviceSummaryResponse");
var codecForOtpDeviceEntry = () => buildCodecForObject().property("otp_device_id", codecForString()).property("device_description", codecForString()).build("TalerMerchantApi.OtpDeviceEntry");
var codecForOtpDeviceDetails = () => buildCodecForObject().property("device_description", codecForString()).property("otp_algorithm", codecForNumber()).property("otp_ctr", codecOptional(codecForNumber())).property("otp_timestamp", codecForNumber()).property("otp_code", codecOptional(codecForString())).build("TalerMerchantApi.OtpDeviceDetails");
var codecForTemplateSummaryResponse = () => buildCodecForObject().property("templates", codecForList(codecForTemplateEntry())).build("TalerMerchantApi.TemplateSummaryResponse");
var codecForTemplateEntry = () => buildCodecForObject().property("template_id", codecForString()).property("template_description", codecForString()).build("TalerMerchantApi.TemplateEntry");
var codecForTemplateDetails = () => buildCodecForObject().property("template_description", codecForString()).property("otp_id", codecOptional(codecForString())).property("template_contract", codecForTemplateContractDetails()).property("editable_defaults", codecOptional(codecForTemplateContractDetailsDefaults())).build("TalerMerchantApi.TemplateDetails");
var codecForTemplateContractDetails = () => buildCodecForObject().property("summary", codecOptional(codecForString())).property("currency", codecOptional(codecForString())).property("amount", codecOptional(codecForAmountString())).property("minimum_age", codecForNumber()).property("pay_duration", codecForDuration).build("TalerMerchantApi.TemplateContractDetails");
var codecForTemplateContractDetailsDefaults = () => buildCodecForObject().property("summary", codecOptional(codecForString())).property("currency", codecOptional(codecForString())).property("amount", codecOptional(codecForAmountString())).build("TalerMerchantApi.TemplateContractDetailsDefaults");
var codecForWalletTemplateDetails = () => buildCodecForObject().property("template_contract", codecForTemplateContractDetails()).property("editable_defaults", codecOptional(codecForTemplateContractDetailsDefaults())).build("TalerMerchantApi.WalletTemplateDetails");
var codecForWebhookSummaryResponse = () => buildCodecForObject().property("webhooks", codecForList(codecForWebhookEntry())).build("TalerMerchantApi.WebhookSummaryResponse");
var codecForWebhookEntry = () => buildCodecForObject().property("webhook_id", codecForString()).property("event_type", codecForString()).build("TalerMerchantApi.WebhookEntry");
var codecForWebhookDetails = () => buildCodecForObject().property("event_type", codecForString()).property("url", codecForString()).property("http_method", codecForString()).property("header_template", codecOptional(codecForString())).property("body_template", codecOptional(codecForString())).build("TalerMerchantApi.WebhookDetails");
var codecForTokenFamilyKind = () => codecForEither(codecForConstString("discount"), codecForConstString("subscription"));
var codecForTokenFamilyDetails = () => buildCodecForObject().property("slug", codecForString()).property("name", codecForString()).property("description", codecForString()).property("description_i18n", codecForInternationalizedString()).property("valid_after", codecForTimestamp).property("valid_before", codecForTimestamp).property("duration", codecForDuration).property("kind", codecForTokenFamilyKind()).property("issued", codecForNumber()).property("redeemed", codecForNumber()).build("TalerMerchantApi.TokenFamilyDetails");
var codecForTokenFamiliesList = () => buildCodecForObject().property("token_families", codecForList(codecForTokenFamilySummary())).build("TalerMerchantApi.TokenFamiliesList");
var codecForTokenFamilySummary = () => buildCodecForObject().property("slug", codecForString()).property("name", codecForString()).property("valid_after", codecForTimestamp).property("valid_before", codecForTimestamp).property("kind", codecForTokenFamilyKind()).build("TalerMerchantApi.TokenFamilySummary");
var codecForInstancesResponse = () => buildCodecForObject().property("instances", codecForList(codecForInstance())).build("TalerMerchantApi.InstancesResponse");
var codecForInstance = () => buildCodecForObject().property("name", codecForString()).property("user_type", codecForString()).property("website", codecOptional(codecForString())).property("logo", codecOptional(codecForString())).property("id", codecForString()).property("merchant_pub", codecForString()).property("payment_targets", codecForList(codecForString())).property("deleted", codecForBoolean()).build("TalerMerchantApi.Instance");
var codecForBankWithdrawalOperationStatus = () => buildCodecForObject().property("status", codecForEither(codecForConstString("pending"), codecForConstString("selected"), codecForConstString("aborted"), codecForConstString("confirmed"))).property("amount", codecOptional(codecForAmountString())).property("currency", codecOptional(codecForCurrencyName())).property("suggested_amount", codecOptional(codecForAmountString())).property("card_fees", codecOptional(codecForAmountString())).property("sender_wire", codecOptional(codecForPaytoString())).property("suggested_exchange", codecOptional(codecForURL2())).property("confirm_transfer_url", codecOptional(codecForURL2())).property("wire_types", codecForList(codecForString())).property("selected_reserve_pub", codecOptional(codecForString())).property("selected_exchange_account", codecOptional(codecForString())).property("max_amount", codecOptional(codecForAmountString())).build("TalerBankIntegrationApi.BankWithdrawalOperationStatus");
var codecForBankWithdrawalOperationPostResponse = () => buildCodecForObject().property("status", codecForEither(codecForConstString("selected"), codecForConstString("aborted"), codecForConstString("confirmed"))).property("confirm_transfer_url", codecOptional(codecForURL2())).build("TalerBankIntegrationApi.BankWithdrawalOperationPostResponse");
var codecForRevenueConfig = () => buildCodecForObject().property("name", codecForConstString("taler-revenue")).property("version", codecForString()).property("currency", codecForString()).property("implementation", codecOptional(codecForString())).build("TalerRevenueApi.RevenueConfig");
var codecForRevenueIncomingHistory = () => buildCodecForObject().property("credit_account", codecForPaytoString()).property("incoming_transactions", codecForList(codecForRevenueIncomingBankTransaction())).build("TalerRevenueApi.MerchantIncomingHistory");
var codecForRevenueIncomingBankTransaction = () => buildCodecForObject().property("amount", codecForAmountString()).property("date", codecForTimestamp).property("debit_account", codecForPaytoString()).property("row_id", codecForNumber()).property("subject", codecForString()).build("TalerRevenueApi.RevenueIncomingBankTransaction");
var codecForURL2 = codecForString;
var codecForCurrencyName = codecForString;
var TalerCorebankApi;
(function(TalerCorebankApi2) {
  let MonitorTimeframeParam;
  (function(MonitorTimeframeParam2) {
    MonitorTimeframeParam2[MonitorTimeframeParam2["hour"] = 0] = "hour";
    MonitorTimeframeParam2[MonitorTimeframeParam2["day"] = 1] = "day";
    MonitorTimeframeParam2[MonitorTimeframeParam2["month"] = 2] = "month";
    MonitorTimeframeParam2[MonitorTimeframeParam2["year"] = 3] = "year";
    MonitorTimeframeParam2[MonitorTimeframeParam2["decade"] = 4] = "decade";
  })(MonitorTimeframeParam = TalerCorebankApi2.MonitorTimeframeParam || (TalerCorebankApi2.MonitorTimeframeParam = {}));
  let TanChannel;
  (function(TanChannel2) {
    TanChannel2["SMS"] = "sms";
    TanChannel2["EMAIL"] = "email";
  })(TanChannel = TalerCorebankApi2.TanChannel || (TalerCorebankApi2.TanChannel = {}));
})(TalerCorebankApi || (TalerCorebankApi = {}));
var TalerExchangeApi;
(function(TalerExchangeApi2) {
  let AmlState;
  (function(AmlState2) {
    AmlState2[AmlState2["normal"] = 0] = "normal";
    AmlState2[AmlState2["pending"] = 1] = "pending";
    AmlState2[AmlState2["frozen"] = 2] = "frozen";
  })(AmlState = TalerExchangeApi2.AmlState || (TalerExchangeApi2.AmlState = {}));
})(TalerExchangeApi || (TalerExchangeApi = {}));
var TalerMerchantApi;
(function(TalerMerchantApi43) {
  let TokenFamilyKind;
  (function(TokenFamilyKind2) {
    TokenFamilyKind2["Discount"] = "discount";
    TokenFamilyKind2["Subscription"] = "subscription";
  })(TokenFamilyKind = TalerMerchantApi43.TokenFamilyKind || (TalerMerchantApi43.TokenFamilyKind = {}));
})(TalerMerchantApi || (TalerMerchantApi = {}));

// ../taler-util/lib/http-status-codes.js
var HttpStatusCode;
(function(HttpStatusCode3) {
  HttpStatusCode3[HttpStatusCode3["Continue"] = 100] = "Continue";
  HttpStatusCode3[HttpStatusCode3["SwitchingProtocols"] = 101] = "SwitchingProtocols";
  HttpStatusCode3[HttpStatusCode3["Processing"] = 102] = "Processing";
  HttpStatusCode3[HttpStatusCode3["Ok"] = 200] = "Ok";
  HttpStatusCode3[HttpStatusCode3["Created"] = 201] = "Created";
  HttpStatusCode3[HttpStatusCode3["Accepted"] = 202] = "Accepted";
  HttpStatusCode3[HttpStatusCode3["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
  HttpStatusCode3[HttpStatusCode3["NoContent"] = 204] = "NoContent";
  HttpStatusCode3[HttpStatusCode3["ResetContent"] = 205] = "ResetContent";
  HttpStatusCode3[HttpStatusCode3["PartialContent"] = 206] = "PartialContent";
  HttpStatusCode3[HttpStatusCode3["MultiStatus"] = 207] = "MultiStatus";
  HttpStatusCode3[HttpStatusCode3["AlreadyReported"] = 208] = "AlreadyReported";
  HttpStatusCode3[HttpStatusCode3["ImUsed"] = 226] = "ImUsed";
  HttpStatusCode3[HttpStatusCode3["MultipleChoices"] = 300] = "MultipleChoices";
  HttpStatusCode3[HttpStatusCode3["MovedPermanently"] = 301] = "MovedPermanently";
  HttpStatusCode3[HttpStatusCode3["Found"] = 302] = "Found";
  HttpStatusCode3[HttpStatusCode3["SeeOther"] = 303] = "SeeOther";
  HttpStatusCode3[HttpStatusCode3["NotModified"] = 304] = "NotModified";
  HttpStatusCode3[HttpStatusCode3["UseProxy"] = 305] = "UseProxy";
  HttpStatusCode3[HttpStatusCode3["SwitchProxy"] = 306] = "SwitchProxy";
  HttpStatusCode3[HttpStatusCode3["TemporaryRedirect"] = 307] = "TemporaryRedirect";
  HttpStatusCode3[HttpStatusCode3["PermanentRedirect"] = 308] = "PermanentRedirect";
  HttpStatusCode3[HttpStatusCode3["BadRequest"] = 400] = "BadRequest";
  HttpStatusCode3[HttpStatusCode3["Unauthorized"] = 401] = "Unauthorized";
  HttpStatusCode3[HttpStatusCode3["PaymentRequired"] = 402] = "PaymentRequired";
  HttpStatusCode3[HttpStatusCode3["Forbidden"] = 403] = "Forbidden";
  HttpStatusCode3[HttpStatusCode3["NotFound"] = 404] = "NotFound";
  HttpStatusCode3[HttpStatusCode3["MethodNotAllowed"] = 405] = "MethodNotAllowed";
  HttpStatusCode3[HttpStatusCode3["NotAcceptable"] = 406] = "NotAcceptable";
  HttpStatusCode3[HttpStatusCode3["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
  HttpStatusCode3[HttpStatusCode3["RequestTimeout"] = 408] = "RequestTimeout";
  HttpStatusCode3[HttpStatusCode3["Conflict"] = 409] = "Conflict";
  HttpStatusCode3[HttpStatusCode3["Gone"] = 410] = "Gone";
  HttpStatusCode3[HttpStatusCode3["LengthRequired"] = 411] = "LengthRequired";
  HttpStatusCode3[HttpStatusCode3["PreconditionFailed"] = 412] = "PreconditionFailed";
  HttpStatusCode3[HttpStatusCode3["PayloadTooLarge"] = 413] = "PayloadTooLarge";
  HttpStatusCode3[HttpStatusCode3["UriTooLong"] = 414] = "UriTooLong";
  HttpStatusCode3[HttpStatusCode3["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
  HttpStatusCode3[HttpStatusCode3["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
  HttpStatusCode3[HttpStatusCode3["ExpectationFailed"] = 417] = "ExpectationFailed";
  HttpStatusCode3[HttpStatusCode3["IAmATeapot"] = 418] = "IAmATeapot";
  HttpStatusCode3[HttpStatusCode3["MisdirectedRequest"] = 421] = "MisdirectedRequest";
  HttpStatusCode3[HttpStatusCode3["UnprocessableEntity"] = 422] = "UnprocessableEntity";
  HttpStatusCode3[HttpStatusCode3["Locked"] = 423] = "Locked";
  HttpStatusCode3[HttpStatusCode3["FailedDependency"] = 424] = "FailedDependency";
  HttpStatusCode3[HttpStatusCode3["UpgradeRequired"] = 426] = "UpgradeRequired";
  HttpStatusCode3[HttpStatusCode3["PreconditionRequired"] = 428] = "PreconditionRequired";
  HttpStatusCode3[HttpStatusCode3["TooManyRequests"] = 429] = "TooManyRequests";
  HttpStatusCode3[HttpStatusCode3["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
  HttpStatusCode3[HttpStatusCode3["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
  HttpStatusCode3[HttpStatusCode3["InternalServerError"] = 500] = "InternalServerError";
  HttpStatusCode3[HttpStatusCode3["NotImplemented"] = 501] = "NotImplemented";
  HttpStatusCode3[HttpStatusCode3["BadGateway"] = 502] = "BadGateway";
  HttpStatusCode3[HttpStatusCode3["ServiceUnavailable"] = 503] = "ServiceUnavailable";
  HttpStatusCode3[HttpStatusCode3["GatewayTimeout"] = 504] = "GatewayTimeout";
  HttpStatusCode3[HttpStatusCode3["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
  HttpStatusCode3[HttpStatusCode3["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
  HttpStatusCode3[HttpStatusCode3["InsufficientStorage"] = 507] = "InsufficientStorage";
  HttpStatusCode3[HttpStatusCode3["LoopDetected"] = 508] = "LoopDetected";
  HttpStatusCode3[HttpStatusCode3["NotExtended"] = 510] = "NotExtended";
  HttpStatusCode3[HttpStatusCode3["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
})(HttpStatusCode || (HttpStatusCode = {}));

// ../taler-util/lib/http-impl.missing.js
var HttpLibImpl = class {
  fetch(url, opt) {
    throw new Error("Method not implemented.");
  }
};

// ../taler-util/lib/http.js
function createPlatformHttpLib(args) {
  return new HttpLibImpl(args);
}

// ../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/MerchantApiClient.js
var logger4 = new Logger("MerchantApiClient.ts");

// ../taler-util/lib/RequestThrottler.js
var logger5 = new Logger("RequestThrottler.ts");
var MAX_PER_SECOND = 100;
var MAX_PER_MINUTE = 500;
var MAX_PER_HOUR = 2e3;
var OriginState = class {
  constructor() {
    this.tokensSecond = MAX_PER_SECOND;
    this.tokensMinute = MAX_PER_MINUTE;
    this.tokensHour = MAX_PER_HOUR;
    this.lastUpdate = AbsoluteTime.now();
  }
  refill() {
    const now2 = AbsoluteTime.now();
    if (AbsoluteTime.cmp(now2, this.lastUpdate) < 0) {
      this.lastUpdate = now2;
      return;
    }
    const d5 = AbsoluteTime.difference(now2, this.lastUpdate);
    if (d5.d_ms === "forever") {
      throw Error("assertion failed");
    }
    this.tokensSecond = Math.min(MAX_PER_SECOND, this.tokensSecond + d5.d_ms / 1e3);
    this.tokensMinute = Math.min(MAX_PER_MINUTE, this.tokensMinute + d5.d_ms / 1e3 / 60);
    this.tokensHour = Math.min(MAX_PER_HOUR, this.tokensHour + d5.d_ms / 1e3 / 60 / 60);
    this.lastUpdate = now2;
  }
  /**
   * Return true if the request for this origin should be throttled.
   * Otherwise, take a token out of the respective buckets.
   */
  applyThrottle() {
    this.refill();
    if (this.tokensSecond < 1) {
      logger5.warn("request throttled (per second limit exceeded)");
      return true;
    }
    if (this.tokensMinute < 1) {
      logger5.warn("request throttled (per minute limit exceeded)");
      return true;
    }
    if (this.tokensHour < 1) {
      logger5.warn("request throttled (per hour limit exceeded)");
      return true;
    }
    this.tokensSecond--;
    this.tokensMinute--;
    this.tokensHour--;
    return false;
  }
};
var RequestThrottler = class {
  constructor() {
    this.perOriginInfo = {};
  }
  /**
   * Get the throttling state for an origin, or
   * initialize if no state is associated with the
   * origin yet.
   */
  getState(origin) {
    const s5 = this.perOriginInfo[origin];
    if (s5) {
      return s5;
    }
    const ns = this.perOriginInfo[origin] = new OriginState();
    return ns;
  }
  /**
   * Apply throttling to a request.
   *
   * @returns whether the request should be throttled.
   */
  applyThrottle(requestUrl) {
    const origin = new URL(requestUrl).origin;
    return this.getState(origin).applyThrottle();
  }
  /**
   * Get the throttle statistics for a particular URL.
   */
  getThrottleStats(requestUrl) {
    const origin = new URL(requestUrl).origin;
    const state = this.getState(origin);
    return {
      tokensHour: state.tokensHour,
      tokensMinute: state.tokensMinute,
      tokensSecond: state.tokensSecond,
      maxTokensHour: MAX_PER_HOUR,
      maxTokensMinute: MAX_PER_MINUTE,
      maxTokensSecond: MAX_PER_SECOND
    };
  }
};

// ../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/TaskThrottler.js
var logger6 = new Logger("OperationThrottler.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/base64.js
function base64FromArrayBuffer(arrayBuffer) {
  var base64 = "";
  var encodings2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var bytes = new Uint8Array(arrayBuffer);
  var byteLength = bytes.byteLength;
  var byteRemainder = byteLength % 3;
  var mainLength = byteLength - byteRemainder;
  var a5, b4, c4, d5;
  var chunk;
  for (var i4 = 0; i4 < mainLength; i4 = i4 + 3) {
    chunk = bytes[i4] << 16 | bytes[i4 + 1] << 8 | bytes[i4 + 2];
    a5 = (chunk & 16515072) >> 18;
    b4 = (chunk & 258048) >> 12;
    c4 = (chunk & 4032) >> 6;
    d5 = chunk & 63;
    base64 += encodings2[a5] + encodings2[b4] + encodings2[c4] + encodings2[d5];
  }
  if (byteRemainder == 1) {
    chunk = bytes[mainLength];
    a5 = (chunk & 252) >> 2;
    b4 = (chunk & 3) << 4;
    base64 += encodings2[a5] + encodings2[b4] + "==";
  } else if (byteRemainder == 2) {
    chunk = bytes[mainLength] << 8 | bytes[mainLength + 1];
    a5 = (chunk & 64512) >> 10;
    b4 = (chunk & 1008) >> 4;
    c4 = (chunk & 15) << 2;
    base64 += encodings2[a5] + encodings2[b4] + encodings2[c4] + "=";
  }
  return base64;
}

// ../taler-util/lib/contract-terms.js
var logger8 = 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 x5 of Object.keys(dup.$forgettable)) {
          if (!pred([...path, x5])) {
            continue;
          }
          if (!dup.$forgotten) {
            dup.$forgotten = {};
          }
          if (!dup.$forgotten[x5]) {
            const membValCanon = stringToBytes(canonicalJson(scrub(dup[x5])) + "\0");
            const membSalt = stringToBytes(dup.$forgettable[x5] + "\0");
            const h5 = kdf(64, membValCanon, membSalt, new Uint8Array([]));
            dup.$forgotten[x5] = encodeCrock(h5);
          }
          delete dup[x5];
          delete dup.$forgettable[x5];
        }
        if (Object.keys(dup.$forgettable).length === 0) {
          delete dup.$forgettable;
        }
      }
      for (const x5 of Object.keys(dup)) {
        if (x5.startsWith("$")) {
          continue;
        }
        dup[x5] = forgetAllImpl(dup[x5], [...path, x5], 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 x5 of Object.keys(dup)) {
        if (x5.startsWith("$")) {
          continue;
        }
        dup[x5] = saltForgettable(dup[x5]);
      }
    }
    return dup;
  }
  ContractTermsUtil2.saltForgettable = saltForgettable;
  const nameRegex = /^[0-9A-Za-z_]+$/;
  function validateForgettable(anyJson) {
    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((x5) => validateForgettable(x5));
    }
    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 (anyJson.$forgettable?.[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/errors.js
function makeErrorDetail(code, detail, hint) {
  if (!hint && !detail.hint) {
    hint = getDefaultHint(code);
  }
  const when = AbsoluteTime.now();
  return { code, when, hint, ...detail };
}
function getDefaultHint(code) {
  const errName = TalerErrorCode[code];
  if (errName) {
    return `Error (${errName})`;
  } else {
    return `Error (<unknown>)`;
  }
}
var TalerError = class _TalerError extends Error {
  constructor(d5, cause) {
    super(d5.hint ?? `Error (code ${d5.code})`);
    this.errorDetail = d5;
    this.cause = cause;
    Object.setPrototypeOf(this, _TalerError.prototype);
  }
  static fromDetail(code, detail, hint, cause) {
    if (!hint) {
      hint = getDefaultHint(code);
    }
    const when = AbsoluteTime.now();
    return new _TalerError({ code, when, hint, ...detail }, cause);
  }
  static fromUncheckedDetail(d5, c4) {
    return new _TalerError({ ...d5 }, c4);
  }
  static fromException(e4) {
    const errDetail = getErrorDetailFromException(e4);
    return new _TalerError(errDetail, e4);
  }
  hasErrorCode(code) {
    return this.errorDetail.code === code;
  }
  toString() {
    return `TalerError: ${JSON.stringify(this.errorDetail)}`;
  }
};
function getErrorDetailFromException(e4) {
  if (e4 instanceof TalerError) {
    return e4.errorDetail;
  }
  if (e4 instanceof CancellationToken.CancellationError) {
    const err2 = makeErrorDetail(TalerErrorCode.WALLET_CORE_REQUEST_CANCELLED, {});
    return err2;
  }
  if (e4 instanceof Error) {
    const err2 = makeErrorDetail(TalerErrorCode.WALLET_UNEXPECTED_EXCEPTION, {
      stack: e4.stack
    }, `unexpected exception (message: ${e4.message})`);
    return err2;
  }
  let excString;
  try {
    excString = e4.toString();
  } catch (e5) {
    excString = "can't stringify exception";
  }
  const err = makeErrorDetail(TalerErrorCode.WALLET_UNEXPECTED_EXCEPTION, {}, `unexpected exception (not an exception, ${excString})`);
  return err;
}
function assertUnreachable(x5) {
  throw new Error("Didn't expect to get here");
}

// ../taler-util/lib/fnutils.js
var fnutil;
(function(fnutil2) {
  function all(arr, f3) {
    for (const x5 of arr) {
      if (!f3(x5)) {
        return false;
      }
    }
    return true;
  }
  fnutil2.all = all;
  function any(arr, f3) {
    for (const x5 of arr) {
      if (f3(x5)) {
        return true;
      }
    }
    return false;
  }
  fnutil2.any = any;
})(fnutil || (fnutil = {}));

// ../taler-util/lib/http-client/utils.js
function makeBearerTokenAuthHeader(token) {
  return `Bearer ${token}`;
}
function addPaginationParams(url, pagination) {
  if (!pagination)
    return;
  if (pagination.offset) {
    url.searchParams.set("start", pagination.offset);
  }
  const order = !pagination || pagination.order === "asc" ? 1 : -1;
  const limit = !pagination || !pagination.limit || pagination.limit === 0 ? 5 : Math.abs(pagination.limit);
  url.searchParams.set("delta", String(order * limit));
}
function addMerchantPaginationParams(url, pagination) {
  if (!pagination)
    return;
  if (pagination.offset) {
    url.searchParams.set("offset", pagination.offset);
  }
  const order = !pagination || pagination.order === "asc" ? 1 : -1;
  const limit = !pagination || !pagination.limit || pagination.limit === 0 ? 5 : Math.abs(pagination.limit);
  url.searchParams.set("limit", String(order * limit));
}
function addLongPollingParam(url, param) {
  if (!param)
    return;
  if (param.timeoutMs) {
    url.searchParams.set("long_poll_ms", String(param.timeoutMs));
  }
}
var nullEvictor = {
  notifySuccess: () => Promise.resolve()
};

// ../taler-util/lib/http-client/authentication.js
var TalerAuthenticationHttpClient = class {
  constructor(baseUrl, httpClient) {
    this.baseUrl = baseUrl;
    this.PROTOCOL_VERSION = "0:0:0";
    this.httpLib = httpClient ?? createPlatformHttpLib();
  }
  isCompatible(version) {
    const compare2 = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);
    return compare2?.compatible ?? false;
  }
  /**
   * https://docs.taler.net/core/api-corebank.html#post--accounts-$USERNAME-token
   *
   * @returns
   */
  async createAccessTokenBasic(username, password, body) {
    const url = new URL(`token`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      headers: {
        Authorization: makeBasicAuthHeader(username, password)
      },
      body
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForTokenSuccessResponse());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   *
   * @returns
   */
  async createAccessTokenBearer(token, body) {
    const url = new URL(`token`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      headers: {
        Authorization: makeBearerTokenAuthHeader(token)
      },
      body
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForTokenSuccessResponseMerchant());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  async deleteAccessToken(token) {
    const url = new URL(`token`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "DELETE",
      headers: {
        Authorization: makeBearerTokenAuthHeader(token)
      }
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opEmptySuccess(resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
};

// ../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["Dialog"] = "dialog";
  TransactionMajorState2["Finalizing"] = "finalizing";
  TransactionMajorState2["Suspended"] = "suspended";
  TransactionMajorState2["SuspendedFinalizing"] = "suspended-finalizing";
  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["RefreshExpired"] = "refresh-expired";
  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";
  TransactionMinorState2["PaidByOther"] = "paid-by-other";
  TransactionMinorState2["CompletedByOtherWallet"] = "completed-by-other-wallet";
})(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["Deposit"] = "deposit";
  TransactionType2["PeerPushDebit"] = "peer-push-debit";
  TransactionType2["PeerPushCredit"] = "peer-push-credit";
  TransactionType2["PeerPullDebit"] = "peer-pull-debit";
  TransactionType2["PeerPullCredit"] = "peer-pull-credit";
  TransactionType2["Recoup"] = "recoup";
  TransactionType2["DenomLoss"] = "denom-loss";
})(TransactionType || (TransactionType = {}));
var WithdrawalType;
(function(WithdrawalType2) {
  WithdrawalType2["TalerBankIntegrationApi"] = "taler-bank-integration-api";
  WithdrawalType2["ManualTransfer"] = "manual-transfer";
})(WithdrawalType || (WithdrawalType = {}));
var DenomLossEventType;
(function(DenomLossEventType2) {
  DenomLossEventType2["DenomExpired"] = "denom-expired";
  DenomLossEventType2["DenomVanished"] = "denom-vanished";
  DenomLossEventType2["DenomUnoffered"] = "denom-unoffered";
})(DenomLossEventType || (DenomLossEventType = {}));
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("depositPaytoUri", codecForPaytoString()).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()).build("GetPlanForPaymentRequest");
var codecForGetPlanForPullDebitRequest = buildCodecForObject().property("type", codecForConstString(TransactionType.PeerPullDebit)).build("GetPlanForPullDebitRequest");
var codecForGetPlanForPushCreditRequest = buildCodecForObject().property("type", codecForConstString(TransactionType.PeerPushCredit)).build("GetPlanForPushCreditRequest");
var BalanceFlag;
(function(BalanceFlag2) {
  BalanceFlag2["IncomingKyc"] = "incoming-kyc";
  BalanceFlag2["IncomingAml"] = "incoming-aml";
  BalanceFlag2["IncomingConfirmation"] = "incoming-confirmation";
  BalanceFlag2["OutgoingKyc"] = "outgoing-kyc";
})(BalanceFlag || (BalanceFlag = {}));
var ScopeType;
(function(ScopeType2) {
  ScopeType2["Global"] = "global";
  ScopeType2["Exchange"] = "exchange";
  ScopeType2["Auditor"] = "auditor";
})(ScopeType || (ScopeType = {}));
var CoinStatus;
(function(CoinStatus2) {
  CoinStatus2["Fresh"] = "fresh";
  CoinStatus2["DenomLoss"] = "denom-loss";
  CoinStatus2["FreshSuspended"] = "fresh-suspended";
  CoinStatus2["Dormant"] = "dormant";
})(CoinStatus || (CoinStatus = {}));
var ConfirmPayResultType;
(function(ConfirmPayResultType2) {
  ConfirmPayResultType2["Done"] = "done";
  ConfirmPayResultType2["Pending"] = "pending";
})(ConfirmPayResultType || (ConfirmPayResultType = {}));
var codecForTalerErrorDetail = () => buildCodecForObject().property("code", codecForNumber()).property("when", codecOptional(codecForAbsoluteTime)).property("hint", codecOptional(codecForString())).build("TalerErrorDetail");
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["AbortPeerPullDebit"] = "abort-peer-pull-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";
  ExchangeTosStatus2["MissingTos"] = "missing-tos";
})(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["UnavailableUpdate"] = "unavailable-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
};
var ProviderPaymentType;
(function(ProviderPaymentType2) {
  ProviderPaymentType2["Unpaid"] = "unpaid";
  ProviderPaymentType2["Pending"] = "pending";
  ProviderPaymentType2["InsufficientBalance"] = "insufficient-balance";
  ProviderPaymentType2["Paid"] = "paid";
  ProviderPaymentType2["TermsChanged"] = "terms-changed";
})(ProviderPaymentType || (ProviderPaymentType = {}));

// ../taler-util/lib/http-client/bank-conversion.js
var TalerBankConversionCacheEviction;
(function(TalerBankConversionCacheEviction2) {
  TalerBankConversionCacheEviction2[TalerBankConversionCacheEviction2["UPDATE_RATE"] = 0] = "UPDATE_RATE";
})(TalerBankConversionCacheEviction || (TalerBankConversionCacheEviction = {}));

// ../taler-util/lib/http-client/bank-core.js
var TalerCoreBankCacheEviction;
(function(TalerCoreBankCacheEviction2) {
  TalerCoreBankCacheEviction2[TalerCoreBankCacheEviction2["DELETE_ACCOUNT"] = 0] = "DELETE_ACCOUNT";
  TalerCoreBankCacheEviction2[TalerCoreBankCacheEviction2["CREATE_ACCOUNT"] = 1] = "CREATE_ACCOUNT";
  TalerCoreBankCacheEviction2[TalerCoreBankCacheEviction2["UPDATE_ACCOUNT"] = 2] = "UPDATE_ACCOUNT";
  TalerCoreBankCacheEviction2[TalerCoreBankCacheEviction2["UPDATE_PASSWORD"] = 3] = "UPDATE_PASSWORD";
  TalerCoreBankCacheEviction2[TalerCoreBankCacheEviction2["CREATE_TRANSACTION"] = 4] = "CREATE_TRANSACTION";
  TalerCoreBankCacheEviction2[TalerCoreBankCacheEviction2["CONFIRM_WITHDRAWAL"] = 5] = "CONFIRM_WITHDRAWAL";
  TalerCoreBankCacheEviction2[TalerCoreBankCacheEviction2["ABORT_WITHDRAWAL"] = 6] = "ABORT_WITHDRAWAL";
  TalerCoreBankCacheEviction2[TalerCoreBankCacheEviction2["CREATE_WITHDRAWAL"] = 7] = "CREATE_WITHDRAWAL";
  TalerCoreBankCacheEviction2[TalerCoreBankCacheEviction2["CREATE_CASHOUT"] = 8] = "CREATE_CASHOUT";
})(TalerCoreBankCacheEviction || (TalerCoreBankCacheEviction = {}));

// ../taler-util/lib/http-client/bank-integration.js
var logger9 = new Logger("bank-integration.ts");
var TalerBankIntegrationHttpClient = class _TalerBankIntegrationHttpClient {
  constructor(baseUrl, httpClient) {
    this.baseUrl = baseUrl;
    this.PROTOCOL_VERSION = _TalerBankIntegrationHttpClient.PROTOCOL_VERSION;
    this.httpLib = httpClient ?? createPlatformHttpLib();
  }
  isCompatible(version) {
    const compare2 = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);
    return compare2?.compatible ?? false;
  }
  /**
   * https://docs.taler.net/core/api-bank-integration.html#get--config
   *
   */
  async getConfig() {
    const url = new URL(`config`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET"
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForIntegrationBankConfig());
      default:
        logger9.warn(`config request failed, status ${resp.status}`);
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-bank-integration.html#get--withdrawal-operation-$WITHDRAWAL_ID
   *
   */
  async getWithdrawalOperationById(woid, params) {
    const url = new URL(`withdrawal-operation/${woid}`, this.baseUrl);
    addLongPollingParam(url, params);
    if (params) {
      url.searchParams.set("old_state", !params.old_state ? "pending" : params.old_state);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET"
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForBankWithdrawalOperationStatus());
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-bank-integration.html#post-$BANK_API_BASE_URL-withdrawal-operation-$wopid
   *
   */
  async completeWithdrawalOperationById(woid, body) {
    const url = new URL(`withdrawal-operation/${woid}`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForBankWithdrawalOperationPostResponse());
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict: {
        const body2 = await readTalerErrorResponse(resp);
        const details = codecForTalerErrorDetail().decode(body2);
        switch (details.code) {
          case TalerErrorCode.BANK_WITHDRAWAL_OPERATION_RESERVE_SELECTION_CONFLICT:
            return opKnownTalerFailure(details.code, details);
          case TalerErrorCode.BANK_DUPLICATE_RESERVE_PUB_SUBJECT:
            return opKnownTalerFailure(details.code, details);
          case TalerErrorCode.BANK_UNKNOWN_ACCOUNT:
            return opKnownTalerFailure(details.code, details);
          case TalerErrorCode.BANK_ACCOUNT_IS_NOT_EXCHANGE:
            return opKnownTalerFailure(details.code, details);
          case TalerErrorCode.BANK_AMOUNT_DIFFERS:
            return opKnownTalerFailure(details.code, details);
          case TalerErrorCode.BANK_AMOUNT_REQUIRED:
            return opKnownTalerFailure(details.code, details);
          default:
            return opUnknownFailure(resp, details);
        }
      }
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-bank-integration.html#post-$BANK_API_BASE_URL-withdrawal-operation-$wopid
   *
   */
  async abortWithdrawalOperationById(woid) {
    const url = new URL(`withdrawal-operation/${woid}/abort`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST"
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent:
        return opEmptySuccess(resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
};
TalerBankIntegrationHttpClient.PROTOCOL_VERSION = "2:0:1";

// ../taler-util/lib/http-client/bank-revenue.js
var TalerRevenueHttpClient = class {
  constructor(baseUrl, httpClient) {
    this.baseUrl = baseUrl;
    this.PROTOCOL_VERSION = "0:0:0";
    this.httpLib = httpClient ?? createPlatformHttpLib();
  }
  isCompatible(version) {
    const compare2 = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);
    return compare2?.compatible ?? false;
  }
  /**
   * https://docs.taler.net/core/api-bank-revenue.html#get--config
   *
   */
  async getConfig(auth) {
    const url = new URL(`config`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers: {
        Authorization: auth ? makeBasicAuthHeader(auth.username, auth.password) : void 0
      }
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForRevenueConfig());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-bank-revenue.html#get--history
   *
   * @returns
   */
  async getHistory(auth, params) {
    const url = new URL(`history`, this.baseUrl);
    addPaginationParams(url, params);
    addLongPollingParam(url, params);
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers: {
        Authorization: auth ? makeBasicAuthHeader(auth.username, auth.password) : void 0
      }
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForRevenueIncomingHistory());
      case HttpStatusCode.NoContent:
        return opFixedSuccess({ incoming_transactions: [], credit_account: "" });
      case HttpStatusCode.BadRequest:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
};

// ../taler-util/lib/http-client/challenger.js
var ChallengerCacheEviction;
(function(ChallengerCacheEviction2) {
  ChallengerCacheEviction2[ChallengerCacheEviction2["CREATE_CHALLENGE"] = 0] = "CREATE_CHALLENGE";
  ChallengerCacheEviction2[ChallengerCacheEviction2["SOLVE_CHALLENGE"] = 1] = "SOLVE_CHALLENGE";
})(ChallengerCacheEviction || (ChallengerCacheEviction = {}));

// ../taler-util/lib/http-client/exchange.js
var TalerExchangeCacheEviction;
(function(TalerExchangeCacheEviction2) {
  TalerExchangeCacheEviction2[TalerExchangeCacheEviction2["CREATE_DESCISION"] = 0] = "CREATE_DESCISION";
})(TalerExchangeCacheEviction || (TalerExchangeCacheEviction = {}));

// ../taler-util/lib/http-client/merchant.js
var TalerMerchantInstanceCacheEviction;
(function(TalerMerchantInstanceCacheEviction2) {
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["CREATE_ORDER"] = 0] = "CREATE_ORDER";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["UPDATE_ORDER"] = 1] = "UPDATE_ORDER";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["DELETE_ORDER"] = 2] = "DELETE_ORDER";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["UPDATE_CURRENT_INSTANCE"] = 3] = "UPDATE_CURRENT_INSTANCE";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["DELETE_CURRENT_INSTANCE"] = 4] = "DELETE_CURRENT_INSTANCE";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["CREATE_BANK_ACCOUNT"] = 5] = "CREATE_BANK_ACCOUNT";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["UPDATE_BANK_ACCOUNT"] = 6] = "UPDATE_BANK_ACCOUNT";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["DELETE_BANK_ACCOUNT"] = 7] = "DELETE_BANK_ACCOUNT";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["CREATE_PRODUCT"] = 8] = "CREATE_PRODUCT";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["UPDATE_PRODUCT"] = 9] = "UPDATE_PRODUCT";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["DELETE_PRODUCT"] = 10] = "DELETE_PRODUCT";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["CREATE_TRANSFER"] = 11] = "CREATE_TRANSFER";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["DELETE_TRANSFER"] = 12] = "DELETE_TRANSFER";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["CREATE_DEVICE"] = 13] = "CREATE_DEVICE";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["UPDATE_DEVICE"] = 14] = "UPDATE_DEVICE";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["DELETE_DEVICE"] = 15] = "DELETE_DEVICE";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["CREATE_TEMPLATE"] = 16] = "CREATE_TEMPLATE";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["UPDATE_TEMPLATE"] = 17] = "UPDATE_TEMPLATE";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["DELETE_TEMPLATE"] = 18] = "DELETE_TEMPLATE";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["CREATE_WEBHOOK"] = 19] = "CREATE_WEBHOOK";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["UPDATE_WEBHOOK"] = 20] = "UPDATE_WEBHOOK";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["DELETE_WEBHOOK"] = 21] = "DELETE_WEBHOOK";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["CREATE_TOKENFAMILY"] = 22] = "CREATE_TOKENFAMILY";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["UPDATE_TOKENFAMILY"] = 23] = "UPDATE_TOKENFAMILY";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["DELETE_TOKENFAMILY"] = 24] = "DELETE_TOKENFAMILY";
  TalerMerchantInstanceCacheEviction2[TalerMerchantInstanceCacheEviction2["LAST"] = 25] = "LAST";
})(TalerMerchantInstanceCacheEviction || (TalerMerchantInstanceCacheEviction = {}));
var TalerMerchantManagementCacheEviction;
(function(TalerMerchantManagementCacheEviction2) {
  TalerMerchantManagementCacheEviction2[TalerMerchantManagementCacheEviction2["CREATE_INSTANCE"] = 26] = "CREATE_INSTANCE";
  TalerMerchantManagementCacheEviction2[TalerMerchantManagementCacheEviction2["UPDATE_INSTANCE"] = 27] = "UPDATE_INSTANCE";
  TalerMerchantManagementCacheEviction2[TalerMerchantManagementCacheEviction2["DELETE_INSTANCE"] = 28] = "DELETE_INSTANCE";
})(TalerMerchantManagementCacheEviction || (TalerMerchantManagementCacheEviction = {}));
var TalerMerchantInstanceHttpClient = class {
  constructor(baseUrl, httpClient, cacheEvictor) {
    this.baseUrl = baseUrl;
    this.PROTOCOL_VERSION = "15:0:0";
    this.httpLib = httpClient ?? createPlatformHttpLib();
    this.cacheEvictor = cacheEvictor ?? nullEvictor;
  }
  isCompatible(version) {
    const compare2 = LibtoolVersion.compare(this.PROTOCOL_VERSION, version);
    return compare2?.compatible ?? false;
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get--config
   *
   */
  async getConfig() {
    const url = new URL(`config`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET"
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForMerchantConfig());
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  //
  // Wallet API
  //
  /**
   * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-orders-$ORDER_ID-claim
   */
  async claimOrder(orderId, body) {
    const url = new URL(`orders/${orderId}/claim`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body
    });
    switch (resp.status) {
      case HttpStatusCode.Ok: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_ORDER);
        return opSuccessFromHttp(resp, codecForClaimResponse());
      }
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-orders-$ORDER_ID-pay
   */
  async makePayment(orderId, body) {
    const url = new URL(`orders/${orderId}/pay`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body
    });
    switch (resp.status) {
      case HttpStatusCode.Ok: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_ORDER);
        return opSuccessFromHttp(resp, codecForPaymentResponse());
      }
      case HttpStatusCode.BadRequest:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.PaymentRequired:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Forbidden:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.RequestTimeout:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Gone:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.PreconditionFailed:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.BadGateway:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.GatewayTimeout:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-orders-$ORDER_ID
   */
  async getPaymentStatus(orderId, params = {}) {
    const url = new URL(`orders/${orderId}`, this.baseUrl);
    if (params.allowRefundedForRepurchase !== void 0) {
      url.searchParams.set("allow_refunded_for_repurchase", params.allowRefundedForRepurchase ? "YES" : "NO");
    }
    if (params.awaitRefundObtained !== void 0) {
      url.searchParams.set("await_refund_obtained", params.allowRefundedForRepurchase ? "YES" : "NO");
    }
    if (params.claimToken !== void 0) {
      url.searchParams.set("token", params.claimToken);
    }
    if (params.contractTermHash !== void 0) {
      url.searchParams.set("h_contract", params.contractTermHash);
    }
    if (params.refund !== void 0) {
      url.searchParams.set("refund", params.refund);
    }
    if (params.sessionId !== void 0) {
      url.searchParams.set("session_id", params.sessionId);
    }
    if (params.timeout !== void 0) {
      url.searchParams.set("timeout_ms", String(params.timeout));
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET"
      // body,
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForStatusPaid());
      case HttpStatusCode.Accepted:
        return opSuccessFromHttp(resp, codecForStatusGoto());
      case HttpStatusCode.PaymentRequired:
        return opSuccessFromHttp(resp, codecForStatusStatusUnpaid());
      case HttpStatusCode.Forbidden:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotAcceptable:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#demonstrating-payment
   */
  async demostratePayment(orderId, body) {
    const url = new URL(`orders/${orderId}/paid`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body
    });
    switch (resp.status) {
      case HttpStatusCode.Ok: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_ORDER);
        return opSuccessFromHttp(resp, codecForPaidRefundStatusResponse());
      }
      case HttpStatusCode.BadRequest:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Forbidden:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#aborting-incomplete-payments
   */
  async abortIncompletePayment(orderId, body) {
    const url = new URL(`orders/${orderId}/abort`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body
    });
    switch (resp.status) {
      case HttpStatusCode.Ok: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_ORDER);
        return opSuccessFromHttp(resp, codecForAbortResponse());
      }
      case HttpStatusCode.BadRequest:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Forbidden:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#obtaining-refunds
   */
  async obtainRefund(orderId, body) {
    const url = new URL(`orders/${orderId}/refund`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body
    });
    switch (resp.status) {
      case HttpStatusCode.Ok: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_ORDER);
        return opSuccessFromHttp(resp, codecForWalletRefundResponse());
      }
      case HttpStatusCode.BadRequest:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Forbidden:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  //
  // Management
  //
  /**
   * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-auth
   */
  async updateCurrentInstanceAuthentication(token, body) {
    const url = new URL(`private/auth`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opEmptySuccess(resp);
      case HttpStatusCode.NoContent:
        return opEmptySuccess(resp);
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private
   */
  async updateCurrentInstance(token, body) {
    const url = new URL(`private`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "PATCH",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_CURRENT_INSTANCE);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private
   *
   */
  async getCurrentInstanceDetails(token) {
    const url = new URL(`private`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForQueryInstancesResponse());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private
   */
  async deleteCurrentInstance(token, params = {}) {
    const url = new URL(`private`, this.baseUrl);
    if (params.purge !== void 0) {
      url.searchParams.set("purge", params.purge ? "YES" : "NO");
    }
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "DELETE",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.DELETE_CURRENT_INSTANCE);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get--instances-$INSTANCE-private-kyc
   */
  async getCurrentIntanceKycStatus(token, params = {}) {
    const url = new URL(`private/kyc`, this.baseUrl);
    if (params.wireHash) {
      url.searchParams.set("h_wire", params.wireHash);
    }
    if (params.exchangeURL) {
      url.searchParams.set("exchange_url", params.exchangeURL);
    }
    if (params.timeout) {
      url.searchParams.set("timeout_ms", String(params.timeout));
    }
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Accepted:
        return opSuccessFromHttp(resp, codecForAccountKycRedirects());
      case HttpStatusCode.NoContent:
        return opEmptySuccess(resp);
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.BadGateway:
        return opKnownAlternativeFailure(resp, resp.status, codecForAccountKycRedirects());
      case HttpStatusCode.ServiceUnavailable:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.GatewayTimeout:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  //
  // Bank Accounts
  //
  /**
   * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-accounts
   */
  async addBankAccount(token, body) {
    const url = new URL(`private/accounts`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.CREATE_BANK_ACCOUNT);
        return opSuccessFromHttp(resp, codecForAccountAddResponse());
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private-accounts-$H_WIRE
   */
  async updateBankAccount(token, wireAccount, body) {
    const url = new URL(`private/accounts/${wireAccount}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "PATCH",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_BANK_ACCOUNT);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-accounts
   */
  async listBankAccounts(token, params) {
    const url = new URL(`private/accounts`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForAccountsSummaryResponse());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-accounts-$H_WIRE
   */
  async getBankAccountDetails(token, wireAccount) {
    const url = new URL(`private/accounts/${wireAccount}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForBankAccountDetail());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-accounts-$H_WIRE
   */
  async deleteBankAccount(token, wireAccount) {
    const url = new URL(`private/accounts/${wireAccount}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "DELETE",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.DELETE_BANK_ACCOUNT);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  //
  // Inventory Management
  //
  /**
   * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-products
   */
  async addProduct(token, body) {
    const url = new URL(`private/products`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.CREATE_PRODUCT);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private-products-$PRODUCT_ID
   */
  async updateProduct(token, productId, body) {
    const url = new URL(`private/products/${productId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "PATCH",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_PRODUCT);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-products
   */
  async listProducts(token, params) {
    const url = new URL(`private/products`, this.baseUrl);
    addMerchantPaginationParams(url, params);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForInventorySummaryResponse());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-pos
   */
  async getPointOfSaleInventory(token) {
    const url = new URL(`private/pos`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForMerchantPosProductDetail());
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-products-$PRODUCT_ID
   */
  async getProductDetails(token, productId) {
    const url = new URL(`private/products/${productId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForProductDetail());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#reserving-inventory
   */
  async lockProduct(token, productId, body) {
    const url = new URL(`private/products/${productId}/lock`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_PRODUCT);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Gone:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#removing-products-from-inventory
   */
  async deleteProduct(token, productId) {
    const url = new URL(`private/products/${productId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "DELETE",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.DELETE_PRODUCT);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  //
  // Payment processing
  //
  /**
   * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-orders
   */
  async createOrder(token, body) {
    const url = new URL(`private/orders`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body,
      headers
    });
    return this.procesOrderCreationResponse(resp);
  }
  async procesOrderCreationResponse(resp) {
    switch (resp.status) {
      case HttpStatusCode.Ok: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.CREATE_ORDER);
        return opSuccessFromHttp(resp, codecForPostOrderResponse());
      }
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Gone:
        return opKnownAlternativeFailure(resp, resp.status, codecForOutOfStockResponse());
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#inspecting-orders
   */
  async listOrders(token, params = {}) {
    const url = new URL(`private/orders`, this.baseUrl);
    if (params.date) {
      url.searchParams.set("date_s", String(params.date));
    }
    if (params.fulfillmentUrl) {
      url.searchParams.set("fulfillment_url", params.fulfillmentUrl);
    }
    if (params.paid !== void 0) {
      url.searchParams.set("paid", params.paid ? "YES" : "NO");
    }
    if (params.refunded !== void 0) {
      url.searchParams.set("refunded", params.refunded ? "YES" : "NO");
    }
    if (params.sessionId) {
      url.searchParams.set("session_id", params.sessionId);
    }
    if (params.timeout) {
      url.searchParams.set("timeout", String(params.timeout));
    }
    if (params.wired !== void 0) {
      url.searchParams.set("wired", params.wired ? "YES" : "NO");
    }
    addMerchantPaginationParams(url, params);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForOrderHistory());
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-orders-$ORDER_ID
   */
  async getOrderDetails(token, orderId, params = {}) {
    const url = new URL(`private/orders/${orderId}`, this.baseUrl);
    if (params.allowRefundedForRepurchase !== void 0) {
      url.searchParams.set("allow_refunded_for_repurchase", params.allowRefundedForRepurchase ? "YES" : "NO");
    }
    if (params.sessionId) {
      url.searchParams.set("session_id", params.sessionId);
    }
    if (params.timeout) {
      url.searchParams.set("timeout_ms", String(params.timeout));
    }
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForMerchantOrderPrivateStatusResponse());
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.BadGateway:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.GatewayTimeout:
        return opKnownAlternativeFailure(resp, resp.status, codecForOutOfStockResponse());
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#private-order-data-cleanup
   */
  async forgetOrder(token, orderId, body) {
    const url = new URL(`private/orders/${orderId}/forget`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "PATCH",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_ORDER);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.NoContent:
        return opEmptySuccess(resp);
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.BadRequest:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-orders-$ORDER_ID
   */
  async deleteOrder(token, orderId) {
    const url = new URL(`private/orders/${orderId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "DELETE",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.DELETE_ORDER);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  //
  // Refunds
  //
  /**
   * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-orders-$ORDER_ID-refund
   */
  async addRefund(token, orderId, body) {
    const url = new URL(`private/orders/${orderId}/refund`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_ORDER);
        return opSuccessFromHttp(resp, codecForMerchantRefundResponse());
      }
      case HttpStatusCode.Forbidden:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Gone:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  //
  // Wire Transfer
  //
  /**
   * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-transfers
   */
  async informWireTransfer(token, body) {
    const url = new URL(`private/transfers`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.CREATE_TRANSFER);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-transfers
   */
  async listWireTransfers(token, params = {}) {
    const url = new URL(`private/transfers`, this.baseUrl);
    if (params.after) {
      url.searchParams.set("after", String(params.after));
    }
    if (params.before) {
      url.searchParams.set("before", String(params.before));
    }
    if (params.paytoURI) {
      url.searchParams.set("payto_uri", params.paytoURI);
    }
    if (params.verified !== void 0) {
      url.searchParams.set("verified", params.verified ? "YES" : "NO");
    }
    addMerchantPaginationParams(url, params);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForTansferList());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-transfers-$TID
   */
  async deleteWireTransfer(token, transferId) {
    const url = new URL(`private/transfers/${transferId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "DELETE",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.DELETE_TRANSFER);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  //
  // OTP Devices
  //
  /**
   * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-otp-devices
   */
  async addOtpDevice(token, body) {
    const url = new URL(`private/otp-devices`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.CREATE_DEVICE);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private-otp-devices-$DEVICE_ID
   */
  async updateOtpDevice(token, deviceId, body) {
    const url = new URL(`private/otp-devices/${deviceId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "PATCH",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_DEVICE);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-otp-devices
   */
  async listOtpDevices(token, params) {
    const url = new URL(`private/otp-devices`, this.baseUrl);
    addMerchantPaginationParams(url, params);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForOtpDeviceSummaryResponse());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-otp-devices-$DEVICE_ID
   */
  async getOtpDeviceDetails(token, deviceId, params = {}) {
    const url = new URL(`private/otp-devices/${deviceId}`, this.baseUrl);
    if (params.faketime) {
      url.searchParams.set("faketime", String(params.faketime));
    }
    if (params.price) {
      url.searchParams.set("price", params.price);
    }
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForOtpDeviceDetails());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-otp-devices-$DEVICE_ID
   */
  async deleteOtpDevice(token, deviceId) {
    const url = new URL(`private/otp-devices/${deviceId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "DELETE",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.DELETE_DEVICE);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  //
  // Templates
  //
  /**
   * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-templates
   */
  async addTemplate(token, body) {
    const url = new URL(`private/templates`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.CREATE_TEMPLATE);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCE]-private-templates-$TEMPLATE_ID
   */
  async updateTemplate(token, templateId, body) {
    const url = new URL(`private/templates/${templateId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "PATCH",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_TEMPLATE);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#inspecting-template
   */
  async listTemplates(token, params) {
    const url = new URL(`private/templates`, this.baseUrl);
    addMerchantPaginationParams(url, params);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForTemplateSummaryResponse());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-private-templates-$TEMPLATE_ID
   */
  async getTemplateDetails(token, templateId) {
    const url = new URL(`private/templates/${templateId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForTemplateDetails());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-templates-$TEMPLATE_ID
   */
  async deleteTemplate(token, templateId) {
    const url = new URL(`private/templates/${templateId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "DELETE",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.DELETE_TEMPLATE);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCE]-templates-$TEMPLATE_ID
   */
  async useTemplateGetInfo(templateId) {
    const url = new URL(`templates/${templateId}`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET"
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForWalletTemplateDetails());
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCES]-templates-$TEMPLATE_ID
   */
  async useTemplateCreateOrder(templateId, body) {
    const url = new URL(`templates/${templateId}`, this.baseUrl);
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body
    });
    return this.procesOrderCreationResponse(resp);
  }
  //
  // Webhooks
  //
  /**
   * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCES]-private-webhooks
   */
  async addWebhook(token, body) {
    const url = new URL(`private/webhooks`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.CREATE_WEBHOOK);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCES]-private-webhooks-$WEBHOOK_ID
   */
  async updateWebhook(token, webhookId, body) {
    const url = new URL(`private/webhooks/${webhookId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "PATCH",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_WEBHOOK);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCES]-private-webhooks
   */
  async listWebhooks(token, params) {
    const url = new URL(`private/webhooks`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForWebhookSummaryResponse());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCES]-private-webhooks-$WEBHOOK_ID
   */
  async getWebhookDetails(token, webhookId) {
    const url = new URL(`private/webhooks/${webhookId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent:
        return opSuccessFromHttp(resp, codecForWebhookDetails());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCES]-private-webhooks-$WEBHOOK_ID
   */
  async deleteWebhook(token, webhookId) {
    const url = new URL(`private/webhooks/${webhookId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "DELETE",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.DELETE_WEBHOOK);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  //
  // token families
  //
  /**
   * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCES]-private-tokenfamilies
   */
  async createTokenFamily(token, body) {
    const url = new URL(`private/tokenfamilies`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.CREATE_TOKENFAMILY);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#patch-[-instances-$INSTANCES]-private-tokenfamilies-$TOKEN_FAMILY_SLUG
   */
  async updateTokenFamily(token, tokenSlug, body) {
    const url = new URL(`private/tokenfamilies/${tokenSlug}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.UPDATE_TOKENFAMILY);
        return opSuccessFromHttp(resp, codecForTokenFamilyDetails());
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCES]-private-tokenfamilies
   */
  async listTokenFamilies(token, params) {
    const url = new URL(`private/tokenfamilies`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForTokenFamiliesList());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get-[-instances-$INSTANCES]-private-tokenfamilies-$TOKEN_FAMILY_SLUG
   */
  async getTokenFamilyDetails(token, tokenSlug) {
    const url = new URL(`private/tokenfamilies/${tokenSlug}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForTokenFamilyDetails());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCES]-private-tokenfamilies-$TOKEN_FAMILY_SLUG
   */
  async deleteTokenFamily(token, tokenSlug) {
    const url = new URL(`private/tokenfamilies/${tokenSlug}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "DELETE",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheEvictor.notifySuccess(TalerMerchantInstanceCacheEviction.DELETE_TOKENFAMILY);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * Get the auth api against the current instance
   *
   * https://docs.taler.net/core/api-merchant.html#post-[-instances-$INSTANCE]-private-token
   * https://docs.taler.net/core/api-merchant.html#delete-[-instances-$INSTANCE]-private-token
   */
  getAuthenticationAPI() {
    return new URL(`private/`, this.baseUrl);
  }
};
var TalerMerchantManagementHttpClient = class extends TalerMerchantInstanceHttpClient {
  constructor(baseUrl, httpClient, cacheEvictor) {
    super(baseUrl, httpClient, cacheEvictor);
    this.baseUrl = baseUrl;
    this.cacheManagementEvictor = cacheEvictor ?? nullEvictor;
  }
  getSubInstanceAPI(instanceId) {
    return new URL(`instances/${instanceId}/`, this.baseUrl);
  }
  //
  // Instance Management
  //
  /**
   * https://docs.taler.net/core/api-merchant.html#post--management-instances
   */
  async createInstance(token, body) {
    const url = new URL(`management/instances`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheManagementEvictor.notifySuccess(TalerMerchantManagementCacheEviction.CREATE_INSTANCE);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#post--management-instances-$INSTANCE-auth
   */
  async updateInstanceAuthentication(token, instanceId, body) {
    const url = new URL(`management/instances/${instanceId}/auth`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "POST",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent:
        return opEmptySuccess(resp);
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#patch--management-instances-$INSTANCE
   */
  async updateInstance(token, instanceId, body) {
    const url = new URL(`management/instances/${instanceId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "PATCH",
      body,
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheManagementEvictor.notifySuccess(TalerMerchantManagementCacheEviction.UPDATE_INSTANCE);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get--management-instances
   */
  async listInstances(token, params) {
    const url = new URL(`management/instances`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForInstancesResponse());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get--management-instances-$INSTANCE
   *
   */
  async getInstanceDetails(token, instanceId) {
    const url = new URL(`management/instances/${instanceId}`, this.baseUrl);
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Ok:
        return opSuccessFromHttp(resp, codecForQueryInstancesResponse());
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#delete--management-instances-$INSTANCE
   */
  async deleteInstance(token, instanceId, params = {}) {
    const url = new URL(`management/instances/${instanceId}`, this.baseUrl);
    if (params.purge !== void 0) {
      url.searchParams.set("purge", params.purge ? "YES" : "NO");
    }
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "DELETE",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.NoContent: {
        this.cacheManagementEvictor.notifySuccess(TalerMerchantManagementCacheEviction.DELETE_INSTANCE);
        return opEmptySuccess(resp);
      }
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.NotFound:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
  /**
   * https://docs.taler.net/core/api-merchant.html#get--management-instances-$INSTANCE-kyc
   */
  async getIntanceKycStatus(token, instanceId, params) {
    const url = new URL(`management/instances/${instanceId}/kyc`, this.baseUrl);
    if (params.wireHash) {
      url.searchParams.set("h_wire", params.wireHash);
    }
    if (params.exchangeURL) {
      url.searchParams.set("exchange_url", params.exchangeURL);
    }
    if (params.timeout) {
      url.searchParams.set("timeout_ms", String(params.timeout));
    }
    const headers = {};
    if (token) {
      headers.Authorization = makeBearerTokenAuthHeader(token);
    }
    const resp = await this.httpLib.fetch(url.href, {
      method: "GET",
      headers
    });
    switch (resp.status) {
      case HttpStatusCode.Accepted:
        return opSuccessFromHttp(resp, codecForAccountKycRedirects());
      case HttpStatusCode.NoContent:
        return opEmptySuccess(resp);
      case HttpStatusCode.NotFound:
        return opEmptySuccess(resp);
      case HttpStatusCode.Unauthorized:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.BadGateway:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.ServiceUnavailable:
        return opKnownHttpFailure(resp.status, resp);
      case HttpStatusCode.Conflict:
        return opKnownHttpFailure(resp.status, resp);
      default:
        return opUnknownFailure(resp, await readTalerErrorResponse(resp));
    }
  }
};

// ../taler-util/lib/i18n.js
var jedLib = __toESM(require_jed(), 1);
var logger10 = 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 x5 = childArray[i4];
    if (x5 === void 0) {
      continue;
    } else if (typeof x5 === "string") {
      continue;
    } else {
      placeholderChildren.push(x5);
    }
  }
  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/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/notifications.js
var NotificationType;
(function(NotificationType2) {
  NotificationType2["BalanceChange"] = "balance-change";
  NotificationType2["BackupOperationError"] = "backup-error";
  NotificationType2["TransactionStateTransition"] = "transaction-state-transition";
  NotificationType2["WithdrawalOperationTransition"] = "withdrawal-operation-transition";
  NotificationType2["ExchangeStateTransition"] = "exchange-state-transition";
  NotificationType2["Idle"] = "idle";
  NotificationType2["TaskObservabilityEvent"] = "task-observability-event";
  NotificationType2["RequestObservabilityEvent"] = "request-observability-event";
})(NotificationType || (NotificationType = {}));
var ObservabilityEventType;
(function(ObservabilityEventType2) {
  ObservabilityEventType2["HttpFetchStart"] = "http-fetch-start";
  ObservabilityEventType2["HttpFetchFinishError"] = "http-fetch-finish-error";
  ObservabilityEventType2["HttpFetchFinishSuccess"] = "http-fetch-finish-success";
  ObservabilityEventType2["DbQueryStart"] = "db-query-start";
  ObservabilityEventType2["DbQueryFinishSuccess"] = "db-query-finish-success";
  ObservabilityEventType2["DbQueryFinishError"] = "db-query-finish-error";
  ObservabilityEventType2["RequestStart"] = "request-start";
  ObservabilityEventType2["RequestFinishSuccess"] = "request-finish-success";
  ObservabilityEventType2["RequestFinishError"] = "request-finish-error";
  ObservabilityEventType2["TaskStart"] = "task-start";
  ObservabilityEventType2["TaskStop"] = "task-stop";
  ObservabilityEventType2["TaskReset"] = "task-reset";
  ObservabilityEventType2["ShepherdTaskResult"] = "shepherd-task-result";
  ObservabilityEventType2["DeclareTaskDependency"] = "declare-task-dependency";
  ObservabilityEventType2["CryptoStart"] = "crypto-start";
  ObservabilityEventType2["CryptoFinishSuccess"] = "crypto-finish-success";
  ObservabilityEventType2["CryptoFinishError"] = "crypto-finish-error";
  ObservabilityEventType2["Message"] = "message";
  ObservabilityEventType2["DeclareConcernsTransaction"] = "declare-concerns-transaction";
})(ObservabilityEventType || (ObservabilityEventType = {}));

// ../taler-util/lib/observability.js
var seqId = 1e3;
var ObservableHttpClientLibrary = class {
  constructor(impl, oc) {
    this.impl = impl;
    this.oc = oc;
    this.cancelatorById = /* @__PURE__ */ new Map();
  }
  cancelRequest(id) {
    const cancelator = this.cancelatorById.get(id);
    if (!cancelator)
      return;
    cancelator.cancel();
  }
  async fetch(url, opt) {
    const id = `req-${seqId}`;
    seqId = seqId + 1;
    const cancelator = CancellationToken.create();
    if (opt?.cancellationToken) {
      opt.cancellationToken.onCancelled(cancelator.cancel);
    }
    this.cancelatorById.set(id, cancelator);
    this.oc.observe({
      id,
      when: AbsoluteTime.now(),
      type: ObservabilityEventType.HttpFetchStart,
      url
    });
    const optsWithCancel = opt ?? {};
    optsWithCancel.cancellationToken = cancelator.token;
    try {
      const res = await this.impl.fetch(url, optsWithCancel);
      this.oc.observe({
        id,
        when: AbsoluteTime.now(),
        type: ObservabilityEventType.HttpFetchFinishSuccess,
        url,
        status: res.status
      });
      return res;
    } catch (e4) {
      this.oc.observe({
        id,
        when: AbsoluteTime.now(),
        type: ObservabilityEventType.HttpFetchFinishError,
        url,
        error: getErrorDetailFromException(e4)
      });
      throw e4;
    } finally {
      this.cancelatorById.delete(id);
    }
  }
};

// ../taler-util/lib/rfc3548.js
var encTable2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
function encodeRfc3548Base32(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 isRfc3548Base32Charset(s5) {
  for (let idx = 0; idx < s5.length; idx++) {
    const c4 = s5.charAt(idx);
    if (encTable2.indexOf(c4) === -1)
      return false;
  }
  return true;
}
function randomRfc3548Base32Key() {
  const buf = getRandomBytes(20);
  return encodeRfc3548Base32(buf);
}

// ../taler-util/lib/timer.js
var logger11 = new Logger("timer.ts");
var IntervalHandle = class {
  constructor(h5) {
    this.h = h5;
  }
  clear() {
    clearInterval(this.h);
  }
  /**
   * Make sure the event loop exits when the timer is the
   * only event left.  Has no effect in the browser.
   */
  unref() {
    if (typeof this.h === "object" && "unref" in this.h) {
      this.h.unref();
    }
  }
};
var TimeoutHandle = class {
  constructor(h5) {
    this.h = h5;
  }
  clear() {
    clearTimeout(this.h);
  }
  /**
   * Make sure the event loop exits when the timer is the
   * only event left.  Has no effect in the browser.
   */
  unref() {
    if (typeof this.h === "object" && "unref" in this.h) {
      this.h.unref();
    }
  }
};
var performanceNow = (() => {
  if (typeof process !== "undefined" && process.hrtime) {
    return () => {
      return process.hrtime.bigint();
    };
  }
  if (typeof performance !== "undefined") {
    return () => BigInt(Math.floor(performance.now() * 1e3)) * BigInt(1e3);
  }
  return () => BigInt((/* @__PURE__ */ new Date()).getTime()) * BigInt(1e3) * BigInt(1e3);
})();
var SetTimeoutTimerAPI = class {
  /**
   * Call a function every time the delay given in milliseconds passes.
   */
  every(delayMs, callback) {
    return new IntervalHandle(setInterval(callback, delayMs));
  }
  /**
   * Call a function after the delay given in milliseconds passes.
   */
  after(delayMs, callback) {
    return new TimeoutHandle(setTimeout(callback, delayMs));
  }
};
var timer = new SetTimeoutTimerAPI();

// ../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/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_hooks_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_preact_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_preact_module();
init_preact_module();
init_compat_module();
init_preact_module();
init_preact_module();
init_preact_module();
init_preact_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_preact_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_preact_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_compat_module();
init_preact_module();
init_preact_module();
init_preact_module();
init_preact_module();
init_preact_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_hooks_module();
init_preact_module();
init_preact_module();
init_preact_module();
init_preact_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() {
          if (index === total)
            return { done: true, value: void 0 };
          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");
          }
          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() {
          if (index === total)
            return { done: true, value: void 0 };
          const key = localStorage.key(index);
          if (key === null) {
            throw Error("key cant be null");
          }
          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() {
          if (index === total)
            return { done: true, value: void 0 };
          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");
          }
          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";
async function getAllContent() {
  if (isFirefox) {
    return browser.storage.local.get();
  } else {
    return chrome.storage.local.get();
  }
}
async function updateContent(obj) {
  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 ?? {}).forEach(([k22, v3]) => {
      backend.set(k22, v3);
    });
  });
  backend.onAnyUpdate(async () => {
    const result = {};
    for (const [key, value] of backend.entries()) {
      result[key] = value;
    }
    await 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 ?? codecForString()
  };
}
var supportLocalStorage = typeof window !== "undefined";
var supportBrowserStorage = typeof chrome !== "undefined" && typeof chrome.storage !== "undefined";
var storage = function buildStorage() {
  if (supportBrowserStorage) {
    if (supportLocalStorage) {
      return browserStorageMap(localStorageMap());
    } else {
      return browserStorageMap(memoryMap());
    }
  } else if (supportLocalStorage) {
    return localStorageMap();
  } else {
    return memoryMap();
  }
}();
function useLocalStorage(key, defaultValue) {
  const current = convert(storage.get(key.id), key, defaultValue);
  const [_3, setStoredValue] = p3(AbsoluteTime.now().t_ms);
  h2(() => {
    return storage.onUpdate(key.id, () => {
      setStoredValue(AbsoluteTime.now().t_ms);
    });
  }, [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: current,
    update: setValue,
    reset: () => {
      setValue(defaultValue);
    }
  };
}
function convert(updated, key, defaultValue) {
  if (updated === void 0)
    return defaultValue;
  try {
    return key.codec.decode(JSON.parse(updated));
  } catch (e22) {
    return defaultValue;
  }
}
var MIN_LANG_COVERAGE_THRESHOLD = 90;
function getBrowserLang(completeness) {
  if (typeof window === "undefined")
    return void 0;
  if (window.navigator.language) {
    if (completeness[window.navigator.language] >= MIN_LANG_COVERAGE_THRESHOLD) {
      return window.navigator.language;
    }
  }
  if (window.navigator.languages) {
    const match52 = Object.entries(completeness).filter(([code, value]) => {
      if (value < MIN_LANG_COVERAGE_THRESHOLD)
        return false;
      return window.navigator.languages.findIndex((l3) => l3.startsWith(code)) !== -1;
    }).map(([code, value]) => ({ code, value }));
    if (match52.length > 0) {
      let max = match52[0];
      match52.forEach((v3) => {
        if (v3.value > max.value) {
          max = v3;
        }
      });
      return max.code;
    }
  }
  ;
  return void 0;
}
var langPreferenceKey = buildStorageKey("lang-preference");
function useLang(initial22, completeness) {
  const defaultValue = (getBrowserLang(completeness) || initial22 || "en").substring(0, 2);
  return useLocalStorage(langPreferenceKey, defaultValue);
}
var storage2 = memoryMap();
var storage3 = memoryMap();
var GLOBAL_NOTIFICATION_TIMEOUT = Duration.fromSpec({
  seconds: 5
});
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;
}
async function defaultRequestHandler(baseUrl, endpoint, options = {}) {
  const requestHeaders = {};
  if (options.token) {
    requestHeaders.Authorization = `Bearer secret-token:${options.token}`;
  } else if (options.basicAuth) {
    requestHeaders.Authorization = `Basic ${base64encode(
      `${options.basicAuth.username}:${options.basicAuth.password}`
    )}`;
  }
  requestHeaders["Content-Type"] = !options.contentType || options.contentType === "json" ? "application/json" : "text/plain";
  if (options.talerAmlOfficerSignature) {
    requestHeaders["Taler-AML-Officer-Signature"] = options.talerAmlOfficerSignature;
  }
  const requestMethod = options?.method ?? "GET";
  const requestBody = options?.data;
  const requestTimeout = options?.timeout ?? 5 * 1e3;
  const requestParams = options.params ?? {};
  const requestPreventCache = options.preventCache ?? false;
  const requestPreventCors = options.preventCors ?? 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: "${baseUrl}${endpoint}"`
    };
    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 = await 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 = await buildRequestOk(
      response,
      validURL.href,
      payload,
      !!options.token,
      options
    );
    return result;
  } else {
    const dataTxt = await response.text();
    const error2 = buildRequestFailed(
      validURL.href,
      dataTxt,
      response.status,
      payload,
      options
    );
    throw new RequestError(error2);
  }
}
var RequestError = class extends Error {
  constructor(d32) {
    super(d32.message);
    this.info = d32;
    this.cause = d32;
  }
};
async function buildRequestOk(response, url, payload, hasToken, options) {
  const dataTxt = await 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 ?? {};
  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 logger12 = new Logger("browserHttpLib");
var BrowserFetchHttpLib = class {
  constructor(args) {
    this.throttle = new RequestThrottler();
    this.throttlingEnabled = true;
    this.requireTls = false;
    this.throttlingEnabled = args?.enableThrottling ?? true;
    this.requireTls = args?.requireTls ?? false;
  }
  async fetch(requestUrl, options) {
    const requestMethod = options?.method ?? "GET";
    const requestBody = options?.body;
    const requestHeader = options?.headers;
    const requestTimeout = options?.timeout ?? Duration.fromMilliseconds(DEFAULT_REQUEST_TIMEOUT_MS);
    const requestCancel = options?.cancellationToken;
    const requestRedirect = options?.redirect;
    const parsedUrl = new URL(requestUrl);
    if (this.throttlingEnabled && this.throttle.applyThrottle(requestUrl)) {
      throw TalerError.fromDetail(
        TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED,
        {
          requestMethod,
          requestUrl,
          throttleStats: this.throttle.getThrottleStats(requestUrl)
        },
        `request to origin ${parsedUrl.origin} was throttled`
      );
    }
    if (this.requireTls && parsedUrl.protocol !== "https:") {
      throw TalerError.fromDetail(
        TalerErrorCode.WALLET_NETWORK_ERROR,
        {
          requestMethod,
          requestUrl
        },
        `request to ${parsedUrl.origin} is not possible with protocol ${parsedUrl.protocol}`
      );
    }
    const myBody = requestMethod === "POST" || requestMethod === "PUT" || requestMethod === "PATCH" ? encodeBody(requestBody) : void 0;
    const requestHeadersMap = getDefaultHeaders(requestMethod);
    if (requestHeader) {
      Object.entries(requestHeader).forEach(([key, value]) => {
        if (value === void 0)
          return;
        requestHeadersMap[key] = value;
      });
    }
    const controller = new AbortController();
    let timeoutId;
    if (requestTimeout.d_ms !== "forever") {
      timeoutId = setTimeout(() => {
        controller.abort(TalerErrorCode.GENERIC_TIMEOUT);
      }, requestTimeout.d_ms);
    }
    if (requestCancel) {
      requestCancel.onCancelled(() => {
        controller.abort(TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR);
      });
    }
    try {
      const response = await fetch(requestUrl, {
        headers: requestHeadersMap,
        body: myBody,
        method: requestMethod,
        signal: controller.signal,
        redirect: requestRedirect
      });
      if (timeoutId) {
        clearTimeout(timeoutId);
      }
      const headerMap = new Headers2();
      response.headers.forEach((value, key) => {
        headerMap.set(key, value);
      });
      const text = makeTextHandler(response, requestUrl, requestMethod);
      const json = makeJsonHandler(response, requestUrl, requestMethod, text);
      return {
        headers: headerMap,
        status: response.status,
        requestMethod,
        requestUrl,
        json,
        text,
        bytes: async () => (await response.blob()).arrayBuffer()
      };
    } catch (e22) {
      if (controller.signal) {
        throw TalerError.fromDetail(
          controller.signal.reason,
          {
            requestUrl,
            requestMethod,
            timeoutMs: requestTimeout.d_ms === "forever" ? 0 : requestTimeout.d_ms
          },
          `HTTP request failed.`
        );
      }
      throw e22;
    }
  }
};
function makeTextHandler(response, requestUrl, requestMethod) {
  let firstTime = true;
  let respText;
  let error2;
  return async function getTextFromResponse() {
    if (firstTime) {
      firstTime = false;
      try {
        respText = await response.text();
      } catch (e22) {
        error2 = TalerError.fromDetail(
          TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,
          {
            requestUrl,
            requestMethod,
            httpStatusCode: response.status,
            validationError: e22 instanceof Error ? e22.message : String(e22)
          },
          "Invalid text from HTTP response"
        );
      }
    }
    if (error2 !== void 0) {
      throw error2;
    }
    return respText;
  };
}
function makeJsonHandler(response, requestUrl, requestMethod, readTextHandler) {
  let firstTime = true;
  let responseJson = void 0;
  let error2;
  return async function getJsonFromResponse() {
    if (firstTime) {
      let responseText;
      try {
        responseText = await readTextHandler();
      } catch (e22) {
        const message = e22 instanceof Error ? `Couldn't read HTTP response: ${e22.message}` : "Couldn't read HTTP response";
        error2 = TalerError.fromDetail(
          TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,
          {
            requestUrl,
            requestMethod,
            httpStatusCode: response.status,
            validationError: e22 instanceof Error ? e22.message : String(e22)
          },
          message
        );
      }
      if (!error2) {
        try {
          responseJson = JSON.parse(responseText);
        } catch (e22) {
          const message = e22 instanceof Error ? `Invalid JSON from HTTP response: ${e22.message}` : "Invalid JSON from HTTP response";
          error2 = TalerError.fromDetail(
            TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,
            {
              requestUrl,
              requestMethod,
              // @ts-expect-error no error then text is initialized
              response: responseText,
              httpStatusCode: response.status,
              validationError: e22 instanceof Error ? e22.message : String(e22)
            },
            message
          );
        }
        if (responseJson === null || typeof responseJson !== "object") {
          error2 = TalerError.fromDetail(
            TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,
            {
              requestUrl,
              requestMethod,
              response: JSON.stringify(responseJson),
              httpStatusCode: response.status
            },
            "Invalid JSON from HTTP response: null or not object"
          );
        }
      }
    }
    if (error2 !== void 0) {
      throw error2;
    }
    return responseJson;
  };
}
function urlPattern(pattern, reverse) {
  const url = reverse;
  return {
    pattern: new RegExp(pattern),
    url
  };
}
var nullRountDef = {
  pattern: new RegExp(/.*/),
  url: () => ""
};
var Context = B({ request: defaultRequestHandler });
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;
  };
}
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];
  };
}
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;
}
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
    };
  };
}
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);
}
function requiredArgs(required, args) {
  if (args.length < required) {
    throw new TypeError(required + " argument" + (required > 1 ? "s" : "") + " required, but only " + args.length + " present");
  }
}
function _typeof(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof = function _typeof38(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);
  }
}
var defaultOptions = {};
function getDefaultOptions() {
  return defaultOptions;
}
var daysInYear = 365.2425;
var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
var millisecondsInMinute = 6e4;
var millisecondsInHour = 36e5;
var millisecondsInSecond = 1e3;
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;
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;
}
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;
  }
}
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;
}
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;
}
function startOfUTCWeek(dirtyDate, options) {
  var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
  requiredArgs(1, arguments);
  var defaultOptions22 = 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 : defaultOptions22.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions22.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;
}
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 defaultOptions22 = 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 : defaultOptions22.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions22.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;
  }
}
function startOfUTCWeekYear(dirtyDate, options) {
  var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
  requiredArgs(1, arguments);
  var defaultOptions22 = 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 : defaultOptions22.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions22.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;
}
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;
}
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;
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 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;
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;
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;
function _typeof4(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof4 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof4 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof4(obj);
}
function _inherits(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o3, p4) {
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf(o3, p4);
}
function _createSuper(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn(this, result);
  };
}
function _possibleConstructorReturn(self2, call) {
  if (call && (_typeof4(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized(self2);
}
function _assertThisInitialized(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf(o3) {
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf(o3);
}
function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties(Constructor, staticProps);
  return Constructor;
}
function _defineProperty(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var Setter = /* @__PURE__ */ function() {
  function Setter2() {
    _classCallCheck(this, Setter2);
    _defineProperty(this, "subPriority", 0);
  }
  _createClass(Setter2, [{
    key: "validate",
    value: function validate(_utcDate, _options) {
      return true;
    }
  }]);
  return Setter2;
}();
var ValueSetter = /* @__PURE__ */ function(_Setter) {
  _inherits(ValueSetter2, _Setter);
  var _super = _createSuper(ValueSetter2);
  function ValueSetter2(value, validateValue, setValue, priority, subPriority) {
    var _this;
    _classCallCheck(this, ValueSetter2);
    _this = _super.call(this);
    _this.value = value;
    _this.validateValue = validateValue;
    _this.setValue = setValue;
    _this.priority = priority;
    if (subPriority) {
      _this.subPriority = subPriority;
    }
    return _this;
  }
  _createClass(ValueSetter2, [{
    key: "validate",
    value: function validate(utcDate, options) {
      return this.validateValue(utcDate, this.value, options);
    }
  }, {
    key: "set",
    value: function set2(utcDate, flags, options) {
      return this.setValue(utcDate, flags, this.value, options);
    }
  }]);
  return ValueSetter2;
}(Setter);
function _classCallCheck2(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties2(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass2(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties2(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties2(Constructor, staticProps);
  return Constructor;
}
var Parser = /* @__PURE__ */ function() {
  function Parser2() {
    _classCallCheck2(this, Parser2);
  }
  _createClass2(Parser2, [{
    key: "run",
    value: function run(dateString, token, match52, options) {
      var result = this.parse(dateString, token, match52, options);
      if (!result) {
        return null;
      }
      return {
        setter: new ValueSetter(result.value, this.validate, this.set, this.priority, this.subPriority),
        rest: result.rest
      };
    }
  }, {
    key: "validate",
    value: function validate(_utcDate, _value, _options) {
      return true;
    }
  }]);
  return Parser2;
}();
function _typeof5(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof5 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof5 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof5(obj);
}
function _classCallCheck3(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties3(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass3(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties3(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties3(Constructor, staticProps);
  return Constructor;
}
function _inherits2(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf2(subClass, superClass);
}
function _setPrototypeOf2(o3, p4) {
  _setPrototypeOf2 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf2(o3, p4);
}
function _createSuper2(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct2();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf2(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf2(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn2(this, result);
  };
}
function _possibleConstructorReturn2(self2, call) {
  if (call && (_typeof5(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized2(self2);
}
function _assertThisInitialized2(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct2() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf2(o3) {
  _getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf2(o3);
}
function _defineProperty2(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var EraParser = /* @__PURE__ */ function(_Parser) {
  _inherits2(EraParser2, _Parser);
  var _super = _createSuper2(EraParser2);
  function EraParser2() {
    var _this;
    _classCallCheck3(this, EraParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty2(_assertThisInitialized2(_this), "priority", 140);
    _defineProperty2(_assertThisInitialized2(_this), "incompatibleTokens", ["R", "u", "t", "T"]);
    return _this;
  }
  _createClass3(EraParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "G":
        case "GG":
        case "GGG":
          return match52.era(dateString, {
            width: "abbreviated"
          }) || match52.era(dateString, {
            width: "narrow"
          });
        case "GGGGG":
          return match52.era(dateString, {
            width: "narrow"
          });
        case "GGGG":
        default:
          return match52.era(dateString, {
            width: "wide"
          }) || match52.era(dateString, {
            width: "abbreviated"
          }) || match52.era(dateString, {
            width: "narrow"
          });
      }
    }
  }, {
    key: "set",
    value: function set2(date2, flags, value) {
      flags.era = value;
      date2.setUTCFullYear(value, 0, 1);
      date2.setUTCHours(0, 0, 0, 0);
      return date2;
    }
  }]);
  return EraParser2;
}(Parser);
var numericPatterns = {
  month: /^(1[0-2]|0?\d)/,
  // 0 to 12
  date: /^(3[0-1]|[0-2]?\d)/,
  // 0 to 31
  dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
  // 0 to 366
  week: /^(5[0-3]|[0-4]?\d)/,
  // 0 to 53
  hour23h: /^(2[0-3]|[0-1]?\d)/,
  // 0 to 23
  hour24h: /^(2[0-4]|[0-1]?\d)/,
  // 0 to 24
  hour11h: /^(1[0-1]|0?\d)/,
  // 0 to 11
  hour12h: /^(1[0-2]|0?\d)/,
  // 0 to 12
  minute: /^[0-5]?\d/,
  // 0 to 59
  second: /^[0-5]?\d/,
  // 0 to 59
  singleDigit: /^\d/,
  // 0 to 9
  twoDigits: /^\d{1,2}/,
  // 0 to 99
  threeDigits: /^\d{1,3}/,
  // 0 to 999
  fourDigits: /^\d{1,4}/,
  // 0 to 9999
  anyDigitsSigned: /^-?\d+/,
  singleDigitSigned: /^-?\d/,
  // 0 to 9, -0 to -9
  twoDigitsSigned: /^-?\d{1,2}/,
  // 0 to 99, -0 to -99
  threeDigitsSigned: /^-?\d{1,3}/,
  // 0 to 999, -0 to -999
  fourDigitsSigned: /^-?\d{1,4}/
  // 0 to 9999, -0 to -9999
};
var timezonePatterns = {
  basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
  basic: /^([+-])(\d{2})(\d{2})|Z/,
  basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
  extended: /^([+-])(\d{2}):(\d{2})|Z/,
  extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
};
function mapValue(parseFnResult, mapFn) {
  if (!parseFnResult) {
    return parseFnResult;
  }
  return {
    value: mapFn(parseFnResult.value),
    rest: parseFnResult.rest
  };
}
function parseNumericPattern(pattern, dateString) {
  var matchResult = dateString.match(pattern);
  if (!matchResult) {
    return null;
  }
  return {
    value: parseInt(matchResult[0], 10),
    rest: dateString.slice(matchResult[0].length)
  };
}
function parseTimezonePattern(pattern, dateString) {
  var matchResult = dateString.match(pattern);
  if (!matchResult) {
    return null;
  }
  if (matchResult[0] === "Z") {
    return {
      value: 0,
      rest: dateString.slice(1)
    };
  }
  var sign = matchResult[1] === "+" ? 1 : -1;
  var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
  var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
  var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
  return {
    value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),
    rest: dateString.slice(matchResult[0].length)
  };
}
function parseAnyDigitsSigned(dateString) {
  return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);
}
function parseNDigits(n2, dateString) {
  switch (n2) {
    case 1:
      return parseNumericPattern(numericPatterns.singleDigit, dateString);
    case 2:
      return parseNumericPattern(numericPatterns.twoDigits, dateString);
    case 3:
      return parseNumericPattern(numericPatterns.threeDigits, dateString);
    case 4:
      return parseNumericPattern(numericPatterns.fourDigits, dateString);
    default:
      return parseNumericPattern(new RegExp("^\\d{1," + n2 + "}"), dateString);
  }
}
function parseNDigitsSigned(n2, dateString) {
  switch (n2) {
    case 1:
      return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);
    case 2:
      return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);
    case 3:
      return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);
    case 4:
      return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);
    default:
      return parseNumericPattern(new RegExp("^-?\\d{1," + n2 + "}"), dateString);
  }
}
function dayPeriodEnumToHours(dayPeriod) {
  switch (dayPeriod) {
    case "morning":
      return 4;
    case "evening":
      return 17;
    case "pm":
    case "noon":
    case "afternoon":
      return 12;
    case "am":
    case "midnight":
    case "night":
    default:
      return 0;
  }
}
function normalizeTwoDigitYear(twoDigitYear, currentYear) {
  var isCommonEra = currentYear > 0;
  var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
  var result;
  if (absCurrentYear <= 50) {
    result = twoDigitYear || 100;
  } else {
    var rangeEnd = absCurrentYear + 50;
    var rangeEndCentury = Math.floor(rangeEnd / 100) * 100;
    var isPreviousCentury = twoDigitYear >= rangeEnd % 100;
    result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
  }
  return isCommonEra ? result : 1 - result;
}
function isLeapYearIndex(year) {
  return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
}
function _typeof6(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof6 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof6 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof6(obj);
}
function _classCallCheck4(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties4(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass4(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties4(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties4(Constructor, staticProps);
  return Constructor;
}
function _inherits3(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf3(subClass, superClass);
}
function _setPrototypeOf3(o3, p4) {
  _setPrototypeOf3 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf3(o3, p4);
}
function _createSuper3(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct3();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf3(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf3(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn3(this, result);
  };
}
function _possibleConstructorReturn3(self2, call) {
  if (call && (_typeof6(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized3(self2);
}
function _assertThisInitialized3(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct3() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf3(o3) {
  _getPrototypeOf3 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf3(o3);
}
function _defineProperty3(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var YearParser = /* @__PURE__ */ function(_Parser) {
  _inherits3(YearParser2, _Parser);
  var _super = _createSuper3(YearParser2);
  function YearParser2() {
    var _this;
    _classCallCheck4(this, YearParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty3(_assertThisInitialized3(_this), "priority", 130);
    _defineProperty3(_assertThisInitialized3(_this), "incompatibleTokens", ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"]);
    return _this;
  }
  _createClass4(YearParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      var valueCallback92 = function valueCallback102(year) {
        return {
          year,
          isTwoDigitYear: token === "yy"
        };
      };
      switch (token) {
        case "y":
          return mapValue(parseNDigits(4, dateString), valueCallback92);
        case "yo":
          return mapValue(match52.ordinalNumber(dateString, {
            unit: "year"
          }), valueCallback92);
        default:
          return mapValue(parseNDigits(token.length, dateString), valueCallback92);
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value.isTwoDigitYear || value.year > 0;
    }
  }, {
    key: "set",
    value: function set2(date2, flags, value) {
      var currentYear = date2.getUTCFullYear();
      if (value.isTwoDigitYear) {
        var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
        date2.setUTCFullYear(normalizedTwoDigitYear, 0, 1);
        date2.setUTCHours(0, 0, 0, 0);
        return date2;
      }
      var year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
      date2.setUTCFullYear(year, 0, 1);
      date2.setUTCHours(0, 0, 0, 0);
      return date2;
    }
  }]);
  return YearParser2;
}(Parser);
function _typeof7(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof7 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof7 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof7(obj);
}
function _classCallCheck5(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties5(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass5(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties5(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties5(Constructor, staticProps);
  return Constructor;
}
function _inherits4(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf4(subClass, superClass);
}
function _setPrototypeOf4(o3, p4) {
  _setPrototypeOf4 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf4(o3, p4);
}
function _createSuper4(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct4();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf4(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf4(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn4(this, result);
  };
}
function _possibleConstructorReturn4(self2, call) {
  if (call && (_typeof7(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized4(self2);
}
function _assertThisInitialized4(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct4() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf4(o3) {
  _getPrototypeOf4 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf4(o3);
}
function _defineProperty4(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var LocalWeekYearParser = /* @__PURE__ */ function(_Parser) {
  _inherits4(LocalWeekYearParser2, _Parser);
  var _super = _createSuper4(LocalWeekYearParser2);
  function LocalWeekYearParser2() {
    var _this;
    _classCallCheck5(this, LocalWeekYearParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty4(_assertThisInitialized4(_this), "priority", 130);
    _defineProperty4(_assertThisInitialized4(_this), "incompatibleTokens", ["y", "R", "u", "Q", "q", "M", "L", "I", "d", "D", "i", "t", "T"]);
    return _this;
  }
  _createClass5(LocalWeekYearParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      var valueCallback92 = function valueCallback102(year) {
        return {
          year,
          isTwoDigitYear: token === "YY"
        };
      };
      switch (token) {
        case "Y":
          return mapValue(parseNDigits(4, dateString), valueCallback92);
        case "Yo":
          return mapValue(match52.ordinalNumber(dateString, {
            unit: "year"
          }), valueCallback92);
        default:
          return mapValue(parseNDigits(token.length, dateString), valueCallback92);
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value.isTwoDigitYear || value.year > 0;
    }
  }, {
    key: "set",
    value: function set2(date2, flags, value, options) {
      var currentYear = getUTCWeekYear(date2, options);
      if (value.isTwoDigitYear) {
        var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
        date2.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);
        date2.setUTCHours(0, 0, 0, 0);
        return startOfUTCWeek(date2, options);
      }
      var year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
      date2.setUTCFullYear(year, 0, options.firstWeekContainsDate);
      date2.setUTCHours(0, 0, 0, 0);
      return startOfUTCWeek(date2, options);
    }
  }]);
  return LocalWeekYearParser2;
}(Parser);
function _typeof8(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof8 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof8 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof8(obj);
}
function _classCallCheck6(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties6(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass6(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties6(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties6(Constructor, staticProps);
  return Constructor;
}
function _inherits5(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf5(subClass, superClass);
}
function _setPrototypeOf5(o3, p4) {
  _setPrototypeOf5 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf5(o3, p4);
}
function _createSuper5(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct5();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf5(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf5(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn5(this, result);
  };
}
function _possibleConstructorReturn5(self2, call) {
  if (call && (_typeof8(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized5(self2);
}
function _assertThisInitialized5(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct5() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf5(o3) {
  _getPrototypeOf5 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf5(o3);
}
function _defineProperty5(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var ISOWeekYearParser = /* @__PURE__ */ function(_Parser) {
  _inherits5(ISOWeekYearParser2, _Parser);
  var _super = _createSuper5(ISOWeekYearParser2);
  function ISOWeekYearParser2() {
    var _this;
    _classCallCheck6(this, ISOWeekYearParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty5(_assertThisInitialized5(_this), "priority", 130);
    _defineProperty5(_assertThisInitialized5(_this), "incompatibleTokens", ["G", "y", "Y", "u", "Q", "q", "M", "L", "w", "d", "D", "e", "c", "t", "T"]);
    return _this;
  }
  _createClass6(ISOWeekYearParser2, [{
    key: "parse",
    value: function parse2(dateString, token) {
      if (token === "R") {
        return parseNDigitsSigned(4, dateString);
      }
      return parseNDigitsSigned(token.length, dateString);
    }
  }, {
    key: "set",
    value: function set2(_date, _flags, value) {
      var firstWeekOfYear = /* @__PURE__ */ new Date(0);
      firstWeekOfYear.setUTCFullYear(value, 0, 4);
      firstWeekOfYear.setUTCHours(0, 0, 0, 0);
      return startOfUTCISOWeek(firstWeekOfYear);
    }
  }]);
  return ISOWeekYearParser2;
}(Parser);
function _typeof9(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof9 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof9 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof9(obj);
}
function _classCallCheck7(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties7(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass7(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties7(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties7(Constructor, staticProps);
  return Constructor;
}
function _inherits6(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf6(subClass, superClass);
}
function _setPrototypeOf6(o3, p4) {
  _setPrototypeOf6 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf6(o3, p4);
}
function _createSuper6(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct6();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf6(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf6(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn6(this, result);
  };
}
function _possibleConstructorReturn6(self2, call) {
  if (call && (_typeof9(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized6(self2);
}
function _assertThisInitialized6(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct6() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf6(o3) {
  _getPrototypeOf6 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf6(o3);
}
function _defineProperty6(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var ExtendedYearParser = /* @__PURE__ */ function(_Parser) {
  _inherits6(ExtendedYearParser2, _Parser);
  var _super = _createSuper6(ExtendedYearParser2);
  function ExtendedYearParser2() {
    var _this;
    _classCallCheck7(this, ExtendedYearParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty6(_assertThisInitialized6(_this), "priority", 130);
    _defineProperty6(_assertThisInitialized6(_this), "incompatibleTokens", ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"]);
    return _this;
  }
  _createClass7(ExtendedYearParser2, [{
    key: "parse",
    value: function parse2(dateString, token) {
      if (token === "u") {
        return parseNDigitsSigned(4, dateString);
      }
      return parseNDigitsSigned(token.length, dateString);
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2.setUTCFullYear(value, 0, 1);
      date2.setUTCHours(0, 0, 0, 0);
      return date2;
    }
  }]);
  return ExtendedYearParser2;
}(Parser);
function _typeof10(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof10 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof10 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof10(obj);
}
function _classCallCheck8(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties8(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass8(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties8(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties8(Constructor, staticProps);
  return Constructor;
}
function _inherits7(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf7(subClass, superClass);
}
function _setPrototypeOf7(o3, p4) {
  _setPrototypeOf7 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf7(o3, p4);
}
function _createSuper7(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct7();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf7(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf7(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn7(this, result);
  };
}
function _possibleConstructorReturn7(self2, call) {
  if (call && (_typeof10(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized7(self2);
}
function _assertThisInitialized7(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct7() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf7(o3) {
  _getPrototypeOf7 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf7(o3);
}
function _defineProperty7(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var QuarterParser = /* @__PURE__ */ function(_Parser) {
  _inherits7(QuarterParser2, _Parser);
  var _super = _createSuper7(QuarterParser2);
  function QuarterParser2() {
    var _this;
    _classCallCheck8(this, QuarterParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty7(_assertThisInitialized7(_this), "priority", 120);
    _defineProperty7(_assertThisInitialized7(_this), "incompatibleTokens", ["Y", "R", "q", "M", "L", "w", "I", "d", "D", "i", "e", "c", "t", "T"]);
    return _this;
  }
  _createClass8(QuarterParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "Q":
        case "QQ":
          return parseNDigits(token.length, dateString);
        case "Qo":
          return match52.ordinalNumber(dateString, {
            unit: "quarter"
          });
        case "QQQ":
          return match52.quarter(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.quarter(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "QQQQQ":
          return match52.quarter(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "QQQQ":
        default:
          return match52.quarter(dateString, {
            width: "wide",
            context: "formatting"
          }) || match52.quarter(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.quarter(dateString, {
            width: "narrow",
            context: "formatting"
          });
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 1 && value <= 4;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2.setUTCMonth((value - 1) * 3, 1);
      date2.setUTCHours(0, 0, 0, 0);
      return date2;
    }
  }]);
  return QuarterParser2;
}(Parser);
function _typeof11(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof11 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof11 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof11(obj);
}
function _classCallCheck9(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties9(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass9(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties9(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties9(Constructor, staticProps);
  return Constructor;
}
function _inherits8(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf8(subClass, superClass);
}
function _setPrototypeOf8(o3, p4) {
  _setPrototypeOf8 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf8(o3, p4);
}
function _createSuper8(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct8();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf8(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf8(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn8(this, result);
  };
}
function _possibleConstructorReturn8(self2, call) {
  if (call && (_typeof11(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized8(self2);
}
function _assertThisInitialized8(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct8() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf8(o3) {
  _getPrototypeOf8 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf8(o3);
}
function _defineProperty8(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var StandAloneQuarterParser = /* @__PURE__ */ function(_Parser) {
  _inherits8(StandAloneQuarterParser2, _Parser);
  var _super = _createSuper8(StandAloneQuarterParser2);
  function StandAloneQuarterParser2() {
    var _this;
    _classCallCheck9(this, StandAloneQuarterParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty8(_assertThisInitialized8(_this), "priority", 120);
    _defineProperty8(_assertThisInitialized8(_this), "incompatibleTokens", ["Y", "R", "Q", "M", "L", "w", "I", "d", "D", "i", "e", "c", "t", "T"]);
    return _this;
  }
  _createClass9(StandAloneQuarterParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "q":
        case "qq":
          return parseNDigits(token.length, dateString);
        case "qo":
          return match52.ordinalNumber(dateString, {
            unit: "quarter"
          });
        case "qqq":
          return match52.quarter(dateString, {
            width: "abbreviated",
            context: "standalone"
          }) || match52.quarter(dateString, {
            width: "narrow",
            context: "standalone"
          });
        case "qqqqq":
          return match52.quarter(dateString, {
            width: "narrow",
            context: "standalone"
          });
        case "qqqq":
        default:
          return match52.quarter(dateString, {
            width: "wide",
            context: "standalone"
          }) || match52.quarter(dateString, {
            width: "abbreviated",
            context: "standalone"
          }) || match52.quarter(dateString, {
            width: "narrow",
            context: "standalone"
          });
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 1 && value <= 4;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2.setUTCMonth((value - 1) * 3, 1);
      date2.setUTCHours(0, 0, 0, 0);
      return date2;
    }
  }]);
  return StandAloneQuarterParser2;
}(Parser);
function _typeof12(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof12 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof12 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof12(obj);
}
function _classCallCheck10(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties10(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass10(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties10(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties10(Constructor, staticProps);
  return Constructor;
}
function _inherits9(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf9(subClass, superClass);
}
function _setPrototypeOf9(o3, p4) {
  _setPrototypeOf9 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf9(o3, p4);
}
function _createSuper9(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct9();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf9(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf9(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn9(this, result);
  };
}
function _possibleConstructorReturn9(self2, call) {
  if (call && (_typeof12(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized9(self2);
}
function _assertThisInitialized9(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct9() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf9(o3) {
  _getPrototypeOf9 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf9(o3);
}
function _defineProperty9(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var MonthParser = /* @__PURE__ */ function(_Parser) {
  _inherits9(MonthParser2, _Parser);
  var _super = _createSuper9(MonthParser2);
  function MonthParser2() {
    var _this;
    _classCallCheck10(this, MonthParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty9(_assertThisInitialized9(_this), "incompatibleTokens", ["Y", "R", "q", "Q", "L", "w", "I", "D", "i", "e", "c", "t", "T"]);
    _defineProperty9(_assertThisInitialized9(_this), "priority", 110);
    return _this;
  }
  _createClass10(MonthParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      var valueCallback92 = function valueCallback102(value) {
        return value - 1;
      };
      switch (token) {
        case "M":
          return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback92);
        case "MM":
          return mapValue(parseNDigits(2, dateString), valueCallback92);
        case "Mo":
          return mapValue(match52.ordinalNumber(dateString, {
            unit: "month"
          }), valueCallback92);
        case "MMM":
          return match52.month(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.month(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "MMMMM":
          return match52.month(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "MMMM":
        default:
          return match52.month(dateString, {
            width: "wide",
            context: "formatting"
          }) || match52.month(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.month(dateString, {
            width: "narrow",
            context: "formatting"
          });
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 0 && value <= 11;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2.setUTCMonth(value, 1);
      date2.setUTCHours(0, 0, 0, 0);
      return date2;
    }
  }]);
  return MonthParser2;
}(Parser);
function _typeof13(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof13 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof13 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof13(obj);
}
function _classCallCheck11(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties11(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass11(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties11(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties11(Constructor, staticProps);
  return Constructor;
}
function _inherits10(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf10(subClass, superClass);
}
function _setPrototypeOf10(o3, p4) {
  _setPrototypeOf10 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf10(o3, p4);
}
function _createSuper10(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct10();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf10(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf10(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn10(this, result);
  };
}
function _possibleConstructorReturn10(self2, call) {
  if (call && (_typeof13(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized10(self2);
}
function _assertThisInitialized10(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct10() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf10(o3) {
  _getPrototypeOf10 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf10(o3);
}
function _defineProperty10(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var StandAloneMonthParser = /* @__PURE__ */ function(_Parser) {
  _inherits10(StandAloneMonthParser2, _Parser);
  var _super = _createSuper10(StandAloneMonthParser2);
  function StandAloneMonthParser2() {
    var _this;
    _classCallCheck11(this, StandAloneMonthParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty10(_assertThisInitialized10(_this), "priority", 110);
    _defineProperty10(_assertThisInitialized10(_this), "incompatibleTokens", ["Y", "R", "q", "Q", "M", "w", "I", "D", "i", "e", "c", "t", "T"]);
    return _this;
  }
  _createClass11(StandAloneMonthParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      var valueCallback92 = function valueCallback102(value) {
        return value - 1;
      };
      switch (token) {
        case "L":
          return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback92);
        case "LL":
          return mapValue(parseNDigits(2, dateString), valueCallback92);
        case "Lo":
          return mapValue(match52.ordinalNumber(dateString, {
            unit: "month"
          }), valueCallback92);
        case "LLL":
          return match52.month(dateString, {
            width: "abbreviated",
            context: "standalone"
          }) || match52.month(dateString, {
            width: "narrow",
            context: "standalone"
          });
        case "LLLLL":
          return match52.month(dateString, {
            width: "narrow",
            context: "standalone"
          });
        case "LLLL":
        default:
          return match52.month(dateString, {
            width: "wide",
            context: "standalone"
          }) || match52.month(dateString, {
            width: "abbreviated",
            context: "standalone"
          }) || match52.month(dateString, {
            width: "narrow",
            context: "standalone"
          });
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 0 && value <= 11;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2.setUTCMonth(value, 1);
      date2.setUTCHours(0, 0, 0, 0);
      return date2;
    }
  }]);
  return StandAloneMonthParser2;
}(Parser);
function setUTCWeek(dirtyDate, dirtyWeek, options) {
  requiredArgs(2, arguments);
  var date2 = toDate(dirtyDate);
  var week = toInteger(dirtyWeek);
  var diff = getUTCWeek(date2, options) - week;
  date2.setUTCDate(date2.getUTCDate() - diff * 7);
  return date2;
}
function _typeof14(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof14 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof14 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof14(obj);
}
function _classCallCheck12(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties12(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass12(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties12(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties12(Constructor, staticProps);
  return Constructor;
}
function _inherits11(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf11(subClass, superClass);
}
function _setPrototypeOf11(o3, p4) {
  _setPrototypeOf11 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf11(o3, p4);
}
function _createSuper11(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct11();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf11(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf11(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn11(this, result);
  };
}
function _possibleConstructorReturn11(self2, call) {
  if (call && (_typeof14(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized11(self2);
}
function _assertThisInitialized11(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct11() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf11(o3) {
  _getPrototypeOf11 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf11(o3);
}
function _defineProperty11(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var LocalWeekParser = /* @__PURE__ */ function(_Parser) {
  _inherits11(LocalWeekParser2, _Parser);
  var _super = _createSuper11(LocalWeekParser2);
  function LocalWeekParser2() {
    var _this;
    _classCallCheck12(this, LocalWeekParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty11(_assertThisInitialized11(_this), "priority", 100);
    _defineProperty11(_assertThisInitialized11(_this), "incompatibleTokens", ["y", "R", "u", "q", "Q", "M", "L", "I", "d", "D", "i", "t", "T"]);
    return _this;
  }
  _createClass12(LocalWeekParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "w":
          return parseNumericPattern(numericPatterns.week, dateString);
        case "wo":
          return match52.ordinalNumber(dateString, {
            unit: "week"
          });
        default:
          return parseNDigits(token.length, dateString);
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 1 && value <= 53;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value, options) {
      return startOfUTCWeek(setUTCWeek(date2, value, options), options);
    }
  }]);
  return LocalWeekParser2;
}(Parser);
function setUTCISOWeek(dirtyDate, dirtyISOWeek) {
  requiredArgs(2, arguments);
  var date2 = toDate(dirtyDate);
  var isoWeek = toInteger(dirtyISOWeek);
  var diff = getUTCISOWeek(date2) - isoWeek;
  date2.setUTCDate(date2.getUTCDate() - diff * 7);
  return date2;
}
function _typeof15(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof15 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof15 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof15(obj);
}
function _classCallCheck13(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties13(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass13(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties13(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties13(Constructor, staticProps);
  return Constructor;
}
function _inherits12(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf12(subClass, superClass);
}
function _setPrototypeOf12(o3, p4) {
  _setPrototypeOf12 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf12(o3, p4);
}
function _createSuper12(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct12();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf12(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf12(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn12(this, result);
  };
}
function _possibleConstructorReturn12(self2, call) {
  if (call && (_typeof15(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized12(self2);
}
function _assertThisInitialized12(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct12() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf12(o3) {
  _getPrototypeOf12 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf12(o3);
}
function _defineProperty12(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var ISOWeekParser = /* @__PURE__ */ function(_Parser) {
  _inherits12(ISOWeekParser2, _Parser);
  var _super = _createSuper12(ISOWeekParser2);
  function ISOWeekParser2() {
    var _this;
    _classCallCheck13(this, ISOWeekParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty12(_assertThisInitialized12(_this), "priority", 100);
    _defineProperty12(_assertThisInitialized12(_this), "incompatibleTokens", ["y", "Y", "u", "q", "Q", "M", "L", "w", "d", "D", "e", "c", "t", "T"]);
    return _this;
  }
  _createClass13(ISOWeekParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "I":
          return parseNumericPattern(numericPatterns.week, dateString);
        case "Io":
          return match52.ordinalNumber(dateString, {
            unit: "week"
          });
        default:
          return parseNDigits(token.length, dateString);
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 1 && value <= 53;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      return startOfUTCISOWeek(setUTCISOWeek(date2, value));
    }
  }]);
  return ISOWeekParser2;
}(Parser);
function _typeof16(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof16 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof16 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof16(obj);
}
function _classCallCheck14(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties14(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass14(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties14(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties14(Constructor, staticProps);
  return Constructor;
}
function _inherits13(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf13(subClass, superClass);
}
function _setPrototypeOf13(o3, p4) {
  _setPrototypeOf13 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf13(o3, p4);
}
function _createSuper13(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct13();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf13(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf13(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn13(this, result);
  };
}
function _possibleConstructorReturn13(self2, call) {
  if (call && (_typeof16(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized13(self2);
}
function _assertThisInitialized13(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct13() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf13(o3) {
  _getPrototypeOf13 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf13(o3);
}
function _defineProperty13(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
var DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
var DateParser = /* @__PURE__ */ function(_Parser) {
  _inherits13(DateParser2, _Parser);
  var _super = _createSuper13(DateParser2);
  function DateParser2() {
    var _this;
    _classCallCheck14(this, DateParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty13(_assertThisInitialized13(_this), "priority", 90);
    _defineProperty13(_assertThisInitialized13(_this), "subPriority", 1);
    _defineProperty13(_assertThisInitialized13(_this), "incompatibleTokens", ["Y", "R", "q", "Q", "w", "I", "D", "i", "e", "c", "t", "T"]);
    return _this;
  }
  _createClass14(DateParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "d":
          return parseNumericPattern(numericPatterns.date, dateString);
        case "do":
          return match52.ordinalNumber(dateString, {
            unit: "date"
          });
        default:
          return parseNDigits(token.length, dateString);
      }
    }
  }, {
    key: "validate",
    value: function validate(date2, value) {
      var year = date2.getUTCFullYear();
      var isLeapYear = isLeapYearIndex(year);
      var month = date2.getUTCMonth();
      if (isLeapYear) {
        return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
      } else {
        return value >= 1 && value <= DAYS_IN_MONTH[month];
      }
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2.setUTCDate(value);
      date2.setUTCHours(0, 0, 0, 0);
      return date2;
    }
  }]);
  return DateParser2;
}(Parser);
function _typeof17(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof17 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof17 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof17(obj);
}
function _classCallCheck15(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties15(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass15(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties15(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties15(Constructor, staticProps);
  return Constructor;
}
function _inherits14(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf14(subClass, superClass);
}
function _setPrototypeOf14(o3, p4) {
  _setPrototypeOf14 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf14(o3, p4);
}
function _createSuper14(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct14();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf14(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf14(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn14(this, result);
  };
}
function _possibleConstructorReturn14(self2, call) {
  if (call && (_typeof17(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized14(self2);
}
function _assertThisInitialized14(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct14() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf14(o3) {
  _getPrototypeOf14 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf14(o3);
}
function _defineProperty14(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var DayOfYearParser = /* @__PURE__ */ function(_Parser) {
  _inherits14(DayOfYearParser2, _Parser);
  var _super = _createSuper14(DayOfYearParser2);
  function DayOfYearParser2() {
    var _this;
    _classCallCheck15(this, DayOfYearParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty14(_assertThisInitialized14(_this), "priority", 90);
    _defineProperty14(_assertThisInitialized14(_this), "subpriority", 1);
    _defineProperty14(_assertThisInitialized14(_this), "incompatibleTokens", ["Y", "R", "q", "Q", "M", "L", "w", "I", "d", "E", "i", "e", "c", "t", "T"]);
    return _this;
  }
  _createClass15(DayOfYearParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "D":
        case "DD":
          return parseNumericPattern(numericPatterns.dayOfYear, dateString);
        case "Do":
          return match52.ordinalNumber(dateString, {
            unit: "date"
          });
        default:
          return parseNDigits(token.length, dateString);
      }
    }
  }, {
    key: "validate",
    value: function validate(date2, value) {
      var year = date2.getUTCFullYear();
      var isLeapYear = isLeapYearIndex(year);
      if (isLeapYear) {
        return value >= 1 && value <= 366;
      } else {
        return value >= 1 && value <= 365;
      }
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2.setUTCMonth(0, value);
      date2.setUTCHours(0, 0, 0, 0);
      return date2;
    }
  }]);
  return DayOfYearParser2;
}(Parser);
function setUTCDay(dirtyDate, dirtyDay, options) {
  var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
  requiredArgs(2, arguments);
  var defaultOptions22 = 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 : defaultOptions22.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions22.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 = toInteger(dirtyDay);
  var currentDay = date2.getUTCDay();
  var remainder = day % 7;
  var dayIndex = (remainder + 7) % 7;
  var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;
  date2.setUTCDate(date2.getUTCDate() + diff);
  return date2;
}
function _typeof18(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof18 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof18 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof18(obj);
}
function _classCallCheck16(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties16(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass16(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties16(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties16(Constructor, staticProps);
  return Constructor;
}
function _inherits15(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf15(subClass, superClass);
}
function _setPrototypeOf15(o3, p4) {
  _setPrototypeOf15 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf15(o3, p4);
}
function _createSuper15(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct15();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf15(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf15(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn15(this, result);
  };
}
function _possibleConstructorReturn15(self2, call) {
  if (call && (_typeof18(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized15(self2);
}
function _assertThisInitialized15(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct15() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf15(o3) {
  _getPrototypeOf15 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf15(o3);
}
function _defineProperty15(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var DayParser = /* @__PURE__ */ function(_Parser) {
  _inherits15(DayParser2, _Parser);
  var _super = _createSuper15(DayParser2);
  function DayParser2() {
    var _this;
    _classCallCheck16(this, DayParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty15(_assertThisInitialized15(_this), "priority", 90);
    _defineProperty15(_assertThisInitialized15(_this), "incompatibleTokens", ["D", "i", "e", "c", "t", "T"]);
    return _this;
  }
  _createClass16(DayParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "E":
        case "EE":
        case "EEE":
          return match52.day(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "short",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "EEEEE":
          return match52.day(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "EEEEEE":
          return match52.day(dateString, {
            width: "short",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "EEEE":
        default:
          return match52.day(dateString, {
            width: "wide",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "short",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "narrow",
            context: "formatting"
          });
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 0 && value <= 6;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value, options) {
      date2 = setUTCDay(date2, value, options);
      date2.setUTCHours(0, 0, 0, 0);
      return date2;
    }
  }]);
  return DayParser2;
}(Parser);
function _typeof19(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof19 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof19 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof19(obj);
}
function _classCallCheck17(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties17(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass17(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties17(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties17(Constructor, staticProps);
  return Constructor;
}
function _inherits16(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf16(subClass, superClass);
}
function _setPrototypeOf16(o3, p4) {
  _setPrototypeOf16 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf16(o3, p4);
}
function _createSuper16(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct16();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf16(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf16(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn16(this, result);
  };
}
function _possibleConstructorReturn16(self2, call) {
  if (call && (_typeof19(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized16(self2);
}
function _assertThisInitialized16(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct16() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf16(o3) {
  _getPrototypeOf16 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf16(o3);
}
function _defineProperty16(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var LocalDayParser = /* @__PURE__ */ function(_Parser) {
  _inherits16(LocalDayParser2, _Parser);
  var _super = _createSuper16(LocalDayParser2);
  function LocalDayParser2() {
    var _this;
    _classCallCheck17(this, LocalDayParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty16(_assertThisInitialized16(_this), "priority", 90);
    _defineProperty16(_assertThisInitialized16(_this), "incompatibleTokens", ["y", "R", "u", "q", "Q", "M", "L", "I", "d", "D", "E", "i", "c", "t", "T"]);
    return _this;
  }
  _createClass17(LocalDayParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52, options) {
      var valueCallback92 = function valueCallback102(value) {
        var wholeWeekDays = Math.floor((value - 1) / 7) * 7;
        return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
      };
      switch (token) {
        case "e":
        case "ee":
          return mapValue(parseNDigits(token.length, dateString), valueCallback92);
        case "eo":
          return mapValue(match52.ordinalNumber(dateString, {
            unit: "day"
          }), valueCallback92);
        case "eee":
          return match52.day(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "short",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "eeeee":
          return match52.day(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "eeeeee":
          return match52.day(dateString, {
            width: "short",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "eeee":
        default:
          return match52.day(dateString, {
            width: "wide",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "short",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "narrow",
            context: "formatting"
          });
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 0 && value <= 6;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value, options) {
      date2 = setUTCDay(date2, value, options);
      date2.setUTCHours(0, 0, 0, 0);
      return date2;
    }
  }]);
  return LocalDayParser2;
}(Parser);
function _typeof20(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof20 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof20 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof20(obj);
}
function _classCallCheck18(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties18(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass18(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties18(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties18(Constructor, staticProps);
  return Constructor;
}
function _inherits17(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf17(subClass, superClass);
}
function _setPrototypeOf17(o3, p4) {
  _setPrototypeOf17 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf17(o3, p4);
}
function _createSuper17(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct17();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf17(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf17(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn17(this, result);
  };
}
function _possibleConstructorReturn17(self2, call) {
  if (call && (_typeof20(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized17(self2);
}
function _assertThisInitialized17(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct17() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf17(o3) {
  _getPrototypeOf17 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf17(o3);
}
function _defineProperty17(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var StandAloneLocalDayParser = /* @__PURE__ */ function(_Parser) {
  _inherits17(StandAloneLocalDayParser2, _Parser);
  var _super = _createSuper17(StandAloneLocalDayParser2);
  function StandAloneLocalDayParser2() {
    var _this;
    _classCallCheck18(this, StandAloneLocalDayParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty17(_assertThisInitialized17(_this), "priority", 90);
    _defineProperty17(_assertThisInitialized17(_this), "incompatibleTokens", ["y", "R", "u", "q", "Q", "M", "L", "I", "d", "D", "E", "i", "e", "t", "T"]);
    return _this;
  }
  _createClass18(StandAloneLocalDayParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52, options) {
      var valueCallback92 = function valueCallback102(value) {
        var wholeWeekDays = Math.floor((value - 1) / 7) * 7;
        return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
      };
      switch (token) {
        case "c":
        case "cc":
          return mapValue(parseNDigits(token.length, dateString), valueCallback92);
        case "co":
          return mapValue(match52.ordinalNumber(dateString, {
            unit: "day"
          }), valueCallback92);
        case "ccc":
          return match52.day(dateString, {
            width: "abbreviated",
            context: "standalone"
          }) || match52.day(dateString, {
            width: "short",
            context: "standalone"
          }) || match52.day(dateString, {
            width: "narrow",
            context: "standalone"
          });
        case "ccccc":
          return match52.day(dateString, {
            width: "narrow",
            context: "standalone"
          });
        case "cccccc":
          return match52.day(dateString, {
            width: "short",
            context: "standalone"
          }) || match52.day(dateString, {
            width: "narrow",
            context: "standalone"
          });
        case "cccc":
        default:
          return match52.day(dateString, {
            width: "wide",
            context: "standalone"
          }) || match52.day(dateString, {
            width: "abbreviated",
            context: "standalone"
          }) || match52.day(dateString, {
            width: "short",
            context: "standalone"
          }) || match52.day(dateString, {
            width: "narrow",
            context: "standalone"
          });
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 0 && value <= 6;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value, options) {
      date2 = setUTCDay(date2, value, options);
      date2.setUTCHours(0, 0, 0, 0);
      return date2;
    }
  }]);
  return StandAloneLocalDayParser2;
}(Parser);
function setUTCISODay(dirtyDate, dirtyDay) {
  requiredArgs(2, arguments);
  var day = toInteger(dirtyDay);
  if (day % 7 === 0) {
    day = day - 7;
  }
  var weekStartsOn = 1;
  var date2 = toDate(dirtyDate);
  var currentDay = date2.getUTCDay();
  var remainder = day % 7;
  var dayIndex = (remainder + 7) % 7;
  var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;
  date2.setUTCDate(date2.getUTCDate() + diff);
  return date2;
}
function _typeof21(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof21 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof21 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof21(obj);
}
function _classCallCheck19(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties19(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass19(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties19(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties19(Constructor, staticProps);
  return Constructor;
}
function _inherits18(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf18(subClass, superClass);
}
function _setPrototypeOf18(o3, p4) {
  _setPrototypeOf18 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf18(o3, p4);
}
function _createSuper18(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct18();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf18(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf18(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn18(this, result);
  };
}
function _possibleConstructorReturn18(self2, call) {
  if (call && (_typeof21(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized18(self2);
}
function _assertThisInitialized18(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct18() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf18(o3) {
  _getPrototypeOf18 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf18(o3);
}
function _defineProperty18(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var ISODayParser = /* @__PURE__ */ function(_Parser) {
  _inherits18(ISODayParser2, _Parser);
  var _super = _createSuper18(ISODayParser2);
  function ISODayParser2() {
    var _this;
    _classCallCheck19(this, ISODayParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty18(_assertThisInitialized18(_this), "priority", 90);
    _defineProperty18(_assertThisInitialized18(_this), "incompatibleTokens", ["y", "Y", "u", "q", "Q", "M", "L", "w", "d", "D", "E", "e", "c", "t", "T"]);
    return _this;
  }
  _createClass19(ISODayParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      var valueCallback92 = function valueCallback102(value) {
        if (value === 0) {
          return 7;
        }
        return value;
      };
      switch (token) {
        case "i":
        case "ii":
          return parseNDigits(token.length, dateString);
        case "io":
          return match52.ordinalNumber(dateString, {
            unit: "day"
          });
        case "iii":
          return mapValue(match52.day(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "short",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "narrow",
            context: "formatting"
          }), valueCallback92);
        case "iiiii":
          return mapValue(match52.day(dateString, {
            width: "narrow",
            context: "formatting"
          }), valueCallback92);
        case "iiiiii":
          return mapValue(match52.day(dateString, {
            width: "short",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "narrow",
            context: "formatting"
          }), valueCallback92);
        case "iiii":
        default:
          return mapValue(match52.day(dateString, {
            width: "wide",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "short",
            context: "formatting"
          }) || match52.day(dateString, {
            width: "narrow",
            context: "formatting"
          }), valueCallback92);
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 1 && value <= 7;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2 = setUTCISODay(date2, value);
      date2.setUTCHours(0, 0, 0, 0);
      return date2;
    }
  }]);
  return ISODayParser2;
}(Parser);
function _typeof22(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof22 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof22 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof22(obj);
}
function _classCallCheck20(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties20(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass20(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties20(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties20(Constructor, staticProps);
  return Constructor;
}
function _inherits19(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf19(subClass, superClass);
}
function _setPrototypeOf19(o3, p4) {
  _setPrototypeOf19 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf19(o3, p4);
}
function _createSuper19(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct19();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf19(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf19(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn19(this, result);
  };
}
function _possibleConstructorReturn19(self2, call) {
  if (call && (_typeof22(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized19(self2);
}
function _assertThisInitialized19(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct19() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf19(o3) {
  _getPrototypeOf19 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf19(o3);
}
function _defineProperty19(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var AMPMParser = /* @__PURE__ */ function(_Parser) {
  _inherits19(AMPMParser2, _Parser);
  var _super = _createSuper19(AMPMParser2);
  function AMPMParser2() {
    var _this;
    _classCallCheck20(this, AMPMParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty19(_assertThisInitialized19(_this), "priority", 80);
    _defineProperty19(_assertThisInitialized19(_this), "incompatibleTokens", ["b", "B", "H", "k", "t", "T"]);
    return _this;
  }
  _createClass20(AMPMParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "a":
        case "aa":
        case "aaa":
          return match52.dayPeriod(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.dayPeriod(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "aaaaa":
          return match52.dayPeriod(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "aaaa":
        default:
          return match52.dayPeriod(dateString, {
            width: "wide",
            context: "formatting"
          }) || match52.dayPeriod(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.dayPeriod(dateString, {
            width: "narrow",
            context: "formatting"
          });
      }
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
      return date2;
    }
  }]);
  return AMPMParser2;
}(Parser);
function _typeof23(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof23 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof23 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof23(obj);
}
function _classCallCheck21(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties21(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass21(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties21(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties21(Constructor, staticProps);
  return Constructor;
}
function _inherits20(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf20(subClass, superClass);
}
function _setPrototypeOf20(o3, p4) {
  _setPrototypeOf20 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf20(o3, p4);
}
function _createSuper20(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct20();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf20(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf20(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn20(this, result);
  };
}
function _possibleConstructorReturn20(self2, call) {
  if (call && (_typeof23(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized20(self2);
}
function _assertThisInitialized20(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct20() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf20(o3) {
  _getPrototypeOf20 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf20(o3);
}
function _defineProperty20(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var AMPMMidnightParser = /* @__PURE__ */ function(_Parser) {
  _inherits20(AMPMMidnightParser2, _Parser);
  var _super = _createSuper20(AMPMMidnightParser2);
  function AMPMMidnightParser2() {
    var _this;
    _classCallCheck21(this, AMPMMidnightParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty20(_assertThisInitialized20(_this), "priority", 80);
    _defineProperty20(_assertThisInitialized20(_this), "incompatibleTokens", ["a", "B", "H", "k", "t", "T"]);
    return _this;
  }
  _createClass21(AMPMMidnightParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "b":
        case "bb":
        case "bbb":
          return match52.dayPeriod(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.dayPeriod(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "bbbbb":
          return match52.dayPeriod(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "bbbb":
        default:
          return match52.dayPeriod(dateString, {
            width: "wide",
            context: "formatting"
          }) || match52.dayPeriod(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.dayPeriod(dateString, {
            width: "narrow",
            context: "formatting"
          });
      }
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
      return date2;
    }
  }]);
  return AMPMMidnightParser2;
}(Parser);
function _typeof24(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof24 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof24 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof24(obj);
}
function _classCallCheck22(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties22(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass22(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties22(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties22(Constructor, staticProps);
  return Constructor;
}
function _inherits21(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf21(subClass, superClass);
}
function _setPrototypeOf21(o3, p4) {
  _setPrototypeOf21 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf21(o3, p4);
}
function _createSuper21(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct21();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf21(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf21(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn21(this, result);
  };
}
function _possibleConstructorReturn21(self2, call) {
  if (call && (_typeof24(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized21(self2);
}
function _assertThisInitialized21(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct21() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf21(o3) {
  _getPrototypeOf21 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf21(o3);
}
function _defineProperty21(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var DayPeriodParser = /* @__PURE__ */ function(_Parser) {
  _inherits21(DayPeriodParser2, _Parser);
  var _super = _createSuper21(DayPeriodParser2);
  function DayPeriodParser2() {
    var _this;
    _classCallCheck22(this, DayPeriodParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty21(_assertThisInitialized21(_this), "priority", 80);
    _defineProperty21(_assertThisInitialized21(_this), "incompatibleTokens", ["a", "b", "t", "T"]);
    return _this;
  }
  _createClass22(DayPeriodParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "B":
        case "BB":
        case "BBB":
          return match52.dayPeriod(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.dayPeriod(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "BBBBB":
          return match52.dayPeriod(dateString, {
            width: "narrow",
            context: "formatting"
          });
        case "BBBB":
        default:
          return match52.dayPeriod(dateString, {
            width: "wide",
            context: "formatting"
          }) || match52.dayPeriod(dateString, {
            width: "abbreviated",
            context: "formatting"
          }) || match52.dayPeriod(dateString, {
            width: "narrow",
            context: "formatting"
          });
      }
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
      return date2;
    }
  }]);
  return DayPeriodParser2;
}(Parser);
function _typeof25(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof25 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof25 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof25(obj);
}
function _classCallCheck23(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties23(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass23(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties23(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties23(Constructor, staticProps);
  return Constructor;
}
function _inherits22(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf22(subClass, superClass);
}
function _setPrototypeOf22(o3, p4) {
  _setPrototypeOf22 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf22(o3, p4);
}
function _createSuper22(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct22();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf22(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf22(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn22(this, result);
  };
}
function _possibleConstructorReturn22(self2, call) {
  if (call && (_typeof25(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized22(self2);
}
function _assertThisInitialized22(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct22() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf22(o3) {
  _getPrototypeOf22 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf22(o3);
}
function _defineProperty22(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var Hour1to12Parser = /* @__PURE__ */ function(_Parser) {
  _inherits22(Hour1to12Parser2, _Parser);
  var _super = _createSuper22(Hour1to12Parser2);
  function Hour1to12Parser2() {
    var _this;
    _classCallCheck23(this, Hour1to12Parser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty22(_assertThisInitialized22(_this), "priority", 70);
    _defineProperty22(_assertThisInitialized22(_this), "incompatibleTokens", ["H", "K", "k", "t", "T"]);
    return _this;
  }
  _createClass23(Hour1to12Parser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "h":
          return parseNumericPattern(numericPatterns.hour12h, dateString);
        case "ho":
          return match52.ordinalNumber(dateString, {
            unit: "hour"
          });
        default:
          return parseNDigits(token.length, dateString);
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 1 && value <= 12;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      var isPM = date2.getUTCHours() >= 12;
      if (isPM && value < 12) {
        date2.setUTCHours(value + 12, 0, 0, 0);
      } else if (!isPM && value === 12) {
        date2.setUTCHours(0, 0, 0, 0);
      } else {
        date2.setUTCHours(value, 0, 0, 0);
      }
      return date2;
    }
  }]);
  return Hour1to12Parser2;
}(Parser);
function _typeof26(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof26 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof26 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof26(obj);
}
function _classCallCheck24(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties24(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass24(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties24(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties24(Constructor, staticProps);
  return Constructor;
}
function _inherits23(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf23(subClass, superClass);
}
function _setPrototypeOf23(o3, p4) {
  _setPrototypeOf23 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf23(o3, p4);
}
function _createSuper23(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct23();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf23(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf23(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn23(this, result);
  };
}
function _possibleConstructorReturn23(self2, call) {
  if (call && (_typeof26(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized23(self2);
}
function _assertThisInitialized23(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct23() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf23(o3) {
  _getPrototypeOf23 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf23(o3);
}
function _defineProperty23(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var Hour0to23Parser = /* @__PURE__ */ function(_Parser) {
  _inherits23(Hour0to23Parser2, _Parser);
  var _super = _createSuper23(Hour0to23Parser2);
  function Hour0to23Parser2() {
    var _this;
    _classCallCheck24(this, Hour0to23Parser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty23(_assertThisInitialized23(_this), "priority", 70);
    _defineProperty23(_assertThisInitialized23(_this), "incompatibleTokens", ["a", "b", "h", "K", "k", "t", "T"]);
    return _this;
  }
  _createClass24(Hour0to23Parser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "H":
          return parseNumericPattern(numericPatterns.hour23h, dateString);
        case "Ho":
          return match52.ordinalNumber(dateString, {
            unit: "hour"
          });
        default:
          return parseNDigits(token.length, dateString);
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 0 && value <= 23;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2.setUTCHours(value, 0, 0, 0);
      return date2;
    }
  }]);
  return Hour0to23Parser2;
}(Parser);
function _typeof27(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof27 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof27 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof27(obj);
}
function _classCallCheck25(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties25(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass25(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties25(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties25(Constructor, staticProps);
  return Constructor;
}
function _inherits24(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf24(subClass, superClass);
}
function _setPrototypeOf24(o3, p4) {
  _setPrototypeOf24 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf24(o3, p4);
}
function _createSuper24(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct24();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf24(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf24(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn24(this, result);
  };
}
function _possibleConstructorReturn24(self2, call) {
  if (call && (_typeof27(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized24(self2);
}
function _assertThisInitialized24(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct24() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf24(o3) {
  _getPrototypeOf24 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf24(o3);
}
function _defineProperty24(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var Hour0To11Parser = /* @__PURE__ */ function(_Parser) {
  _inherits24(Hour0To11Parser2, _Parser);
  var _super = _createSuper24(Hour0To11Parser2);
  function Hour0To11Parser2() {
    var _this;
    _classCallCheck25(this, Hour0To11Parser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty24(_assertThisInitialized24(_this), "priority", 70);
    _defineProperty24(_assertThisInitialized24(_this), "incompatibleTokens", ["h", "H", "k", "t", "T"]);
    return _this;
  }
  _createClass25(Hour0To11Parser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "K":
          return parseNumericPattern(numericPatterns.hour11h, dateString);
        case "Ko":
          return match52.ordinalNumber(dateString, {
            unit: "hour"
          });
        default:
          return parseNDigits(token.length, dateString);
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 0 && value <= 11;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      var isPM = date2.getUTCHours() >= 12;
      if (isPM && value < 12) {
        date2.setUTCHours(value + 12, 0, 0, 0);
      } else {
        date2.setUTCHours(value, 0, 0, 0);
      }
      return date2;
    }
  }]);
  return Hour0To11Parser2;
}(Parser);
function _typeof28(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof28 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof28 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof28(obj);
}
function _classCallCheck26(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties26(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass26(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties26(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties26(Constructor, staticProps);
  return Constructor;
}
function _inherits25(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf25(subClass, superClass);
}
function _setPrototypeOf25(o3, p4) {
  _setPrototypeOf25 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf25(o3, p4);
}
function _createSuper25(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct25();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf25(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf25(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn25(this, result);
  };
}
function _possibleConstructorReturn25(self2, call) {
  if (call && (_typeof28(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized25(self2);
}
function _assertThisInitialized25(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct25() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf25(o3) {
  _getPrototypeOf25 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf25(o3);
}
function _defineProperty25(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var Hour1To24Parser = /* @__PURE__ */ function(_Parser) {
  _inherits25(Hour1To24Parser2, _Parser);
  var _super = _createSuper25(Hour1To24Parser2);
  function Hour1To24Parser2() {
    var _this;
    _classCallCheck26(this, Hour1To24Parser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty25(_assertThisInitialized25(_this), "priority", 70);
    _defineProperty25(_assertThisInitialized25(_this), "incompatibleTokens", ["a", "b", "h", "H", "K", "t", "T"]);
    return _this;
  }
  _createClass26(Hour1To24Parser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "k":
          return parseNumericPattern(numericPatterns.hour24h, dateString);
        case "ko":
          return match52.ordinalNumber(dateString, {
            unit: "hour"
          });
        default:
          return parseNDigits(token.length, dateString);
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 1 && value <= 24;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      var hours = value <= 24 ? value % 24 : value;
      date2.setUTCHours(hours, 0, 0, 0);
      return date2;
    }
  }]);
  return Hour1To24Parser2;
}(Parser);
function _typeof29(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof29 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof29 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof29(obj);
}
function _classCallCheck27(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties27(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass27(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties27(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties27(Constructor, staticProps);
  return Constructor;
}
function _inherits26(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf26(subClass, superClass);
}
function _setPrototypeOf26(o3, p4) {
  _setPrototypeOf26 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf26(o3, p4);
}
function _createSuper26(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct26();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf26(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf26(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn26(this, result);
  };
}
function _possibleConstructorReturn26(self2, call) {
  if (call && (_typeof29(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized26(self2);
}
function _assertThisInitialized26(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct26() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf26(o3) {
  _getPrototypeOf26 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf26(o3);
}
function _defineProperty26(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var MinuteParser = /* @__PURE__ */ function(_Parser) {
  _inherits26(MinuteParser2, _Parser);
  var _super = _createSuper26(MinuteParser2);
  function MinuteParser2() {
    var _this;
    _classCallCheck27(this, MinuteParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty26(_assertThisInitialized26(_this), "priority", 60);
    _defineProperty26(_assertThisInitialized26(_this), "incompatibleTokens", ["t", "T"]);
    return _this;
  }
  _createClass27(MinuteParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "m":
          return parseNumericPattern(numericPatterns.minute, dateString);
        case "mo":
          return match52.ordinalNumber(dateString, {
            unit: "minute"
          });
        default:
          return parseNDigits(token.length, dateString);
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 0 && value <= 59;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2.setUTCMinutes(value, 0, 0);
      return date2;
    }
  }]);
  return MinuteParser2;
}(Parser);
function _typeof30(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof30 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof30 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof30(obj);
}
function _classCallCheck28(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties28(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass28(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties28(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties28(Constructor, staticProps);
  return Constructor;
}
function _inherits27(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf27(subClass, superClass);
}
function _setPrototypeOf27(o3, p4) {
  _setPrototypeOf27 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf27(o3, p4);
}
function _createSuper27(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct27();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf27(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf27(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn27(this, result);
  };
}
function _possibleConstructorReturn27(self2, call) {
  if (call && (_typeof30(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized27(self2);
}
function _assertThisInitialized27(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct27() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf27(o3) {
  _getPrototypeOf27 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf27(o3);
}
function _defineProperty27(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var SecondParser = /* @__PURE__ */ function(_Parser) {
  _inherits27(SecondParser2, _Parser);
  var _super = _createSuper27(SecondParser2);
  function SecondParser2() {
    var _this;
    _classCallCheck28(this, SecondParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty27(_assertThisInitialized27(_this), "priority", 50);
    _defineProperty27(_assertThisInitialized27(_this), "incompatibleTokens", ["t", "T"]);
    return _this;
  }
  _createClass28(SecondParser2, [{
    key: "parse",
    value: function parse2(dateString, token, match52) {
      switch (token) {
        case "s":
          return parseNumericPattern(numericPatterns.second, dateString);
        case "so":
          return match52.ordinalNumber(dateString, {
            unit: "second"
          });
        default:
          return parseNDigits(token.length, dateString);
      }
    }
  }, {
    key: "validate",
    value: function validate(_date, value) {
      return value >= 0 && value <= 59;
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2.setUTCSeconds(value, 0);
      return date2;
    }
  }]);
  return SecondParser2;
}(Parser);
function _typeof31(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof31 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof31 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof31(obj);
}
function _classCallCheck29(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties29(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass29(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties29(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties29(Constructor, staticProps);
  return Constructor;
}
function _inherits28(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf28(subClass, superClass);
}
function _setPrototypeOf28(o3, p4) {
  _setPrototypeOf28 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf28(o3, p4);
}
function _createSuper28(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct28();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf28(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf28(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn28(this, result);
  };
}
function _possibleConstructorReturn28(self2, call) {
  if (call && (_typeof31(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized28(self2);
}
function _assertThisInitialized28(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct28() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf28(o3) {
  _getPrototypeOf28 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf28(o3);
}
function _defineProperty28(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var FractionOfSecondParser = /* @__PURE__ */ function(_Parser) {
  _inherits28(FractionOfSecondParser2, _Parser);
  var _super = _createSuper28(FractionOfSecondParser2);
  function FractionOfSecondParser2() {
    var _this;
    _classCallCheck29(this, FractionOfSecondParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty28(_assertThisInitialized28(_this), "priority", 30);
    _defineProperty28(_assertThisInitialized28(_this), "incompatibleTokens", ["t", "T"]);
    return _this;
  }
  _createClass29(FractionOfSecondParser2, [{
    key: "parse",
    value: function parse2(dateString, token) {
      var valueCallback92 = function valueCallback102(value) {
        return Math.floor(value * Math.pow(10, -token.length + 3));
      };
      return mapValue(parseNDigits(token.length, dateString), valueCallback92);
    }
  }, {
    key: "set",
    value: function set2(date2, _flags, value) {
      date2.setUTCMilliseconds(value);
      return date2;
    }
  }]);
  return FractionOfSecondParser2;
}(Parser);
function _typeof32(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof32 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof32 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof32(obj);
}
function _classCallCheck30(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties30(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass30(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties30(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties30(Constructor, staticProps);
  return Constructor;
}
function _inherits29(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf29(subClass, superClass);
}
function _setPrototypeOf29(o3, p4) {
  _setPrototypeOf29 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf29(o3, p4);
}
function _createSuper29(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct29();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf29(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf29(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn29(this, result);
  };
}
function _possibleConstructorReturn29(self2, call) {
  if (call && (_typeof32(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized29(self2);
}
function _assertThisInitialized29(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct29() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf29(o3) {
  _getPrototypeOf29 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf29(o3);
}
function _defineProperty29(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var ISOTimezoneWithZParser = /* @__PURE__ */ function(_Parser) {
  _inherits29(ISOTimezoneWithZParser2, _Parser);
  var _super = _createSuper29(ISOTimezoneWithZParser2);
  function ISOTimezoneWithZParser2() {
    var _this;
    _classCallCheck30(this, ISOTimezoneWithZParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty29(_assertThisInitialized29(_this), "priority", 10);
    _defineProperty29(_assertThisInitialized29(_this), "incompatibleTokens", ["t", "T", "x"]);
    return _this;
  }
  _createClass30(ISOTimezoneWithZParser2, [{
    key: "parse",
    value: function parse2(dateString, token) {
      switch (token) {
        case "X":
          return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);
        case "XX":
          return parseTimezonePattern(timezonePatterns.basic, dateString);
        case "XXXX":
          return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);
        case "XXXXX":
          return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);
        case "XXX":
        default:
          return parseTimezonePattern(timezonePatterns.extended, dateString);
      }
    }
  }, {
    key: "set",
    value: function set2(date2, flags, value) {
      if (flags.timestampIsSet) {
        return date2;
      }
      return new Date(date2.getTime() - value);
    }
  }]);
  return ISOTimezoneWithZParser2;
}(Parser);
function _typeof33(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof33 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof33 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof33(obj);
}
function _classCallCheck31(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties31(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass31(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties31(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties31(Constructor, staticProps);
  return Constructor;
}
function _inherits30(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf30(subClass, superClass);
}
function _setPrototypeOf30(o3, p4) {
  _setPrototypeOf30 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf30(o3, p4);
}
function _createSuper30(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct30();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf30(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf30(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn30(this, result);
  };
}
function _possibleConstructorReturn30(self2, call) {
  if (call && (_typeof33(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized30(self2);
}
function _assertThisInitialized30(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct30() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf30(o3) {
  _getPrototypeOf30 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf30(o3);
}
function _defineProperty30(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var ISOTimezoneParser = /* @__PURE__ */ function(_Parser) {
  _inherits30(ISOTimezoneParser2, _Parser);
  var _super = _createSuper30(ISOTimezoneParser2);
  function ISOTimezoneParser2() {
    var _this;
    _classCallCheck31(this, ISOTimezoneParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty30(_assertThisInitialized30(_this), "priority", 10);
    _defineProperty30(_assertThisInitialized30(_this), "incompatibleTokens", ["t", "T", "X"]);
    return _this;
  }
  _createClass31(ISOTimezoneParser2, [{
    key: "parse",
    value: function parse2(dateString, token) {
      switch (token) {
        case "x":
          return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, dateString);
        case "xx":
          return parseTimezonePattern(timezonePatterns.basic, dateString);
        case "xxxx":
          return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, dateString);
        case "xxxxx":
          return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, dateString);
        case "xxx":
        default:
          return parseTimezonePattern(timezonePatterns.extended, dateString);
      }
    }
  }, {
    key: "set",
    value: function set2(date2, flags, value) {
      if (flags.timestampIsSet) {
        return date2;
      }
      return new Date(date2.getTime() - value);
    }
  }]);
  return ISOTimezoneParser2;
}(Parser);
function _typeof34(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof34 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof34 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof34(obj);
}
function _classCallCheck32(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties32(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass32(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties32(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties32(Constructor, staticProps);
  return Constructor;
}
function _inherits31(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf31(subClass, superClass);
}
function _setPrototypeOf31(o3, p4) {
  _setPrototypeOf31 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf31(o3, p4);
}
function _createSuper31(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct31();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf31(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf31(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn31(this, result);
  };
}
function _possibleConstructorReturn31(self2, call) {
  if (call && (_typeof34(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized31(self2);
}
function _assertThisInitialized31(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct31() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf31(o3) {
  _getPrototypeOf31 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf31(o3);
}
function _defineProperty31(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var TimestampSecondsParser = /* @__PURE__ */ function(_Parser) {
  _inherits31(TimestampSecondsParser2, _Parser);
  var _super = _createSuper31(TimestampSecondsParser2);
  function TimestampSecondsParser2() {
    var _this;
    _classCallCheck32(this, TimestampSecondsParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty31(_assertThisInitialized31(_this), "priority", 40);
    _defineProperty31(_assertThisInitialized31(_this), "incompatibleTokens", "*");
    return _this;
  }
  _createClass32(TimestampSecondsParser2, [{
    key: "parse",
    value: function parse2(dateString) {
      return parseAnyDigitsSigned(dateString);
    }
  }, {
    key: "set",
    value: function set2(_date, _flags, value) {
      return [new Date(value * 1e3), {
        timestampIsSet: true
      }];
    }
  }]);
  return TimestampSecondsParser2;
}(Parser);
function _typeof35(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof35 = function _typeof38(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof35 = function _typeof38(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof35(obj);
}
function _classCallCheck33(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _defineProperties33(target, props) {
  for (var i22 = 0; i22 < props.length; i22++) {
    var descriptor = props[i22];
    descriptor.enumerable = descriptor.enumerable || false;
    descriptor.configurable = true;
    if ("value" in descriptor)
      descriptor.writable = true;
    Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass33(Constructor, protoProps, staticProps) {
  if (protoProps)
    _defineProperties33(Constructor.prototype, protoProps);
  if (staticProps)
    _defineProperties33(Constructor, staticProps);
  return Constructor;
}
function _inherits32(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function");
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
  if (superClass)
    _setPrototypeOf32(subClass, superClass);
}
function _setPrototypeOf32(o3, p4) {
  _setPrototypeOf32 = Object.setPrototypeOf || function _setPrototypeOf33(o22, p22) {
    o22.__proto__ = p22;
    return o22;
  };
  return _setPrototypeOf32(o3, p4);
}
function _createSuper32(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct32();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf32(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf32(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn32(this, result);
  };
}
function _possibleConstructorReturn32(self2, call) {
  if (call && (_typeof35(call) === "object" || typeof call === "function")) {
    return call;
  }
  return _assertThisInitialized32(self2);
}
function _assertThisInitialized32(self2) {
  if (self2 === void 0) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return self2;
}
function _isNativeReflectConstruct32() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e22) {
    return false;
  }
}
function _getPrototypeOf32(o3) {
  _getPrototypeOf32 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf33(o22) {
    return o22.__proto__ || Object.getPrototypeOf(o22);
  };
  return _getPrototypeOf32(o3);
}
function _defineProperty32(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
var TimestampMillisecondsParser = /* @__PURE__ */ function(_Parser) {
  _inherits32(TimestampMillisecondsParser2, _Parser);
  var _super = _createSuper32(TimestampMillisecondsParser2);
  function TimestampMillisecondsParser2() {
    var _this;
    _classCallCheck33(this, TimestampMillisecondsParser2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(args));
    _defineProperty32(_assertThisInitialized32(_this), "priority", 20);
    _defineProperty32(_assertThisInitialized32(_this), "incompatibleTokens", "*");
    return _this;
  }
  _createClass33(TimestampMillisecondsParser2, [{
    key: "parse",
    value: function parse2(dateString) {
      return parseAnyDigitsSigned(dateString);
    }
  }, {
    key: "set",
    value: function set2(_date, _flags, value) {
      return [new Date(value), {
        timestampIsSet: true
      }];
    }
  }]);
  return TimestampMillisecondsParser2;
}(Parser);
var parsers2 = {
  G: new EraParser(),
  y: new YearParser(),
  Y: new LocalWeekYearParser(),
  R: new ISOWeekYearParser(),
  u: new ExtendedYearParser(),
  Q: new QuarterParser(),
  q: new StandAloneQuarterParser(),
  M: new MonthParser(),
  L: new StandAloneMonthParser(),
  w: new LocalWeekParser(),
  I: new ISOWeekParser(),
  d: new DateParser(),
  D: new DayOfYearParser(),
  E: new DayParser(),
  e: new LocalDayParser(),
  c: new StandAloneLocalDayParser(),
  i: new ISODayParser(),
  a: new AMPMParser(),
  b: new AMPMMidnightParser(),
  B: new DayPeriodParser(),
  h: new Hour1to12Parser(),
  H: new Hour0to23Parser(),
  K: new Hour0To11Parser(),
  k: new Hour1To24Parser(),
  m: new MinuteParser(),
  s: new SecondParser(),
  S: new FractionOfSecondParser(),
  X: new ISOTimezoneWithZParser(),
  x: new ISOTimezoneParser(),
  t: new TimestampSecondsParser(),
  T: new TimestampMillisecondsParser()
};
var formatDistanceLocale2 = {
  lessThanXSeconds: {
    standalone: {
      one: "weniger als 1 Sekunde",
      other: "weniger als {{count}} Sekunden"
    },
    withPreposition: {
      one: "weniger als 1 Sekunde",
      other: "weniger als {{count}} Sekunden"
    }
  },
  xSeconds: {
    standalone: {
      one: "1 Sekunde",
      other: "{{count}} Sekunden"
    },
    withPreposition: {
      one: "1 Sekunde",
      other: "{{count}} Sekunden"
    }
  },
  halfAMinute: {
    standalone: "halbe Minute",
    withPreposition: "halben Minute"
  },
  lessThanXMinutes: {
    standalone: {
      one: "weniger als 1 Minute",
      other: "weniger als {{count}} Minuten"
    },
    withPreposition: {
      one: "weniger als 1 Minute",
      other: "weniger als {{count}} Minuten"
    }
  },
  xMinutes: {
    standalone: {
      one: "1 Minute",
      other: "{{count}} Minuten"
    },
    withPreposition: {
      one: "1 Minute",
      other: "{{count}} Minuten"
    }
  },
  aboutXHours: {
    standalone: {
      one: "etwa 1 Stunde",
      other: "etwa {{count}} Stunden"
    },
    withPreposition: {
      one: "etwa 1 Stunde",
      other: "etwa {{count}} Stunden"
    }
  },
  xHours: {
    standalone: {
      one: "1 Stunde",
      other: "{{count}} Stunden"
    },
    withPreposition: {
      one: "1 Stunde",
      other: "{{count}} Stunden"
    }
  },
  xDays: {
    standalone: {
      one: "1 Tag",
      other: "{{count}} Tage"
    },
    withPreposition: {
      one: "1 Tag",
      other: "{{count}} Tagen"
    }
  },
  aboutXWeeks: {
    standalone: {
      one: "etwa 1 Woche",
      other: "etwa {{count}} Wochen"
    },
    withPreposition: {
      one: "etwa 1 Woche",
      other: "etwa {{count}} Wochen"
    }
  },
  xWeeks: {
    standalone: {
      one: "1 Woche",
      other: "{{count}} Wochen"
    },
    withPreposition: {
      one: "1 Woche",
      other: "{{count}} Wochen"
    }
  },
  aboutXMonths: {
    standalone: {
      one: "etwa 1 Monat",
      other: "etwa {{count}} Monate"
    },
    withPreposition: {
      one: "etwa 1 Monat",
      other: "etwa {{count}} Monaten"
    }
  },
  xMonths: {
    standalone: {
      one: "1 Monat",
      other: "{{count}} Monate"
    },
    withPreposition: {
      one: "1 Monat",
      other: "{{count}} Monaten"
    }
  },
  aboutXYears: {
    standalone: {
      one: "etwa 1 Jahr",
      other: "etwa {{count}} Jahre"
    },
    withPreposition: {
      one: "etwa 1 Jahr",
      other: "etwa {{count}} Jahren"
    }
  },
  xYears: {
    standalone: {
      one: "1 Jahr",
      other: "{{count}} Jahre"
    },
    withPreposition: {
      one: "1 Jahr",
      other: "{{count}} Jahren"
    }
  },
  overXYears: {
    standalone: {
      one: "mehr als 1 Jahr",
      other: "mehr als {{count}} Jahre"
    },
    withPreposition: {
      one: "mehr als 1 Jahr",
      other: "mehr als {{count}} Jahren"
    }
  },
  almostXYears: {
    standalone: {
      one: "fast 1 Jahr",
      other: "fast {{count}} Jahre"
    },
    withPreposition: {
      one: "fast 1 Jahr",
      other: "fast {{count}} Jahren"
    }
  }
};
var formatDistance3 = function formatDistance4(token, count, options) {
  var result;
  var tokenValue = options !== null && options !== void 0 && options.addSuffix ? formatDistanceLocale2[token].withPreposition : formatDistanceLocale2[token].standalone;
  if (typeof tokenValue === "string") {
    result = tokenValue;
  } else if (count === 1) {
    result = tokenValue.one;
  } else {
    result = tokenValue.other.replace("{{count}}", String(count));
  }
  if (options !== null && options !== void 0 && options.addSuffix) {
    if (options.comparison && options.comparison > 0) {
      return "in " + result;
    } else {
      return "vor " + result;
    }
  }
  return result;
};
var formatDistance_default2 = formatDistance3;
var dateFormats2 = {
  full: "EEEE, do MMMM y",
  // Montag, 7. Januar 2018
  long: "do MMMM y",
  // 7. Januar 2018
  medium: "do MMM y",
  // 7. Jan. 2018
  short: "dd.MM.y"
  // 07.01.2018
};
var timeFormats2 = {
  full: "HH:mm:ss zzzz",
  long: "HH:mm:ss z",
  medium: "HH:mm:ss",
  short: "HH:mm"
};
var dateTimeFormats2 = {
  full: "{{date}} 'um' {{time}}",
  long: "{{date}} 'um' {{time}}",
  medium: "{{date}} {{time}}",
  short: "{{date}} {{time}}"
};
var formatLong2 = {
  date: buildFormatLongFn({
    formats: dateFormats2,
    defaultWidth: "full"
  }),
  time: buildFormatLongFn({
    formats: timeFormats2,
    defaultWidth: "full"
  }),
  dateTime: buildFormatLongFn({
    formats: dateTimeFormats2,
    defaultWidth: "full"
  })
};
var formatLong_default2 = formatLong2;
var formatRelativeLocale2 = {
  lastWeek: "'letzten' eeee 'um' p",
  yesterday: "'gestern um' p",
  today: "'heute um' p",
  tomorrow: "'morgen um' p",
  nextWeek: "eeee 'um' p",
  other: "P"
};
var formatRelative3 = function formatRelative4(token, _date, _baseDate, _options) {
  return formatRelativeLocale2[token];
};
var formatRelative_default2 = formatRelative3;
var eraValues2 = {
  narrow: ["v.Chr.", "n.Chr."],
  abbreviated: ["v.Chr.", "n.Chr."],
  wide: ["vor Christus", "nach Christus"]
};
var quarterValues2 = {
  narrow: ["1", "2", "3", "4"],
  abbreviated: ["Q1", "Q2", "Q3", "Q4"],
  wide: ["1. Quartal", "2. Quartal", "3. Quartal", "4. Quartal"]
};
var monthValues2 = {
  narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
  abbreviated: ["Jan", "Feb", "M\xE4r", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"],
  wide: ["Januar", "Februar", "M\xE4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]
};
var formattingMonthValues = {
  narrow: monthValues2.narrow,
  abbreviated: ["Jan.", "Feb.", "M\xE4rz", "Apr.", "Mai", "Juni", "Juli", "Aug.", "Sep.", "Okt.", "Nov.", "Dez."],
  wide: monthValues2.wide
};
var dayValues2 = {
  narrow: ["S", "M", "D", "M", "D", "F", "S"],
  short: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
  abbreviated: ["So.", "Mo.", "Di.", "Mi.", "Do.", "Fr.", "Sa."],
  wide: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
};
var dayPeriodValues2 = {
  narrow: {
    am: "vm.",
    pm: "nm.",
    midnight: "Mitternacht",
    noon: "Mittag",
    morning: "Morgen",
    afternoon: "Nachm.",
    evening: "Abend",
    night: "Nacht"
  },
  abbreviated: {
    am: "vorm.",
    pm: "nachm.",
    midnight: "Mitternacht",
    noon: "Mittag",
    morning: "Morgen",
    afternoon: "Nachmittag",
    evening: "Abend",
    night: "Nacht"
  },
  wide: {
    am: "vormittags",
    pm: "nachmittags",
    midnight: "Mitternacht",
    noon: "Mittag",
    morning: "Morgen",
    afternoon: "Nachmittag",
    evening: "Abend",
    night: "Nacht"
  }
};
var formattingDayPeriodValues2 = {
  narrow: {
    am: "vm.",
    pm: "nm.",
    midnight: "Mitternacht",
    noon: "Mittag",
    morning: "morgens",
    afternoon: "nachm.",
    evening: "abends",
    night: "nachts"
  },
  abbreviated: {
    am: "vorm.",
    pm: "nachm.",
    midnight: "Mitternacht",
    noon: "Mittag",
    morning: "morgens",
    afternoon: "nachmittags",
    evening: "abends",
    night: "nachts"
  },
  wide: {
    am: "vormittags",
    pm: "nachmittags",
    midnight: "Mitternacht",
    noon: "Mittag",
    morning: "morgens",
    afternoon: "nachmittags",
    evening: "abends",
    night: "nachts"
  }
};
var ordinalNumber3 = function ordinalNumber4(dirtyNumber) {
  var number2 = Number(dirtyNumber);
  return number2 + ".";
};
var localize2 = {
  ordinalNumber: ordinalNumber3,
  era: buildLocalizeFn({
    values: eraValues2,
    defaultWidth: "wide"
  }),
  quarter: buildLocalizeFn({
    values: quarterValues2,
    defaultWidth: "wide",
    argumentCallback: function argumentCallback2(quarter) {
      return quarter - 1;
    }
  }),
  month: buildLocalizeFn({
    values: monthValues2,
    formattingValues: formattingMonthValues,
    defaultWidth: "wide"
  }),
  day: buildLocalizeFn({
    values: dayValues2,
    defaultWidth: "wide"
  }),
  dayPeriod: buildLocalizeFn({
    values: dayPeriodValues2,
    defaultWidth: "wide",
    formattingValues: formattingDayPeriodValues2,
    defaultFormattingWidth: "wide"
  })
};
var localize_default2 = localize2;
var matchOrdinalNumberPattern2 = /^(\d+)(\.)?/i;
var parseOrdinalNumberPattern2 = /\d+/i;
var matchEraPatterns2 = {
  narrow: /^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,
  abbreviated: /^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,
  wide: /^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i
};
var parseEraPatterns2 = {
  any: [/^v/i, /^n/i]
};
var matchQuarterPatterns2 = {
  narrow: /^[1234]/i,
  abbreviated: /^q[1234]/i,
  wide: /^[1234](\.)? Quartal/i
};
var parseQuarterPatterns2 = {
  any: [/1/i, /2/i, /3/i, /4/i]
};
var matchMonthPatterns2 = {
  narrow: /^[jfmasond]/i,
  abbreviated: /^(j[aä]n|feb|mär[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\.?/i,
  wide: /^(januar|februar|märz|april|mai|juni|juli|august|september|oktober|november|dezember)/i
};
var parseMonthPatterns2 = {
  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: [/^j[aä]/i, /^f/i, /^mär/i, /^ap/i, /^mai/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
};
var matchDayPatterns2 = {
  narrow: /^[smdmf]/i,
  short: /^(so|mo|di|mi|do|fr|sa)/i,
  abbreviated: /^(son?|mon?|die?|mit?|don?|fre?|sam?)\.?/i,
  wide: /^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i
};
var parseDayPatterns2 = {
  any: [/^so/i, /^mo/i, /^di/i, /^mi/i, /^do/i, /^f/i, /^sa/i]
};
var matchDayPeriodPatterns2 = {
  narrow: /^(vm\.?|nm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,
  abbreviated: /^(vorm\.?|nachm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,
  wide: /^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i
};
var parseDayPeriodPatterns2 = {
  any: {
    am: /^v/i,
    pm: /^n/i,
    midnight: /^Mitte/i,
    noon: /^Mitta/i,
    morning: /morgens/i,
    afternoon: /nachmittags/i,
    // will never be matched. Afternoon is matched by `pm`
    evening: /abends/i,
    night: /nachts/i
    // will never be matched. Night is matched by `pm`
  }
};
var match2 = {
  ordinalNumber: buildMatchPatternFn({
    matchPattern: matchOrdinalNumberPattern2,
    parsePattern: parseOrdinalNumberPattern2,
    valueCallback: function valueCallback3(value) {
      return parseInt(value);
    }
  }),
  era: buildMatchFn({
    matchPatterns: matchEraPatterns2,
    defaultMatchWidth: "wide",
    parsePatterns: parseEraPatterns2,
    defaultParseWidth: "any"
  }),
  quarter: buildMatchFn({
    matchPatterns: matchQuarterPatterns2,
    defaultMatchWidth: "wide",
    parsePatterns: parseQuarterPatterns2,
    defaultParseWidth: "any",
    valueCallback: function valueCallback4(index) {
      return index + 1;
    }
  }),
  month: buildMatchFn({
    matchPatterns: matchMonthPatterns2,
    defaultMatchWidth: "wide",
    parsePatterns: parseMonthPatterns2,
    defaultParseWidth: "any"
  }),
  day: buildMatchFn({
    matchPatterns: matchDayPatterns2,
    defaultMatchWidth: "wide",
    parsePatterns: parseDayPatterns2,
    defaultParseWidth: "any"
  }),
  dayPeriod: buildMatchFn({
    matchPatterns: matchDayPeriodPatterns2,
    defaultMatchWidth: "wide",
    parsePatterns: parseDayPeriodPatterns2,
    defaultParseWidth: "any"
  })
};
var match_default2 = match2;
var locale2 = {
  code: "de",
  formatDistance: formatDistance_default2,
  formatLong: formatLong_default2,
  formatRelative: formatRelative_default2,
  localize: localize_default2,
  match: match_default2,
  options: {
    weekStartsOn: 1,
    firstWeekContainsDate: 4
  }
};
var de_default = locale2;
var dateFormats3 = {
  full: "EEEE, d MMMM yyyy",
  long: "d MMMM yyyy",
  medium: "d MMM yyyy",
  short: "dd/MM/yyyy"
};
var timeFormats3 = {
  full: "HH:mm:ss zzzz",
  long: "HH:mm:ss z",
  medium: "HH:mm:ss",
  short: "HH:mm"
};
var dateTimeFormats3 = {
  full: "{{date}} 'at' {{time}}",
  long: "{{date}} 'at' {{time}}",
  medium: "{{date}}, {{time}}",
  short: "{{date}}, {{time}}"
};
var formatLong3 = {
  date: buildFormatLongFn({
    formats: dateFormats3,
    defaultWidth: "full"
  }),
  time: buildFormatLongFn({
    formats: timeFormats3,
    defaultWidth: "full"
  }),
  dateTime: buildFormatLongFn({
    formats: dateTimeFormats3,
    defaultWidth: "full"
  })
};
var formatLong_default3 = formatLong3;
var locale3 = {
  code: "en-GB",
  formatDistance: formatDistance_default,
  formatLong: formatLong_default3,
  formatRelative: formatRelative_default,
  localize: localize_default,
  match: match_default,
  options: {
    weekStartsOn: 1,
    firstWeekContainsDate: 4
  }
};
var en_GB_default = locale3;
var formatDistanceLocale3 = {
  lessThanXSeconds: {
    one: "menos de un segundo",
    other: "menos de {{count}} segundos"
  },
  xSeconds: {
    one: "1 segundo",
    other: "{{count}} segundos"
  },
  halfAMinute: "medio minuto",
  lessThanXMinutes: {
    one: "menos de un minuto",
    other: "menos de {{count}} minutos"
  },
  xMinutes: {
    one: "1 minuto",
    other: "{{count}} minutos"
  },
  aboutXHours: {
    one: "alrededor de 1 hora",
    other: "alrededor de {{count}} horas"
  },
  xHours: {
    one: "1 hora",
    other: "{{count}} horas"
  },
  xDays: {
    one: "1 d\xEDa",
    other: "{{count}} d\xEDas"
  },
  aboutXWeeks: {
    one: "alrededor de 1 semana",
    other: "alrededor de {{count}} semanas"
  },
  xWeeks: {
    one: "1 semana",
    other: "{{count}} semanas"
  },
  aboutXMonths: {
    one: "alrededor de 1 mes",
    other: "alrededor de {{count}} meses"
  },
  xMonths: {
    one: "1 mes",
    other: "{{count}} meses"
  },
  aboutXYears: {
    one: "alrededor de 1 a\xF1o",
    other: "alrededor de {{count}} a\xF1os"
  },
  xYears: {
    one: "1 a\xF1o",
    other: "{{count}} a\xF1os"
  },
  overXYears: {
    one: "m\xE1s de 1 a\xF1o",
    other: "m\xE1s de {{count}} a\xF1os"
  },
  almostXYears: {
    one: "casi 1 a\xF1o",
    other: "casi {{count}} a\xF1os"
  }
};
var formatDistance5 = function formatDistance6(token, count, options) {
  var result;
  var tokenValue = formatDistanceLocale3[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 "en " + result;
    } else {
      return "hace " + result;
    }
  }
  return result;
};
var formatDistance_default3 = formatDistance5;
var dateFormats4 = {
  full: "EEEE, d 'de' MMMM 'de' y",
  long: "d 'de' MMMM 'de' y",
  medium: "d MMM y",
  short: "dd/MM/y"
};
var timeFormats4 = {
  full: "HH:mm:ss zzzz",
  long: "HH:mm:ss z",
  medium: "HH:mm:ss",
  short: "HH:mm"
};
var dateTimeFormats4 = {
  full: "{{date}} 'a las' {{time}}",
  long: "{{date}} 'a las' {{time}}",
  medium: "{{date}}, {{time}}",
  short: "{{date}}, {{time}}"
};
var formatLong4 = {
  date: buildFormatLongFn({
    formats: dateFormats4,
    defaultWidth: "full"
  }),
  time: buildFormatLongFn({
    formats: timeFormats4,
    defaultWidth: "full"
  }),
  dateTime: buildFormatLongFn({
    formats: dateTimeFormats4,
    defaultWidth: "full"
  })
};
var formatLong_default4 = formatLong4;
var formatRelativeLocale3 = {
  lastWeek: "'el' eeee 'pasado a la' p",
  yesterday: "'ayer a la' p",
  today: "'hoy a la' p",
  tomorrow: "'ma\xF1ana a la' p",
  nextWeek: "eeee 'a la' p",
  other: "P"
};
var formatRelativeLocalePlural = {
  lastWeek: "'el' eeee 'pasado a las' p",
  yesterday: "'ayer a las' p",
  today: "'hoy a las' p",
  tomorrow: "'ma\xF1ana a las' p",
  nextWeek: "eeee 'a las' p",
  other: "P"
};
var formatRelative5 = function formatRelative6(token, date2, _baseDate, _options) {
  if (date2.getUTCHours() !== 1) {
    return formatRelativeLocalePlural[token];
  } else {
    return formatRelativeLocale3[token];
  }
};
var formatRelative_default3 = formatRelative5;
var eraValues3 = {
  narrow: ["AC", "DC"],
  abbreviated: ["AC", "DC"],
  wide: ["antes de cristo", "despu\xE9s de cristo"]
};
var quarterValues3 = {
  narrow: ["1", "2", "3", "4"],
  abbreviated: ["T1", "T2", "T3", "T4"],
  wide: ["1\xBA trimestre", "2\xBA trimestre", "3\xBA trimestre", "4\xBA trimestre"]
};
var monthValues3 = {
  narrow: ["e", "f", "m", "a", "m", "j", "j", "a", "s", "o", "n", "d"],
  abbreviated: ["ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic"],
  wide: ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"]
};
var dayValues3 = {
  narrow: ["d", "l", "m", "m", "j", "v", "s"],
  short: ["do", "lu", "ma", "mi", "ju", "vi", "s\xE1"],
  abbreviated: ["dom", "lun", "mar", "mi\xE9", "jue", "vie", "s\xE1b"],
  wide: ["domingo", "lunes", "martes", "mi\xE9rcoles", "jueves", "viernes", "s\xE1bado"]
};
var dayPeriodValues3 = {
  narrow: {
    am: "a",
    pm: "p",
    midnight: "mn",
    noon: "md",
    morning: "ma\xF1ana",
    afternoon: "tarde",
    evening: "tarde",
    night: "noche"
  },
  abbreviated: {
    am: "AM",
    pm: "PM",
    midnight: "medianoche",
    noon: "mediodia",
    morning: "ma\xF1ana",
    afternoon: "tarde",
    evening: "tarde",
    night: "noche"
  },
  wide: {
    am: "a.m.",
    pm: "p.m.",
    midnight: "medianoche",
    noon: "mediodia",
    morning: "ma\xF1ana",
    afternoon: "tarde",
    evening: "tarde",
    night: "noche"
  }
};
var formattingDayPeriodValues3 = {
  narrow: {
    am: "a",
    pm: "p",
    midnight: "mn",
    noon: "md",
    morning: "de la ma\xF1ana",
    afternoon: "de la tarde",
    evening: "de la tarde",
    night: "de la noche"
  },
  abbreviated: {
    am: "AM",
    pm: "PM",
    midnight: "medianoche",
    noon: "mediodia",
    morning: "de la ma\xF1ana",
    afternoon: "de la tarde",
    evening: "de la tarde",
    night: "de la noche"
  },
  wide: {
    am: "a.m.",
    pm: "p.m.",
    midnight: "medianoche",
    noon: "mediodia",
    morning: "de la ma\xF1ana",
    afternoon: "de la tarde",
    evening: "de la tarde",
    night: "de la noche"
  }
};
var ordinalNumber5 = function ordinalNumber6(dirtyNumber, _options) {
  var number2 = Number(dirtyNumber);
  return number2 + "\xBA";
};
var localize3 = {
  ordinalNumber: ordinalNumber5,
  era: buildLocalizeFn({
    values: eraValues3,
    defaultWidth: "wide"
  }),
  quarter: buildLocalizeFn({
    values: quarterValues3,
    defaultWidth: "wide",
    argumentCallback: function argumentCallback3(quarter) {
      return Number(quarter) - 1;
    }
  }),
  month: buildLocalizeFn({
    values: monthValues3,
    defaultWidth: "wide"
  }),
  day: buildLocalizeFn({
    values: dayValues3,
    defaultWidth: "wide"
  }),
  dayPeriod: buildLocalizeFn({
    values: dayPeriodValues3,
    defaultWidth: "wide",
    formattingValues: formattingDayPeriodValues3,
    defaultFormattingWidth: "wide"
  })
};
var localize_default3 = localize3;
var matchOrdinalNumberPattern3 = /^(\d+)(º)?/i;
var parseOrdinalNumberPattern3 = /\d+/i;
var matchEraPatterns3 = {
  narrow: /^(ac|dc|a|d)/i,
  abbreviated: /^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,
  wide: /^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i
};
var parseEraPatterns3 = {
  any: [/^ac/i, /^dc/i],
  wide: [/^(antes de cristo|antes de la era com[uú]n)/i, /^(despu[eé]s de cristo|era com[uú]n)/i]
};
var matchQuarterPatterns3 = {
  narrow: /^[1234]/i,
  abbreviated: /^T[1234]/i,
  wide: /^[1234](º)? trimestre/i
};
var parseQuarterPatterns3 = {
  any: [/1/i, /2/i, /3/i, /4/i]
};
var matchMonthPatterns3 = {
  narrow: /^[efmajsond]/i,
  abbreviated: /^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,
  wide: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i
};
var parseMonthPatterns3 = {
  narrow: [/^e/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
  any: [/^en/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]
};
var matchDayPatterns3 = {
  narrow: /^[dlmjvs]/i,
  short: /^(do|lu|ma|mi|ju|vi|s[áa])/i,
  abbreviated: /^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,
  wide: /^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i
};
var parseDayPatterns3 = {
  narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^j/i, /^v/i, /^s/i],
  any: [/^do/i, /^lu/i, /^ma/i, /^mi/i, /^ju/i, /^vi/i, /^sa/i]
};
var matchDayPeriodPatterns3 = {
  narrow: /^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,
  any: /^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i
};
var parseDayPeriodPatterns3 = {
  any: {
    am: /^a/i,
    pm: /^p/i,
    midnight: /^mn/i,
    noon: /^md/i,
    morning: /mañana/i,
    afternoon: /tarde/i,
    evening: /tarde/i,
    night: /noche/i
  }
};
var match3 = {
  ordinalNumber: buildMatchPatternFn({
    matchPattern: matchOrdinalNumberPattern3,
    parsePattern: parseOrdinalNumberPattern3,
    valueCallback: function valueCallback5(value) {
      return parseInt(value, 10);
    }
  }),
  era: buildMatchFn({
    matchPatterns: matchEraPatterns3,
    defaultMatchWidth: "wide",
    parsePatterns: parseEraPatterns3,
    defaultParseWidth: "any"
  }),
  quarter: buildMatchFn({
    matchPatterns: matchQuarterPatterns3,
    defaultMatchWidth: "wide",
    parsePatterns: parseQuarterPatterns3,
    defaultParseWidth: "any",
    valueCallback: function valueCallback6(index) {
      return index + 1;
    }
  }),
  month: buildMatchFn({
    matchPatterns: matchMonthPatterns3,
    defaultMatchWidth: "wide",
    parsePatterns: parseMonthPatterns3,
    defaultParseWidth: "any"
  }),
  day: buildMatchFn({
    matchPatterns: matchDayPatterns3,
    defaultMatchWidth: "wide",
    parsePatterns: parseDayPatterns3,
    defaultParseWidth: "any"
  }),
  dayPeriod: buildMatchFn({
    matchPatterns: matchDayPeriodPatterns3,
    defaultMatchWidth: "any",
    parsePatterns: parseDayPeriodPatterns3,
    defaultParseWidth: "any"
  })
};
var match_default3 = match3;
var locale4 = {
  code: "es",
  formatDistance: formatDistance_default3,
  formatLong: formatLong_default4,
  formatRelative: formatRelative_default3,
  localize: localize_default3,
  match: match_default3,
  options: {
    weekStartsOn: 1,
    firstWeekContainsDate: 1
  }
};
var es_default = locale4;
var formatDistanceLocale4 = {
  lessThanXSeconds: {
    one: "moins d\u2019une seconde",
    other: "moins de {{count}} secondes"
  },
  xSeconds: {
    one: "1 seconde",
    other: "{{count}} secondes"
  },
  halfAMinute: "30 secondes",
  lessThanXMinutes: {
    one: "moins d\u2019une minute",
    other: "moins de {{count}} minutes"
  },
  xMinutes: {
    one: "1 minute",
    other: "{{count}} minutes"
  },
  aboutXHours: {
    one: "environ 1 heure",
    other: "environ {{count}} heures"
  },
  xHours: {
    one: "1 heure",
    other: "{{count}} heures"
  },
  xDays: {
    one: "1 jour",
    other: "{{count}} jours"
  },
  aboutXWeeks: {
    one: "environ 1 semaine",
    other: "environ {{count}} semaines"
  },
  xWeeks: {
    one: "1 semaine",
    other: "{{count}} semaines"
  },
  aboutXMonths: {
    one: "environ 1 mois",
    other: "environ {{count}} mois"
  },
  xMonths: {
    one: "1 mois",
    other: "{{count}} mois"
  },
  aboutXYears: {
    one: "environ 1 an",
    other: "environ {{count}} ans"
  },
  xYears: {
    one: "1 an",
    other: "{{count}} ans"
  },
  overXYears: {
    one: "plus d\u2019un an",
    other: "plus de {{count}} ans"
  },
  almostXYears: {
    one: "presqu\u2019un an",
    other: "presque {{count}} ans"
  }
};
var formatDistance7 = function formatDistance8(token, count, options) {
  var result;
  var form = formatDistanceLocale4[token];
  if (typeof form === "string") {
    result = form;
  } else if (count === 1) {
    result = form.one;
  } else {
    result = form.other.replace("{{count}}", String(count));
  }
  if (options !== null && options !== void 0 && options.addSuffix) {
    if (options.comparison && options.comparison > 0) {
      return "dans " + result;
    } else {
      return "il y a " + result;
    }
  }
  return result;
};
var formatDistance_default4 = formatDistance7;
var dateFormats5 = {
  full: "EEEE d MMMM y",
  long: "d MMMM y",
  medium: "d MMM y",
  short: "dd/MM/y"
};
var timeFormats5 = {
  full: "HH:mm:ss zzzz",
  long: "HH:mm:ss z",
  medium: "HH:mm:ss",
  short: "HH:mm"
};
var dateTimeFormats5 = {
  full: "{{date}} '\xE0' {{time}}",
  long: "{{date}} '\xE0' {{time}}",
  medium: "{{date}}, {{time}}",
  short: "{{date}}, {{time}}"
};
var formatLong5 = {
  date: buildFormatLongFn({
    formats: dateFormats5,
    defaultWidth: "full"
  }),
  time: buildFormatLongFn({
    formats: timeFormats5,
    defaultWidth: "full"
  }),
  dateTime: buildFormatLongFn({
    formats: dateTimeFormats5,
    defaultWidth: "full"
  })
};
var formatLong_default5 = formatLong5;
var formatRelativeLocale4 = {
  lastWeek: "eeee 'dernier \xE0' p",
  yesterday: "'hier \xE0' p",
  today: "'aujourd\u2019hui \xE0' p",
  tomorrow: "'demain \xE0' p'",
  nextWeek: "eeee 'prochain \xE0' p",
  other: "P"
};
var formatRelative7 = function formatRelative8(token, _date, _baseDate, _options) {
  return formatRelativeLocale4[token];
};
var formatRelative_default4 = formatRelative7;
var eraValues4 = {
  narrow: ["av. J.-C", "ap. J.-C"],
  abbreviated: ["av. J.-C", "ap. J.-C"],
  wide: ["avant J\xE9sus-Christ", "apr\xE8s J\xE9sus-Christ"]
};
var quarterValues4 = {
  narrow: ["T1", "T2", "T3", "T4"],
  abbreviated: ["1er trim.", "2\xE8me trim.", "3\xE8me trim.", "4\xE8me trim."],
  wide: ["1er trimestre", "2\xE8me trimestre", "3\xE8me trimestre", "4\xE8me trimestre"]
};
var monthValues4 = {
  narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
  abbreviated: ["janv.", "f\xE9vr.", "mars", "avr.", "mai", "juin", "juil.", "ao\xFBt", "sept.", "oct.", "nov.", "d\xE9c."],
  wide: ["janvier", "f\xE9vrier", "mars", "avril", "mai", "juin", "juillet", "ao\xFBt", "septembre", "octobre", "novembre", "d\xE9cembre"]
};
var dayValues4 = {
  narrow: ["D", "L", "M", "M", "J", "V", "S"],
  short: ["di", "lu", "ma", "me", "je", "ve", "sa"],
  abbreviated: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."],
  wide: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"]
};
var dayPeriodValues4 = {
  narrow: {
    am: "AM",
    pm: "PM",
    midnight: "minuit",
    noon: "midi",
    morning: "mat.",
    afternoon: "ap.m.",
    evening: "soir",
    night: "mat."
  },
  abbreviated: {
    am: "AM",
    pm: "PM",
    midnight: "minuit",
    noon: "midi",
    morning: "matin",
    afternoon: "apr\xE8s-midi",
    evening: "soir",
    night: "matin"
  },
  wide: {
    am: "AM",
    pm: "PM",
    midnight: "minuit",
    noon: "midi",
    morning: "du matin",
    afternoon: "de l\u2019apr\xE8s-midi",
    evening: "du soir",
    night: "du matin"
  }
};
var ordinalNumber7 = function ordinalNumber8(dirtyNumber, options) {
  var number2 = Number(dirtyNumber);
  var unit = options === null || options === void 0 ? void 0 : options.unit;
  if (number2 === 0)
    return "0";
  var feminineUnits = ["year", "week", "hour", "minute", "second"];
  var suffix;
  if (number2 === 1) {
    suffix = unit && feminineUnits.includes(unit) ? "\xE8re" : "er";
  } else {
    suffix = "\xE8me";
  }
  return number2 + suffix;
};
var localize4 = {
  ordinalNumber: ordinalNumber7,
  era: buildLocalizeFn({
    values: eraValues4,
    defaultWidth: "wide"
  }),
  quarter: buildLocalizeFn({
    values: quarterValues4,
    defaultWidth: "wide",
    argumentCallback: function argumentCallback4(quarter) {
      return quarter - 1;
    }
  }),
  month: buildLocalizeFn({
    values: monthValues4,
    defaultWidth: "wide"
  }),
  day: buildLocalizeFn({
    values: dayValues4,
    defaultWidth: "wide"
  }),
  dayPeriod: buildLocalizeFn({
    values: dayPeriodValues4,
    defaultWidth: "wide"
  })
};
var localize_default4 = localize4;
var matchOrdinalNumberPattern4 = /^(\d+)(ième|ère|ème|er|e)?/i;
var parseOrdinalNumberPattern4 = /\d+/i;
var matchEraPatterns4 = {
  narrow: /^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,
  abbreviated: /^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,
  wide: /^(avant Jésus-Christ|après Jésus-Christ)/i
};
var parseEraPatterns4 = {
  any: [/^av/i, /^ap/i]
};
var matchQuarterPatterns4 = {
  narrow: /^T?[1234]/i,
  abbreviated: /^[1234](er|ème|e)? trim\.?/i,
  wide: /^[1234](er|ème|e)? trimestre/i
};
var parseQuarterPatterns4 = {
  any: [/1/i, /2/i, /3/i, /4/i]
};
var matchMonthPatterns4 = {
  narrow: /^[jfmasond]/i,
  abbreviated: /^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,
  wide: /^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i
};
var parseMonthPatterns4 = {
  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, /^av/i, /^ma/i, /^juin/i, /^juil/i, /^ao/i, /^s/i, /^o/i, /^n/i, /^d/i]
};
var matchDayPatterns4 = {
  narrow: /^[lmjvsd]/i,
  short: /^(di|lu|ma|me|je|ve|sa)/i,
  abbreviated: /^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,
  wide: /^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i
};
var parseDayPatterns4 = {
  narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^j/i, /^v/i, /^s/i],
  any: [/^di/i, /^lu/i, /^ma/i, /^me/i, /^je/i, /^ve/i, /^sa/i]
};
var matchDayPeriodPatterns4 = {
  narrow: /^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,
  any: /^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i
};
var parseDayPeriodPatterns4 = {
  any: {
    am: /^a/i,
    pm: /^p/i,
    midnight: /^min/i,
    noon: /^mid/i,
    morning: /mat/i,
    afternoon: /ap/i,
    evening: /soir/i,
    night: /nuit/i
  }
};
var match4 = {
  ordinalNumber: buildMatchPatternFn({
    matchPattern: matchOrdinalNumberPattern4,
    parsePattern: parseOrdinalNumberPattern4,
    valueCallback: function valueCallback7(value) {
      return parseInt(value);
    }
  }),
  era: buildMatchFn({
    matchPatterns: matchEraPatterns4,
    defaultMatchWidth: "wide",
    parsePatterns: parseEraPatterns4,
    defaultParseWidth: "any"
  }),
  quarter: buildMatchFn({
    matchPatterns: matchQuarterPatterns4,
    defaultMatchWidth: "wide",
    parsePatterns: parseQuarterPatterns4,
    defaultParseWidth: "any",
    valueCallback: function valueCallback8(index) {
      return index + 1;
    }
  }),
  month: buildMatchFn({
    matchPatterns: matchMonthPatterns4,
    defaultMatchWidth: "wide",
    parsePatterns: parseMonthPatterns4,
    defaultParseWidth: "any"
  }),
  day: buildMatchFn({
    matchPatterns: matchDayPatterns4,
    defaultMatchWidth: "wide",
    parsePatterns: parseDayPatterns4,
    defaultParseWidth: "any"
  }),
  dayPeriod: buildMatchFn({
    matchPatterns: matchDayPeriodPatterns4,
    defaultMatchWidth: "any",
    parsePatterns: parseDayPeriodPatterns4,
    defaultParseWidth: "any"
  })
};
var match_default4 = match4;
var locale5 = {
  code: "fr",
  formatDistance: formatDistance_default4,
  formatLong: formatLong_default5,
  formatRelative: formatRelative_default4,
  localize: localize_default4,
  match: match_default4,
  options: {
    weekStartsOn: 1,
    firstWeekContainsDate: 4
  }
};
var fr_default = locale5;
var supportedLang = {
  es: "Espanol [es]",
  en: "English [en]",
  fr: "Francais [fr]",
  de: "Deutsch [de]",
  sv: "Svenska [sv]",
  it: "Italiane [it]"
};
var initial = {
  lang: "en",
  supportedLang,
  changeLanguage: () => {
  },
  i18n,
  dateLocale: en_GB_default,
  completeness: {
    de: 0,
    en: 0,
    es: 0,
    fr: 0,
    it: 0,
    sv: 0
  }
};
var Context2 = B(initial);
var TranslationProvider = ({
  initial: initial22,
  children,
  forceLang,
  source,
  completeness: completenessProp
}) => {
  const completeness = {
    en: 100,
    de: !completenessProp || !completenessProp["de"] ? 0 : completenessProp["de"],
    es: !completenessProp || !completenessProp["es"] ? 0 : completenessProp["es"],
    fr: !completenessProp || !completenessProp["fr"] ? 0 : completenessProp["fr"],
    it: !completenessProp || !completenessProp["it"] ? 0 : completenessProp["it"],
    sv: !completenessProp || !completenessProp["sv"] ? 0 : completenessProp["sv"]
  };
  const { value: lang, update: changeLanguage } = useLang(initial22, completeness);
  h2(() => {
    if (forceLang) {
      changeLanguage(forceLang);
    }
  }, [forceLang]);
  h2(() => {
    setupI18n(lang, source);
  }, [lang]);
  if (forceLang) {
    setupI18n(forceLang, source);
  } else {
    setupI18n(lang, source);
  }
  const dateLocale = lang === "es" ? es_default : lang === "fr" ? fr_default : lang === "de" ? de_default : en_GB_default;
  return h(Context2.Provider, {
    value: { lang, changeLanguage, supportedLang, i18n, dateLocale, completeness },
    children
  });
};
var useTranslationContext = () => q2(Context2);
var ActiviyTracker = class {
  constructor() {
    this.observers = new Array();
    this.notify = this.notify.bind(this);
    this.subscribe = this.subscribe.bind(this);
  }
  notify(data) {
    this.observers.forEach((observer) => observer(data));
  }
  subscribe(func) {
    this.observers.push(func);
    return () => {
      this.observers.forEach((observer, index) => {
        if (observer === func) {
          this.observers.splice(index, 1);
        }
      });
    };
  }
};
var BankContext = B(void 0);
var ChallengerContext = B(void 0);
var MerchantContext = B(void 0);
var useMerchantApiContext = () => q2(MerchantContext);
var CONFIG_FAIL_TRY_AGAIN_MS3 = 5e3;
var MerchantApiProvider = ({
  baseUrl,
  children,
  evictors = {},
  frameOnError
}) => {
  const [checked, setChecked] = p3();
  const [merchantEndpoint, changeMerchantEndpoint] = p3(baseUrl);
  const { getRemoteConfig, VERSION: VERSION2, lib, cancelRequest, onActivity } = buildMerchantApiClient(merchantEndpoint, evictors);
  h2(() => {
    let keepRetrying = true;
    async function testConfig() {
      try {
        const config = await getRemoteConfig();
        if (LibtoolVersion.compare(VERSION2, config.version)) {
          setChecked({ type: "ok", config, hints: [] });
        } else {
          setChecked({
            type: "incompatible",
            result: config,
            supported: VERSION2
          });
        }
      } catch (error2) {
        if (error2 instanceof TalerError) {
          if (keepRetrying) {
            setTimeout(() => {
              testConfig();
            }, CONFIG_FAIL_TRY_AGAIN_MS3);
          }
          setChecked({ type: "error", error: error2 });
        } else {
          setChecked({ type: "error", error: TalerError.fromException(error2) });
        }
      }
    }
    testConfig();
    return () => {
      keepRetrying = false;
    };
  }, []);
  if (!checked || checked.type !== "ok") {
    return h(frameOnError, { state: checked }, []);
  }
  const value = {
    url: merchantEndpoint,
    config: checked.config,
    onActivity,
    lib,
    cancelRequest,
    changeBackend: changeMerchantEndpoint,
    hints: checked.hints
  };
  return h(MerchantContext.Provider, {
    value,
    children
  });
};
function buildMerchantApiClient(url, evictors) {
  const httpFetch = new BrowserFetchHttpLib({
    enableThrottling: true,
    requireTls: false
  });
  const tracker = new ActiviyTracker();
  const httpLib = new ObservableHttpClientLibrary(httpFetch, {
    observe(ev) {
      tracker.notify(ev);
    }
  });
  const instance = new TalerMerchantManagementHttpClient(
    url.href,
    httpLib,
    evictors.management
  );
  const authenticate = new TalerAuthenticationHttpClient(
    instance.getAuthenticationAPI().href,
    httpLib
  );
  function getSubInstanceAPI(instanceId) {
    const api = buildMerchantApiClient(
      instance.getSubInstanceAPI(instanceId),
      evictors
    );
    return api.lib;
  }
  async function getRemoteConfig() {
    const resp = await instance.getConfig();
    if (resp.type === "fail") {
      throw TalerError.fromUncheckedDetail(resp.detail);
    }
    return resp.body;
  }
  return {
    getRemoteConfig,
    VERSION: instance.PROTOCOL_VERSION,
    lib: {
      instance,
      authenticate,
      subInstanceApi: getSubInstanceAPI
    },
    onActivity: tracker.subscribe,
    cancelRequest: httpLib.cancelRequest
  };
}
var ExchangeContext = B(void 0);
var Context3 = B(void 0);
var useNavigationContext = () => q2(Context3);
function getPathAndParamsFromWindow() {
  const path = typeof window !== "undefined" ? window.location.hash.substring(1) : "/";
  const params = {};
  if (typeof window !== "undefined") {
    for (const [key, value] of new URLSearchParams(window.location.search)) {
      if (!params[key]) {
        params[key] = [];
      }
      params[key].push(value);
    }
  }
  return { path, params };
}
var { path: initialPath, params: initialParams } = getPathAndParamsFromWindow();
var PopStateEventType = "popstate";
var BrowserHashNavigationProvider = ({
  children
}) => {
  const [{ path, params }, setState] = p3({
    path: initialPath,
    params: initialParams
  });
  if (typeof window === "undefined") {
    throw Error(
      "Can't use BrowserHashNavigationProvider if there is no window object"
    );
  }
  function navigateTo(path2) {
    const { params: params2 } = getPathAndParamsFromWindow();
    setState({ path: path2, params: params2 });
    window.location.href = path2;
  }
  h2(() => {
    function eventListener() {
      setState(getPathAndParamsFromWindow());
    }
    window.addEventListener(PopStateEventType, eventListener);
    return () => {
      window.removeEventListener(PopStateEventType, eventListener);
    };
  }, []);
  return h(Context3.Provider, {
    value: { path, params, navigateTo },
    children
  });
};
function createHeadMetaTag(uri, onNotFound) {
  const meta = document.createElement("meta");
  meta.setAttribute("name", "taler-uri");
  meta.setAttribute("content", stringifyTalerUri(uri));
  document.head.appendChild(meta);
  let walletFound = false;
  window.addEventListener("beforeunload", () => {
    walletFound = true;
  });
  setTimeout(() => {
    if (!walletFound && onNotFound) {
      onNotFound();
    }
  }, 10);
}
var Context4 = B(void 0);
var TalerWalletIntegrationBrowserProvider = ({
  children
}) => {
  const value = {
    publishTalerAction: createHeadMetaTag
  };
  return h(Context4.Provider, {
    value,
    children
  });
};
var utils_exports = {};
__export2(utils_exports, {
  compose: () => compose,
  recursive: () => recursive,
  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 h44 = withHook(() => hook(p4));
    return h44();
  };
}
function recursive(hook) {
  function withHook(stateHook) {
    function ComposedComponent() {
      const state = stateHook();
      if (typeof state === "function") {
        const subComponent = withHook(state);
        return h(subComponent, {});
      }
      return state;
    }
    return ComposedComponent;
  }
  return (p4) => {
    const h44 = withHook(() => hook(p4));
    return h44();
  };
}
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((e22) => inspect(e22));
  } else {
    inspect(children);
  }
}
var FormContext = B(void 0);

// src/Application.tsx
init_preact_module();
init_hooks_module();

// ../../node_modules/.pnpm/swr@2.2.2_react@18.3.1/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.3.1/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) => ({
  ...a5,
  ...b4
});
var isPromiseLike = (x5) => isFunction(x5.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
};
async function internalMutate(...args) {
  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);
  async function mutateByKey(_k) {
    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 = await 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.3.1/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 {
        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(
    async (revalidateOpts) => {
      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 = await 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 timer2;
    function next() {
      const interval = isFunction(refreshInterval) ? refreshInterval(getCache().data) : refreshInterval;
      if (interval && timer2 !== -1) {
        timer2 = setTimeout(execute, interval);
      }
    }
    function execute() {
      if (!getCache().error && (refreshWhenHidden || getConfig().isVisible()) && (refreshWhenOffline || getConfig().isOnline())) {
        revalidate(WITH_DEDUPE).then(next);
      } else {
        next();
      }
    }
    next();
    return () => {
      if (timer2) {
        clearTimeout(timer2);
        timer2 = -1;
      }
    };
  }, [
    refreshInterval,
    refreshWhenHidden,
    refreshWhenOffline,
    key
  ]);
  x2(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);

// ../../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 prompt2 = null;
  function setPrompt(nextPrompt) {
    false ? tiny_warning_esm_default(prompt2 == null, "A history supports only one prompt at a time") : void 0;
    prompt2 = nextPrompt;
    return function() {
      if (prompt2 === nextPrompt)
        prompt2 = null;
    };
  }
  function confirmTransitionTo(location2, action, getUserConfirmation, callback) {
    if (prompt2 != null) {
      var result = typeof prompt2 === "function" ? prompt2(location2, action) : prompt2;
      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(history3, nextState);
    history3.length = globalHistory.length;
    transitionManager.notifyListeners(history3.location, history3.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 = history3.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 = history3.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, history3.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(history3.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, history3.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(history3.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(prompt2) {
    if (prompt2 === void 0) {
      prompt2 = false;
    }
    var unblock = transitionManager.setPrompt(prompt2);
    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 history3 = {
    length: globalHistory.length,
    action: "POP",
    location: initialLocation,
    createHref,
    push,
    replace,
    go,
    goBack,
    goForward,
    block,
    listen
  };
  return history3;
}

// src/Routing.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 = x(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(x(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/Routing.tsx
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/session.ts
init_preact_module();
init_hooks_module();
var codecForSessionState = () => buildCodecForObject().property("backendUrl", codecForURL()).property("token", codecOptional(codecForString())).property(
  "prevToken",
  codecOptional(codecForString())
).build("SavedSession");
function inferInstanceName(url) {
  const match6 = INSTANCE_ID_LOOKUP.exec(url.href);
  return !match6 || !match6[1] ? DEFAULT_ADMIN_USERNAME : match6[1];
}
var defaultState = (url) => {
  return {
    backendUrl: url,
    token: void 0,
    prevToken: void 0
  };
};
var SESSION_STATE_KEY = buildStorageKey(
  "merchant-session",
  codecForSessionState()
);
var DEFAULT_ADMIN_USERNAME = "default";
var INSTANCE_ID_LOOKUP = /\/instances\/([^/]*)\/?$/;
function cleanAllCache() {
  mutate(() => true, void 0, { revalidate: false });
}
var Context5 = B(void 0);
var useSessionContext = () => q2(Context5);
var SessionContextProvider = ({
  children
  // value,
}) => {
  const {
    lib: rootLib,
    config: rootConfig,
    url: merchantUrl
  } = useMerchantApiContext();
  const [status, setStatus] = p3("loggedIn");
  const [currentConfig, setCurrentConfig] = p3();
  const { value: state, update } = useLocalStorage(
    SESSION_STATE_KEY,
    defaultState(merchantUrl)
  );
  const currentInstance = inferInstanceName(state.backendUrl);
  let lib;
  let config;
  const doingImpersonation = state.backendUrl.href !== merchantUrl.href;
  if (doingImpersonation) {
    lib = rootLib.subInstanceApi(inferInstanceName(state.backendUrl));
    config = currentConfig ?? rootConfig;
  } else {
    lib = rootLib;
    config = rootConfig;
  }
  h2(() => {
    if (!doingImpersonation)
      return;
    lib.instance.getConfig().then((resp) => {
      if (resp.type === "ok") {
        setCurrentConfig(resp.body);
      }
    });
  }, [state.backendUrl.href]);
  const value = {
    state: {
      backendUrl: state.backendUrl,
      token: state.token,
      impersonated: doingImpersonation,
      instance: currentInstance,
      isAdmin: currentInstance === DEFAULT_ADMIN_USERNAME,
      status
    },
    lib,
    config,
    logOut() {
      setStatus("loggedOut");
      update({
        backendUrl: merchantUrl,
        token: void 0,
        prevToken: void 0
      });
      cleanAllCache();
    },
    deImpersonate() {
      cleanAllCache();
      update({
        backendUrl: merchantUrl,
        token: state.prevToken,
        prevToken: void 0
      });
      setStatus("loggedIn");
    },
    impersonate(baseUrl) {
      update({
        backendUrl: baseUrl,
        token: void 0,
        prevToken: state.token
      });
      setStatus("loggedIn");
      cleanAllCache();
    },
    logIn(token) {
      cleanAllCache();
      setStatus("loggedIn");
      update({
        backendUrl: state.backendUrl,
        token,
        prevToken: state.prevToken
      });
    }
  };
  return h(Context5.Provider, {
    value,
    children
  });
};

// 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 CROCKFORD_BASE32_REGEX = /^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]+[*~$=U]*$/;
var URL_REGEX = /^((https?:)(\/\/\/?)([\w]*(?::[\w]*)?@)?([\d\w\.-]+)(?::(\d+))?)\/$/;
var PAGINATED_LIST_SIZE = 5;
var PAGINATED_LIST_REQUEST = PAGINATED_LIST_SIZE + 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(FormContext2.Provider, { value }, /* @__PURE__ */ h(
    "form",
    {
      class: "field",
      onSubmit: (e4) => {
        e4.preventDefault();
      }
    },
    children
  ));
}
var FormContext2 = B(null);
function useFormContext() {
  return q2(FormContext2);
}

// 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 initial3 = readField(initialObject, String(name));
  const hasError = readField(errors2, String(name));
  return {
    error: isDirty ? hasError : void 0,
    required: !isDirty && hasError,
    value,
    initial: initial3,
    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 { ...object2, [head]: setValueDeeper(object2[head] || {}, rest, value) };
};

// src/components/form/Input.tsx
var defaultToString = (f3) => f3 || "";
var defaultFromString = (v3) => v3;
var TextInput = ({ inputType, error: error2, ...rest }) => inputType === "multiline" ? /* @__PURE__ */ h(
  "textarea",
  {
    ...rest,
    class: error2 ? "textarea is-danger" : "textarea",
    rows: "3"
  }
) : /* @__PURE__ */ h(
  "input",
  {
    ...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,
      {
        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 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 ImportingAccountModal({
  onCancel,
  onConfirm
}) {
  const { i18n: i18n2 } = useTranslationContext();
  const [letter, setLetter] = p3();
  let parsed = void 0;
  try {
    parsed = JSON.parse(letter ?? "");
  } catch (e4) {
    parsed = void 0;
  }
  let account = void 0;
  let parsingError = void 0;
  try {
    account = parsed !== void 0 ? codecForAccountLetter().decode(parsed) : void 0;
  } catch (e4) {
    account = void 0;
    if (e4 instanceof Error) {
      parsingError = e4.message;
    }
  }
  const errors2 = {
    letter: !letter ? i18n2.str`required` : parsed === void 0 ? i18n2.str`letter should be a JSON string` : account === void 0 ? i18n2.str`JSON string is invalid` : void 0
  };
  return /* @__PURE__ */ h(
    ConfirmModal,
    {
      label: i18n2.str`Import`,
      description: i18n2.str`Importing an account from the bank`,
      active: true,
      onCancel,
      disabled: account === void 0,
      onConfirm: () => onConfirm(account)
    },
    /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "You can export your account settings from the Libeufin Bank's account profile. Paste the content in the next field.")),
    /* @__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, "Account 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: letter ?? "",
        onChange: (e4) => {
          setLetter(e4.currentTarget.value);
        }
      }
    )), letter !== void 0 && errors2.letter && /* @__PURE__ */ h("p", { class: "help is-danger" }, errors2.letter), parsingError !== void 0 && /* @__PURE__ */ h("p", { class: "help is-danger" }, parsingError))))
  );
}
function getHostFromHostPath(s5) {
  if (!s5)
    return void 0;
  try {
    const u4 = new URL(`https://${s5}`);
    const endpath = u4.pathname.lastIndexOf("/");
    return u4.origin + u4.pathname.substring(0, endpath);
  } catch (e4) {
    return void 0;
  }
}
function getAccountIdFromHostPath(s5) {
  if (!s5)
    return void 0;
  try {
    const u4 = new URL(`https://${s5}`);
    const endpath = u4.pathname.lastIndexOf("/");
    return u4.pathname.substring(endpath + 1);
  } catch (e4) {
    return void 0;
  }
}
function CompareAccountsModal({
  onCancel,
  onConfirm,
  formPayto,
  testPayto
}) {
  const { i18n: i18n2 } = useTranslationContext();
  return /* @__PURE__ */ h(
    ConfirmModal,
    {
      label: i18n2.str`Update form`,
      description: i18n2.str`Comparing account details`,
      active: true,
      onCancel,
      onConfirm: () => onConfirm(stringifyPaytoUri(testPayto))
    },
    /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "Testing against the account info URL succeeded but the account information reported is different with the account details form.")),
    /* @__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("td", null, /* @__PURE__ */ h(i18n2.Translate, null, "Field")), /* @__PURE__ */ h("td", null, /* @__PURE__ */ h(i18n2.Translate, null, "In the form")), /* @__PURE__ */ h("td", null, /* @__PURE__ */ h(i18n2.Translate, null, "Reported")))), /* @__PURE__ */ h("tbody", null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("td", null, /* @__PURE__ */ h(i18n2.Translate, null, "Type")), /* @__PURE__ */ h("td", null, formPayto?.targetType ?? "--"), /* @__PURE__ */ h("td", null, testPayto.targetType)), testPayto.targetType === "iban" && /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("td", null, /* @__PURE__ */ h(i18n2.Translate, null, "IBAN")), /* @__PURE__ */ h("td", null, formPayto?.targetPath ?? "--"), /* @__PURE__ */ h("td", null, testPayto.targetPath)), testPayto.targetType === "bitcoin" && /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("td", null, /* @__PURE__ */ h(i18n2.Translate, null, "Address")), /* @__PURE__ */ h("td", null, formPayto?.targetPath ?? "--"), /* @__PURE__ */ h("td", null, testPayto.targetPath)), testPayto.targetType === "x-taler-bank" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("td", null, /* @__PURE__ */ h(i18n2.Translate, null, "Host")), /* @__PURE__ */ h("td", null, getHostFromHostPath(formPayto?.targetPath) ?? "--"), /* @__PURE__ */ h("td", null, getHostFromHostPath(testPayto.targetPath))), /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("td", null, /* @__PURE__ */ h(i18n2.Translate, null, "Account id")), /* @__PURE__ */ h("td", null, getAccountIdFromHostPath(formPayto?.targetPath) ?? "--"), /* @__PURE__ */ h("td", null, getAccountIdFromHostPath(testPayto.targetPath)))), /* @__PURE__ */ h("tr", null, /* @__PURE__ */ h("td", null, /* @__PURE__ */ h(i18n2.Translate, null, "Owner's name")), /* @__PURE__ */ h("td", null, formPayto?.params["receiver-name"] ?? "--"), /* @__PURE__ */ h("td", null, testPayto.params["receiver-name"])))))
  );
}
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 SetTokenNewInstanceModal({
  onCancel,
  onClear,
  onConfirm
}) {
  const [form, setValue] = p3({
    new_token: "",
    repeat_token: ""
  });
  const { i18n: i18n2 } = useTranslationContext();
  const errors2 = {
    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 access 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
  );
  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" }, i18n2.str`You are setting the access token for the new instance`), /* @__PURE__ */ h("button", { class: "delete ", "aria-label": "close", onClick: onCancel })), /* @__PURE__ */ h("section", { class: "modal-card-body 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: form,
      valueHandler: setValue
    },
    /* @__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("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "With external authorization method no check will be done by the merchant backend"))), /* @__PURE__ */ h("div", { class: "column" }))), /* @__PURE__ */ h("footer", { class: "modal-card-foot" }, onClear && /* @__PURE__ */ h(
    "button",
    {
      class: "button is-danger",
      onClick: onClear,
      disabled: onClear === void 0
    },
    /* @__PURE__ */ h(i18n2.Translate, null, "Set external authorization")
  ), /* @__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: "button is-info",
      onClick: () => onConfirm(form.new_token),
      disabled: hasErrors
    },
    /* @__PURE__ */ h(i18n2.Translate, null, "Set access token")
  )))), /* @__PURE__ */ h(
    "button",
    {
      class: "modal-close is-large ",
      "aria-label": "close",
      onClick: onCancel
    }
  ));
}
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 = async (...args) => {
    if (!fn2)
      return;
    setLoading(true);
    const handler = setTimeout(() => {
      setSlow(true);
    }, tooLong);
    try {
      const result = await 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({ onClick, disabled, children, ...rest }) {
  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", { ...rest }, /* @__PURE__ */ h("button", { class: "button is-success", onClick: request, disabled }, children));
}

// src/components/instance/DefaultInstanceFormFields.tsx
init_preact_module();

// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/toInteger/index.js
function toInteger2(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 requiredArgs2(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 _typeof2(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof2 = function _typeof37(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof2 = function _typeof37(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof2(obj);
}
function toDate2(argument) {
  requiredArgs2(1, arguments);
  var argStr = Object.prototype.toString.call(argument);
  if (argument instanceof Date || _typeof2(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) {
  requiredArgs2(2, arguments);
  var date2 = toDate2(dirtyDate);
  var amount = toInteger2(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) {
  requiredArgs2(2, arguments);
  var date2 = toDate2(dirtyDate);
  var amount = toInteger2(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 _typeof3(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof3 = function _typeof37(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof3 = function _typeof37(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof3(obj);
}
function add2(dirtyDate, duration) {
  requiredArgs2(2, arguments);
  if (!duration || _typeof3(duration) !== "object")
    return /* @__PURE__ */ new Date(NaN);
  var years = duration.years ? toInteger2(duration.years) : 0;
  var months = duration.months ? toInteger2(duration.months) : 0;
  var weeks = duration.weeks ? toInteger2(duration.weeks) : 0;
  var days = duration.days ? toInteger2(duration.days) : 0;
  var hours = duration.hours ? toInteger2(duration.hours) : 0;
  var minutes = duration.minutes ? toInteger2(duration.minutes) : 0;
  var seconds = duration.seconds ? toInteger2(duration.seconds) : 0;
  var date2 = toDate2(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) {
  requiredArgs2(2, arguments);
  var timestamp = toDate2(dirtyDate).getTime();
  var amount = toInteger2(dirtyAmount);
  return new Date(timestamp + amount);
}

// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/defaultOptions/index.js
var defaultOptions2 = {};
function getDefaultOptions2() {
  return defaultOptions2;
}

// ../../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) {
  requiredArgs2(1, arguments);
  var date2 = toDate2(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) {
  requiredArgs2(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) {
  requiredArgs2(2, arguments);
  var dateLeft = toDate2(dirtyDateLeft);
  var dateRight = toDate2(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 daysInYear2 = 365.2425;
var maxTime2 = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
var millisecondsInMinute2 = 6e4;
var millisecondsInHour2 = 36e5;
var minTime2 = -maxTime2;
var secondsInHour2 = 3600;
var secondsInDay2 = secondsInHour2 * 24;
var secondsInWeek2 = secondsInDay2 * 7;
var secondsInYear2 = secondsInDay2 * daysInYear2;
var secondsInMonth2 = secondsInYear2 / 12;
var secondsInQuarter2 = secondsInMonth2 * 3;

// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/isDate/index.js
function _typeof36(obj) {
  "@babel/helpers - typeof";
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
    _typeof36 = function _typeof37(obj2) {
      return typeof obj2;
    };
  } else {
    _typeof36 = function _typeof37(obj2) {
      return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
    };
  }
  return _typeof36(obj);
}
function isDate(value) {
  requiredArgs2(1, arguments);
  return value instanceof Date || _typeof36(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) {
  requiredArgs2(1, arguments);
  if (!isDate(dirtyDate) && typeof dirtyDate !== "number") {
    return false;
  }
  var date2 = toDate2(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) {
  requiredArgs2(2, arguments);
  var dateLeft = toDate2(dirtyDateLeft);
  var dateRight = toDate2(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) {
  requiredArgs2(2, arguments);
  var dateLeft = toDate2(dirtyDateLeft);
  var dateRight = toDate2(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) {
  requiredArgs2(2, arguments);
  var dateLeft = toDate2(dirtyDateLeft);
  var dateRight = toDate2(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) {
  requiredArgs2(2, arguments);
  return toDate2(dateLeft).getTime() - toDate2(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) {
  requiredArgs2(2, arguments);
  var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour2;
  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) {
  requiredArgs2(2, arguments);
  var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInMinute2;
  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) {
  requiredArgs2(1, arguments);
  var date2 = toDate2(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) {
  requiredArgs2(1, arguments);
  var date2 = toDate2(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) {
  requiredArgs2(1, arguments);
  var date2 = toDate2(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) {
  requiredArgs2(2, arguments);
  var dateLeft = toDate2(dirtyDateLeft);
  var dateRight = toDate2(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(toDate2(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) {
  requiredArgs2(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) {
  requiredArgs2(2, arguments);
  var dateLeft = toDate2(dirtyDateLeft);
  var dateRight = toDate2(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) {
  requiredArgs2(2, arguments);
  var amount = toInteger2(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) {
  requiredArgs2(1, arguments);
  var date2 = toDate2(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 startOfUTCISOWeek2(dirtyDate) {
  requiredArgs2(1, arguments);
  var weekStartsOn = 1;
  var date2 = toDate2(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 getUTCISOWeekYear2(dirtyDate) {
  requiredArgs2(1, arguments);
  var date2 = toDate2(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 = startOfUTCISOWeek2(fourthOfJanuaryOfNextYear);
  var fourthOfJanuaryOfThisYear = /* @__PURE__ */ new Date(0);
  fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
  fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
  var startOfThisYear = startOfUTCISOWeek2(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 startOfUTCISOWeekYear2(dirtyDate) {
  requiredArgs2(1, arguments);
  var year = getUTCISOWeekYear2(dirtyDate);
  var fourthOfJanuary = /* @__PURE__ */ new Date(0);
  fourthOfJanuary.setUTCFullYear(year, 0, 4);
  fourthOfJanuary.setUTCHours(0, 0, 0, 0);
  var date2 = startOfUTCISOWeek2(fourthOfJanuary);
  return date2;
}

// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js
var MILLISECONDS_IN_WEEK3 = 6048e5;
function getUTCISOWeek2(dirtyDate) {
  requiredArgs2(1, arguments);
  var date2 = toDate2(dirtyDate);
  var diff = startOfUTCISOWeek2(date2).getTime() - startOfUTCISOWeekYear2(date2).getTime();
  return Math.round(diff / MILLISECONDS_IN_WEEK3) + 1;
}

// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js
function startOfUTCWeek2(dirtyDate, options) {
  var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
  requiredArgs2(1, arguments);
  var defaultOptions3 = getDefaultOptions2();
  var weekStartsOn = toInteger2((_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 : defaultOptions3.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.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 = toDate2(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 getUTCWeekYear2(dirtyDate, options) {
  var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
  requiredArgs2(1, arguments);
  var date2 = toDate2(dirtyDate);
  var year = date2.getUTCFullYear();
  var defaultOptions3 = getDefaultOptions2();
  var firstWeekContainsDate = toInteger2((_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 : defaultOptions3.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.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 = startOfUTCWeek2(firstWeekOfNextYear, options);
  var firstWeekOfThisYear = /* @__PURE__ */ new Date(0);
  firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
  firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
  var startOfThisYear = startOfUTCWeek2(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 startOfUTCWeekYear2(dirtyDate, options) {
  var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
  requiredArgs2(1, arguments);
  var defaultOptions3 = getDefaultOptions2();
  var firstWeekContainsDate = toInteger2((_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 : defaultOptions3.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions3.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 = getUTCWeekYear2(dirtyDate, options);
  var firstWeek = /* @__PURE__ */ new Date(0);
  firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
  firstWeek.setUTCHours(0, 0, 0, 0);
  var date2 = startOfUTCWeek2(firstWeek, options);
  return date2;
}

// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/_lib/getUTCWeek/index.js
var MILLISECONDS_IN_WEEK4 = 6048e5;
function getUTCWeek2(dirtyDate, options) {
  requiredArgs2(1, arguments);
  var date2 = toDate2(dirtyDate);
  var diff = startOfUTCWeek2(date2, options).getTime() - startOfUTCWeekYear2(date2, options).getTime();
  return Math.round(diff / MILLISECONDS_IN_WEEK4) + 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 M4(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 H3(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 G2(date2, token, localize6) {
    var era = date2.getUTCFullYear() > 0 ? 1 : 0;
    switch (token) {
      case "G":
      case "GG":
      case "GGG":
        return localize6.era(era, {
          width: "abbreviated"
        });
      case "GGGGG":
        return localize6.era(era, {
          width: "narrow"
        });
      case "GGGG":
      default:
        return localize6.era(era, {
          width: "wide"
        });
    }
  },
  // Year
  y: function y4(date2, token, localize6) {
    if (token === "yo") {
      var signedYear = date2.getUTCFullYear();
      var year = signedYear > 0 ? signedYear : 1 - signedYear;
      return localize6.ordinalNumber(year, {
        unit: "year"
      });
    }
    return lightFormatters_default.y(date2, token);
  },
  // Local week-numbering year
  Y: function Y3(date2, token, localize6, options) {
    var signedWeekYear = getUTCWeekYear2(date2, options);
    var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
    if (token === "YY") {
      var twoDigitYear = weekYear % 100;
      return addLeadingZeros(twoDigitYear, 2);
    }
    if (token === "Yo") {
      return localize6.ordinalNumber(weekYear, {
        unit: "year"
      });
    }
    return addLeadingZeros(weekYear, token.length);
  },
  // ISO week-numbering year
  R: function R2(date2, token) {
    var isoWeekYear = getUTCISOWeekYear2(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 Q2(date2, token, localize6) {
    var quarter = Math.ceil((date2.getUTCMonth() + 1) / 3);
    switch (token) {
      case "Q":
        return String(quarter);
      case "QQ":
        return addLeadingZeros(quarter, 2);
      case "Qo":
        return localize6.ordinalNumber(quarter, {
          unit: "quarter"
        });
      case "QQQ":
        return localize6.quarter(quarter, {
          width: "abbreviated",
          context: "formatting"
        });
      case "QQQQQ":
        return localize6.quarter(quarter, {
          width: "narrow",
          context: "formatting"
        });
      case "QQQQ":
      default:
        return localize6.quarter(quarter, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // Stand-alone quarter
  q: function q4(date2, token, localize6) {
    var quarter = Math.ceil((date2.getUTCMonth() + 1) / 3);
    switch (token) {
      case "q":
        return String(quarter);
      case "qq":
        return addLeadingZeros(quarter, 2);
      case "qo":
        return localize6.ordinalNumber(quarter, {
          unit: "quarter"
        });
      case "qqq":
        return localize6.quarter(quarter, {
          width: "abbreviated",
          context: "standalone"
        });
      case "qqqqq":
        return localize6.quarter(quarter, {
          width: "narrow",
          context: "standalone"
        });
      case "qqqq":
      default:
        return localize6.quarter(quarter, {
          width: "wide",
          context: "standalone"
        });
    }
  },
  // Month
  M: function M5(date2, token, localize6) {
    var month = date2.getUTCMonth();
    switch (token) {
      case "M":
      case "MM":
        return lightFormatters_default.M(date2, token);
      case "Mo":
        return localize6.ordinalNumber(month + 1, {
          unit: "month"
        });
      case "MMM":
        return localize6.month(month, {
          width: "abbreviated",
          context: "formatting"
        });
      case "MMMMM":
        return localize6.month(month, {
          width: "narrow",
          context: "formatting"
        });
      case "MMMM":
      default:
        return localize6.month(month, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // Stand-alone month
  L: function L4(date2, token, localize6) {
    var month = date2.getUTCMonth();
    switch (token) {
      case "L":
        return String(month + 1);
      case "LL":
        return addLeadingZeros(month + 1, 2);
      case "Lo":
        return localize6.ordinalNumber(month + 1, {
          unit: "month"
        });
      case "LLL":
        return localize6.month(month, {
          width: "abbreviated",
          context: "standalone"
        });
      case "LLLLL":
        return localize6.month(month, {
          width: "narrow",
          context: "standalone"
        });
      case "LLLL":
      default:
        return localize6.month(month, {
          width: "wide",
          context: "standalone"
        });
    }
  },
  // Local week of year
  w: function w4(date2, token, localize6, options) {
    var week = getUTCWeek2(date2, options);
    if (token === "wo") {
      return localize6.ordinalNumber(week, {
        unit: "week"
      });
    }
    return addLeadingZeros(week, token.length);
  },
  // ISO week of year
  I: function I4(date2, token, localize6) {
    var isoWeek = getUTCISOWeek2(date2);
    if (token === "Io") {
      return localize6.ordinalNumber(isoWeek, {
        unit: "week"
      });
    }
    return addLeadingZeros(isoWeek, token.length);
  },
  // Day of the month
  d: function d4(date2, token, localize6) {
    if (token === "do") {
      return localize6.ordinalNumber(date2.getUTCDate(), {
        unit: "date"
      });
    }
    return lightFormatters_default.d(date2, token);
  },
  // Day of year
  D: function D4(date2, token, localize6) {
    var dayOfYear = getUTCDayOfYear(date2);
    if (token === "Do") {
      return localize6.ordinalNumber(dayOfYear, {
        unit: "dayOfYear"
      });
    }
    return addLeadingZeros(dayOfYear, token.length);
  },
  // Day of week
  E: function E2(date2, token, localize6) {
    var dayOfWeek = date2.getUTCDay();
    switch (token) {
      case "E":
      case "EE":
      case "EEE":
        return localize6.day(dayOfWeek, {
          width: "abbreviated",
          context: "formatting"
        });
      case "EEEEE":
        return localize6.day(dayOfWeek, {
          width: "narrow",
          context: "formatting"
        });
      case "EEEEEE":
        return localize6.day(dayOfWeek, {
          width: "short",
          context: "formatting"
        });
      case "EEEE":
      default:
        return localize6.day(dayOfWeek, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // Local day of week
  e: function e3(date2, token, localize6, 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 localize6.ordinalNumber(localDayOfWeek, {
          unit: "day"
        });
      case "eee":
        return localize6.day(dayOfWeek, {
          width: "abbreviated",
          context: "formatting"
        });
      case "eeeee":
        return localize6.day(dayOfWeek, {
          width: "narrow",
          context: "formatting"
        });
      case "eeeeee":
        return localize6.day(dayOfWeek, {
          width: "short",
          context: "formatting"
        });
      case "eeee":
      default:
        return localize6.day(dayOfWeek, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // Stand-alone local day of week
  c: function c3(date2, token, localize6, 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 localize6.ordinalNumber(localDayOfWeek, {
          unit: "day"
        });
      case "ccc":
        return localize6.day(dayOfWeek, {
          width: "abbreviated",
          context: "standalone"
        });
      case "ccccc":
        return localize6.day(dayOfWeek, {
          width: "narrow",
          context: "standalone"
        });
      case "cccccc":
        return localize6.day(dayOfWeek, {
          width: "short",
          context: "standalone"
        });
      case "cccc":
      default:
        return localize6.day(dayOfWeek, {
          width: "wide",
          context: "standalone"
        });
    }
  },
  // ISO day of week
  i: function i3(date2, token, localize6) {
    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 localize6.ordinalNumber(isoDayOfWeek, {
          unit: "day"
        });
      case "iii":
        return localize6.day(dayOfWeek, {
          width: "abbreviated",
          context: "formatting"
        });
      case "iiiii":
        return localize6.day(dayOfWeek, {
          width: "narrow",
          context: "formatting"
        });
      case "iiiiii":
        return localize6.day(dayOfWeek, {
          width: "short",
          context: "formatting"
        });
      case "iiii":
      default:
        return localize6.day(dayOfWeek, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // AM or PM
  a: function a4(date2, token, localize6) {
    var hours = date2.getUTCHours();
    var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
    switch (token) {
      case "a":
      case "aa":
        return localize6.dayPeriod(dayPeriodEnumValue, {
          width: "abbreviated",
          context: "formatting"
        });
      case "aaa":
        return localize6.dayPeriod(dayPeriodEnumValue, {
          width: "abbreviated",
          context: "formatting"
        }).toLowerCase();
      case "aaaaa":
        return localize6.dayPeriod(dayPeriodEnumValue, {
          width: "narrow",
          context: "formatting"
        });
      case "aaaa":
      default:
        return localize6.dayPeriod(dayPeriodEnumValue, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // AM, PM, midnight, noon
  b: function b3(date2, token, localize6) {
    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 localize6.dayPeriod(dayPeriodEnumValue, {
          width: "abbreviated",
          context: "formatting"
        });
      case "bbb":
        return localize6.dayPeriod(dayPeriodEnumValue, {
          width: "abbreviated",
          context: "formatting"
        }).toLowerCase();
      case "bbbbb":
        return localize6.dayPeriod(dayPeriodEnumValue, {
          width: "narrow",
          context: "formatting"
        });
      case "bbbb":
      default:
        return localize6.dayPeriod(dayPeriodEnumValue, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // in the morning, in the afternoon, in the evening, at night
  B: function B4(date2, token, localize6) {
    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 localize6.dayPeriod(dayPeriodEnumValue, {
          width: "abbreviated",
          context: "formatting"
        });
      case "BBBBB":
        return localize6.dayPeriod(dayPeriodEnumValue, {
          width: "narrow",
          context: "formatting"
        });
      case "BBBB":
      default:
        return localize6.dayPeriod(dayPeriodEnumValue, {
          width: "wide",
          context: "formatting"
        });
    }
  },
  // Hour [1-12]
  h: function h4(date2, token, localize6) {
    if (token === "ho") {
      var hours = date2.getUTCHours() % 12;
      if (hours === 0)
        hours = 12;
      return localize6.ordinalNumber(hours, {
        unit: "hour"
      });
    }
    return lightFormatters_default.h(date2, token);
  },
  // Hour [0-23]
  H: function H4(date2, token, localize6) {
    if (token === "Ho") {
      return localize6.ordinalNumber(date2.getUTCHours(), {
        unit: "hour"
      });
    }
    return lightFormatters_default.H(date2, token);
  },
  // Hour [0-11]
  K: function K4(date2, token, localize6) {
    var hours = date2.getUTCHours() % 12;
    if (token === "Ko") {
      return localize6.ordinalNumber(hours, {
        unit: "hour"
      });
    }
    return addLeadingZeros(hours, token.length);
  },
  // Hour [1-24]
  k: function k4(date2, token, localize6) {
    var hours = date2.getUTCHours();
    if (hours === 0)
      hours = 24;
    if (token === "ko") {
      return localize6.ordinalNumber(hours, {
        unit: "hour"
      });
    }
    return addLeadingZeros(hours, token.length);
  },
  // Minute
  m: function m4(date2, token, localize6) {
    if (token === "mo") {
      return localize6.ordinalNumber(date2.getUTCMinutes(), {
        unit: "minute"
      });
    }
    return lightFormatters_default.m(date2, token);
  },
  // Second
  s: function s4(date2, token, localize6) {
    if (token === "so") {
      return localize6.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 X3(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 O3(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 z4(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 T4(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, formatLong7) {
  switch (pattern) {
    case "P":
      return formatLong7.date({
        width: "short"
      });
    case "PP":
      return formatLong7.date({
        width: "medium"
      });
    case "PPP":
      return formatLong7.date({
        width: "long"
      });
    case "PPPP":
    default:
      return formatLong7.date({
        width: "full"
      });
  }
};
var timeLongFormatter = function timeLongFormatter2(pattern, formatLong7) {
  switch (pattern) {
    case "p":
      return formatLong7.time({
        width: "short"
      });
    case "pp":
      return formatLong7.time({
        width: "medium"
      });
    case "ppp":
      return formatLong7.time({
        width: "long"
      });
    case "pppp":
    default:
      return formatLong7.time({
        width: "full"
      });
  }
};
var dateTimeLongFormatter = function dateTimeLongFormatter2(pattern, formatLong7) {
  var matchResult = pattern.match(/(P+)(p+)?/) || [];
  var datePattern = matchResult[1];
  var timePattern = matchResult[2];
  if (!timePattern) {
    return dateLongFormatter(pattern, formatLong7);
  }
  var dateTimeFormat;
  switch (datePattern) {
    case "P":
      dateTimeFormat = formatLong7.dateTime({
        width: "short"
      });
      break;
    case "PP":
      dateTimeFormat = formatLong7.dateTime({
        width: "medium"
      });
      break;
    case "PPP":
      dateTimeFormat = formatLong7.dateTime({
        width: "long"
      });
      break;
    case "PPPP":
    default:
      dateTimeFormat = formatLong7.dateTime({
        width: "full"
      });
      break;
  }
  return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong7)).replace("{{time}}", timeLongFormatter(timePattern, formatLong7));
};
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 formatDistanceLocale5 = {
  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 formatDistance9 = function formatDistance10(token, count, options) {
  var result;
  var tokenValue = formatDistanceLocale5[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_default5 = formatDistance9;

// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js
function buildFormatLongFn2(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 dateFormats6 = {
  full: "EEEE, MMMM do, y",
  long: "MMMM do, y",
  medium: "MMM d, y",
  short: "MM/dd/yyyy"
};
var timeFormats6 = {
  full: "h:mm:ss a zzzz",
  long: "h:mm:ss a z",
  medium: "h:mm:ss a",
  short: "h:mm a"
};
var dateTimeFormats6 = {
  full: "{{date}} 'at' {{time}}",
  long: "{{date}} 'at' {{time}}",
  medium: "{{date}}, {{time}}",
  short: "{{date}}, {{time}}"
};
var formatLong6 = {
  date: buildFormatLongFn2({
    formats: dateFormats6,
    defaultWidth: "full"
  }),
  time: buildFormatLongFn2({
    formats: timeFormats6,
    defaultWidth: "full"
  }),
  dateTime: buildFormatLongFn2({
    formats: dateTimeFormats6,
    defaultWidth: "full"
  })
};
var formatLong_default = formatLong6;

// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js
var formatRelativeLocale5 = {
  lastWeek: "'last' eeee 'at' p",
  yesterday: "'yesterday at' p",
  today: "'today at' p",
  tomorrow: "'tomorrow at' p",
  nextWeek: "eeee 'at' p",
  other: "P"
};
var formatRelative9 = function formatRelative10(token, _date, _baseDate, _options) {
  return formatRelativeLocale5[token];
};
var formatRelative_default5 = formatRelative9;

// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js
function buildLocalizeFn2(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 eraValues5 = {
  narrow: ["B", "A"],
  abbreviated: ["BC", "AD"],
  wide: ["Before Christ", "Anno Domini"]
};
var quarterValues5 = {
  narrow: ["1", "2", "3", "4"],
  abbreviated: ["Q1", "Q2", "Q3", "Q4"],
  wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
};
var monthValues5 = {
  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 dayValues5 = {
  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 dayPeriodValues5 = {
  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 formattingDayPeriodValues4 = {
  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 ordinalNumber9 = function ordinalNumber10(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 localize5 = {
  ordinalNumber: ordinalNumber9,
  era: buildLocalizeFn2({
    values: eraValues5,
    defaultWidth: "wide"
  }),
  quarter: buildLocalizeFn2({
    values: quarterValues5,
    defaultWidth: "wide",
    argumentCallback: function argumentCallback5(quarter) {
      return quarter - 1;
    }
  }),
  month: buildLocalizeFn2({
    values: monthValues5,
    defaultWidth: "wide"
  }),
  day: buildLocalizeFn2({
    values: dayValues5,
    defaultWidth: "wide"
  }),
  dayPeriod: buildLocalizeFn2({
    values: dayPeriodValues5,
    defaultWidth: "wide",
    formattingValues: formattingDayPeriodValues4,
    defaultFormattingWidth: "wide"
  })
};
var localize_default5 = localize5;

// ../../node_modules/.pnpm/date-fns@2.29.3/node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js
function buildMatchFn2(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) ? findIndex2(parsePatterns, function(pattern) {
      return pattern.test(matchedString);
    }) : findKey2(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 findKey2(object2, predicate) {
  for (var key in object2) {
    if (object2.hasOwnProperty(key) && predicate(object2[key])) {
      return key;
    }
  }
  return void 0;
}
function findIndex2(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 buildMatchPatternFn2(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 matchOrdinalNumberPattern5 = /^(\d+)(th|st|nd|rd)?/i;
var parseOrdinalNumberPattern5 = /\d+/i;
var matchEraPatterns5 = {
  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 parseEraPatterns5 = {
  any: [/^b/i, /^(a|c)/i]
};
var matchQuarterPatterns5 = {
  narrow: /^[1234]/i,
  abbreviated: /^q[1234]/i,
  wide: /^[1234](th|st|nd|rd)? quarter/i
};
var parseQuarterPatterns5 = {
  any: [/1/i, /2/i, /3/i, /4/i]
};
var matchMonthPatterns5 = {
  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 parseMonthPatterns5 = {
  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 matchDayPatterns5 = {
  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 parseDayPatterns5 = {
  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 matchDayPeriodPatterns5 = {
  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 parseDayPeriodPatterns5 = {
  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 match5 = {
  ordinalNumber: buildMatchPatternFn2({
    matchPattern: matchOrdinalNumberPattern5,
    parsePattern: parseOrdinalNumberPattern5,
    valueCallback: function valueCallback9(value) {
      return parseInt(value, 10);
    }
  }),
  era: buildMatchFn2({
    matchPatterns: matchEraPatterns5,
    defaultMatchWidth: "wide",
    parsePatterns: parseEraPatterns5,
    defaultParseWidth: "any"
  }),
  quarter: buildMatchFn2({
    matchPatterns: matchQuarterPatterns5,
    defaultMatchWidth: "wide",
    parsePatterns: parseQuarterPatterns5,
    defaultParseWidth: "any",
    valueCallback: function valueCallback10(index) {
      return index + 1;
    }
  }),
  month: buildMatchFn2({
    matchPatterns: matchMonthPatterns5,
    defaultMatchWidth: "wide",
    parsePatterns: parseMonthPatterns5,
    defaultParseWidth: "any"
  }),
  day: buildMatchFn2({
    matchPatterns: matchDayPatterns5,
    defaultMatchWidth: "wide",
    parsePatterns: parseDayPatterns5,
    defaultParseWidth: "any"
  }),
  dayPeriod: buildMatchFn2({
    matchPatterns: matchDayPeriodPatterns5,
    defaultMatchWidth: "any",
    parsePatterns: parseDayPeriodPatterns5,
    defaultParseWidth: "any"
  })
};
var match_default5 = match5;

// ../../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_default5,
  formatLong: formatLong_default,
  formatRelative: formatRelative_default5,
  localize: localize_default5,
  match: match_default5,
  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;
  requiredArgs2(2, arguments);
  var formatStr = String(dirtyFormatStr);
  var defaultOptions3 = getDefaultOptions2();
  var locale6 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions3.locale) !== null && _ref !== void 0 ? _ref : defaultLocale_default;
  var firstWeekContainsDate = toInteger2((_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 : defaultOptions3.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions3.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 = toInteger2((_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 : defaultOptions3.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions3.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 (!locale6.localize) {
    throw new RangeError("locale must contain localize property");
  }
  if (!locale6.formatLong) {
    throw new RangeError("locale must contain formatLong property");
  }
  var originalDate = toDate2(dirtyDate);
  if (!isValid(originalDate)) {
    throw new RangeError("Invalid time value");
  }
  var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
  var utcDate = subMilliseconds(originalDate, timezoneOffset);
  var formatterOptions = {
    firstWeekContainsDate,
    weekStartsOn,
    locale: locale6,
    _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, locale6.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, locale6.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 formatDistance11(dirtyDate, dirtyBaseDate, options) {
  var _ref, _options$locale;
  requiredArgs2(2, arguments);
  var defaultOptions3 = getDefaultOptions2();
  var locale6 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions3.locale) !== null && _ref !== void 0 ? _ref : defaultLocale_default;
  if (!locale6.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 = toDate2(dirtyBaseDate);
    dateRight = toDate2(dirtyDate);
  } else {
    dateLeft = toDate2(dirtyDate);
    dateRight = toDate2(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 locale6.formatDistance("lessThanXSeconds", 5, localizeOptions);
      } else if (seconds < 10) {
        return locale6.formatDistance("lessThanXSeconds", 10, localizeOptions);
      } else if (seconds < 20) {
        return locale6.formatDistance("lessThanXSeconds", 20, localizeOptions);
      } else if (seconds < 40) {
        return locale6.formatDistance("halfAMinute", 0, localizeOptions);
      } else if (seconds < 60) {
        return locale6.formatDistance("lessThanXMinutes", 1, localizeOptions);
      } else {
        return locale6.formatDistance("xMinutes", 1, localizeOptions);
      }
    } else {
      if (minutes === 0) {
        return locale6.formatDistance("lessThanXMinutes", 1, localizeOptions);
      } else {
        return locale6.formatDistance("xMinutes", minutes, localizeOptions);
      }
    }
  } else if (minutes < 45) {
    return locale6.formatDistance("xMinutes", minutes, localizeOptions);
  } else if (minutes < 90) {
    return locale6.formatDistance("aboutXHours", 1, localizeOptions);
  } else if (minutes < MINUTES_IN_DAY) {
    var hours = Math.round(minutes / 60);
    return locale6.formatDistance("aboutXHours", hours, localizeOptions);
  } else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) {
    return locale6.formatDistance("xDays", 1, localizeOptions);
  } else if (minutes < MINUTES_IN_MONTH) {
    var days = Math.round(minutes / MINUTES_IN_DAY);
    return locale6.formatDistance("xDays", days, localizeOptions);
  } else if (minutes < MINUTES_IN_TWO_MONTHS) {
    months = Math.round(minutes / MINUTES_IN_MONTH);
    return locale6.formatDistance("aboutXMonths", months, localizeOptions);
  }
  months = differenceInMonths(dateRight, dateLeft);
  if (months < 12) {
    var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH);
    return locale6.formatDistance("xMonths", nearestMonth, localizeOptions);
  } else {
    var monthsSinceStartOfYear = months % 12;
    var years = Math.floor(months / 12);
    if (monthsSinceStartOfYear < 3) {
      return locale6.formatDistance("aboutXYears", years, localizeOptions);
    } else if (monthsSinceStartOfYear < 9) {
      return locale6.formatDistance("overXYears", years, localizeOptions);
    } else {
      return locale6.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 defaultOptions3 = getDefaultOptions2();
  var locale6 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions3.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 (!locale6.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(locale6.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) {
  requiredArgs2(1, arguments);
  var start = toDate2(interval.start);
  var end = toDate2(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) {
  requiredArgs2(2, arguments);
  var date2 = toDate2(dirtyDate);
  var dateToCompare = toDate2(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) {
  requiredArgs2(1, arguments);
  return toDate2(dirtyDate).getTime() > Date.now();
}

// 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;
  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: initial3,
  onChange
}) {
  const [value, handler] = p3({
    v: toTwoDigitString(initial3)
  });
  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(initial3) });
        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,
  withoutClear,
  side
}) {
  const [opened, setOpened] = p3(false);
  const { i18n: i18n2 } = useTranslationContext();
  const { error: error2, required, value: anyValue, onChange } = useField(name);
  let strValue = "";
  const value = anyValue;
  if (!value) {
    strValue = "";
  } else if (value.d_ms === "forever") {
    strValue = i18n2.str`forever`;
  } else {
    if (value.d_ms === void 0) {
      throw Error(
        `assertion error: duration should have a d_ms but got '${JSON.stringify(
          value
        )}'`
      );
    }
    strValue = formatDuration(
      intervalToDuration({ start: 0, end: value.d_ms }),
      {
        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" }))), /* @__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), /* @__PURE__ */ h("span", { class: "has-text-grey" }, help)), withForever && /* @__PURE__ */ h("span", { "data-tooltip": i18n2.str`change value to never` }, /* @__PURE__ */ h(
    "button",
    {
      class: "button is-info mr-3",
      onClick: () => onChange({ d_ms: "forever" })
    },
    /* @__PURE__ */ h(i18n2.Translate, null, "forever")
  )), !readonly && !withoutClear && /* @__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")
  )), side), opened && /* @__PURE__ */ h(SimpleModal, { onCancel: () => setOpened(false) }, /* @__PURE__ */ h(
    DurationPicker,
    {
      days: true,
      hours: true,
      minutes: true,
      value: !value || value.d_ms === "forever" ? 0 : value.d_ms,
      onChange: (v3) => {
        onChange({ d_ms: 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?.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: () => image.current?.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: () => image.current?.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/InputToggle.tsx
init_preact_module();
var defaultToBoolean = (f3) => f3;
var defaultFromBoolean = (v3) => v3;
function InputToggle({
  name,
  readonly,
  placeholder,
  tooltip,
  label,
  help,
  threeState,
  side,
  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: "toggle-checkbox",
      checked: toBoolean(value),
      placeholder,
      ref: (d5) => {
        if (d5) {
          d5.indeterminate = !!threeState && toBoolean(value) === void 0;
        }
      },
      readonly,
      name: String(name),
      disabled: readonly,
      onChange: onCheckboxClick
    }
  ), /* @__PURE__ */ h(
    "div",
    {
      class: `toggle-switch ${readonly ? "disabled" : ""} ${toBoolean(value) === void 0 ? "no-dot" : ""}`,
      style: { cursor: readonly ? "default" : void 0 }
    }
  )), /* @__PURE__ */ h("p", null, help)), error2 && /* @__PURE__ */ h("p", { class: "help is-danger" }, error2)), side));
}

// src/components/form/InputWithAddon.tsx
init_preact_module();
var defaultToString2 = (f3) => f3 || "";
var defaultFromString2 = (v3) => v3;
function InputWithAddon({
  name,
  readonly,
  addonBefore,
  children,
  expand,
  label,
  placeholder,
  help,
  tooltip,
  inputType,
  inputExtra,
  side,
  addonAfter,
  addonAfterAction,
  toStr = defaultToString2,
  fromStr = defaultFromString2
}) {
  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",
      {
        ...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", onClick: addonAfterAction, style: { cursor: addonAfterAction ? "pointer" : void 0 } }, /* @__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)), expand ? /* @__PURE__ */ h("div", null, side) : side));
}

// src/components/instance/DefaultInstanceFormFields.tsx
function DefaultInstanceFormFields({
  readonlyId,
  showId,
  showLessFields
}) {
  const { i18n: i18n2 } = useTranslationContext();
  const { state } = useSessionContext();
  return /* @__PURE__ */ h(p2, null, showId && /* @__PURE__ */ h(
    InputWithAddon,
    {
      name: "id",
      addonBefore: new URL("instances/", state.backendUrl.href).href,
      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.`
    }
  ), showLessFields ? void 0 : /* @__PURE__ */ h(p2, null, /* @__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(
    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(
    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(
    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/hooks/preference.ts
var defaultSettings = {
  advanceOrderMode: false,
  advanceInstanceMode: false,
  hideKycUntil: AbsoluteTime.never(),
  hideMissingAccountUntil: AbsoluteTime.never(),
  dateFormat: "ymd"
};
var codecForPreferences = () => buildCodecForObject().property("advanceOrderMode", codecForBoolean()).property("advanceInstanceMode", codecForBoolean()).property("hideKycUntil", codecForAbsoluteTime).property("hideMissingAccountUntil", codecForAbsoluteTime).property(
  "dateFormat",
  codecForEither(
    codecForConstString("ymd"),
    codecForConstString("dmy"),
    codecForConstString("mdy")
  )
).build("Preferences");
var PREFERENCES_KEY = buildStorageKey(
  "merchant-preferences",
  codecForPreferences()
);
function usePreference() {
  const { value, update } = useLocalStorage(PREFERENCES_KEY, defaultSettings);
  function updateField(k5, v3) {
    const newValue = { ...value, [k5]: v3 };
    update(newValue);
  }
  return [value, updateField, 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/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: true,
    default_pay_delay: { d_ms: 2 * 60 * 60 * 1e3 },
    // two hours
    default_wire_transfer_delay: { d_ms: 2 * 60 * 60 * 24 * 1e3 }
    // two days
  };
}
function CreatePage({ onCreate, onBack, forceId }) {
  const [pref, updatePref] = usePreference();
  const { i18n: i18n2 } = useTranslationContext();
  const [value, valueHandler] = p3(with_defaults(forceId));
  const [isTokenSet, updateIsTokenSet] = p3(false);
  const [isTokenDialogActive, updateIsTokenDialogActive] = p3(false);
  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` : !!value.default_wire_transfer_delay && value.default_wire_transfer_delay.d_ms !== "forever" && value.default_pay_delay.d_ms !== "forever" && value.default_pay_delay.d_ms > value.default_wire_transfer_delay.d_ms ? i18n2.str`pay delay can't be greater than wire transfer delay` : void 0,
    default_wire_transfer_delay: !value.default_wire_transfer_delay ? i18n2.str`required` : void 0,
    address: undefinedIfEmpty({
      address_lines: value.address?.address_lines && value.address?.address_lines.length > 7 ? i18n2.str`max 7 lines` : void 0
    }),
    jurisdiction: undefinedIfEmpty({
      address_lines: value.address?.address_lines && value.address?.address_lines.length > 7 ? i18n2.str`max 7 lines` : void 0
    })
  };
  const hasErrors = Object.keys(errors2).some(
    (k5) => errors2[k5] !== void 0
  );
  const submit = () => {
    const newValue = structuredClone(value);
    const newToken = newValue.auth_token;
    newValue.auth_token = void 0;
    newValue.auth = newToken === null || newToken === void 0 ? { method: "external" } : { method: "token", token: createRFC8959AccessTokenPlain(newToken) };
    if (!newValue.address)
      newValue.address = {};
    if (!newValue.jurisdiction)
      newValue.jurisdiction = {};
    newValue.default_pay_delay = Duration.toTalerProtocolDuration(
      newValue.default_pay_delay
    );
    newValue.default_wire_transfer_delay = Duration.toTalerProtocolDuration(
      newValue.default_wire_transfer_delay
    );
    return onCreate(
      newValue
    );
  };
  function updateToken(token) {
    valueHandler((old) => ({
      ...old,
      auth_token: token === null ? void 0 : token
    }));
  }
  return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("div", { class: "columns" }, /* @__PURE__ */ h("div", { class: "column" }), /* @__PURE__ */ h("div", { class: "column is-four-fifths" }, isTokenDialogActive && /* @__PURE__ */ h(
    SetTokenNewInstanceModal,
    {
      onCancel: () => {
        updateIsTokenDialogActive(false);
        updateIsTokenSet(false);
      },
      onClear: () => {
        updateToken(null);
        updateIsTokenDialogActive(false);
        updateIsTokenSet(true);
      },
      onConfirm: (newToken) => {
        updateToken(newToken);
        updateIsTokenDialogActive(false);
        updateIsTokenSet(true);
      }
    }
  )), /* @__PURE__ */ h("div", { class: "column" })), /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h("div", { class: "tabs is-toggle is-fullwidth is-small" }, /* @__PURE__ */ h("ul", null, /* @__PURE__ */ h(
    "li",
    {
      class: !pref.advanceInstanceMode ? "is-active" : "",
      onClick: () => {
        updatePref("advanceInstanceMode", false);
      }
    },
    /* @__PURE__ */ h("a", null, /* @__PURE__ */ h("span", null, /* @__PURE__ */ h(i18n2.Translate, null, "Simple")))
  ), /* @__PURE__ */ h(
    "li",
    {
      class: pref.advanceInstanceMode ? "is-active" : "",
      onClick: () => {
        updatePref("advanceInstanceMode", true);
      }
    },
    /* @__PURE__ */ h("a", null, /* @__PURE__ */ h("span", null, /* @__PURE__ */ h(i18n2.Translate, null, "Advanced")))
  ))), " ", /* @__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,
        showLessFields: !pref.advanceInstanceMode
      }
    )
  ), /* @__PURE__ */ h("div", { class: "level" }, /* @__PURE__ */ h("div", { class: "level-item has-text-centered" }, /* @__PURE__ */ h("h1", { class: "title" }, /* @__PURE__ */ h(
    "button",
    {
      class: !isTokenSet ? "button is-danger has-tooltip-bottom" : !value.auth_token ? "button has-tooltip-bottom" : "button is-info has-tooltip-bottom",
      "data-tooltip": i18n2.str`change authorization configuration`,
      onClick: () => updateIsTokenDialogActive(true)
    },
    /* @__PURE__ */ h("div", { class: "icon is-centered" }, /* @__PURE__ */ h("i", { class: "mdi mdi-lock-reset" })),
    /* @__PURE__ */ h("span", null, /* @__PURE__ */ h(i18n2.Translate, null, "Set access token"))
  )))), /* @__PURE__ */ h("div", { class: "level" }, /* @__PURE__ */ h("div", { class: "level-item has-text-centered" }, !isTokenSet ? /* @__PURE__ */ h("p", { class: "is-size-6" }, /* @__PURE__ */ h(i18n2.Translate, null, "Access token is not yet configured. This instance can't be created.")) : value.auth_token === void 0 ? /* @__PURE__ */ h("p", { class: "is-size-6" }, /* @__PURE__ */ h(i18n2.Translate, null, "No access token. Authorization must be handled externally.")) : /* @__PURE__ */ h("p", { class: "is-size-6" }, /* @__PURE__ */ h(i18n2.Translate, null, "Access token is set. Authorization is handled by the merchant backend.")))), /* @__PURE__ */ h("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 || !isTokenSet,
      "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/index.tsx
function Create({ onBack, onConfirm, forceId }) {
  const [notif, setNotif] = p3(void 0);
  const { i18n: i18n2 } = useTranslationContext();
  const { lib } = useSessionContext();
  const { state, logIn } = useSessionContext();
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    CreatePage,
    {
      onBack,
      forceId,
      onCreate: async (d5) => {
        if (state.status !== "loggedIn")
          return;
        try {
          await lib.instance.createInstance(state.token, d5);
          if (d5.auth.token) {
            const result = await lib.authenticate.createAccessTokenBearer(
              d5.auth.token,
              {
                scope: "write",
                duration: {
                  d_us: "forever"
                },
                refreshable: true
              }
            );
            if (result.type === "ok") {
              const { token } = result.body;
              logIn(token);
            }
          }
          onConfirm();
        } catch (ex) {
          if (ex instanceof Error) {
            setNotif({
              message: i18n2.str`Failed to create instance`,
              type: "ERROR",
              description: ex.message
            });
          } else {
            console.error(ex);
          }
        }
      }
    }
  ));
}

// src/paths/admin/list/index.tsx
init_preact_module();
init_hooks_module();

// src/components/ErrorLoadingMerchant.tsx
init_preact_module();
function ErrorLoadingMerchant({ error: error2, showDetail }) {
  const { i18n: i18n2 } = useTranslationContext();
  switch (error2.errorDetail.code) {
    case TalerErrorCode.GENERIC_TIMEOUT: {
      if (error2.hasErrorCode(TalerErrorCode.GENERIC_TIMEOUT)) {
        const { requestMethod, requestUrl, timeoutMs } = error2.errorDetail;
        return /* @__PURE__ */ h(
          NotificationCard,
          {
            notification: {
              type: "ERROR",
              message: i18n2.str`The request reached a timeout, check your connection.`,
              description: error2.message,
              details: JSON.stringify({ requestMethod, requestUrl, timeoutMs }, void 0, 2)
            }
          }
        );
      }
      assertUnreachable(1);
    }
    case TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR: {
      if (error2.hasErrorCode(TalerErrorCode.GENERIC_CLIENT_INTERNAL_ERROR)) {
        const { requestMethod, requestUrl, timeoutMs } = error2.errorDetail;
        return /* @__PURE__ */ h(
          NotificationCard,
          {
            notification: {
              type: "ERROR",
              message: i18n2.str`The request was cancelled.`,
              description: error2.message,
              details: JSON.stringify({ requestMethod, requestUrl, timeoutMs }, void 0, 2)
            }
          }
        );
      }
      assertUnreachable(1);
    }
    case TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT: {
      if (error2.hasErrorCode(TalerErrorCode.WALLET_HTTP_REQUEST_GENERIC_TIMEOUT)) {
        const { requestMethod, requestUrl, timeoutMs } = error2.errorDetail;
        return /* @__PURE__ */ h(
          NotificationCard,
          {
            notification: {
              type: "ERROR",
              message: i18n2.str`The request reached a timeout, check your connection.`,
              description: error2.message,
              details: JSON.stringify({ requestMethod, requestUrl, timeoutMs }, void 0, 2)
            }
          }
        );
      }
      assertUnreachable(1);
    }
    case TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED: {
      if (error2.hasErrorCode(TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED)) {
        const { requestMethod, requestUrl, throttleStats } = error2.errorDetail;
        return /* @__PURE__ */ h(
          NotificationCard,
          {
            notification: {
              type: "ERROR",
              message: i18n2.str`A lot of request were made to the same server and this action was throttled.`,
              description: error2.message,
              details: JSON.stringify({ requestMethod, requestUrl, throttleStats }, void 0, 2)
            }
          }
        );
      }
      assertUnreachable(1);
    }
    case TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE: {
      if (error2.hasErrorCode(TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE)) {
        const { requestMethod, requestUrl, httpStatusCode, validationError } = error2.errorDetail;
        return /* @__PURE__ */ h(
          NotificationCard,
          {
            notification: {
              type: "ERROR",
              message: i18n2.str`The response of the request is malformed.`,
              description: error2.message,
              details: JSON.stringify({ requestMethod, requestUrl, httpStatusCode, validationError }, void 0, 2)
            }
          }
        );
      }
      assertUnreachable(1);
    }
    case TalerErrorCode.WALLET_NETWORK_ERROR: {
      if (error2.hasErrorCode(TalerErrorCode.WALLET_NETWORK_ERROR)) {
        const { requestMethod, requestUrl } = error2.errorDetail;
        return /* @__PURE__ */ h(
          NotificationCard,
          {
            notification: {
              type: "ERROR",
              message: i18n2.str`Could not complete the request due to a network problem.`,
              description: error2.message,
              details: JSON.stringify({ requestMethod, requestUrl }, void 0, 2)
            }
          }
        );
      }
      assertUnreachable(1);
    }
    case TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR: {
      if (error2.hasErrorCode(TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR)) {
        const { requestMethod, requestUrl, httpStatusCode, errorResponse } = error2.errorDetail;
        return /* @__PURE__ */ h(
          NotificationCard,
          {
            notification: {
              type: "ERROR",
              message: i18n2.str`Unexpected request error.`,
              description: error2.message,
              details: JSON.stringify({ requestMethod, requestUrl, httpStatusCode, errorResponse }, void 0, 2)
            }
          }
        );
      }
      assertUnreachable(1);
    }
    default: {
      return /* @__PURE__ */ h(
        NotificationCard,
        {
          notification: {
            type: "ERROR",
            message: i18n2.str`Unexpected error.`,
            description: error2.message,
            details: JSON.stringify(error2.errorDetail, void 0, 2)
          }
        }
      );
    }
  }
}

// src/hooks/instance.ts
var useSWR2 = useSWR;
function revalidateInstanceDetails() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "getCurrentInstanceDetails",
    void 0,
    { revalidate: true }
  );
}
function useInstanceDetails() {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  async function fetcher([token]) {
    return await instance.getCurrentInstanceDetails(token);
  }
  const { data, error: error2 } = useSWR2([session.token, "getCurrentInstanceDetails"], fetcher);
  if (data)
    return data;
  if (error2)
    return error2;
  return void 0;
}
function useInstanceKYCDetails() {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  async function fetcher([token]) {
    return await instance.getCurrentIntanceKycStatus(token, {});
  }
  const { data, error: error2 } = useSWR2([session.token, "getCurrentIntanceKycStatus"], fetcher);
  if (data)
    return data;
  if (error2)
    return error2;
  return void 0;
}
function revalidateManagedInstanceDetails() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "getInstanceDetails",
    void 0,
    { revalidate: true }
  );
}
function useManagedInstanceDetails(instanceId) {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  async function fetcher([token, instanceId2]) {
    return await instance.getInstanceDetails(token, instanceId2);
  }
  const { data, error: error2 } = useSWR2([session.token, instanceId, "getInstanceDetails"], fetcher);
  if (data)
    return data;
  if (error2)
    return error2;
  return void 0;
}
function revalidateBackendInstances() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "listInstances",
    void 0,
    { revalidate: true }
  );
}
function useBackendInstances() {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  async function fetcher([token]) {
    return await instance.listInstances(token);
  }
  const { data, error: error2 } = useSWR2([session.token, "listInstances"], fetcher);
  if (data)
    return data;
  if (error2)
    return error2;
  return void 0;
}

// src/paths/login/index.tsx
init_preact_module();
init_hooks_module();
var tokenRequest = {
  scope: "write",
  duration: {
    d_us: "forever"
  },
  refreshable: true
};
function LoginPage(_p) {
  const [token, setToken] = p3("");
  const [notif, setNotif] = p3(void 0);
  const { state, logIn } = useSessionContext();
  const { lib } = useSessionContext();
  const { i18n: i18n2 } = useTranslationContext();
  async function doLoginImpl() {
    const result = await lib.authenticate.createAccessTokenBearer(
      createRFC8959AccessTokenEncoded(token),
      tokenRequest
    );
    if (result.type === "ok") {
      const { token: token2 } = result.body;
      logIn(token2);
      return;
    } else {
      switch (result.case) {
        case HttpStatusCode.Unauthorized: {
          setNotif({
            message: "Your password is incorrect",
            type: "ERROR"
          });
          return;
        }
        case HttpStatusCode.NotFound: {
          setNotif({
            message: "Your instance not found",
            type: "ERROR"
          });
          return;
        }
      }
    }
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__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 for ", /* @__PURE__ */ h("b", null, '"', state.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 ? doLoginImpl() : null,
        value: token,
        onInput: (e4) => setToken(e4?.currentTarget.value)
      }
    )))))
  ), /* @__PURE__ */ h(
    "footer",
    {
      class: "modal-card-foot ",
      style: {
        justifyContent: "space-between",
        border: "1px solid",
        borderTop: 0
      }
    },
    /* @__PURE__ */ h("div", null),
    /* @__PURE__ */ h(AsyncButton2, { type: "is-info", onClick: doLoginImpl }, /* @__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
  );
}

// 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,
  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,
      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,
  instances,
  onUpdate,
  onDelete,
  onPurge
}) {
  const { i18n: i18n2 } = useTranslationContext();
  const { lib } = useSessionContext();
  const { impersonate } = useSessionContext();
  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`,
        onClick: async (_e) => {
          const newInstanceApi = lib.subInstanceApi(i4.id);
          impersonate(new URL(newInstanceApi.instance.baseUrl));
        }
      },
      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-magnify 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,
  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,
      onUpdate,
      selected,
      onCreate
    }
  ));
}

// src/paths/admin/list/index.tsx
function Instances({
  onCreate,
  onUpdate
}) {
  const result = useBackendInstances();
  const [deleting, setDeleting] = p3(null);
  const [purging, setPurging] = p3(null);
  const [notif, setNotif] = p3(void 0);
  const { i18n: i18n2 } = useTranslationContext();
  const { lib } = useSessionContext();
  const { state } = useSessionContext();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result.case);
      }
    }
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    View,
    {
      instances: result.body.instances,
      onDelete: setDeleting,
      onCreate,
      onPurge: setPurging,
      onUpdate,
      selected: !!deleting
    }
  ), deleting && /* @__PURE__ */ h(
    DeleteModal,
    {
      element: deleting,
      onCancel: () => setDeleting(null),
      onConfirm: async () => {
        if (state.status !== "loggedIn") {
          return;
        }
        try {
          await lib.instance.deleteInstance(state.token, 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 () => {
        if (state.status !== "loggedIn") {
          return;
        }
        try {
          await lib.instance.deleteInstance(state.token, purging.id, { purge: true });
          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/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. &quot;USD:2.3&quot;.": [
        ""
      ],
      "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. &quot;USD:2.3&quot;.": [
        ""
      ],
      "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. &quot;USD:2.3&quot;.": [
        "Ingrese divisa y valor separado por dos puntos, e.g. &quot;USD:2.3&quot;."
      ],
      "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. &quot;USD:2.3&quot;.": [
        ""
      ],
      "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. &quot;USD:2.3&quot;.": [
        ""
      ],
      "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. &quot;USD:2.3&quot;.": [
        ""
      ],
      "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.12.2" : void 0;
function Sidebar({ mobile }) {
  const { i18n: i18n2 } = useTranslationContext();
  const { state, logOut, config } = useSessionContext();
  const kycStatus = useInstanceKYCDetails();
  const needKYC = kycStatus !== void 0 && !(kycStatus instanceof TalerError) && kycStatus.type === "ok" && !!kycStatus.body;
  const isLoggedIn = state.status === "loggedIn";
  const hasToken = isLoggedIn && state.token !== void 0;
  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" }, isLoggedIn ? /* @__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: "/inventory", 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, "Inventory")))), /* @__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-qrcode" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Templates")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/tokenfamilies", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-key" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Token Families")))), 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: "/otp-devices", 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, "OTP Devices")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/webhooks", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-webhook" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Webhooks")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/settings", class: "has-icon" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-square-edit-outline" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, /* @__PURE__ */ h(i18n2.Translate, null, "Settings")))), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("a", { href: "/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", href: "/interface" }, /* @__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-web" })), /* @__PURE__ */ h("span", { class: "menu-item-label" }, state.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" }, state.instance))), state.isAdmin && /* @__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"))))), hasToken ? /* @__PURE__ */ h("li", null, /* @__PURE__ */ h(
      "a",
      {
        class: "has-icon is-state-info is-hoverable",
        onClick: (e4) => {
          logOut();
          e4.preventDefault();
        }
      },
      /* @__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"))
    )) : void 0))
  );
}

// src/components/menu/index.tsx
function getInstanceTitle(path, id) {
  switch (path) {
    case "/settings" /* settings */:
      return `${id}: Settings`;
    case "/bank/new" /* bank_new */:
      return `${id}: New bank account`;
    case "/bank" /* bank_list */:
      return `${id}: Bank accounts`;
    case "/bank/:bid/update" /* bank_update */:
      return `${id}: Update bank Account`;
    case "/orders" /* order_list */:
      return `${id}: Orders`;
    case "/order/new" /* order_new */:
      return `${id}: New order`;
    case "/inventory" /* inventory_list */:
      return `${id}: Inventory`;
    case "/inventory/new" /* inventory_new */:
      return `${id}: New product`;
    case "/inventory/:pid/update" /* inventory_update */:
      return `${id}: Update product`;
    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 "/otp-devices" /* otp_devices_list */:
      return `${id}: OTP devices`;
    case "/otp-devices/new" /* otp_devices_new */:
      return `${id}: New OTP device`;
    case "/otp-devices/:vid/update" /* otp_devices_update */:
      return `${id}: Update OTP device`;
    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" /* interface */:
      return `${id}: Interface`;
    case "/tokenfamilies" /* token_family_list */:
      return `${id}: Token families`;
    case "/tokenfamilies/new" /* token_family_new */:
      return `${id}: New token family`;
    case "/tokenfamilies/:slug/update" /* token_family_update */:
      return `${id}: Update token family`;
    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(_p) {
  const [mobileOpen, setMobileOpen] = p3(false);
  const { state, deImpersonate } = useSessionContext();
  const { path } = useNavigationContext();
  const titleWithSubtitle = !state.isAdmin ? getInstanceTitle(path, state.instance) : getAdminTitle(path, state.instance);
  const isLoggedIn = state.status === "loggedIn";
  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
      }
    ),
    isLoggedIn && /* @__PURE__ */ h(Sidebar, { mobile: mobileOpen }),
    state.status !== "loggedOut" && state.impersonated && /* @__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, '"', state.instance, '"'), ".", " ", /* @__PURE__ */ h(
        "a",
        {
          href: "#/instances",
          onClick: () => {
            deImpersonate();
          }
        },
        "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
      }
    )
  );
}

// src/hooks/bank.ts
var useSWR3 = useSWR;
function revalidateInstanceBankAccounts() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "listBankAccounts",
    void 0,
    { revalidate: true }
  );
}
function useInstanceBankAccounts() {
  const { state: session } = useSessionContext();
  const {
    lib: { instance }
  } = useSessionContext();
  async function fetcher([token, _bid]) {
    return await instance.listBankAccounts(token, {
      // limit: PAGINATED_LIST_REQUEST,
      // offset: bid,
      // order: "dec",
    });
  }
  const { data, error: error2 } = useSWR3([session.token, "offset", "listBankAccounts"], fetcher);
  if (error2)
    return error2;
  if (data === void 0)
    return void 0;
  if (data.type !== "ok")
    return data;
  const filtered = data.body.accounts.filter((a5) => a5.active);
  data.body.accounts = filtered;
  return data;
}
function revalidateBankAccountDetails() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "getBankAccountDetails",
    void 0,
    { revalidate: true }
  );
}
function useBankAccountDetails(h_wire) {
  const { state: session } = useSessionContext();
  const {
    lib: { instance }
  } = useSessionContext();
  async function fetcher([token, wireId]) {
    return await instance.getBankAccountDetails(token, wireId);
  }
  const { data, error: error2 } = useSWR3([session.token, h_wire, "getBankAccountDetails"], fetcher);
  if (data)
    return data;
  if (error2)
    return error2;
  return void 0;
}

// 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();

// src/components/form/InputSelector.tsx
init_preact_module();
var defaultToString3 = (f3) => f3 || "";
var defaultFromString3 = (v3) => v3;
function InputSelector({
  name,
  readonly,
  expand,
  placeholder,
  tooltip,
  label,
  help,
  values,
  fromStr = defaultFromString3,
  toStr = defaultToString3
}) {
  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/InputPaytoForm.tsx
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_path1(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_path1(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.`;
}
var DOMAIN_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9-_]{1,61}[a-zA-Z0-9-_](?:\.[a-zA-Z0-9-_]{2,})+(:[0-9]+)?(\/[a-zA-Z0-9-.]+)*\/?$/;
function validateTalerBank_path1(addr, i18n2) {
  try {
    const valid = DOMAIN_REGEX.test(addr);
    if (valid)
      return void 0;
  } catch (e4) {
    console.log(e4);
  }
  return i18n2.str`This is not a valid host.`;
}
function validateIBAN_path1(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
}) {
  const { value: initialValueStr, onChange } = useField(name);
  const initialPayto = parsePaytoUri(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 initial3 = initialPayto === void 0 ? defaultTarget : {
    target: initialPayto.targetType,
    params: initialPayto.params,
    path1: initialPath1,
    path2: initialPath2
  };
  const [value, setValue] = p3(initial3);
  h2(() => {
    const nv = parsePaytoUri(initialValueStr ?? "");
    const paths2 = !initialPayto ? [] : initialPayto.targetPath.split("/");
    if (nv !== void 0 && nv.isKnown) {
      if (nv.targetType === "iban" && paths2.length >= 2) {
        paths2[0] = paths2[1];
        delete paths2[1];
      }
      setValue({
        target: nv.targetType,
        params: nv.params,
        path1: paths2.length >= 1 ? paths2[0] : void 0,
        path2: paths2.length >= 2 ? paths2[1] : void 0
      });
    }
  }, [initialValueStr]);
  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_path1(value.path1, i18n2) : value.target === "bitcoin" ? validateBitcoin_path1(value.path1, i18n2) : value.target === "ethereum" ? validateEthereum_path1(value.path1, i18n2) : value.target === "x-taler-bank" ? validateTalerBank_path1(value.path1, i18n2) : void 0,
    path2: value.target === "x-taler-bank" ? !value.path2 ? i18n2.str`required` : void 0 : void 0,
    params: undefinedIfEmpty({
      "receiver-name": !value.params?.["receiver-name"] ? i18n2.str`required` : void 0
    })
  };
  const hasErrors = Object.keys(errors2).some(
    (k5) => errors2[k5] !== void 0
  );
  const path1WithSlash = value.path1 && !value.path1.endsWith("/") ? value.path1 + "/" : value.path1;
  const pto = hasErrors || !value.target ? void 0 : {
    targetType: value.target,
    targetPath: value.path2 ? `${path1WithSlash}${value.path2}` : value.path1 ?? "",
    params: value.params ?? {},
    isKnown: false
  };
  const str = !pto ? void 0 : stringifyPaytoUri(pto);
  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`Type`,
        tooltip: i18n2.str`Method to use for wire transfer`,
        values: targets,
        readonly,
        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`,
        readonly,
        tooltip: i18n2.str`Routing number.`
      }
    ), /* @__PURE__ */ h(
      Input,
      {
        name: "path2",
        label: i18n2.str`Account`,
        readonly,
        tooltip: i18n2.str`Account number.`
      }
    )),
    value.target === "bic" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
      Input,
      {
        name: "path1",
        label: i18n2.str`Code`,
        readonly,
        tooltip: i18n2.str`Business Identifier Code.`
      }
    )),
    value.target === "iban" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
      Input,
      {
        name: "path1",
        label: i18n2.str`IBAN`,
        tooltip: i18n2.str`International Bank Account Number.`,
        readonly,
        placeholder: "DE1231231231",
        inputExtra: { style: { textTransform: "uppercase" } }
      }
    )),
    value.target === "upi" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
      Input,
      {
        name: "path1",
        readonly,
        label: i18n2.str`Account`,
        tooltip: i18n2.str`Unified Payment Interface.`
      }
    )),
    value.target === "bitcoin" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
      Input,
      {
        name: "path1",
        readonly,
        label: i18n2.str`Address`,
        tooltip: i18n2.str`Bitcoin protocol.`
      }
    )),
    value.target === "ethereum" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
      Input,
      {
        name: "path1",
        readonly,
        label: i18n2.str`Address`,
        tooltip: i18n2.str`Ethereum protocol.`
      }
    )),
    value.target === "ilp" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
      Input,
      {
        name: "path1",
        readonly,
        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",
        readonly,
        label: i18n2.str`Host`,
        fromStr: (v3) => {
          if (v3.startsWith("http")) {
            try {
              const url = new URL(v3);
              return url.host + url.pathname;
            } catch {
              return v3;
            }
          }
          return v3;
        },
        tooltip: i18n2.str`Bank host.`,
        help: /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("div", null, /* @__PURE__ */ h(i18n2.Translate, null, "Without scheme and may include subpath:")), /* @__PURE__ */ h("div", null, "bank.com/"), /* @__PURE__ */ h("div", null, "bank.com/path/subpath/"))
      }
    ), /* @__PURE__ */ h(
      Input,
      {
        name: "path2",
        readonly,
        label: i18n2.str`Account`,
        tooltip: i18n2.str`Bank account.`
      }
    )),
    value.target !== noTargetValue && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
      Input,
      {
        name: "params.receiver-name",
        readonly,
        label: i18n2.str`Owner's name`,
        placeholder: "John Doe",
        tooltip: i18n2.str`Legal name of the person holding the account.`,
        help: i18n2.str`It should match the bank account name.`
      }
    ))
  ));
}

// src/paths/instance/accounts/update/UpdatePage.tsx
init_preact_module();
init_hooks_module();
var accountAuthType = ["unedit", "none", "basic"];
function UpdatePage({
  account,
  onUpdate,
  onBack,
  onReplace
}) {
  const { i18n: i18n2 } = useTranslationContext();
  const [state, setState] = p3({
    payto_uri: account.payto_uri,
    credit_facade_url: account.credit_facade_url,
    credit_facade_credentials: {
      // @ts-ignore
      type: "unedit"
    }
  });
  const [importing, setImporting] = p3(false);
  const [revenuePayto, setRevenuePayto] = p3(
    // parsePaytoUri("payto://x-taler-bank/asd.com:1010/asd/pepe"),
    void 0
  );
  const [testError, setTestError] = p3(
    void 0
  );
  const replacingAccountId = state.payto_uri !== account.payto_uri;
  const facadeURL = safeConvertURL(state.credit_facade_url);
  const errors2 = {
    payto_uri: !state.payto_uri ? i18n2.str`required` : void 0,
    credit_facade_url: !state.credit_facade_url ? void 0 : !facadeURL ? i18n2.str`Invalid url` : !facadeURL.href.endsWith("/") ? i18n2.str`URL should end with a '/'` : facadeURL.searchParams.size > 0 ? i18n2.str`URL should not contain params` : facadeURL.hash ? i18n2.str`URL should not hash param` : void 0,
    credit_facade_credentials: !state.credit_facade_credentials ? void 0 : undefinedIfEmpty({
      type: replacingAccountId && // @ts-ignore
      state.credit_facade_credentials?.type === "unedit" ? i18n2.str`required` : void 0,
      username: state.credit_facade_credentials?.type !== "basic" ? void 0 : !state.credit_facade_credentials.username ? i18n2.str`required` : void 0,
      password: state.credit_facade_credentials?.type !== "basic" ? void 0 : !state.credit_facade_credentials.password ? i18n2.str`required` : void 0
    })
  };
  const hasErrors = Object.keys(errors2).some(
    (k5) => errors2[k5] !== void 0
  );
  const submitForm = () => {
    if (hasErrors)
      return Promise.reject();
    const credit_facade_url = !state.credit_facade_url ? void 0 : facadeURL?.href;
    const credit_facade_credentials = credit_facade_url == void 0 || state.credit_facade_credentials === void 0 ? void 0 : (
      // @ts-ignore
      state.credit_facade_credentials.type === "unedit" ? void 0 : state.credit_facade_credentials.type === "basic" ? {
        type: "basic",
        password: state.credit_facade_credentials.password,
        username: state.credit_facade_credentials.username
      } : {
        type: "none"
      }
    );
    if (replacingAccountId) {
      console.log("======== REPLACE");
      return onReplace(account, {
        payto_uri: state.payto_uri,
        credit_facade_credentials,
        credit_facade_url
      });
    } else {
      console.log("======== UPDATE");
      return onUpdate({ credit_facade_credentials, credit_facade_url });
    }
  };
  async function testAccountInfo() {
    const revenueAPI = !state.credit_facade_url ? void 0 : new URL("./", state.credit_facade_url);
    if (revenueAPI) {
      const resp = await testRevenueAPI(
        revenueAPI,
        state.credit_facade_credentials
      );
      if (resp instanceof TalerError) {
        setTestError(i18n2.str`The request to check the revenue API failed.`);
        setState({
          ...state,
          verified: void 0
        });
        return;
      } else if (resp.type === "fail") {
        switch (resp.case) {
          case HttpStatusCode.BadRequest: {
            setTestError(i18n2.str`Server replied with "bad request".`);
            setState({
              ...state,
              verified: void 0
            });
            return;
          }
          case HttpStatusCode.Unauthorized: {
            setTestError(i18n2.str`Unauthorized, check credentials.`);
            setState({
              ...state,
              verified: false
            });
            return;
          }
          case HttpStatusCode.NotFound: {
            setTestError(
              i18n2.str`The endpoint doesn't seems to be a Taler Revenue API.`
            );
            setState({
              ...state,
              verified: void 0
            });
            return;
          }
          default: {
            assertUnreachable(resp);
          }
        }
      } else {
        const found = resp.body;
        const match6 = state.payto_uri === found;
        setState({
          ...state,
          verified: match6
        });
        if (!match6) {
          setRevenuePayto(parsePaytoUri(resp.body));
        }
        setTestError(void 0);
      }
    }
  }
  return /* @__PURE__ */ h(p2, 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, "Account:"), " ", /* @__PURE__ */ h("b", null, account.id.substring(0, 8), "..."))))))), /* @__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(
      InputPaytoForm,
      {
        name: "payto_uri",
        label: i18n2.str`Account`
      }
    ),
    /* @__PURE__ */ h("div", { class: "message-body", style: { marginBottom: 10 } }, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "If the bank supports Taler Revenue API then you can add the endpoint URL below to keep the revenue information in sync."))),
    /* @__PURE__ */ h(
      Input,
      {
        name: "credit_facade_url",
        label: i18n2.str`Endpoint URL`,
        help: "https://bank.demo.taler.net/accounts/_username_/taler-revenue/",
        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";
          if (str === "basic")
            return "With authentication";
          return "Do not change";
        }
      }
    ),
    state.credit_facade_credentials?.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.`
      }
    )) : void 0,
    /* @__PURE__ */ h(
      InputToggle,
      {
        label: i18n2.str`Match`,
        tooltip: i18n2.str`Check where the information match against the server info.`,
        name: "verified",
        readonly: true,
        threeState: true,
        help: testError !== void 0 ? testError : state.verified === void 0 ? i18n2.str`Not verified` : state.verified ? i18n2.str`Last test was ok` : i18n2.str`Last test failed`,
        side: /* @__PURE__ */ h(
          "button",
          {
            class: "button is-info",
            "data-tooltip": i18n2.str`Compare info from server with account form`,
            disabled: !state.credit_facade_url,
            onClick: async () => {
              const result = await testAccountInfo();
            }
          },
          /* @__PURE__ */ h(i18n2.Translate, null, "Test")
        )
      }
    )
  ), /* @__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")
  )))))), !importing ? void 0 : /* @__PURE__ */ h(
    ImportingAccountModal,
    {
      onCancel: () => {
        setImporting(false);
      },
      onConfirm: (ac) => {
        const u4 = new URL(ac.infoURL);
        const user = u4.username;
        const pwd = u4.password;
        u4.password = "";
        u4.username = "";
        const credit_facade_url = u4.href;
        setState({
          payto_uri: ac.accountURI,
          credit_facade_credentials: user || pwd ? {
            type: "basic",
            password: pwd,
            username: user
          } : void 0,
          credit_facade_url
        });
        setImporting(false);
      }
    }
  ), !revenuePayto ? void 0 : /* @__PURE__ */ h(
    CompareAccountsModal,
    {
      onCancel: () => {
        setRevenuePayto(void 0);
      },
      onConfirm: (d5) => {
        setState({
          ...state,
          payto_uri: d5
        });
        setRevenuePayto(void 0);
      },
      formPayto: !state.payto_uri ? void 0 : parsePaytoUri(state.payto_uri),
      testPayto: revenuePayto
    }
  ));
}
function safeConvertURL(s5) {
  if (!s5)
    return void 0;
  try {
    return new URL(s5);
  } catch (e4) {
    return void 0;
  }
}

// src/paths/instance/accounts/create/CreatePage.tsx
var accountAuthType2 = ["none", "basic"];
function CreatePage2({ onCreate, onBack }) {
  const { i18n: i18n2 } = useTranslationContext();
  const [importing, setImporting] = p3(false);
  const [state, setState] = p3({});
  const facadeURL = safeConvertURL(state.credit_facade_url);
  const [revenuePayto, setRevenuePayto] = p3(
    // parsePaytoUri("payto://x-taler-bank/asd.com:1010/asd/pepe"),
    void 0
  );
  const [testError, setTestError] = p3(
    void 0
  );
  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 : !facadeURL ? i18n2.str`Invalid url` : !facadeURL.href.endsWith("/") ? i18n2.str`URL should end with a '/'` : facadeURL.searchParams.size > 0 ? i18n2.str`URL should not contain params` : facadeURL.hash ? i18n2.str`URL should not hash param` : void 0
  };
  const hasErrors = Object.keys(errors2).some(
    (k5) => errors2[k5] !== void 0
  );
  const submitForm = () => {
    if (hasErrors)
      return Promise.reject();
    const credit_facade_url = !state.credit_facade_url ? void 0 : facadeURL?.href;
    const credit_facade_credentials = credit_facade_url == void 0 ? void 0 : state.credit_facade_credentials?.type === "basic" ? {
      type: "basic",
      password: state.credit_facade_credentials.password,
      username: state.credit_facade_credentials.username
    } : {
      type: "none"
    };
    return onCreate({
      payto_uri: state.payto_uri,
      credit_facade_credentials,
      credit_facade_url
    });
  };
  async function testAccountInfo() {
    const revenueAPI = !state.credit_facade_url ? void 0 : new URL("./", state.credit_facade_url);
    if (revenueAPI) {
      const resp = await testRevenueAPI(
        revenueAPI,
        state.credit_facade_credentials
      );
      if (resp instanceof TalerError) {
        setTestError(i18n2.str`The request to check the revenue API failed.`);
        setState({
          ...state,
          verified: void 0
        });
        return;
      } else if (resp.type === "fail") {
        switch (resp.case) {
          case HttpStatusCode.BadRequest: {
            setTestError(i18n2.str`Server replied with "bad request".`);
            setState({
              ...state,
              verified: void 0
            });
            return;
          }
          case HttpStatusCode.Unauthorized: {
            setTestError(i18n2.str`Unauthorized, check credentials.`);
            setState({
              ...state,
              verified: void 0
            });
            return;
          }
          case HttpStatusCode.NotFound: {
            setTestError(
              i18n2.str`The endpoint doesn't seems to be a Taler Revenue API.`
            );
            setState({
              ...state,
              verified: void 0
            });
            return;
          }
          default: {
            assertUnreachable(resp);
          }
        }
      } else {
        const found = resp.body;
        const match6 = state.payto_uri === found;
        setState({
          ...state,
          verified: match6
        });
        if (!match6) {
          setRevenuePayto(parsePaytoUri(resp.body));
        }
        setTestError(void 0);
      }
    }
  }
  return /* @__PURE__ */ h(p2, 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 details`
      }
    ),
    /* @__PURE__ */ h("div", { class: "message-body", style: { marginBottom: 10 } }, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "If the bank supports Taler Revenue API then you can add the endpoint URL below to keep the revenue information in sync."))),
    /* @__PURE__ */ h(
      Input,
      {
        name: "credit_facade_url",
        label: i18n2.str`Endpoint URL`,
        help: "https://bank.demo.taler.net/accounts/_username_/taler-revenue/",
        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: accountAuthType2,
        toStr: (str) => {
          if (str === "none")
            return "Without authentication";
          return "Username and password";
        }
      }
    ),
    state.credit_facade_credentials?.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.`
      }
    )) : void 0,
    /* @__PURE__ */ h(
      InputToggle,
      {
        label: i18n2.str`Match`,
        tooltip: i18n2.str`Check where the information match against the server info.`,
        name: "verified",
        readonly: true,
        threeState: true,
        help: testError !== void 0 ? testError : state.verified === void 0 ? i18n2.str`Not verified` : state.verified ? i18n2.str`Last test was ok` : i18n2.str`Last test failed`,
        side: /* @__PURE__ */ h(
          "button",
          {
            class: "button is-info",
            "data-tooltip": i18n2.str`Compare info from server with account form`,
            disabled: !state.credit_facade_url,
            onClick: async () => {
              const result = await testAccountInfo();
            }
          },
          /* @__PURE__ */ h(i18n2.Translate, null, "Test")
        )
      }
    )
  ), /* @__PURE__ */ h("div", { class: "buttons is-right mt-5" }, /* @__PURE__ */ h(
    "button",
    {
      class: "button is-info",
      onClick: () => {
        setImporting(true);
      }
    },
    /* @__PURE__ */ h(i18n2.Translate, null, "Import from bank")
  ), 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" }))), !importing ? void 0 : /* @__PURE__ */ h(
    ImportingAccountModal,
    {
      onCancel: () => {
        setImporting(false);
      },
      onConfirm: (ac) => {
        const u4 = new URL(ac.infoURL);
        const user = u4.username;
        const pwd = u4.password;
        u4.password = "";
        u4.username = "";
        const credit_facade_url = u4.href;
        setState({
          payto_uri: ac.accountURI,
          credit_facade_credentials: user || pwd ? {
            type: "basic",
            password: pwd,
            username: user
          } : void 0,
          credit_facade_url
        });
        setImporting(false);
      }
    }
  ), !revenuePayto ? void 0 : /* @__PURE__ */ h(
    CompareAccountsModal,
    {
      onCancel: () => {
        setRevenuePayto(void 0);
      },
      onConfirm: (d5) => {
        setState({
          ...state,
          payto_uri: d5
        });
        setRevenuePayto(void 0);
      },
      formPayto: !state.payto_uri ? void 0 : parsePaytoUri(state.payto_uri),
      testPayto: revenuePayto
    }
  ));
}

// src/paths/instance/accounts/create/index.tsx
function CreateValidator({ onConfirm, onBack }) {
  const { lib: api } = useSessionContext();
  const { state } = useSessionContext();
  const [notif, setNotif] = p3(void 0);
  const [tested, setTested] = p3(false);
  const { i18n: i18n2 } = useTranslationContext();
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    CreatePage2,
    {
      onBack,
      onCreate: async (request) => {
        return api.instance.addBankAccount(state.token, request).then((created) => {
          if (created.type === "fail") {
            setNotif({
              message: i18n2.str`could not create account`,
              type: "ERROR",
              description: created.detail.hint
            });
            return;
          }
          onConfirm();
        }).catch((error2) => {
          setNotif({
            message: i18n2.str`could not create account`,
            type: "ERROR",
            description: error2.message
          });
        });
      }
    }
  ));
}
async function testRevenueAPI(revenueAPI, creds) {
  const api = new TalerRevenueHttpClient(
    revenueAPI.href,
    new BrowserFetchHttpLib()
  );
  const auth = creds === void 0 ? void 0 : creds.type === "none" ? void 0 : creds.type === "basic" ? {
    username: creds.username,
    password: creds.password
  } : void 0;
  try {
    const config = await api.getConfig(auth);
    if (config.type === "fail") {
      return config;
    }
    const resp = await api.getHistory(auth);
    if (resp.type === "fail") {
      return resp;
    }
    return opFixedSuccess(resp.body.credit_account);
  } catch (err) {
    if (err instanceof TalerError) {
      return err;
    }
    throw err;
  }
}

// src/paths/instance/accounts/list/index.tsx
init_preact_module();
init_hooks_module();

// 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")));
}
function NotFoundPageOrAdminCreate() {
  const { state } = useSessionContext();
  const { i18n: i18n2 } = useTranslationContext();
  if (state.isAdmin && state.instance === DEFAULT_ADMIN_USERNAME) {
    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_ADMIN_USERNAME,
        onConfirm: () => {
          cleanAllCache();
          route("/bank" /* bank_list */);
        }
      }
    ));
  }
  return /* @__PURE__ */ h(NotFoundPage, null);
}

// src/paths/instance/accounts/list/ListPage.tsx
init_preact_module();

// src/paths/instance/accounts/list/Table.tsx
init_preact_module();
init_hooks_module();
function CardTable2({
  accounts,
  onCreate,
  onDelete,
  onSelect
}) {
  const [rowSelection, rowSelectionHandler] = p3([]);
  const { i18n: i18n2 } = useTranslationContext();
  return /* @__PURE__ */ h("div", { class: "card has-table" }, /* @__PURE__ */ h("header", { class: "card-header" }, /* @__PURE__ */ h("p", { class: "card-header-title" }, /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-bank" })), /* @__PURE__ */ h(i18n2.Translate, null, "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(
    Table2,
    {
      accounts,
      onDelete,
      onSelect,
      rowSelection,
      rowSelectionHandler
    }
  ) : /* @__PURE__ */ h(EmptyTable2, null)))));
}
function Table2({ accounts, onDelete, onSelect }) {
  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("tbody", null, ibanAccounts.map(({ parsed, acc }, idx) => {
    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", { 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 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-magnify 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 ListPage({
  devices,
  onCreate,
  onDelete,
  onSelect
  // onLoadMoreBefore,
  // onLoadMoreAfter,
}) {
  return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h(
    CardTable2,
    {
      accounts: devices.map((o3) => ({
        ...o3,
        id: String(o3.h_wire)
      })),
      onCreate,
      onDelete,
      onSelect
    }
  ));
}

// src/paths/instance/accounts/list/index.tsx
function ListOtpDevices({ onCreate, onSelect }) {
  const { i18n: i18n2 } = useTranslationContext();
  const [notif, setNotif] = p3(void 0);
  const { lib: api } = useSessionContext();
  const { state } = useSessionContext();
  const result = useInstanceBankAccounts();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), result.body.accounts.length < 1 && /* @__PURE__ */ h(
    NotificationCard,
    {
      notification: {
        type: "WARN",
        message: i18n2.str`You need to associate a bank account to receive revenue.`,
        description: i18n2.str`Without this the you won't be able to create new orders.`
      }
    }
  ), /* @__PURE__ */ h(
    ListPage,
    {
      devices: result.body.accounts,
      onCreate,
      onSelect: (e4) => {
        onSelect(e4.h_wire);
      },
      onDelete: (e4) => {
        return api.instance.deleteBankAccount(state.token, 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();
function UpdateValidator({
  bid,
  onConfirm,
  onBack
}) {
  const { lib: api } = useSessionContext();
  const { state } = useSessionContext();
  const result = useBankAccountDetails(bid);
  const [notif, setNotif] = p3(void 0);
  const { i18n: i18n2 } = useTranslationContext();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    UpdatePage,
    {
      account: { ...result.body, id: bid },
      onBack,
      onUpdate: async (request) => {
        return api.instance.updateBankAccount(state.token, bid, request).then((updated) => {
          if (updated.type === "fail") {
            setNotif({
              message: i18n2.str`could not update account`,
              type: "ERROR",
              description: updated.detail.hint
            });
            return;
          }
          onConfirm();
        }).catch((error2) => {
          setNotif({
            message: i18n2.str`could not update account`,
            type: "ERROR",
            description: error2.message
          });
        });
      },
      onReplace: async (prev, next) => {
        try {
          const created = await api.instance.addBankAccount(
            state.token,
            next
          );
          if (created.type === "fail") {
            setNotif({
              message: i18n2.str`could not create account`,
              type: "ERROR",
              description: created.detail.hint
            });
            return;
          }
        } catch (error2) {
          setNotif({
            message: i18n2.str`could not create account`,
            type: "ERROR",
            description: error2.message
          });
          return;
        }
        try {
          const deleted = await api.instance.deleteBankAccount(
            state.token,
            prev.h_wire
          );
          if (deleted.type === "fail") {
            setNotif({
              message: i18n2.str`could not delete account`,
              type: "ERROR",
              description: deleted.detail.hint
            });
            return;
          }
        } catch (error2) {
          setNotif({
            message: i18n2.str`could not delete account`,
            type: "ERROR",
            description: error2.message
          });
          return;
        }
        onConfirm();
      }
    }
  ));
}

// src/paths/instance/kyc/list/index.tsx
init_preact_module();

// src/paths/instance/kyc/list/ListPage.tsx
init_preact_module();
function ListPage2({ 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(EmptyTable3, 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(EmptyTable3, 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 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-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(_p) {
  const result = useInstanceKYCDetails();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.GatewayTimeout: {
        return /* @__PURE__ */ h("div", null);
      }
      case HttpStatusCode.BadGateway: {
        const status2 = result.body;
        if (!status2) {
          return /* @__PURE__ */ h("div", null, "no kyc required");
        }
        return /* @__PURE__ */ h(ListPage2, { status: status2 });
      }
      case HttpStatusCode.ServiceUnavailable: {
        return /* @__PURE__ */ h("div", null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h("div", null);
      }
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h("div", null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  const status = result.body;
  if (!status) {
    return /* @__PURE__ */ h("div", null, "no kyc required");
  }
  return /* @__PURE__ */ h(ListPage2, { status });
}

// src/paths/instance/orders/create/index.tsx
init_preact_module();
init_hooks_module();

// src/hooks/product.ts
init_hooks_module();

// src/hooks/webhooks.ts
var useSWR4 = useSWR;
function revalidateInstanceWebhooks() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "listWebhooks",
    void 0,
    { revalidate: true }
  );
}
function useInstanceWebhooks() {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  async function fetcher([token, _bid]) {
    return await instance.listWebhooks(token, {
      // limit: PAGINATED_LIST_REQUEST,
      // offset: bid,
      // order: "dec",
    });
  }
  const { data, error: error2 } = useSWR4([session.token, "offset", "listWebhooks"], fetcher);
  if (error2)
    return error2;
  if (data === void 0)
    return void 0;
  if (data.type !== "ok")
    return data;
  return data;
}
function buildPaginatedResult(data, offset, setOffset, getId) {
  const isLastPage = data.length < PAGINATED_LIST_REQUEST;
  const isFirstPage = offset === void 0;
  const result = structuredClone(data);
  if (result.length == PAGINATED_LIST_REQUEST) {
    result.pop();
  }
  return {
    type: "ok",
    body: result,
    isLastPage,
    isFirstPage,
    loadNext: () => {
      if (!result.length)
        return;
      const id = getId(result[result.length - 1]);
      setOffset(id);
    },
    loadFirst: () => {
      setOffset(void 0);
    }
  };
}
function revalidateWebhookDetails() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "getWebhookDetails",
    void 0,
    { revalidate: true }
  );
}
function useWebhookDetails(webhookId) {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  async function fetcher([hookId, token]) {
    return await instance.getWebhookDetails(token, hookId);
  }
  const { data, error: error2 } = useSWR4([webhookId, session.token, "getWebhookDetails"], fetcher);
  if (data)
    return data;
  if (error2)
    return error2;
  return void 0;
}

// src/hooks/product.ts
var useSWR5 = useSWR;
function notUndefined(c4) {
  return c4 !== void 0;
}
function revalidateInstanceProducts() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "listProductsWithId",
    void 0,
    { revalidate: true }
  );
}
function useInstanceProducts() {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  const [offset, setOffset] = p3();
  async function fetcher([token, bid]) {
    const list = await instance.listProducts(token, {
      limit: PAGINATED_LIST_REQUEST,
      offset: bid === void 0 ? void 0 : String(bid),
      order: "dec"
    });
    if (list.type !== "ok") {
      return list;
    }
    const all = await Promise.all(
      list.body.products.map(async (c4) => {
        const r3 = await instance.getProductDetails(token, c4.product_id);
        if (r3.type === "fail") {
          return void 0;
        }
        return { ...r3.body, id: c4.product_id, serial: c4.product_serial };
      })
    );
    const products = all.filter(notUndefined);
    return opFixedSuccess({ products });
  }
  const { data, error: error2 } = useSWR5([session.token, offset, "listProductsWithId"], fetcher);
  if (error2)
    return error2;
  if (data === void 0)
    return void 0;
  if (data.type !== "ok")
    return data;
  return buildPaginatedResult(data.body.products, offset, setOffset, (d5) => d5.serial);
}
function revalidateProductDetails() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "getProductDetails",
    void 0,
    { revalidate: true }
  );
}
function useProductDetails(productId) {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  async function fetcher([pid, token]) {
    return await instance.getProductDetails(token, pid);
  }
  const { data, error: error2 } = useSWR5([productId, session.token, "getProductDetails"], fetcher);
  if (data)
    return data;
  if (error2)
    return error2;
  return void 0;
}

// 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 } = useSessionContext();
  return /* @__PURE__ */ h(
    InputWithAddon,
    {
      name,
      readonly,
      addonBefore: config.currency,
      side,
      label,
      placeholder,
      help,
      tooltip,
      addonAfter,
      inputType: "number",
      expand,
      toStr: (v3) => 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 <span /> 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 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/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] = usePreference();
  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 },
      side
    },
    children
  );
}

// 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) => ({ ...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 _ValidationError 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 _ReferenceSet {
  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<TContext extends AnyObject>(): 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 findIndex3(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 findIndex3(keys, a5) - findIndex3(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: recursive2 = 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 (!recursive2 || !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 recursive2 = (_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 (!recursive2 || !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<typeof T>
      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 () => {
    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 && Amounts.parse(value) !== void 0;
}
function currencyGreaterThan0(value) {
  if (value) {
    try {
      const [, amount] = value.split(":");
      const intAmount = parseInt(amount, 10);
      return intAmount > 0;
    } catch {
      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 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)
});
var timestampSchema = create6().shape({
  t_s: create().test(
    "is-timestamp",
    "Invalid timestamp",
    (value) => typeof value === "number" || value === "never"
  )
}).required();
var durationSchema = create6().shape({
  d_us: create().test(
    "is-duration",
    "Invalid duration",
    (value) => typeof value === "number" || value === "forever"
  )
}).required();
var tokenFamilyKindSchema = create().oneOf(["discount", "subscription"]).required();
var TokenFamilyCreateSchema = create6().shape({
  slug: create3().ensure().required(),
  name: create3().required(),
  description: create3().required(),
  // description_i18n: yup.lazy((obj) =>
  //   yup.object().shape(
  //     Object.keys(obj || {}).reduce((acc, key) => {
  //       acc[key] = yup.string().required();
  //       return acc;
  //     }, {})
  //   )
  // ).optional(),
  valid_after: timestampSchema.optional(),
  valid_before: timestampSchema,
  duration: durationSchema,
  kind: tokenFamilyKindSchema
});
var TokenFamilyUpdateSchema = create6().shape({
  name: create3().required(),
  description: create3().required(),
  // description_i18n: yup.lazy((obj) =>
  //   yup.object().shape(
  //     Object.keys(obj).reduce((acc, key) => {
  //       acc[key] = yup.string().required();
  //       return acc;
  //     }, {})
  //   )
  // ),
  valid_after: timestampSchema,
  valid_before: timestampSchema,
  duration: durationSchema
});

// 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 : { ...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: initial3 }) {
  const [value, valueHandler] = p3({
    taxes: [],
    ...initial3
  });
  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 : { ...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 ?? 0
      ).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] = {
    ...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 = Duration.fromTalerProtocolDuration(
    config.default_pay_delay
  );
  const defaultWireDeadline = Duration.fromTalerProtocolDuration(
    config.default_wire_transfer_delay
  );
  return {
    inventoryProducts: {},
    products: [],
    pricing: {},
    payments: {
      max_fee: void 0,
      createToken: true,
      pay_deadline: defaultPayDeadline,
      refund_deadline: defaultPayDeadline,
      wire_transfer_deadline: defaultWireDeadline
    },
    shipping: {},
    extra: {}
  };
}
function CreatePage3({
  onCreate,
  onBack,
  instanceConfig,
  instanceInventory
}) {
  const { config } = useSessionContext();
  const instance_default = with_defaults2(instanceConfig, config.currency);
  const [value, valueHandler] = p3(instance_default);
  const zero = Amounts.zeroOfCurrency(config.currency);
  const [pref, updatePrefs] = usePreference();
  const inventoryList = Object.values(value.inventoryProducts || {});
  const productList = Object.values(value.products || {});
  const { i18n: i18n2 } = useTranslationContext();
  const parsedPrice = !value.pricing?.order_price ? void 0 : Amounts.parse(value.pricing.order_price);
  const errors2 = {
    pricing: undefinedIfEmpty({
      summary: !value.pricing?.summary ? i18n2.str`required` : void 0,
      order_price: !value.pricing?.order_price ? i18n2.str`required` : !parsedPrice ? i18n2.str`not valid` : Amounts.isZero(parsedPrice) ? i18n2.str`must be greater than 0` : void 0
    }),
    payments: undefinedIfEmpty({
      refund_deadline: !value.payments?.refund_deadline ? void 0 : value.payments.pay_deadline && Duration.cmp(
        value.payments.refund_deadline,
        value.payments.pay_deadline
      ) === -1 ? i18n2.str`refund deadline cannot be before pay deadline` : value.payments.wire_transfer_deadline && Duration.cmp(
        value.payments.wire_transfer_deadline,
        value.payments.refund_deadline
      ) === -1 ? i18n2.str`wire transfer deadline cannot be before refund deadline` : void 0,
      pay_deadline: !value.payments?.pay_deadline ? i18n2.str`required` : value.payments.wire_transfer_deadline && Duration.cmp(
        value.payments.wire_transfer_deadline,
        value.payments.pay_deadline
      ) === -1 ? i18n2.str`wire transfer deadline cannot be before pay deadline` : void 0,
      wire_transfer_deadline: !value.payments?.wire_transfer_deadline ? i18n2.str`required` : void 0,
      auto_refund_deadline: !value.payments?.auto_refund_deadline ? void 0 : !value.payments?.refund_deadline ? i18n2.str`should have a refund deadline` : Duration.cmp(
        value.payments.refund_deadline,
        value.payments.auto_refund_deadline
      ) == -1 ? i18n2.str`auto refund cannot be after refund deadline` : void 0
    }),
    shipping: undefinedIfEmpty({
      delivery_date: !value.shipping?.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 = value;
    if (!value.payments)
      return;
    if (!value.shipping)
      return;
    const request = {
      order: {
        amount: order.pricing.order_price,
        summary: order.pricing.summary,
        products: productList,
        extra: undefinedIfEmpty(value.extra),
        pay_deadline: AbsoluteTime.toProtocolTimestamp(
          AbsoluteTime.addDuration(
            AbsoluteTime.now(),
            value.payments.pay_deadline
          )
        ),
        wire_transfer_deadline: AbsoluteTime.toProtocolTimestamp(
          AbsoluteTime.addDuration(
            AbsoluteTime.now(),
            value.payments.wire_transfer_deadline
          )
        ),
        refund_deadline: AbsoluteTime.toProtocolTimestamp(
          AbsoluteTime.addDuration(
            AbsoluteTime.now(),
            value.payments.refund_deadline
          )
        ),
        auto_refund: value.payments.auto_refund_deadline ? Duration.toTalerProtocolDuration(
          value.payments.auto_refund_deadline
        ) : 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 = { ...v3.inventoryProducts };
      inventoryProducts[product.id] = { product, quantity };
      return { ...v3, inventoryProducts };
    });
  };
  const removeProductFromTheInventoryList = (id) => {
    valueHandler((v3) => {
      const inventoryProducts = { ...v3.inventoryProducts };
      delete inventoryProducts[id];
      return { ...v3, inventoryProducts };
    });
  };
  const addNewProduct = async (product) => {
    return valueHandler((v3) => {
      const products = v3.products ? [...v3.products, product] : [];
      return { ...v3, products };
    });
  };
  const removeFromNewProduct = (index) => {
    valueHandler((v3) => {
      const products = v3.products ? [...v3.products] : [];
      products.splice(index, 1);
      return { ...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 ?? 0).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 {
        ...v3,
        pricing: {
          ...v3.pricing,
          products_price: hasProducts ? totalAsString : void 0,
          order_price: hasProducts ? totalAsString : void 0
        }
      };
    });
  }, [hasProducts, totalAsString]);
  const discountOrRise = rate(
    parsedPrice ?? Amounts.zeroOfCurrency(config.currency),
    totalPrice.amount
  );
  const minAgeByProducts = inventoryList.reduce(
    (cur, prev) => !prev.product.minimum_age || cur > prev.product.minimum_age ? cur : prev.product.minimum_age,
    0
  );
  const noDefault_payDeadline = !instance_default.payments || !instance_default.payments.pay_deadline;
  const noDefault_wireDeadline = !instance_default.payments || !instance_default.payments.wire_transfer_deadline;
  const requiresSomeTalerOptions = noDefault_payDeadline || noDefault_wireDeadline;
  return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h("div", { class: "tabs is-toggle is-fullwidth is-small" }, /* @__PURE__ */ h("ul", null, /* @__PURE__ */ h(
    "li",
    {
      class: !pref.advanceOrderMode ? "is-active" : "",
      onClick: () => {
        updatePrefs("advanceOrderMode", false);
      }
    },
    /* @__PURE__ */ h("a", null, /* @__PURE__ */ h("span", null, /* @__PURE__ */ h(i18n2.Translate, null, "Simple")))
  ), /* @__PURE__ */ h(
    "li",
    {
      class: pref.advanceOrderMode ? "is-active" : "",
      onClick: () => {
        updatePrefs("advanceOrderMode", true);
      }
    },
    /* @__PURE__ */ h("a", null, /* @__PURE__ */ h("span", null, /* @__PURE__ */ h(i18n2.Translate, null, "Advanced")))
  ))), /* @__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
      }
    ),
    pref.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`
      }
    ),
    pref.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.`
        }
      ),
      value.shipping?.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.`
        }
      )
    ),
    (pref.advanceOrderMode || requiresSomeTalerOptions) && /* @__PURE__ */ h(
      InputGroup,
      {
        name: "payments",
        label: i18n2.str`Taler payment options`,
        tooltip: i18n2.str`Override default Taler payment settings for this order`
      },
      (pref.advanceOrderMode || noDefault_payDeadline) && /* @__PURE__ */ h(
        InputDuration,
        {
          name: "payments.pay_deadline",
          label: i18n2.str`Payment time`,
          help: /* @__PURE__ */ h(DeadlineHelp, { duration: value.payments?.pay_deadline }),
          withForever: true,
          withoutClear: true,
          tooltip: i18n2.str`Time for the customer to pay for the offer before it expires. Inventory products will be reserved until this deadline. Time start to run after the order is created.`,
          side: /* @__PURE__ */ h("span", null, /* @__PURE__ */ h(
            "button",
            {
              class: "button",
              onClick: () => {
                const c4 = {
                  ...value,
                  payments: {
                    ...value.payments ?? {},
                    pay_deadline: instance_default.payments?.pay_deadline
                  }
                };
                valueHandler(c4);
              }
            },
            /* @__PURE__ */ h(i18n2.Translate, null, "default")
          ))
        }
      ),
      pref.advanceOrderMode && /* @__PURE__ */ h(
        InputDuration,
        {
          name: "payments.refund_deadline",
          label: i18n2.str`Refund time`,
          help: /* @__PURE__ */ h(
            DeadlineHelp,
            {
              duration: value.payments?.refund_deadline
            }
          ),
          withForever: true,
          withoutClear: true,
          tooltip: i18n2.str`Time while the order can be refunded by the merchant. Time starts after the order is created.`,
          side: /* @__PURE__ */ h("span", null, /* @__PURE__ */ h(
            "button",
            {
              class: "button",
              onClick: () => {
                valueHandler({
                  ...value,
                  payments: {
                    ...value.payments ?? {},
                    refund_deadline: instance_default.payments?.refund_deadline
                  }
                });
              }
            },
            /* @__PURE__ */ h(i18n2.Translate, null, "default")
          ))
        }
      ),
      (pref.advanceOrderMode || noDefault_wireDeadline) && /* @__PURE__ */ h(
        InputDuration,
        {
          name: "payments.wire_transfer_deadline",
          label: i18n2.str`Wire transfer time`,
          help: /* @__PURE__ */ h(
            DeadlineHelp,
            {
              duration: value.payments?.wire_transfer_deadline
            }
          ),
          withoutClear: true,
          withForever: true,
          tooltip: i18n2.str`Time for the exchange to make the wire transfer. Time starts after the order is created.`,
          side: /* @__PURE__ */ h("span", null, /* @__PURE__ */ h(
            "button",
            {
              class: "button",
              onClick: () => {
                valueHandler({
                  ...value,
                  payments: {
                    ...value.payments ?? {},
                    wire_transfer_deadline: instance_default.payments?.wire_transfer_deadline
                  }
                });
              }
            },
            /* @__PURE__ */ h(i18n2.Translate, null, "default")
          ))
        }
      ),
      pref.advanceOrderMode && /* @__PURE__ */ h(
        InputDuration,
        {
          name: "payments.auto_refund_deadline",
          label: i18n2.str`Auto-refund time`,
          help: /* @__PURE__ */ h(
            DeadlineHelp,
            {
              duration: value.payments?.auto_refund_deadline
            }
          ),
          tooltip: i18n2.str`Time until which the wallet will automatically check for refunds without user interaction.`,
          withForever: true
        }
      ),
      pref.advanceOrderMode && /* @__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.`
        }
      ),
      pref.advanceOrderMode && /* @__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.`
        }
      ),
      pref.advanceOrderMode && /* @__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`
        }
      )
    ),
    pref.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(value.extra ?? {}).map((key, idx) => {
        return /* @__PURE__ */ h(
          Input,
          {
            name: `extra.${key}`,
            key: String(idx),
            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) {
                    delete value.extra[key];
                  }
                  valueHandler({
                    ...value
                  });
                  e4.preventDefault();
                }
              },
              "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) => {
            setNewField("");
            valueHandler({
              ...value,
              extra: {
                ...value.extra ?? {},
                [newField]: ""
              }
            });
            e4.preventDefault();
          }
        },
        "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
  };
}
function DeadlineHelp({ duration }) {
  const { i18n: i18n2 } = useTranslationContext();
  const [now2, setNow] = p3(AbsoluteTime.now());
  h2(() => {
    const iid = setInterval(() => {
      setNow(AbsoluteTime.now());
    }, 60 * 1e3);
    return () => {
      clearInterval(iid);
    };
  });
  if (!duration)
    return /* @__PURE__ */ h(i18n2.Translate, null, "Disabled");
  const when = AbsoluteTime.addDuration(now2, duration);
  if (when.t_ms === "never")
    return /* @__PURE__ */ h(i18n2.Translate, null, "No deadline");
  return /* @__PURE__ */ h(i18n2.Translate, null, "Deadline at ", format(when.t_ms, "dd/MM/yy HH:mm"));
}

// src/paths/instance/orders/create/index.tsx
function OrderCreate({ onConfirm, onBack }) {
  const { lib } = useSessionContext();
  const [notif, setNotif] = p3(void 0);
  const { state } = useSessionContext();
  const detailsResult = useInstanceDetails();
  const inventoryResult = useInstanceProducts();
  if (!detailsResult)
    return /* @__PURE__ */ h(Loading, null);
  if (detailsResult instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: detailsResult });
  }
  if (detailsResult.type === "fail") {
    switch (detailsResult.case) {
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      default: {
        assertUnreachable(detailsResult);
      }
    }
  }
  if (!inventoryResult)
    return /* @__PURE__ */ h(Loading, null);
  if (inventoryResult instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: inventoryResult });
  }
  if (inventoryResult.type === "fail") {
    switch (inventoryResult.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(inventoryResult);
      }
    }
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    CreatePage3,
    {
      onBack,
      onCreate: (request) => {
        lib.instance.createOrder(state.token, request).then((r3) => {
          if (r3.type === "ok") {
            return onConfirm(r3.body.order_id);
          } else {
            setNotif({
              message: "could not create order",
              type: "ERROR"
            });
          }
        }).catch((error2) => {
          setNotif({
            message: "could not create order",
            type: "ERROR",
            description: error2.message
          });
        });
      },
      instanceConfig: detailsResult.body,
      instanceInventory: inventoryResult.body
    }
  ));
}

// src/paths/instance/orders/details/index.tsx
init_preact_module();
init_hooks_module();

// src/hooks/order.ts
var useSWR6 = useSWR;
function revalidateOrderDetails() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "getOrderDetails",
    void 0,
    { revalidate: true }
  );
}
function useOrderDetails(oderId) {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  async function fetcher([dId, token]) {
    return await instance.getOrderDetails(token, dId);
  }
  const { data, error: error2 } = useSWR6([oderId, session.token, "getOrderDetails"], fetcher);
  if (data)
    return data;
  if (error2)
    return error2;
  return void 0;
}
function revalidateInstanceOrders() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "listOrders",
    void 0,
    { revalidate: true }
  );
}
function useInstanceOrders(args, updatePosition = () => {
}) {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  async function fetcher([token, o3, p4, r3, w5, d5]) {
    return await instance.listOrders(token, {
      limit: PAGINATED_LIST_REQUEST,
      offset: o3,
      order: "dec",
      paid: p4,
      refunded: r3,
      wired: w5,
      date: d5
    });
  }
  const { data, error: error2 } = useSWR6([session.token, args?.position, args?.paid, args?.refunded, args?.wired, args?.date, "listOrders"], fetcher);
  if (error2)
    return error2;
  if (data === void 0)
    return void 0;
  if (data.type !== "ok")
    return data;
  return buildPaginatedResult(data.body.orders, args?.position, updatePosition, (d5) => String(d5.row_id));
}

// 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 CardTable3({
  orders,
  onCreate,
  onRefund,
  onCopyURL,
  onSelect,
  onLoadMoreAfter,
  onLoadMoreBefore
}) {
  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(
    Table3,
    {
      instances: orders,
      onSelect,
      onRefund,
      onCopyURL: (o3) => onCopyURL(o3.id),
      rowSelection,
      rowSelectionHandler,
      onLoadMoreAfter,
      onLoadMoreBefore
    }
  ) : /* @__PURE__ */ h(EmptyTable4, null)))));
}
function Table3({
  instances,
  onSelect,
  onRefund,
  onCopyURL,
  onLoadMoreAfter,
  onLoadMoreBefore
}) {
  const { i18n: i18n2 } = useTranslationContext();
  const [settings] = usePreference();
  return /* @__PURE__ */ h("div", { class: "table-container" }, onLoadMoreBefore && /* @__PURE__ */ h("button", { class: "button is-fullwidth", onClick: onLoadMoreBefore }, /* @__PURE__ */ h(i18n2.Translate, null, "load first page")), /* @__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",
      "data-tooltip": i18n2.str`load more orders after the last one`,
      onClick: onLoadMoreAfter
    },
    /* @__PURE__ */ h(i18n2.Translate, null, "load next page")
  ));
}
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-magnify 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] = usePreference();
  const { i18n: i18n2 } = useTranslationContext();
  const refunds = (order.order_status === "paid" ? order.refund_details : []).reduce(mergeRefunds, []);
  const { config } = useSessionContext();
  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] = usePreference();
  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
}) {
  const now2 = /* @__PURE__ */ new Date();
  const refundable = order.contract_terms.refund_deadline.t_s !== "never" && now2.getTime() < order.contract_terms.refund_deadline.t_s * 1e3;
  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" && refundable) {
    events2.push({
      when: new Date(order.contract_terms.refund_deadline.t_s * 1e3),
      description: "refund deadline",
      type: "deadline"
    });
  }
  if (order.contract_terms.delivery_date && order.contract_terms.delivery_date.t_s !== "never") {
    events2.push({
      when: new Date(order.contract_terms.delivery_date?.t_s * 1e3),
      description: "delivery",
      type: "delivery"
    });
  }
  const [value, valueHandler] = p3(order);
  const { i18n: i18n2 } = useTranslationContext();
  const [settings] = usePreference();
  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"), ":"), " ", order.contract_terms.timestamp.t_s === "never" ? "never" : 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
}) {
  const now2 = /* @__PURE__ */ new Date();
  const refundable = order.contract_terms.refund_deadline.t_s !== "never" && now2.getTime() < order.contract_terms.refund_deadline.t_s * 1e3;
  const events2 = [];
  if (order.contract_terms.refund_deadline.t_s !== "never" && refundable) {
    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(order.contract_terms.delivery_date?.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"
      });
    }
  });
  const ra = !order.refunded ? void 0 : Amounts.parse(order.refund_amount);
  const am = Amounts.parseOrThrow(order.contract_terms.amount);
  if (ra && Amounts.cmp(ra, am) === 1) {
    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 nextEvent = events2.find((e4) => {
    return e4.when.getTime() > now2.getTime();
  });
  const [value, valueHandler] = p3(order);
  const { state } = useSessionContext();
  const refundurl = stringifyRefundUri({
    merchantBaseUrl: state.backendUrl.href,
    orderId: order.contract_terms.order_id
  });
  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"
      }
    },
    nextEvent && /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "Next event in "), " ", formatDistance11(
      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] = usePreference();
  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 DetailPage({ 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 }) {
  const result = useOrderDetails(oid);
  const [notif, setNotif] = p3(void 0);
  const { lib: api } = useSessionContext();
  const { state } = useSessionContext();
  const { i18n: i18n2 } = useTranslationContext();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.BadGateway: {
        return /* @__PURE__ */ h("div", null, "Failed to obtain a response from the exchange");
      }
      case HttpStatusCode.GatewayTimeout: {
        return /* @__PURE__ */ h("div", null, "The merchant's interaction with the exchange took too long");
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    DetailPage,
    {
      onBack,
      id: oid,
      onRefund: (id, value) => {
        if (state.status !== "loggedIn") {
          return;
        }
        api.instance.addRefund(state.token, 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.body
    }
  ));
}

// src/paths/instance/orders/list/index.tsx
init_preact_module();
init_hooks_module();

// src/components/form/JumpToElementById.tsx
init_preact_module();
init_hooks_module();
function JumpToElementById({ testIfExist, onSelect, placeholder, description }) {
  const { i18n: i18n2 } = useTranslationContext();
  const [error2, setError] = p3(
    void 0
  );
  const [id, setId] = p3();
  async function check(currentId) {
    if (!currentId) {
      setError(i18n2.str`missing id`);
      return;
    }
    try {
      const exi = await testIfExist(currentId);
      if (exi) {
        onSelect(currentId);
        setError(void 0);
      } else {
        setError(i18n2.str`not found`);
      }
    } catch {
      setError(i18n2.str`not found`);
    }
  }
  return /* @__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: error2 ? "input is-danger" : "input",
      type: "text",
      value: id ?? "",
      onChange: (e4) => setId(e4.currentTarget.value),
      placeholder
    }
  ), error2 && /* @__PURE__ */ h("p", { class: "help is-danger" }, error2)), /* @__PURE__ */ h(
    "span",
    {
      class: "has-tooltip-bottom",
      "data-tooltip": description
    },
    /* @__PURE__ */ h(
      "button",
      {
        class: "button",
        onClick: (e4) => check(id)
      },
      /* @__PURE__ */ h("span", { class: "icon" }, /* @__PURE__ */ h("i", { class: "mdi mdi-arrow-right" }))
    )
  )))));
}

// src/paths/instance/orders/list/ListPage.tsx
init_preact_module();
init_hooks_module();
function ListPage3({
  onLoadMoreAfter,
  onLoadMoreBefore,
  orders,
  isAllActive,
  onSelectOrder,
  onRefundOrder,
  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 [settings] = usePreference();
  return /* @__PURE__ */ h(p2, null, /* @__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 || jumpToDate.t_ms === "never" ? "" : format(jumpToDate.t_ms, 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: (d5) => {
        onSelectDate(AbsoluteTime.fromMilliseconds(d5.getTime()));
      }
    }
  ), /* @__PURE__ */ h(
    CardTable3,
    {
      orders,
      onCreate,
      onCopyURL,
      onSelect: onSelectOrder,
      onRefund: onRefundOrder,
      onLoadMoreAfter,
      onLoadMoreBefore
    }
  ));
}

// src/paths/instance/orders/list/index.tsx
function OrderList({ onCreate, onSelect }) {
  const [filter, setFilter] = p3({ paid: false });
  const [orderToBeRefunded, setOrderToBeRefunded] = p3(void 0);
  const setNewDate = (date2) => setFilter((prev) => ({ ...prev, date: date2 }));
  const result = useInstanceOrders(
    filter,
    (d5) => setFilter({ ...filter, position: d5 })
  );
  const { lib } = useSessionContext();
  const [notif, setNotif] = p3(void 0);
  const { i18n: i18n2 } = useTranslationContext();
  const { state } = useSessionContext();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  const isNotPaidActive = filter.paid === false ? "is-active" : "";
  const isPaidActive = filter.paid === true && filter.wired === void 0 ? "is-active" : "";
  const isRefundedActive = filter.refunded === true ? "is-active" : "";
  const isNotWiredActive = filter.wired === false && filter.paid === true ? "is-active" : "";
  const isWiredActive = filter.wired === true ? "is-active" : "";
  const isAllActive = filter.paid === void 0 && filter.refunded === void 0 && filter.wired === void 0 ? "is-active" : "";
  return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    JumpToElementById,
    {
      testIfExist: async (order) => {
        const resp = await lib.instance.getOrderDetails(state.token, order);
        return resp.type === "ok";
      },
      onSelect,
      description: i18n2.str`jump to order with the given product ID`,
      placeholder: i18n2.str`order id`
    }
  ), /* @__PURE__ */ h(
    ListPage3,
    {
      orders: result.body.map((o3) => ({ ...o3, id: o3.order_id })),
      onLoadMoreBefore: result.isFirstPage ? void 0 : result.loadFirst,
      onLoadMoreAfter: result.isLastPage ? void 0 : result.loadNext,
      onSelectOrder: (order) => onSelect(order.id),
      onRefundOrder: (value) => setOrderToBeRefunded(value),
      isAllActive,
      isNotWiredActive,
      isWiredActive,
      isPaidActive,
      isNotPaidActive,
      isRefundedActive,
      jumpToDate: filter.date,
      onSelectDate: setNewDate,
      onCopyURL: async (id) => {
        const resp = await lib.instance.getOrderDetails(state.token, id);
        if (resp.type === "ok") {
          if (resp.body.order_status === "unpaid") {
            copyToClipboard(resp.body.taler_pay_uri);
          } else {
            if (resp.body.contract_terms.fulfillment_url) {
              copyToClipboard(resp.body.contract_terms.fulfillment_url);
            }
          }
          copyToClipboard(resp.body.order_status);
        }
      },
      onCreate,
      onShowAll: () => setFilter({}),
      onShowNotPaid: () => setFilter({ paid: false }),
      onShowPaid: () => setFilter({ paid: true }),
      onShowRefunded: () => setFilter({ refunded: true }),
      onShowNotWired: () => setFilter({ wired: false, paid: true }),
      onShowWired: () => setFilter({ wired: true })
    }
  ), orderToBeRefunded && /* @__PURE__ */ h(
    RefundModalForTable,
    {
      id: orderToBeRefunded.order_id,
      onCancel: () => setOrderToBeRefunded(void 0),
      onConfirm: (value) => {
        lib.instance.addRefund(state.token, 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));
      }
    }
  ));
}
function RefundModalForTable({ id, onConfirm, onCancel }) {
  const result = useOrderDetails(id);
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.BadGateway: {
        return /* @__PURE__ */ h("div", null, "Failed to obtain a response from the exchange");
      }
      case HttpStatusCode.GatewayTimeout: {
        return /* @__PURE__ */ h("div", null, "The merchant's interaction with the exchange took too long");
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h(
    RefundModal,
    {
      order: result.body,
      onCancel,
      onConfirm
    }
  );
}
async function copyToClipboard(text) {
  return navigator.clipboard.writeText(text);
}

// src/paths/instance/otp_devices/create/index.tsx
init_preact_module();
init_hooks_module();

// src/paths/instance/otp_devices/create/CreatePage.tsx
init_preact_module();
init_hooks_module();
var algorithms = [0, 1, 2];
var algorithmsNames = ["off", "30s 8d TOTP-SHA1", "30s 8d eTOTP-SHA1"];
function CreatePage4({ onCreate, onBack }) {
  const { i18n: i18n2 } = useTranslationContext();
  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` : !isRfc3548Base32Charset(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_device_description: !state.otp_device_description ? i18n2.str`required` : !/[a-zA-Z0-9]*/.test(state.otp_device_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_device_description",
        label: i18n2.str`Description`,
        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 ? /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
      InputWithAddon,
      {
        expand: true,
        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(),
        addonAfterAction: () => {
          setShowKey(!showKey);
        },
        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(
          "button",
          {
            "data-tooltip": i18n2.str`generate random secret key`,
            class: "button is-info mr-3",
            onClick: (e4) => {
              setState((s5) => ({
                ...s5,
                otp_key: randomRfc3548Base32Key()
              }));
              e4.preventDefault();
            }
          },
          /* @__PURE__ */ h(i18n2.Translate, null, "random")
        )
      }
    )) : 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/otp_devices/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/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/instance/otp_devices/create/CreatedSuccessfully.tsx
function CreatedSuccessfully2({
  entity,
  onConfirm
}) {
  const { i18n: i18n2 } = useTranslationContext();
  const { state } = useSessionContext();
  const issuer = state.backendUrl.href;
  const qrText = `otpauth://totp/${state.instance}/${entity.otp_device_id}?issuer=${issuer}&algorithm=SHA1&digits=8&period=30&secret=${entity.otp_key}`;
  const qrTextSafe = `otpauth://totp/${state.instance}/${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 save the key before continuing.")), /* @__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_device_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/otp_devices/create/index.tsx
function CreateValidator2({ onConfirm, onBack }) {
  const { lib: api } = useSessionContext();
  const { state } = useSessionContext();
  const [notif, setNotif] = p3(void 0);
  const { i18n: i18n2 } = useTranslationContext();
  const [created, setCreated] = p3(null);
  if (created) {
    return /* @__PURE__ */ h(CreatedSuccessfully2, { entity: created, onConfirm });
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    CreatePage4,
    {
      onBack,
      onCreate: (request) => {
        return api.instance.addOtpDevice(state.token, request).then((d5) => {
          setCreated(request);
        }).catch((error2) => {
          setNotif({
            message: i18n2.str`could not create device`,
            type: "ERROR",
            description: error2.message
          });
        });
      }
    }
  ));
}

// src/paths/instance/otp_devices/list/index.tsx
init_preact_module();
init_hooks_module();

// src/hooks/otp.ts
var useSWR7 = useSWR;
function revalidateInstanceOtpDevices() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "listOtpDevices",
    void 0,
    { revalidate: true }
  );
}
function useInstanceOtpDevices() {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  async function fetcher([token, _bid]) {
    return await instance.listOtpDevices(token, {
      // limit: PAGINATED_LIST_REQUEST,
      // offset: bid,
      // order: "dec",
    });
  }
  const { data, error: error2 } = useSWR7([session.token, "offset", "listOtpDevices"], fetcher);
  if (error2)
    return error2;
  if (data === void 0)
    return void 0;
  if (data.type !== "ok")
    return data;
  return data;
}
function revalidateOtpDeviceDetails() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "getOtpDeviceDetails",
    void 0,
    { revalidate: true }
  );
}
function useOtpDeviceDetails(deviceId) {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  async function fetcher([dId, token]) {
    return await instance.getOtpDeviceDetails(token, dId);
  }
  const { data, error: error2 } = useSWR7([deviceId, session.token, "getOtpDeviceDetails"], fetcher);
  if (data)
    return data;
  if (error2)
    return error2;
  return void 0;
}

// src/paths/instance/otp_devices/list/ListPage.tsx
init_preact_module();

// src/paths/instance/otp_devices/list/Table.tsx
init_preact_module();
init_hooks_module();
function CardTable4({
  devices,
  onCreate,
  onDelete,
  onSelect,
  onLoadMoreAfter,
  onLoadMoreBefore
}) {
  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-lock" })), /* @__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(
    Table4,
    {
      instances: devices,
      onDelete,
      onSelect,
      rowSelection,
      rowSelectionHandler,
      onLoadMoreAfter,
      onLoadMoreBefore
    }
  ) : /* @__PURE__ */ h(EmptyTable5, null)))));
}
function Table4({
  instances,
  onLoadMoreAfter,
  onDelete,
  onSelect,
  onLoadMoreBefore
}) {
  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`,
      onClick: onLoadMoreBefore
    },
    /* @__PURE__ */ h(i18n2.Translate, null, "load first page")
  ), /* @__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.device_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 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`,
      onClick: onLoadMoreAfter
    },
    /* @__PURE__ */ h(i18n2.Translate, null, "load next page")
  ));
}
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-magnify mdi-48px" }))), /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "There is no devices yet, add more pressing the + sign")));
}

// src/paths/instance/otp_devices/list/ListPage.tsx
function ListPage4({
  devices,
  onCreate,
  onDelete,
  onSelect,
  onLoadMoreBefore,
  onLoadMoreAfter
}) {
  return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h(
    CardTable4,
    {
      devices: devices.map((o3) => ({
        ...o3,
        id: String(o3.otp_device_id)
      })),
      onCreate,
      onDelete,
      onSelect,
      onLoadMoreBefore,
      onLoadMoreAfter
    }
  ));
}

// src/paths/instance/otp_devices/list/index.tsx
function ListOtpDevices2({ onCreate, onSelect }) {
  const { i18n: i18n2 } = useTranslationContext();
  const [notif, setNotif] = p3(void 0);
  const { lib } = useSessionContext();
  const { state } = useSessionContext();
  const result = useInstanceOtpDevices();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    ListPage4,
    {
      devices: result.body.otp_devices,
      onLoadMoreBefore: void 0,
      onLoadMoreAfter: void 0,
      onCreate,
      onSelect: (e4) => {
        onSelect(e4.otp_device_id);
      },
      onDelete: (e4) => {
        return lib.instance.deleteOtpDevice(state.token, 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/otp_devices/update/index.tsx
init_preact_module();
init_hooks_module();

// src/paths/instance/otp_devices/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 UpdatePage2({ 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_device_description",
        label: i18n2.str`Description`,
        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: 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(),
        addonAfterAction: () => {
          setShowKey(!showKey);
        },
        addonAfter: /* @__PURE__ */ h(
          "span",
          {
            class: "icon",
            onClick: () => {
              setShowKey(!showKey);
            }
          },
          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) => ({ ...s5, otp_key: "" }));
            },
            class: "button"
          },
          "change key"
        ) : /* @__PURE__ */ h(
          "button",
          {
            "data-tooltip": i18n2.str`generate random secret key`,
            class: "button is-info mr-3",
            onClick: (e4) => {
              setState((s5) => ({
                ...s5,
                otp_key: randomRfc3548Base32Key()
              }));
            }
          },
          /* @__PURE__ */ h(i18n2.Translate, null, "random")
        )
      }
    )) : 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/otp_devices/update/index.tsx
function UpdateValidator2({
  vid,
  onConfirm,
  onBack
}) {
  const result = useOtpDeviceDetails(vid);
  const [notif, setNotif] = p3(void 0);
  const [keyUpdated, setKeyUpdated] = p3(null);
  const { lib } = useSessionContext();
  const { state } = useSessionContext();
  const { i18n: i18n2 } = useTranslationContext();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  if (keyUpdated) {
    return /* @__PURE__ */ h(CreatedSuccessfully2, { entity: keyUpdated, onConfirm });
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    UpdatePage2,
    {
      device: {
        id: vid,
        otp_algorithm: result.body.otp_algorithm,
        otp_device_description: result.body.device_description,
        otp_key: "",
        otp_ctr: result.body.otp_ctr
      },
      onBack,
      onUpdate: async (newInfo) => {
        return lib.instance.updateOtpDevice(state.token, vid, newInfo).then((d5) => {
          if (d5.type === "ok") {
            if (newInfo.otp_key) {
              setKeyUpdated({
                otp_algorithm: newInfo.otp_algorithm,
                otp_device_description: newInfo.otp_device_description,
                otp_device_id: newInfo.id,
                otp_key: newInfo.otp_key,
                otp_ctr: newInfo.otp_ctr
              });
            } else {
              onConfirm();
            }
          } else {
            switch (d5.case) {
              case HttpStatusCode.NotFound: {
                setNotif({
                  message: i18n2.str`Could not update template`,
                  type: "ERROR",
                  description: i18n2.str`Template id is unknown`
                });
                break;
              }
              case HttpStatusCode.Conflict: {
                setNotif({
                  message: i18n2.str`Could not update template`,
                  type: "ERROR",
                  description: i18n2.str`The provided information is inconsistent with the current state of the template`
                });
                break;
              }
            }
          }
        }).catch((error2) => {
          setNotif({
            message: i18n2.str`could not update template`,
            type: "ERROR",
            description: error2.message
          });
        });
      }
    }
  ));
}

// 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({
        ...formValue,
        current: (formValue?.current || 0) + addedStock.incoming,
        lost: (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`Warehouse address` }, /* @__PURE__ */ h(InputLocation, { name: "address" }))
  ))));
}

// src/components/product/ProductForm.tsx
function ProductForm2({ onSubscribe, initial: initial3, alreadyExist }) {
  const [value, valueHandler] = p3({
    address: {},
    description_i18n: {},
    taxes: [],
    next_restock: { t_s: "never" },
    price: ":0",
    ...initial3,
    stock: !initial3 || initial3.total_stock === -1 ? void 0 : {
      current: initial3.total_stock || 0,
      lost: initial3.total_lost || 0,
      sold: initial3.total_sold || 0,
      address: initial3.address,
      nextRestock: initial3.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 : { ...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 { i18n: i18n2 } = useTranslationContext();
  const { state } = useSessionContext();
  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: new URL("product/", state.backendUrl.href).href,
        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 restriction`,
        tooltip: i18n2.str`is this product restricted for customer below certain age?`,
        help: i18n2.str`minimum age of the customer`
      }
    ),
    /* @__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`example: 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`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 CreatePage5({ 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 { lib } = useSessionContext();
  const { state } = useSessionContext();
  const [notif, setNotif] = p3(void 0);
  const { i18n: i18n2 } = useTranslationContext();
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    CreatePage5,
    {
      onBack,
      onCreate: (request) => {
        return lib.instance.addProduct(state.token, 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 CardTable5({
  instances,
  onCreate,
  onSelect,
  onUpdate,
  onDelete,
  onLoadMoreAfter,
  onLoadMoreBefore
}) {
  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, "Inventory")), /* @__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(
    Table5,
    {
      instances,
      onSelect,
      onDelete,
      onUpdate,
      onLoadMoreAfter,
      onLoadMoreBefore,
      rowSelection,
      rowSelectionHandler
    }
  ) : /* @__PURE__ */ h(EmptyTable6, null)))));
}
function Table5({
  rowSelection,
  rowSelectionHandler,
  instances,
  onSelect,
  onUpdate,
  onDelete,
  onLoadMoreAfter,
  onLoadMoreBefore
}) {
  const { i18n: i18n2 } = useTranslationContext();
  const [settings] = usePreference();
  return /* @__PURE__ */ h("div", { class: "table-container" }, onLoadMoreBefore && /* @__PURE__ */ h("button", { class: "button is-fullwidth", onClick: onLoadMoreBefore }, /* @__PURE__ */ h(i18n2.Translate, null, "load first page")), /* @__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, "Sales")), /* @__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",
            maxHeight: "2em",
            width: "auto",
            height: "auto"
          }
        }
      )
    ), /* @__PURE__ */ h(
      "td",
      {
        class: "has-tooltip-right",
        "data-tooltip": i4.description,
        onClick: () => rowSelection !== i4.id && rowSelectionHandler(i4.id),
        style: { cursor: "pointer" }
      },
      i4.description.length > 30 ? i4.description.substring(0, 30) + "..." : 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" }
      },
      /* @__PURE__ */ h("span", { style: { "whiteSpace": "nowrap" } }, 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(
          () => rowSelectionHandler(void 0)
        ),
        onCancel: () => rowSelectionHandler(void 0)
      }
    ))));
  }))), onLoadMoreAfter && /* @__PURE__ */ h(
    "button",
    {
      class: "button is-fullwidth",
      "data-tooltip": i18n2.str`load more products after the last one`,
      onClick: onLoadMoreAfter
    },
    /* @__PURE__ */ h(i18n2.Translate, null, "load next page")
  ));
}
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 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({
          ...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({
          ...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, { ...props }) : /* @__PURE__ */ h(FastProductWithManagedStockUpdateForm, { ...props });
}
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-magnify 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) {
  if (taxes === void 0)
    return 0;
  return taxes.reduce((p4, c4) => p4 + parseInt(c4.tax.split(":")[1], 10), 0);
}

// src/paths/instance/products/list/index.tsx
function ProductList2({
  onCreate,
  onSelect
}) {
  const result = useInstanceProducts();
  const { lib } = useSessionContext();
  const { state } = useSessionContext();
  const [deleting, setDeleting] = p3(null);
  const [notif, setNotif] = p3(void 0);
  const { i18n: i18n2 } = useTranslationContext();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    JumpToElementById,
    {
      testIfExist: async (id) => {
        const resp = await lib.instance.getProductDetails(state.token, id);
        return resp.type === "ok";
      },
      onSelect,
      description: i18n2.str`jump to product with the given product ID`,
      placeholder: i18n2.str`product id`
    }
  ), /* @__PURE__ */ h(
    CardTable5,
    {
      instances: result.body,
      onLoadMoreBefore: result.isFirstPage ? void 0 : result.loadFirst,
      onLoadMoreAfter: result.isLastPage ? void 0 : result.loadNext,
      onCreate,
      onUpdate: async (id, prod) => {
        try {
          await lib.instance.updateProduct(state.token, id, prod);
          setNotif({
            message: i18n2.str`product updated successfully`,
            type: "SUCCESS"
          });
        } catch (error2) {
          setNotif({
            message: i18n2.str`could not update the product`,
            type: "ERROR",
            description: error2 instanceof Error ? error2.message : void 0
          });
        }
        return;
      },
      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 () => {
        try {
          await lib.instance.deleteProduct(state.token, 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 UpdatePage3({ 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
}) {
  const result = useProductDetails(pid);
  const [notif, setNotif] = p3(void 0);
  const { lib } = useSessionContext();
  const { state } = useSessionContext();
  const { i18n: i18n2 } = useTranslationContext();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    UpdatePage3,
    {
      product: { ...result.body, product_id: pid },
      onBack,
      onUpdate: (data) => {
        return lib.instance.updateProduct(state.token, pid, data).then(onConfirm).catch((error2) => {
          setNotif({
            message: i18n2.str`could not create product`,
            type: "ERROR",
            description: error2.message
          });
        });
      }
    }
  ));
}

// src/paths/instance/templates/create/index.tsx
init_preact_module();
init_hooks_module();

// src/paths/instance/templates/create/CreatePage.tsx
init_preact_module();
init_hooks_module();
function CreatePage6({ onCreate, onBack }) {
  const { i18n: i18n2 } = useTranslationContext();
  const { config } = useSessionContext();
  const { state: session } = useSessionContext();
  const devices = useInstanceOtpDevices();
  const [state, setState] = p3({
    minimum_age: 0,
    pay_duration: {
      d_ms: 1e3 * 60 * 30
      //30 min
    }
  });
  function updateState(up) {
    setState((old) => {
      const newState = up(old);
      if (!newState.amount_editable) {
        newState.currency_editable = false;
      }
      return newState;
    });
  }
  const parsedPrice = !state.amount ? void 0 : Amounts.parse(state.amount);
  const errors2 = {
    id: !state.id ? i18n2.str`should not be empty` : !/[a-zA-Z0-9]*/.test(state.id) ? i18n2.str`no valid. only characters and numbers` : void 0,
    description: !state.description ? i18n2.str`should not be empty` : void 0,
    amount: !state.amount ? state.amount_editable ? void 0 : i18n2.str`required` : !parsedPrice ? i18n2.str`not valid` : Amounts.isZero(parsedPrice) ? state.amount_editable ? void 0 : i18n2.str`must be greater than 0` : void 0,
    minimum_age: state.minimum_age && state.minimum_age < 0 ? i18n2.str`should be greater that 0` : void 0,
    pay_duration: !state.pay_duration ? i18n2.str`can't be empty` : state.pay_duration.d_ms === "forever" ? void 0 : state.pay_duration.d_ms < 1e3 ? i18n2.str`to short` : void 0
  };
  const cList = Object.values(config.currencies).map((d5) => d5.name);
  const hasErrors = Object.keys(errors2).some(
    (k5) => errors2[k5] !== void 0
  );
  const zero = Amounts.stringify(Amounts.zeroOfCurrency(config.currency));
  const submitForm = () => {
    if (hasErrors)
      return Promise.reject();
    const contract_amount = state.amount_editable ? void 0 : state.amount;
    const contract_summary = state.summary_editable ? void 0 : state.summary;
    const template_contract = {
      minimum_age: state.minimum_age,
      pay_duration: Duration.toTalerProtocolDuration(state.pay_duration),
      amount: contract_amount,
      summary: contract_summary,
      currency: cList.length > 1 && state.currency_editable ? void 0 : config.currency
    };
    return onCreate({
      template_id: state.id,
      template_description: state.description,
      template_contract,
      editable_defaults: {
        amount: !state.amount_editable ? void 0 : state.amount ?? zero,
        summary: !state.summary_editable ? void 0 : state.summary ?? "",
        currency: cList.length === 1 || !state.currency_editable ? void 0 : config.currency
      },
      otp_id: state.otpId
    });
  };
  const deviceList = !devices || devices instanceof TalerError || devices.type === "fail" ? [] : devices.body.otp_devices;
  const deviceMap = deviceList.reduce(
    (prev, cur) => {
      prev[cur.otp_device_id] = cur.device_description;
      return prev;
    },
    {}
  );
  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: updateState,
      errors: errors2
    },
    /* @__PURE__ */ h(
      InputWithAddon,
      {
        name: "id",
        help: new URL(`templates/${state.id ?? ""}`, session.backendUrl.href).href,
        label: i18n2.str`Identifier`,
        tooltip: i18n2.str`Name of the template in URLs.`
      }
    ),
    /* @__PURE__ */ h(
      Input,
      {
        name: "description",
        label: i18n2.str`Description`,
        help: "",
        tooltip: i18n2.str`Describe what this template stands for`
      }
    ),
    /* @__PURE__ */ h(
      Input,
      {
        name: "summary",
        inputType: "multiline",
        label: i18n2.str`Summary`,
        tooltip: i18n2.str`If specified, this template will create order with the same summary`
      }
    ),
    /* @__PURE__ */ h(
      InputToggle,
      {
        name: "summary_editable",
        label: i18n2.str`Summary is editable`,
        tooltip: i18n2.str`Allow the user to change the summary.`
      }
    ),
    /* @__PURE__ */ h(
      InputCurrency,
      {
        name: "amount",
        label: i18n2.str`Amount`,
        tooltip: i18n2.str`If specified, this template will create order with the same price`
      }
    ),
    /* @__PURE__ */ h(
      InputToggle,
      {
        name: "amount_editable",
        label: i18n2.str`Amount is editable`,
        tooltip: i18n2.str`Allow the user to select the amount to pay.`
      }
    ),
    cList.length > 1 && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
      InputToggle,
      {
        name: "currency_editable",
        readonly: !state.amount_editable,
        label: i18n2.str`Currency is editable`,
        tooltip: i18n2.str`Allow the user to change currency.`
      }
    ), /* @__PURE__ */ h(TextField, { name: "sc", label: i18n2.str`Supported currencies` }, /* @__PURE__ */ h(i18n2.Translate, null, "supported currencies: ", cList.join(", ")))),
    /* @__PURE__ */ h(
      InputNumber2,
      {
        name: "minimum_age",
        label: i18n2.str`Minimum age`,
        help: "",
        tooltip: i18n2.str`Is this contract restricted to some age?`
      }
    ),
    /* @__PURE__ */ h(
      InputDuration,
      {
        name: "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.`
      }
    ),
    !deviceList.length ? /* @__PURE__ */ h(
      TextField,
      {
        name: "otpId",
        label: i18n2.str`OTP device`,
        tooltip: i18n2.str`Use to verify transaction while offline.`
      },
      /* @__PURE__ */ h(i18n2.Translate, null, "No OTP device."),
      "\xA0",
      /* @__PURE__ */ h("a", { href: "/otp-devices/new" }, /* @__PURE__ */ h(i18n2.Translate, null, "Add one first"))
    ) : /* @__PURE__ */ h(
      InputSelector,
      {
        name: "otpId",
        label: i18n2.str`OTP device`,
        values: [
          void 0,
          ...deviceList.map((e4) => e4.otp_device_id)
        ],
        toStr: (v3) => {
          if (!v3) {
            return i18n2.str`No device`;
          }
          return deviceMap[v3];
        },
        tooltip: i18n2.str`Use to verify transaction in offline mode.`
      }
    )
  ), /* @__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 { lib } = useSessionContext();
  const { state } = useSessionContext();
  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 lib.instance.addTemplate(state.token, request).then(() => onConfirm()).catch((error2) => {
          setNotif({
            message: i18n2.str`could not inform template`,
            type: "ERROR",
            description: error2.message
          });
        });
      }
    }
  ));
}

// src/paths/instance/templates/list/index.tsx
init_preact_module();
init_hooks_module();

// src/hooks/templates.ts
init_hooks_module();
var useSWR8 = useSWR;
function revalidateInstanceTemplates() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "listTemplates",
    void 0,
    { revalidate: true }
  );
}
function useInstanceTemplates() {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  const [offset, setOffset] = p3();
  async function fetcher([token, bid]) {
    return await instance.listTemplates(token, {
      limit: PAGINATED_LIST_REQUEST,
      offset: bid,
      order: "dec"
    });
  }
  const { data, error: error2 } = useSWR8([session.token, offset, "listTemplates"], fetcher);
  if (error2)
    return error2;
  if (data === void 0)
    return void 0;
  if (data.type !== "ok")
    return data;
  return data;
}
function revalidateTemplateDetails() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "getTemplateDetails",
    void 0,
    { revalidate: true }
  );
}
function useTemplateDetails(templateId) {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  async function fetcher([tid, token]) {
    return await instance.getTemplateDetails(token, tid);
  }
  const { data, error: error2 } = useSWR8([templateId, session.token, "getTemplateDetails"], fetcher);
  if (data)
    return data;
  if (error2)
    return error2;
  return void 0;
}

// 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
}) {
  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-qrcode" })), /* @__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(
    Table6,
    {
      instances: templates,
      onDelete,
      onSelect,
      onNewOrder,
      onQR,
      rowSelection,
      rowSelectionHandler,
      onLoadMoreAfter,
      onLoadMoreBefore
    }
  ) : /* @__PURE__ */ h(EmptyTable7, null)))));
}
function Table6({
  instances,
  onLoadMoreAfter,
  onDelete,
  onNewOrder,
  onQR,
  onSelect,
  onLoadMoreBefore
}) {
  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`,
      onClick: onLoadMoreBefore
    },
    /* @__PURE__ */ h(i18n2.Translate, null, "load first page")
  ), /* @__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)
      },
      "Use template"
    ), /* @__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`,
      onClick: onLoadMoreAfter
    },
    /* @__PURE__ */ h(i18n2.Translate, null, "load next page")
  ));
}
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-magnify 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 ListPage5({
  templates,
  onCreate,
  onDelete,
  onSelect,
  onNewOrder,
  onQR,
  onLoadMoreBefore,
  onLoadMoreAfter
}) {
  return /* @__PURE__ */ h(
    CardTable6,
    {
      templates: templates.map((o3) => ({
        ...o3,
        id: String(o3.template_id)
      })),
      onQR,
      onCreate,
      onDelete,
      onSelect,
      onNewOrder,
      onLoadMoreBefore,
      onLoadMoreAfter
    }
  );
}

// src/paths/instance/templates/list/index.tsx
function ListTemplates({
  onCreate,
  onQR,
  onSelect,
  onNewOrder
}) {
  const { i18n: i18n2 } = useTranslationContext();
  const [notif, setNotif] = p3(void 0);
  const { state, lib } = useSessionContext();
  const result = useInstanceTemplates();
  const [deleting, setDeleting] = p3(null);
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    JumpToElementById,
    {
      testIfExist: async (id) => {
        const resp = await lib.instance.getTemplateDetails(state.token, id);
        return resp.type === "ok";
      },
      onSelect,
      description: i18n2.str`jump to template with the given template ID`,
      placeholder: i18n2.str`template id`
    }
  ), /* @__PURE__ */ h(
    ListPage5,
    {
      templates: result.body.templates,
      onLoadMoreBefore: void 0,
      onLoadMoreAfter: 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 () => {
        try {
          await lib.instance.deleteTemplate(state.token, 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/qr/index.tsx
init_preact_module();

// src/paths/instance/templates/qr/QrPage.tsx
init_preact_module();
function QrPage({ id: templateId, onBack }) {
  const { i18n: i18n2 } = useTranslationContext();
  const { state } = useSessionContext();
  const merchantBaseUrl = state.backendUrl.href;
  const payTemplateUri = stringifyPayTemplateUri({
    merchantBaseUrl,
    templateId
    // FIXME!
    //templateParams: {},
  });
  return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("section", { id: "printThis" }, /* @__PURE__ */ h(QR, { text: payTemplateUri }), /* @__PURE__ */ h("pre", { style: { textAlign: "center" } }, /* @__PURE__ */ h("a", { target: "_blank", rel: "noreferrer", href: payTemplateUri }, payTemplateUri))), /* @__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", null), /* @__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" }))));
}
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(
    `<html><head><title>Order template for ${name}</title><style>`
  );
  printWindow.document.write("</style></head><body>&nbsp;</body></html>");
  printWindow.document.close();
  printWindow.document.body.appendChild(divContents.cloneNode(true));
  printWindow.addEventListener("load", () => {
    printWindow.print();
  });
}

// src/paths/instance/templates/qr/index.tsx
function TemplateQrPage({
  tid,
  onBack
}) {
  const result = useTemplateDetails(tid);
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h(QrPage, { contract: result.body.template_contract, id: tid, onBack });
}

// 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 UpdatePage4({ template, onUpdate, onBack }) {
  const { i18n: i18n2 } = useTranslationContext();
  const { config } = useSessionContext();
  const { state: session } = useSessionContext();
  const [state, setState] = p3({
    description: template.template_description,
    minimum_age: template.template_contract.minimum_age,
    otpId: template.otp_id,
    pay_duration: template.template_contract.pay_duration ? Duration.fromTalerProtocolDuration(
      template.template_contract.pay_duration
    ) : void 0,
    summary: template.editable_defaults?.summary ?? template.template_contract.summary,
    amount: template.editable_defaults?.amount ?? template.template_contract.amount,
    currency_editable: !!template.editable_defaults?.currency,
    summary_editable: template.editable_defaults?.summary !== void 0,
    amount_editable: template.editable_defaults?.amount !== void 0
  });
  function updateState(up) {
    setState((old) => {
      const newState = up(old);
      if (!newState.amount_editable) {
        newState.currency_editable = false;
      }
      return newState;
    });
  }
  const devices = useInstanceOtpDevices();
  const deviceList = !devices || devices instanceof TalerError || devices.type === "fail" ? [] : devices.body.otp_devices;
  const deviceMap = deviceList.reduce(
    (prev, cur) => {
      prev[cur.otp_device_id] = cur.device_description;
      return prev;
    },
    {}
  );
  const parsedPrice = !state.amount ? void 0 : Amounts.parse(state.amount);
  const errors2 = {
    description: !state.description ? i18n2.str`should not be empty` : void 0,
    amount: !state.amount ? state.amount_editable ? void 0 : i18n2.str`required` : !parsedPrice ? i18n2.str`not valid` : Amounts.isZero(parsedPrice) ? state.amount_editable ? void 0 : i18n2.str`must be greater than 0` : void 0,
    minimum_age: state.minimum_age && state.minimum_age < 0 ? i18n2.str`should be greater that 0` : void 0,
    pay_duration: !state.pay_duration ? i18n2.str`can't be empty` : state.pay_duration.d_ms === "forever" ? void 0 : state.pay_duration.d_ms < 1e3 ? i18n2.str`to short` : void 0
  };
  const cList = Object.values(config.currencies).map((d5) => d5.name);
  const hasErrors = Object.keys(errors2).some(
    (k5) => errors2[k5] !== void 0
  );
  const zero = Amounts.stringify(Amounts.zeroOfCurrency(config.currency));
  const submitForm = () => {
    if (hasErrors)
      return Promise.reject();
    const contract_amount = state.amount_editable ? void 0 : state.amount;
    const contract_summary = state.summary_editable ? void 0 : state.summary;
    const template_contract = {
      minimum_age: state.minimum_age,
      pay_duration: Duration.toTalerProtocolDuration(state.pay_duration),
      amount: contract_amount,
      summary: contract_summary,
      currency: cList.length > 1 && state.currency_editable ? void 0 : config.currency
    };
    return onUpdate({
      template_description: state.description,
      template_contract,
      editable_defaults: {
        amount: !state.amount_editable ? void 0 : state.amount ?? zero,
        summary: !state.summary_editable ? void 0 : state.summary ?? "",
        currency: cList.length === 1 || !state.currency_editable ? void 0 : config.currency
      },
      otp_id: state.otpId
    });
  };
  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" }, new URL(`templates/${template.id}`, session.backendUrl.href).href)))))), /* @__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: updateState,
      errors: errors2
    },
    /* @__PURE__ */ h(
      Input,
      {
        name: "description",
        label: i18n2.str`Description`,
        help: "",
        tooltip: i18n2.str`Describe what this template stands for`
      }
    ),
    /* @__PURE__ */ h(
      Input,
      {
        name: "summary",
        inputType: "multiline",
        label: i18n2.str`Summary`,
        tooltip: i18n2.str`If specified, this template will create order with the same summary`
      }
    ),
    /* @__PURE__ */ h(
      InputToggle,
      {
        name: "summary_editable",
        label: i18n2.str`Summary is editable`,
        tooltip: i18n2.str`Allow the user to change the summary.`
      }
    ),
    /* @__PURE__ */ h(
      InputCurrency,
      {
        name: "amount",
        label: i18n2.str`Amount`,
        tooltip: i18n2.str`If specified, this template will create order with the same price`
      }
    ),
    /* @__PURE__ */ h(
      InputToggle,
      {
        name: "amount_editable",
        label: i18n2.str`Amount is editable`,
        tooltip: i18n2.str`Allow the user to select the amount to pay.`
      }
    ),
    cList.length > 1 && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
      InputToggle,
      {
        name: "currency_editable",
        readonly: !state.amount_editable,
        label: i18n2.str`Currency is editable`,
        tooltip: i18n2.str`Allow the user to change currency.`
      }
    ), /* @__PURE__ */ h(TextField, { name: "sc", label: i18n2.str`Supported currencies` }, /* @__PURE__ */ h(i18n2.Translate, null, "supported currencies: ", cList.join(", ")))),
    /* @__PURE__ */ h(
      InputNumber2,
      {
        name: "minimum_age",
        label: i18n2.str`Minimum age`,
        help: "",
        tooltip: i18n2.str`Is this contract restricted to some age?`
      }
    ),
    /* @__PURE__ */ h(
      InputDuration,
      {
        name: "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.`
      }
    ),
    !deviceList.length ? /* @__PURE__ */ h(
      TextField,
      {
        name: "otpId",
        label: i18n2.str`OTP device`,
        tooltip: i18n2.str`Use to verify transaction while offline.`
      },
      /* @__PURE__ */ h(i18n2.Translate, null, "No OTP device."),
      "\xA0",
      /* @__PURE__ */ h("a", { href: "/otp-devices/new" }, /* @__PURE__ */ h(i18n2.Translate, null, "Add one first"))
    ) : /* @__PURE__ */ h(
      InputSelector,
      {
        name: "otpId",
        label: i18n2.str`OTP device`,
        values: [
          void 0,
          ...deviceList.map((e4) => e4.otp_device_id)
        ],
        toStr: (v3) => {
          if (!v3) {
            return i18n2.str`No device`;
          }
          return deviceMap[v3];
        },
        tooltip: i18n2.str`Use to verify transaction in offline mode.`
      }
    )
  ), /* @__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
}) {
  const { lib } = useSessionContext();
  const { state } = useSessionContext();
  const result = useTemplateDetails(tid);
  const [notif, setNotif] = p3(void 0);
  const { i18n: i18n2 } = useTranslationContext();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    UpdatePage4,
    {
      template: { ...result.body, id: tid },
      onBack,
      onUpdate: (data) => {
        return lib.instance.updateTemplate(state.token, tid, data).then(onConfirm).catch((error2) => {
          setNotif({
            message: i18n2.str`could not update 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({
    currency: template.editable_defaults?.currency ?? template.template_contract.currency,
    // FIXME: Add additional check here, editable default might be a plain string!
    amount: template.editable_defaults?.amount ?? template.template_contract.amount,
    summary: template.editable_defaults?.summary ?? template.template_contract.summary
  });
  const errors2 = {
    amount: !state.amount ? i18n2.str`Amount is required` : void 0,
    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
}) {
  const { lib } = useSessionContext();
  const result = useTemplateDetails(tid);
  const [notif, setNotif] = p3(void 0);
  const { i18n: i18n2 } = useTranslationContext();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    UsePage,
    {
      template: result.body,
      id: tid,
      onBack,
      onCreateOrder: (request) => {
        return lib.instance.useTemplateCreateOrder(tid, request).then((res) => {
          if (res.type === "ok") {
            onOrderCreated(res.body.order_id);
          } else {
            setNotif({
              message: i18n2.str`could not create order from template`,
              type: "ERROR"
            });
          }
        }).catch((error2) => {
          setNotif({
            message: i18n2.str`could not create order from template`,
            type: "ERROR",
            description: error2.message
          });
        });
      }
    }
  ));
}

// src/paths/instance/token/index.tsx
init_preact_module();
init_hooks_module();

// src/paths/instance/token/DetailPage.tsx
init_preact_module();
init_hooks_module();
function DetailPage2({
  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 { state } = useSessionContext();
  const text = i18n2.str`You are updating the access token from instance with id "${state.instance}"`;
  async function submitForm() {
    if (hasErrors)
      return;
    const oldToken = form.old_token !== void 0 && hasToken ? createRFC8959AccessTokenPlain(form.old_token) : void 0;
    const newToken = createRFC8959AccessTokenPlain(form.new_token);
    onNewToken(oldToken, newToken);
  }
  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" }, text)))))), /* @__PURE__ */ h("hr", null), !hasToken && /* @__PURE__ */ h(
    NotificationCard,
    {
      notification: {
        message: i18n2.str`This instance doesn't have authentication token.`,
        description: i18n2.str`You can leave it empty if there is another layer of security.`,
        type: "WARN"
      }
    }
  ), /* @__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) {
          onClearToken(form.old_token ? createRFC8959AccessTokenPlain(form.old_token) : void 0);
        } 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("a", { class: "button", onClick: onBack }, /* @__PURE__ */ h(i18n2.Translate, null, "Cancel")), /* @__PURE__ */ h(
    AsyncButton,
    {
      type: "submit",
      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
function Token({ onChange, onCancel }) {
  const { i18n: i18n2 } = useTranslationContext();
  const { lib } = useSessionContext();
  const { logIn } = useSessionContext();
  const [notif, setNotif] = p3(void 0);
  const result = useInstanceDetails();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  const hasToken = result.body.auth.method === "token";
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    DetailPage2,
    {
      onBack: onCancel,
      hasToken,
      onClearToken: async (currentToken) => {
        try {
          const resp = await lib.instance.updateCurrentInstanceAuthentication(
            currentToken,
            {
              method: "external"
            }
          );
          if (resp.type === "ok") {
            onChange();
          } else {
            return setNotif({
              message: i18n2.str`Failed to clear token`,
              type: "ERROR",
              description: resp.detail.hint
            });
          }
        } catch (error2) {
          if (error2 instanceof Error) {
            return setNotif({
              message: i18n2.str`Failed to clear token`,
              type: "ERROR",
              description: error2.message
            });
          }
        }
      },
      onNewToken: async (currentToken, newToken) => {
        try {
          {
            const resp2 = await lib.instance.updateCurrentInstanceAuthentication(
              currentToken,
              {
                token: newToken,
                method: "token"
              }
            );
            if (resp2.type === "fail") {
              return setNotif({
                message: i18n2.str`Failed to set new token`,
                type: "ERROR",
                description: resp2.detail.hint
              });
            }
          }
          const resp = await lib.authenticate.createAccessTokenBearer(
            newToken,
            {
              scope: "write",
              duration: {
                d_us: "forever"
              },
              refreshable: true
            }
          );
          if (resp.type === "ok") {
            logIn(resp.body.token);
            return onChange();
          } else {
            return setNotif({
              message: i18n2.str`Failed to set new token`,
              type: "ERROR"
            });
          }
        } catch (error2) {
          if (error2 instanceof Error) {
            return setNotif({
              message: i18n2.str`Failed to set new token`,
              type: "ERROR",
              description: error2.message
            });
          }
        }
      }
    }
  ));
}

// src/paths/instance/tokenfamilies/create/index.tsx
init_preact_module();
init_hooks_module();

// src/paths/instance/tokenfamilies/create/CreatePage.tsx
init_preact_module();

// src/components/tokenfamily/TokenFamilyForm.tsx
init_preact_module();
init_hooks_module();
function TokenFamilyForm({ onSubscribe }) {
  const [value, valueHandler] = p3({
    slug: "",
    name: "",
    description: "",
    description_i18n: {},
    kind: TalerMerchantApi.TokenFamilyKind.Discount,
    duration: { d_us: "forever" },
    valid_after: { t_s: "never" },
    valid_before: { t_s: "never" }
  });
  let errors2 = {};
  try {
    TokenFamilyCreateSchema.validateSync(value, {
      abortEarly: false
    });
  } catch (err) {
    if (err instanceof ValidationError) {
      const yupErrors = err.inner;
      errors2 = yupErrors.reduce(
        (prev, cur) => !cur.path ? prev : { ...prev, [cur.path]: cur.message },
        {}
      );
    }
  }
  const hasErrors = Object.keys(errors2).some(
    (k5) => errors2[k5] !== void 0
  );
  const submit = T2(() => {
    return value;
  }, [value]);
  h2(() => {
    onSubscribe(hasErrors ? void 0 : submit);
  }, [submit, hasErrors]);
  const { state } = useSessionContext();
  const { i18n: i18n2 } = useTranslationContext();
  return /* @__PURE__ */ h("div", null, /* @__PURE__ */ h(
    FormProvider,
    {
      name: "token_family",
      errors: errors2,
      object: value,
      valueHandler
    },
    /* @__PURE__ */ h(
      InputWithAddon,
      {
        name: "slug",
        addonBefore: new URL("tokenfamily/", state.backendUrl.href).href,
        label: i18n2.str`Slug`,
        tooltip: i18n2.str`token family slug to use in URLs (for internal use only)`
      }
    ),
    /* @__PURE__ */ h(
      InputSelector,
      {
        name: "kind",
        label: i18n2.str`Kind`,
        tooltip: i18n2.str`token family kind`,
        values: ["discount", "subscription"]
      }
    ),
    /* @__PURE__ */ h(
      Input,
      {
        name: "name",
        inputType: "text",
        label: i18n2.str`Name`,
        tooltip: i18n2.str`user-readable token family name`
      }
    ),
    /* @__PURE__ */ h(
      Input,
      {
        name: "description",
        inputType: "multiline",
        label: i18n2.str`Description`,
        tooltip: i18n2.str`token family description for customers`
      }
    ),
    /* @__PURE__ */ h(
      InputDate,
      {
        name: "valid_after",
        label: i18n2.str`Valid After`,
        tooltip: i18n2.str`token family can issue tokens after this date`,
        withTimestampSupport: true
      }
    ),
    /* @__PURE__ */ h(
      InputDate,
      {
        name: "valid_before",
        label: i18n2.str`Valid Before`,
        tooltip: i18n2.str`token family can issue tokens until this date`,
        withTimestampSupport: true
      }
    ),
    /* @__PURE__ */ h(
      InputDuration,
      {
        name: "duration",
        label: i18n2.str`Duration`,
        tooltip: i18n2.str`validity duration of a issued token`,
        withForever: true
      }
    )
  ));
}

// src/paths/instance/tokenfamilies/create/CreatePage.tsx
function CreatePage7({ 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(TokenFamilyForm, { 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/tokenfamilies/create/index.tsx
function CreateTokenFamily({ onConfirm, onBack }) {
  const [notif, setNotif] = p3(void 0);
  const { i18n: i18n2 } = useTranslationContext();
  const { lib } = useSessionContext();
  const { state } = useSessionContext();
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    CreatePage7,
    {
      onBack,
      onCreate: (request) => {
        return lib.instance.createTokenFamily(state.token, request).then(() => onConfirm()).catch((error2) => {
          setNotif({
            message: i18n2.str`could not create token family`,
            type: "ERROR",
            description: error2.message
          });
        });
      }
    }
  ));
}

// src/paths/instance/tokenfamilies/list/index.tsx
init_preact_module();
init_hooks_module();

// src/hooks/tokenfamily.ts
var useSWR9 = useSWR;
function useInstanceTokenFamilies() {
  const { state: session, lib: { instance } } = useSessionContext();
  async function fetcher([token, bid]) {
    return await instance.listTokenFamilies(token, {
      // limit: PAGINATED_LIST_REQUEST,
      // offset: bid === undefined ? undefined: String(bid),
      // order: "dec",
    });
  }
  const { data, error: error2 } = useSWR9([session.token, "offset", "listTokenFamilies"], fetcher);
  if (error2)
    return error2;
  if (data === void 0)
    return void 0;
  if (data.type !== "ok")
    return data;
  return data;
}
function useTokenFamilyDetails(tokenFamilySlug) {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  async function fetcher([slug, token]) {
    return await instance.getTokenFamilyDetails(token, slug);
  }
  const { data, error: error2 } = useSWR9([tokenFamilySlug, session.token, "getTokenFamilyDetails"], fetcher);
  if (error2)
    return error2;
  if (data === void 0)
    return void 0;
  if (data.type !== "ok")
    return data;
  return data;
}

// src/paths/instance/tokenfamilies/list/Table.tsx
init_preact_module();
init_hooks_module();
function CardTable7({
  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, "Token Families")), /* @__PURE__ */ h("div", { class: "card-header-icon", "aria-label": "more options" }, /* @__PURE__ */ h(
    "span",
    {
      class: "has-tooltip-left",
      "data-tooltip": i18n2.str`add token family`
    },
    /* @__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(
    Table7,
    {
      instances,
      onSelect,
      onDelete,
      onUpdate,
      rowSelection,
      rowSelectionHandler
    }
  ) : /* @__PURE__ */ h(EmptyTable8, null)))));
}
function Table7({
  rowSelection,
  rowSelectionHandler,
  instances,
  onSelect,
  onUpdate,
  onDelete
}) {
  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, "Slug")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Name")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Valid After")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Valid Before")), /* @__PURE__ */ h("th", null, /* @__PURE__ */ h(i18n2.Translate, null, "Kind")), /* @__PURE__ */ h("th", null))), /* @__PURE__ */ h("tbody", null, instances.map((i4) => {
    return /* @__PURE__ */ h(p2, { key: i4.slug }, /* @__PURE__ */ h("tr", { key: "info" }, /* @__PURE__ */ h(
      "td",
      {
        onClick: () => rowSelection !== i4.slug && rowSelectionHandler(i4.slug),
        style: { cursor: "pointer" }
      },
      i4.slug
    ), /* @__PURE__ */ h(
      "td",
      {
        onClick: () => rowSelection !== i4.slug && rowSelectionHandler(i4.slug),
        style: { cursor: "pointer" }
      },
      i4.name
    ), /* @__PURE__ */ h(
      "td",
      {
        onClick: () => rowSelection !== i4.slug && rowSelectionHandler(i4.slug),
        style: { cursor: "pointer" }
      },
      i4.valid_after.t_s === "never" ? "never" : format(new Date(i4.valid_after.t_s * 1e3), "yyyy/MM/dd hh:mm:ss")
    ), /* @__PURE__ */ h(
      "td",
      {
        onClick: () => rowSelection !== i4.slug && rowSelectionHandler(i4.slug),
        style: { cursor: "pointer" }
      },
      i4.valid_before.t_s === "never" ? "never" : format(new Date(i4.valid_before.t_s * 1e3), "yyyy/MM/dd hh:mm:ss")
    ), /* @__PURE__ */ h(
      "td",
      {
        onClick: () => rowSelection !== i4.slug && rowSelectionHandler(i4.slug),
        style: { cursor: "pointer" }
      },
      i4.kind
    ), /* @__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 token family 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 token family from the database`
      },
      /* @__PURE__ */ h(
        "button",
        {
          class: "button is-small is-danger",
          type: "button",
          onClick: () => onDelete(i4)
        },
        /* @__PURE__ */ h(i18n2.Translate, null, "Delete")
      )
    )))));
  }))));
}
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 are no token families yet, add the first one by pressing the + sign.")));
}

// src/paths/instance/tokenfamilies/list/index.tsx
function TokenFamilyList({
  onCreate,
  onSelect
}) {
  const result = useInstanceTokenFamilies();
  const [notif, setNotif] = p3(void 0);
  const { lib, state } = useSessionContext();
  const [deleting, setDeleting] = p3(null);
  const { i18n: i18n2 } = useTranslationContext();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h("section", { class: "section is-main-section" }, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    CardTable7,
    {
      instances: result.body.token_families,
      onCreate,
      onUpdate: async (slug, fam) => {
        try {
          await lib.instance.updateTokenFamily(state.token, slug, fam);
          setNotif({
            message: i18n2.str`token family updated successfully`,
            type: "SUCCESS"
          });
        } catch (error2) {
          setNotif({
            message: i18n2.str`could not update the token family`,
            type: "ERROR",
            description: error2 instanceof Error ? error2.message : void 0
          });
        }
        return;
      },
      onSelect: (tokenFamily) => onSelect(tokenFamily.slug),
      onDelete: (fam) => setDeleting(fam)
    }
  ), deleting && /* @__PURE__ */ h(
    ConfirmModal,
    {
      label: `Delete token family`,
      description: `Delete the token family "${deleting.name}"`,
      danger: true,
      active: true,
      onCancel: () => setDeleting(null),
      onConfirm: async () => {
        try {
          await lib.instance.deleteTokenFamily(state.token, deleting.slug);
          setNotif({
            message: i18n2.str`Token family "${deleting.name}" (SLUG: ${deleting.slug}) has been deleted`,
            type: "SUCCESS"
          });
        } catch (error2) {
          setNotif({
            message: i18n2.str`Failed to delete token family`,
            type: "ERROR",
            description: error2 instanceof Error ? error2.message : void 0
          });
        }
        setDeleting(null);
      }
    },
    /* @__PURE__ */ h("p", null, "If you delete the ", /* @__PURE__ */ h("b", null, '"', deleting.name, '"'), " token family (Slug:", " ", /* @__PURE__ */ h("b", null, deleting.slug), "), all issued tokens will become invalid."),
    /* @__PURE__ */ h("p", { class: "warning" }, "Deleting a token family ", /* @__PURE__ */ h("b", null, "cannot be undone"), ".")
  ));
}

// src/paths/instance/tokenfamilies/update/index.tsx
init_preact_module();
init_hooks_module();

// src/paths/instance/tokenfamilies/update/UpdatePage.tsx
init_preact_module();
init_hooks_module();
function convert2(from) {
  const { duration, ...rest } = from;
  const converted = {
    duration: Duration.fromTalerProtocolDuration(duration)
  };
  return { ...converted, ...rest };
}
function UpdatePage5({ onUpdate, onBack, tokenFamily }) {
  const [value, valueHandler] = p3(convert2(tokenFamily));
  let errors2 = {};
  try {
    TokenFamilyUpdateSchema.validateSync(value, {
      abortEarly: false
    });
  } catch (err) {
    if (err instanceof ValidationError) {
      const yupErrors = err.inner;
      errors2 = yupErrors.reduce(
        (prev, cur) => !cur.path ? prev : { ...prev, [cur.path]: cur.message },
        {}
      );
    }
  }
  const hasErrors = Object.keys(errors2).some(
    (k5) => errors2[k5] !== void 0
  );
  const submitForm = () => {
    if (hasErrors)
      return Promise.reject();
    const { duration, ...rest } = value;
    const result = {
      ...rest,
      duration: Duration.toTalerProtocolDuration(duration)
    };
    return onUpdate(result);
  };
  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" }, "Token Family: ", /* @__PURE__ */ h("b", null, tokenFamily.name))))))), /* @__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,
    {
      name: "token_family",
      errors: errors2,
      object: value,
      valueHandler
    },
    /* @__PURE__ */ h(
      Input,
      {
        name: "name",
        inputType: "text",
        label: i18n2.str`Name`,
        tooltip: i18n2.str`user-readable token family name`
      }
    ),
    /* @__PURE__ */ h(
      Input,
      {
        name: "description",
        inputType: "multiline",
        label: i18n2.str`Description`,
        tooltip: i18n2.str`token family description for customers`
      }
    ),
    /* @__PURE__ */ h(
      InputDate,
      {
        name: "valid_after",
        label: i18n2.str`Valid After`,
        tooltip: i18n2.str`token family can issue tokens after this date`,
        withTimestampSupport: true
      }
    ),
    /* @__PURE__ */ h(
      InputDate,
      {
        name: "valid_before",
        label: i18n2.str`Valid Before`,
        tooltip: i18n2.str`token family can issue tokens until this date`,
        withTimestampSupport: true
      }
    ),
    /* @__PURE__ */ h(
      InputDuration,
      {
        name: "duration",
        label: i18n2.str`Duration`,
        tooltip: i18n2.str`validity duration of a issued token`,
        withForever: 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,
    {
      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/tokenfamilies/update/index.tsx
function UpdateTokenFamily({
  slug,
  onConfirm,
  onBack
}) {
  const result = useTokenFamilyDetails(slug);
  const [notif, setNotif] = p3(void 0);
  const { lib, state } = useSessionContext();
  const { i18n: i18n2 } = useTranslationContext();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  const family = {
    name: result.body.name,
    description: result.body.description,
    description_i18n: result.body.description_i18n || {},
    duration: result.body.duration,
    valid_after: result.body.valid_after,
    valid_before: result.body.valid_before
  };
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    UpdatePage5,
    {
      tokenFamily: family,
      onBack,
      onUpdate: (data) => {
        return lib.instance.updateTokenFamily(state.token, slug, data).then(onConfirm).catch((error2) => {
          setNotif({
            message: i18n2.str`could not update token family`,
            type: "ERROR",
            description: error2.message
          });
        });
      }
    }
  ));
}

// src/paths/instance/transfers/create/index.tsx
init_preact_module();
init_hooks_module();

// src/paths/instance/transfers/create/CreatePage.tsx
init_preact_module();
init_hooks_module();
function CreatePage8({ accounts, onCreate, onBack }) {
  const { i18n: i18n2 } = useTranslationContext();
  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 { lib } = useSessionContext();
  const { state } = useSessionContext();
  const [notif, setNotif] = p3(void 0);
  const { i18n: i18n2 } = useTranslationContext();
  const instance = useInstanceBankAccounts();
  const accounts = !instance || instance instanceof TalerError || instance.type === "fail" ? [] : instance.body.accounts.map((a5) => a5.payto_uri);
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    CreatePage8,
    {
      onBack,
      accounts,
      onCreate: (request) => {
        return lib.instance.informWireTransfer(state.token, 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/hooks/transfer.ts
var useSWR10 = useSWR;
function revalidateInstanceTransfers() {
  return mutate(
    (key) => Array.isArray(key) && key[key.length - 1] === "listWireTransfers",
    void 0,
    { revalidate: true }
  );
}
function useInstanceTransfers(args, updatePosition = () => {
}) {
  const { state: session } = useSessionContext();
  const { lib: { instance } } = useSessionContext();
  async function fetcher([token, o3, p4, v3]) {
    return await instance.listWireTransfers(token, {
      paytoURI: p4,
      verified: v3,
      limit: PAGINATED_LIST_REQUEST,
      offset: o3,
      order: "dec"
    });
  }
  const { data, error: error2 } = useSWR10([session.token, args?.position, args?.payto_uri, args?.verified, "listWireTransfers"], fetcher);
  if (error2)
    return error2;
  if (data === void 0)
    return void 0;
  if (data.type !== "ok")
    return data;
  return buildPaginatedResult(data.body.transfers, args?.position, updatePosition, (d5) => String(d5.transfer_serial_id));
}

// src/paths/instance/transfers/list/ListPage.tsx
init_preact_module();

// src/paths/instance/transfers/list/Table.tsx
init_preact_module();
init_hooks_module();
function CardTable8({
  transfers,
  onCreate,
  onDelete,
  onLoadMoreAfter,
  onLoadMoreBefore
}) {
  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(
    Table8,
    {
      instances: transfers,
      onDelete,
      rowSelection,
      rowSelectionHandler,
      onLoadMoreAfter,
      onLoadMoreBefore
    }
  ) : /* @__PURE__ */ h(EmptyTable9, null)))));
}
function Table8({
  instances,
  onLoadMoreAfter,
  onDelete,
  onLoadMoreBefore
}) {
  const { i18n: i18n2 } = useTranslationContext();
  const [settings] = usePreference();
  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`,
      onClick: onLoadMoreBefore
    },
    /* @__PURE__ */ h(i18n2.Translate, null, "load first page")
  ), /* @__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, "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", { title: i4.wtid }, i4.wtid.substring(0, 16), "..."), /* @__PURE__ */ h("td", null, i4.credit_amount), /* @__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 !== true ? /* @__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)
      },
      /* @__PURE__ */ h(i18n2.Translate, null, "Delete")
    ) : void 0));
  }))), onLoadMoreAfter && /* @__PURE__ */ h(
    "button",
    {
      class: "button is-fullwidth",
      "data-tooltip": i18n2.str`load more transfers after the last one`,
      onClick: onLoadMoreAfter
    },
    /* @__PURE__ */ h(i18n2.Translate, null, "load next page")
  ));
}
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-magnify 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 ListPage6({
  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`Bank account`,
        values: accounts,
        fromStr: (d5) => {
          const idx = accounts.indexOf(d5);
          if (idx === -1)
            return void 0;
          return d5;
        },
        placeholder: i18n2.str`All accounts`,
        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(
    CardTable8,
    {
      transfers: transfers.map((o3) => ({
        ...o3,
        id: String(o3.transfer_serial_id)
      })),
      accounts,
      onCreate,
      onDelete,
      onLoadMoreBefore,
      onLoadMoreAfter
    }
  ));
}

// src/paths/instance/transfers/list/index.tsx
function ListTransfer({ onCreate }) {
  const setFilter = (s5) => setForm({ ...form, verified: s5 });
  const { i18n: i18n2 } = useTranslationContext();
  const { state, lib } = useSessionContext();
  const [notif, setNotif] = p3(void 0);
  const [position, setPosition] = p3(void 0);
  const instance = useInstanceBankAccounts();
  const accounts = !instance || instance instanceof TalerError || instance.type === "fail" ? [] : instance.body.accounts.map((a5) => a5.payto_uri);
  const [form, setForm] = p3({ payto_uri: "" });
  const shoulUseDefaultAccount = accounts.length === 1;
  h2(() => {
    if (shoulUseDefaultAccount) {
      setForm({ ...form, payto_uri: accounts[0] });
    }
  }, [shoulUseDefaultAccount]);
  const isVerifiedTransfers = form.verified === true;
  const isNonVerifiedTransfers = form.verified === false;
  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)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    ListPage6,
    {
      accounts,
      transfers: result.body,
      onLoadMoreBefore: result.isFirstPage ? void 0 : result.loadFirst,
      onLoadMoreAfter: result.isLastPage ? void 0 : result.loadNext,
      onCreate,
      onDelete: async (transfer) => {
        try {
          const resp = await lib.instance.deleteWireTransfer(state.token, String(transfer.transfer_serial_id));
          if (resp.type === "ok") {
            setNotif({
              message: i18n2.str`Wire transfer "${transfer.wtid.substring(0, 16)}..." has been deleted`,
              type: "SUCCESS"
            });
          } else {
            setNotif({
              message: i18n2.str`Failed to delete transfer`,
              type: "ERROR",
              description: resp.detail.hint
            });
          }
        } catch (error2) {
          setNotif({
            message: i18n2.str`Failed to delete transfer`,
            type: "ERROR",
            description: error2 instanceof Error ? error2.message : void 0
          });
        }
      },
      onShowAll: () => setFilter(void 0),
      onShowUnverified: () => setFilter(false),
      onShowVerified: () => setFilter(true),
      isAllTransfers,
      isVerifiedTransfers,
      isNonVerifiedTransfers,
      payTo: form.payto_uri,
      onChangePayTo: (p4) => setForm((v3) => ({ ...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 convert3(from) {
  const { default_pay_delay, default_wire_transfer_delay, ...rest } = from;
  const defaults = {
    use_stefan: false,
    default_pay_delay: Duration.fromTalerProtocolDuration(default_pay_delay),
    default_wire_transfer_delay: Duration.fromTalerProtocolDuration(default_wire_transfer_delay)
  };
  return { ...defaults, ...rest };
}
function UpdatePage6({
  onUpdate,
  selected,
  onBack
}) {
  const { state } = useSessionContext();
  const [value, valueHandler] = p3(convert3(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` : !!value.default_wire_transfer_delay && value.default_wire_transfer_delay.d_ms !== "forever" && value.default_pay_delay.d_ms !== "forever" && value.default_pay_delay.d_ms > value.default_wire_transfer_delay.d_ms ? i18n2.str`pay delay can't be greater than wire transfer delay` : void 0,
    default_wire_transfer_delay: !value.default_wire_transfer_delay ? i18n2.str`required` : void 0,
    address: undefinedIfEmpty({
      address_lines: value.address?.address_lines && value.address?.address_lines.length > 7 ? i18n2.str`max 7 lines` : void 0
    }),
    jurisdiction: undefinedIfEmpty({
      address_lines: value.address?.address_lines && value.address?.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 () => {
    const { default_pay_delay, default_wire_transfer_delay, ...rest } = value;
    const result = {
      default_pay_delay: Duration.toTalerProtocolDuration(default_pay_delay),
      default_wire_transfer_delay: Duration.toTalerProtocolDuration(default_wire_transfer_delay),
      ...rest
    };
    await onUpdate(result);
  };
  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, state.instance))))))), /* @__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 { lib } = useSessionContext();
  const updateInstance = lib.instance.updateCurrentInstance.bind(lib.instance);
  const result = useInstanceDetails();
  return CommonUpdate(props, result, updateInstance);
}
function AdminUpdate(props) {
  const { lib } = useSessionContext();
  const t4 = lib.subInstanceApi(props.instanceId).instance;
  const updateInstance = t4.updateCurrentInstance.bind(t4);
  const result = useManagedInstanceDetails(props.instanceId);
  return CommonUpdate(props, result, updateInstance);
}
function CommonUpdate({
  onBack,
  onConfirm
}, result, updateInstance) {
  const [notif, setNotif] = p3(void 0);
  const { i18n: i18n2 } = useTranslationContext();
  const { state } = useSessionContext();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    UpdatePage6,
    {
      onBack,
      isLoading: false,
      selected: result.body,
      onUpdate: (d5) => {
        if (state.status !== "loggedIn") {
          return Promise.resolve();
        }
        return updateInstance(state.token, d5).then(onConfirm).catch(
          (error2) => setNotif({
            message: i18n2.str`Failed to update instance`,
            type: "ERROR",
            description: error2.message
          })
        );
      }
    }
  ));
}

// src/paths/instance/webhooks/create/index.tsx
init_preact_module();
init_hooks_module();

// src/paths/instance/webhooks/create/CreatePage.tsx
init_preact_module();
init_hooks_module();
var validMethod = ["GET", "POST", "PUT", "PATCH", "HEAD"];
function CreatePage9({ 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("p", null, "The text below support ", /* @__PURE__ */ h("a", { target: "_blank", rel: "noreferrer", href: "https://mustache.github.io/mustache.5.html" }, "mustache"), " template engine. Any string between ", /* @__PURE__ */ h("pre", { style: { display: "inline", padding: 0 } }, "{{"), " and ", /* @__PURE__ */ h("pre", { style: { display: "inline", padding: 0 } }, "}}"), " will be replaced with replaced with the value of the corresponding variable."),
    /* @__PURE__ */ h("p", null, "For example ", /* @__PURE__ */ h("pre", { style: { display: "inline", padding: 0 } }, "{{contract_terms.amount}}"), " will be replaced with the the order's price"),
    /* @__PURE__ */ h("p", null, "The short list of variables are:"),
    /* @__PURE__ */ h("div", { class: "menu" }, /* @__PURE__ */ h("ul", { class: "menu-list", style: { listStyleType: "disc", marginLeft: 20 } }, /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("b", null, "contract_terms.summary:"), " order's description "), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("b", null, "contract_terms.amount:"), " order's price "), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("b", null, "order_id:"), " order's unique identification "), state.event_type === "refund" && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("b", null, "refund_amout:"), " the amount that was being refunded"), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("b", null, "reason:"), " the reason entered by the merchant staff for granting the refund"), /* @__PURE__ */ h("li", null, /* @__PURE__ */ h("b", null, "timestamp:"), " time of the refund in nanoseconds since 1970")))),
    /* @__PURE__ */ h(
      Input,
      {
        name: "body_template",
        inputType: "multiline",
        label: i18n2.str`Http 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 [notif, setNotif] = p3(void 0);
  const { i18n: i18n2 } = useTranslationContext();
  const { lib } = useSessionContext();
  const { state } = useSessionContext();
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    CreatePage9,
    {
      onBack,
      onCreate: (request) => {
        return lib.instance.addWebhook(state.token, 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 CardTable9({
  webhooks,
  onCreate,
  onDelete,
  onSelect,
  onLoadMoreAfter,
  onLoadMoreBefore
}) {
  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-webhook" })), /* @__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(
    Table9,
    {
      instances: webhooks,
      onDelete,
      onSelect,
      rowSelection,
      rowSelectionHandler,
      onLoadMoreAfter,
      onLoadMoreBefore
    }
  ) : /* @__PURE__ */ h(EmptyTable10, null)))));
}
function Table9({
  instances,
  onLoadMoreAfter,
  onDelete,
  onSelect,
  onLoadMoreBefore
}) {
  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`,
      onClick: onLoadMoreBefore
    },
    /* @__PURE__ */ h(i18n2.Translate, null, "load first page")
  ), /* @__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`,
      onClick: onLoadMoreAfter
    },
    /* @__PURE__ */ h(i18n2.Translate, null, "load next page")
  ));
}
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-magnify 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 ListPage7({
  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(
    CardTable9,
    {
      webhooks: webhooks.map((o3) => ({
        ...o3,
        id: String(o3.webhook_id)
      })),
      onCreate,
      onDelete,
      onSelect,
      onLoadMoreBefore,
      onLoadMoreAfter
    }
  ));
}

// src/paths/instance/webhooks/list/index.tsx
function ListWebhooks({ onCreate, onSelect }) {
  const { i18n: i18n2 } = useTranslationContext();
  const [notif, setNotif] = p3(void 0);
  const { lib } = useSessionContext();
  const { state } = useSessionContext();
  const result = useInstanceWebhooks();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    ListPage7,
    {
      webhooks: result.body.webhooks,
      onLoadMoreBefore: void 0,
      onLoadMoreAfter: void 0,
      onCreate,
      onSelect: (e4) => {
        onSelect(e4.webhook_id);
      },
      onDelete: (e4) => {
        return lib.instance.deleteWebhook(state.token, 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 UpdatePage7({ 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
}) {
  const { lib } = useSessionContext();
  const { state } = useSessionContext();
  const result = useWebhookDetails(tid);
  const [notif, setNotif] = p3(void 0);
  const { i18n: i18n2 } = useTranslationContext();
  if (!result)
    return /* @__PURE__ */ h(Loading, null);
  if (result instanceof TalerError) {
    return /* @__PURE__ */ h(ErrorLoadingMerchant, { error: result });
  }
  if (result.type === "fail") {
    switch (result.case) {
      case HttpStatusCode.NotFound: {
        return /* @__PURE__ */ h(NotFoundPageOrAdminCreate, null);
      }
      case HttpStatusCode.Unauthorized: {
        return /* @__PURE__ */ h(LoginPage, null);
      }
      default: {
        assertUnreachable(result);
      }
    }
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotificationCard, { notification: notif }), /* @__PURE__ */ h(
    UpdatePage7,
    {
      webhook: { ...result.body, id: tid },
      onBack,
      onUpdate: (data) => {
        return lib.instance.updateWebhook(state.token, tid, data).then(onConfirm).catch((error2) => {
          setNotif({
            message: i18n2.str`could not update template`,
            type: "ERROR",
            description: error2.message
          });
        });
      }
    }
  ));
}

// 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(void 0, {});
  const [value, , updateValue] = usePreference();
  const errors2 = {};
  function valueHandler(s5) {
    const next = s5(value);
    const v3 = {
      advanceOrderMode: next.advanceOrderMode ?? false,
      advanceInstanceMode: next.advanceInstanceMode ?? false,
      hideMissingAccountUntil: next.hideMissingAccountUntil ?? AbsoluteTime.never(),
      hideKycUntil: next.hideKycUntil ?? AbsoluteTime.never(),
      dateFormat: next.dateFormat ?? "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));
          e4.preventDefault();
        }
      },
      /* @__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(
      InputToggle,
      {
        label: i18n2.str`Advance instance settings`,
        tooltip: i18n2.str`Shows more options in the instance settings form`,
        name: "advanceInstanceMode"
      }
    ),
    /* @__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/Routing.tsx
var privatePages = {
  home: urlPattern(/\/home/, () => "#/home"),
  go: urlPattern(/\/home/, () => "#/home")
};
var publicPages = {
  home: urlPattern(/\/home/, () => "#/home"),
  go: urlPattern(/\/home/, () => "#/home")
};
var history2 = createHashHistory();
function Routing(_p) {
  const { state } = useSessionContext();
  const [globalNotification, setGlobalNotification] = p3(void 0);
  const [error2] = P2();
  const [preference] = usePreference();
  const now2 = AbsoluteTime.now();
  const instance = useInstanceBankAccounts();
  const accounts = !instance || instance instanceof TalerError || instance.type === "fail" ? void 0 : instance.body;
  const shouldWarnAboutMissingBankAccounts = !state.isAdmin && accounts !== void 0 && accounts.accounts.length < 1 && (AbsoluteTime.isNever(preference.hideMissingAccountUntil) || AbsoluteTime.cmp(now2, preference.hideMissingAccountUntil) > 0);
  const shouldLogin = state.status === "loggedOut";
  if (shouldLogin) {
    return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(NotConnectedAppMenu, { title: "Welcome!" }), /* @__PURE__ */ h(LoginPage, null));
  }
  if (shouldWarnAboutMissingBankAccounts) {
    return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(Menu, null), /* @__PURE__ */ h(Router, { history: history2 }, /* @__PURE__ */ h(Route, { path: "/interface" /* interface */, component: Settings }), /* @__PURE__ */ h(
      Route,
      {
        default: true,
        component: () => {
          return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(BankAccountBanner, null), /* @__PURE__ */ h(
            CreateValidator,
            {
              onConfirm: () => {
                route("/bank" /* bank_list */);
              }
            }
          ));
        }
      }
    )));
  }
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(Menu, null), /* @__PURE__ */ h(KycBanner, null), /* @__PURE__ */ h(NotificationCard, { notification: globalNotification }), error2 && /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
    NotificationCard,
    {
      notification: {
        message: "Internal error, please report",
        type: "ERROR",
        description: /* @__PURE__ */ h("pre", null, error2 instanceof Error ? error2.stack : String(error2))
      }
    }
  )), /* @__PURE__ */ h(
    Router,
    {
      history: history2,
      onChange: (e4) => {
        const movingOutFromNotification = globalNotification && e4.url !== globalNotification.to;
        if (movingOutFromNotification) {
          setGlobalNotification(void 0);
        }
      }
    },
    /* @__PURE__ */ h(Route, { path: "/", component: Redirect, to: "/orders" /* order_list */ }),
    state.isAdmin && /* @__PURE__ */ h(
      Route,
      {
        path: "/instances" /* list_instances */,
        component: Instances,
        onCreate: () => {
          route("/instance/new" /* new_instance */);
        },
        onUpdate: (id) => {
          route(`/instance/${id}/update`);
        }
      }
    ),
    state.isAdmin && /* @__PURE__ */ h(
      Route,
      {
        path: "/instance/new" /* new_instance */,
        component: Create,
        onBack: () => route("/instances" /* list_instances */),
        onConfirm: () => {
          route("/instances" /* list_instances */);
        }
      }
    ),
    state.isAdmin && /* @__PURE__ */ h(
      Route,
      {
        path: "/instance/:id/update" /* update_instance */,
        component: AdminInstanceUpdatePage,
        onBack: () => route("/instances" /* list_instances */),
        onConfirm: () => {
          route("/instances" /* list_instances */);
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/settings" /* settings */,
        component: Update2,
        onBack: () => {
          route(`/`);
        },
        onConfirm: () => {
          route(`/`);
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/token" /* token */,
        component: Token,
        onChange: () => {
          route(`/`);
        },
        onCancel: () => {
          route("/orders" /* order_list */);
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/inventory" /* inventory_list */,
        component: ProductList2,
        onCreate: () => {
          route("/inventory/new" /* inventory_new */);
        },
        onSelect: (id) => {
          route("/inventory/:pid/update" /* inventory_update */.replace(":pid", id));
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/inventory/:pid/update" /* inventory_update */,
        component: UpdateProduct,
        onConfirm: () => {
          route("/inventory" /* inventory_list */);
        },
        onBack: () => {
          route("/inventory" /* inventory_list */);
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/inventory/new" /* inventory_new */,
        component: CreateProduct,
        onConfirm: () => {
          route("/inventory" /* inventory_list */);
        },
        onBack: () => {
          route("/inventory" /* inventory_list */);
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/bank" /* bank_list */,
        component: ListOtpDevices,
        onCreate: () => {
          route("/bank/new" /* bank_new */);
        },
        onSelect: (id) => {
          route("/bank/:bid/update" /* bank_update */.replace(":bid", id));
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/bank/:bid/update" /* bank_update */,
        component: UpdateValidator,
        onConfirm: () => {
          route("/bank" /* bank_list */);
        },
        onBack: () => {
          route("/bank" /* bank_list */);
        }
      }
    ),
    /* @__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: (id) => {
          route("/order/:oid/details" /* order_details */.replace(":oid", id));
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/order/:oid/details" /* order_details */,
        component: Update,
        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,
        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: "/tokenfamilies" /* token_family_list */,
        component: TokenFamilyList,
        onCreate: () => {
          route("/tokenfamilies/new" /* token_family_new */);
        },
        onSelect: (slug) => {
          route("/tokenfamilies/:slug/update" /* token_family_update */.replace(":slug", slug));
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/tokenfamilies/:slug/update" /* token_family_update */,
        component: UpdateTokenFamily,
        onConfirm: () => {
          route("/tokenfamilies" /* token_family_list */);
        },
        onBack: () => {
          route("/tokenfamilies" /* token_family_list */);
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/tokenfamilies/new" /* token_family_new */,
        component: CreateTokenFamily,
        onConfirm: () => {
          route("/tokenfamilies" /* token_family_list */);
        },
        onBack: () => {
          route("/tokenfamilies" /* token_family_list */);
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/webhooks" /* webhooks_list */,
        component: ListWebhooks,
        onCreate: () => {
          route("/webhooks/new" /* webhooks_new */);
        },
        onSelect: (id) => {
          route("/webhooks/:tid/update" /* webhooks_update */.replace(":tid", id));
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/webhooks/:tid/update" /* webhooks_update */,
        component: UpdateWebhook,
        onConfirm: () => {
          route("/webhooks" /* webhooks_list */);
        },
        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: "/otp-devices" /* otp_devices_list */,
        component: ListOtpDevices2,
        onCreate: () => {
          route("/otp-devices/new" /* otp_devices_new */);
        },
        onSelect: (id) => {
          route("/otp-devices/:vid/update" /* otp_devices_update */.replace(":vid", id));
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/otp-devices/:vid/update" /* otp_devices_update */,
        component: UpdateValidator2,
        onConfirm: () => {
          route("/otp-devices" /* otp_devices_list */);
        },
        onBack: () => {
          route("/otp-devices" /* otp_devices_list */);
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/otp-devices/new" /* otp_devices_new */,
        component: CreateValidator2,
        onConfirm: () => {
          route("/otp-devices" /* otp_devices_list */);
        },
        onBack: () => {
          route("/otp-devices" /* otp_devices_list */);
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/templates" /* templates_list */,
        component: ListTemplates,
        onCreate: () => {
          route("/templates/new" /* templates_new */);
        },
        onNewOrder: (id) => {
          route("/templates/:tid/use" /* templates_use */.replace(":tid", id));
        },
        onQR: (id) => {
          route("/templates/:tid/qr" /* templates_qr */.replace(":tid", id));
        },
        onSelect: (id) => {
          route("/templates/:tid/update" /* templates_update */.replace(":tid", id));
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/templates/:tid/update" /* templates_update */,
        component: UpdateTemplate,
        onConfirm: () => {
          route("/templates" /* templates_list */);
        },
        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: (id) => {
          route("/order/:oid/details" /* order_details */.replace(":oid", id));
        },
        onBack: () => {
          route("/templates" /* templates_list */);
        }
      }
    ),
    /* @__PURE__ */ h(
      Route,
      {
        path: "/templates/:tid/qr" /* templates_qr */,
        component: TemplateQrPage,
        onBack: () => {
          route("/templates" /* templates_list */);
        }
      }
    ),
    /* @__PURE__ */ h(Route, { path: "/kyc" /* kyc */, component: ListKYC }),
    /* @__PURE__ */ h(Route, { path: "/interface" /* interface */, 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({
  id,
  ...rest
}) {
  return /* @__PURE__ */ h(p2, null, /* @__PURE__ */ h(
    AdminUpdate,
    {
      ...rest,
      instanceId: id
    }
  ));
}
function BankAccountBanner() {
  const { i18n: i18n2 } = useTranslationContext();
  const [, updatePref] = usePreference();
  const now2 = AbsoluteTime.now();
  const oneDay = { d_ms: 1e3 * 60 * 60 * 24 };
  const tomorrow = AbsoluteTime.addDuration(now2, oneDay);
  return /* @__PURE__ */ h(
    NotificationCard,
    {
      notification: {
        type: "INFO",
        message: i18n2.str`You need to associate a bank account to receive revenue.`,
        description: /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, null, "Without this the merchant backend will refuse to create new orders.")), /* @__PURE__ */ h("div", { class: "buttons is-right" }, /* @__PURE__ */ h(
          "button",
          {
            class: "button",
            onClick: () => updatePref("hideMissingAccountUntil", tomorrow)
          },
          /* @__PURE__ */ h(i18n2.Translate, null, "Hide for today")
        )))
      }
    }
  );
}
function KycBanner() {
  const kycStatus = useInstanceKYCDetails();
  const { i18n: i18n2 } = useTranslationContext();
  const [prefs, updatePref] = usePreference();
  const now2 = AbsoluteTime.now();
  const needsToBeShown = kycStatus !== void 0 && !(kycStatus instanceof TalerError) && kycStatus.type === "ok" && !!kycStatus.body;
  const hidden = AbsoluteTime.cmp(now2, prefs.hideKycUntil) < 1;
  if (hidden || !needsToBeShown)
    return /* @__PURE__ */ h(p2, null);
  const oneDay = { d_ms: 1e3 * 60 * 60 * 24 };
  const tomorrow = AbsoluteTime.addDuration(now2, oneDay);
  return /* @__PURE__ */ h(
    NotificationCard,
    {
      notification: {
        type: "WARN",
        message: "KYC verification needed",
        description: /* @__PURE__ */ h("div", null, /* @__PURE__ */ h("p", null, /* @__PURE__ */ h(i18n2.Translate, 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: () => updatePref("hideKycUntil", tomorrow)
          },
          /* @__PURE__ */ h(i18n2.Translate, null, "Hide for today")
        )))
      }
    }
  );
}

// src/context/settings.ts
init_preact_module();
init_hooks_module();
var initial2 = {};
var Context6 = B(initial2);
var SettingsProvider = ({
  children,
  value
}) => {
  return h(Context6.Provider, {
    value,
    children
  });
};

// src/settings.ts
var defaultSettings2 = {
  backendBaseURL: buildDefaultBackendBaseURL()
};
var codecForBankUISettings = () => buildCodecForObject().property("backendBaseURL", codecOptional(codecForString())).build("MerchantUiSettings");
function removeUndefineField(obj) {
  const keys = Object.keys(obj);
  return keys.reduce((prev, cur) => {
    if (typeof prev[cur] === "undefined") {
      delete prev[cur];
    }
    return prev;
  }, obj);
}
function fetchSettings(listener) {
  fetch("./settings.json").then((resp) => resp.json()).then((json) => codecForBankUISettings().decode(json)).then(
    (result) => listener({
      ...defaultSettings2,
      ...removeUndefineField(result)
    })
  ).catch((e4) => {
    console.log("failed to fetch settings", e4);
    listener(defaultSettings2);
  });
}
function buildDefaultBackendBaseURL() {
  if (typeof window !== "undefined") {
    const currentLocation = new URL(
      window.location.pathname,
      window.location.origin
    ).href;
    return canonicalizeBaseUrl(currentLocation.replace("/webui", ""));
  }
  throw Error("No default URL");
}

// src/Application.tsx
var WITH_LOCAL_STORAGE_CACHE = false;
function Application() {
  const [settings, setSettings] = p3();
  h2(() => {
    fetchSettings(setSettings);
  }, []);
  if (!settings)
    return /* @__PURE__ */ h(Loading, null);
  const baseUrl = getInitialBackendBaseURL(settings.backendBaseURL);
  return /* @__PURE__ */ h(SettingsProvider, { value: settings }, /* @__PURE__ */ h(
    TranslationProvider,
    {
      source: strings,
      completeness: {
        es: strings["es"].completeness,
        de: strings["de"].completeness
      }
    },
    /* @__PURE__ */ h(
      MerchantApiProvider,
      {
        baseUrl: new URL("./", baseUrl),
        frameOnError: OnConfigError,
        evictors: {
          management: swrCacheEvictor
        }
      },
      /* @__PURE__ */ h(SessionContextProvider, null, /* @__PURE__ */ h(
        SWRConfig2,
        {
          value: {
            provider: WITH_LOCAL_STORAGE_CACHE ? localStorageProvider : void 0,
            // normally, do not revalidate
            revalidateOnFocus: false,
            revalidateOnReconnect: false,
            revalidateIfStale: false,
            revalidateOnMount: void 0,
            focusThrottleInterval: void 0,
            // normally, do not refresh
            refreshInterval: void 0,
            dedupingInterval: 2e3,
            refreshWhenHidden: false,
            refreshWhenOffline: false,
            // ignore errors
            shouldRetryOnError: false,
            errorRetryCount: 0,
            errorRetryInterval: void 0,
            // do not go to loading again if already has data
            keepPreviousData: true
          }
        },
        /* @__PURE__ */ h(TalerWalletIntegrationBrowserProvider, null, /* @__PURE__ */ h(BrowserHashNavigationProvider, null, /* @__PURE__ */ h(Routing, null)))
      ))
    )
  ));
}
function getInitialBackendBaseURL(backendFromSettings) {
  const overrideUrl = typeof localStorage !== "undefined" ? localStorage.getItem("merchant-base-url") : void 0;
  let result;
  if (overrideUrl) {
    result = overrideUrl;
  } else {
    if (!backendFromSettings) {
      console.error(
        "ERROR: backendBaseURL was overridden by a setting file and missing. Setting value to 'window.origin'"
      );
      result = buildDefaultBackendBaseURL();
    } else {
      result = backendFromSettings;
    }
  }
  try {
    return canonicalizeBaseUrl(result);
  } catch (e4) {
    return canonicalizeBaseUrl(window.origin);
  }
}
function localStorageProvider() {
  const map3 = new Map(JSON.parse(localStorage.getItem("app-cache") || "[]"));
  window.addEventListener("beforeunload", () => {
    const appCache = JSON.stringify(Array.from(map3.entries()));
    localStorage.setItem("app-cache", appCache);
  });
  return map3;
}
function OnConfigError({
  state
}) {
  const { i18n: i18n2 } = useTranslationContext();
  if (!state) {
    return /* @__PURE__ */ h(i18n2.Translate, null, "checking compatibility with server...");
  }
  switch (state.type) {
    case "error": {
      return /* @__PURE__ */ h(
        NotificationCard,
        {
          notification: {
            message: i18n2.str`Contacting the server failed`,
            description: state.error.message,
            details: JSON.stringify(state.error.errorDetail, void 0, 2),
            type: "ERROR"
          }
        }
      );
    }
    case "incompatible": {
      return /* @__PURE__ */ h(
        NotificationCard,
        {
          notification: {
            message: i18n2.str`The server version is not supported`,
            description: i18n2.str`Supported version "${state.supported}", server version "${state.result.version}".`,
            type: "WARN"
          }
        }
      );
    }
    default:
      assertUnreachable(state);
  }
}
var swrCacheEvictor = new class {
  async notifySuccess(op) {
    switch (op) {
      case TalerMerchantManagementCacheEviction.CREATE_INSTANCE: {
        await Promise.all([revalidateBackendInstances()]);
        return;
      }
      case TalerMerchantManagementCacheEviction.UPDATE_INSTANCE: {
        await Promise.all([revalidateManagedInstanceDetails()]);
        return;
      }
      case TalerMerchantManagementCacheEviction.DELETE_INSTANCE: {
        await Promise.all([revalidateBackendInstances()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.UPDATE_CURRENT_INSTANCE: {
        await Promise.all([revalidateInstanceDetails()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.DELETE_CURRENT_INSTANCE: {
        await Promise.all([revalidateInstanceDetails()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.CREATE_BANK_ACCOUNT: {
        await Promise.all([revalidateInstanceBankAccounts()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.UPDATE_BANK_ACCOUNT: {
        await Promise.all([revalidateBankAccountDetails()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.DELETE_BANK_ACCOUNT: {
        await Promise.all([revalidateInstanceBankAccounts()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.CREATE_PRODUCT: {
        await Promise.all([revalidateInstanceProducts()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.UPDATE_PRODUCT: {
        await Promise.all([
          revalidateProductDetails(),
          revalidateInstanceProducts()
        ]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.DELETE_PRODUCT: {
        await Promise.all([revalidateInstanceProducts()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.CREATE_TRANSFER: {
        await Promise.all([revalidateInstanceTransfers()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.DELETE_TRANSFER: {
        await Promise.all([revalidateInstanceTransfers()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.CREATE_DEVICE: {
        await Promise.all([revalidateInstanceOtpDevices()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.UPDATE_DEVICE: {
        await Promise.all([revalidateOtpDeviceDetails()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.DELETE_DEVICE: {
        await Promise.all([revalidateInstanceOtpDevices()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.CREATE_TEMPLATE: {
        await Promise.all([revalidateInstanceTemplates()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.UPDATE_TEMPLATE: {
        await Promise.all([revalidateTemplateDetails()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.DELETE_TEMPLATE: {
        await Promise.all([revalidateInstanceTemplates()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.CREATE_WEBHOOK: {
        await Promise.all([revalidateInstanceWebhooks()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.UPDATE_WEBHOOK: {
        await Promise.all([revalidateWebhookDetails()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.DELETE_WEBHOOK: {
        await Promise.all([revalidateInstanceWebhooks()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.CREATE_ORDER: {
        await Promise.all([revalidateInstanceOrders()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.UPDATE_ORDER: {
        await Promise.all([revalidateOrderDetails()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.DELETE_ORDER: {
        await Promise.all([revalidateInstanceOrders()]);
        return;
      }
      case TalerMerchantInstanceCacheEviction.LAST:
    }
  }
}();

// src/index.tsx
init_preact_module();
var app = document.getElementById("app");
if (app) {
  P(/* @__PURE__ */ h(Application, null), app);
} else {
  console.error("HTML element with id 'app' not found.");
}
/*! 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
