import { y as we, h as P, i as z, aB as Qe, aC as He, aD as G, T as m, a as L, aE as ge, D as Y, t as b, p as J, j as T, L as ve, aF as q, $ as Ee, f as N, a3 as le, a1 as Z, u as We, q as de, aG as Xe, W as $e, aH as pe, V as te, R as Ye, aI as Je, aJ as Ze, S as et, x as tt } from "./index-162fd1aa.mjs";
import { I as ae } from "./InputPassword-68c495c7.mjs";
import { c as Q } from "./reactSlick-cb4a2d39.mjs";
import * as $ from "react";
import a from "react";
import { A as ye, b as Ce, a as Ae } from "./AccountMainSection-4c35f8d7.mjs";
import { C as se, a as re, b as ne } from "./CommonEntryGroup-868b943b.mjs";
import { A as at, B as st, E as rt } from "./EmailIcon-753583e6.mjs";
import { c as Se, I as be } from "./dateFns-2367ee5b.mjs";
import { W as ke } from "./WarningIcon-c5874dd2.mjs";
import { C as nt } from "./Checkbox-5e314906.mjs";
import { g as oe, n as ot } from "./MockVars-1cf2eb0a.mjs";
import "./validator-61879ab7.mjs";
import "./reactPlayer-2f69f369.mjs";
import "react-router-dom";
var ie = {}, it = {
  get exports() {
    return ie;
  },
  set exports(C) {
    ie = C;
  }
};
(function(C, h) {
  (function(n, i) {
    C.exports = i();
  })(Se, function() {
    var n = function() {
    }, i = Object.prototype.hasOwnProperty, u = Array.prototype.slice;
    function f(t, e) {
      var s;
      return typeof Object.create == "function" ? s = Object.create(t) : (n.prototype = t, s = new n(), n.prototype = null), e && E(!0, s, e), s;
    }
    function l(t, e, s, r) {
      var o = this;
      return typeof t != "string" && (r = s, s = e, e = t, t = null), typeof e != "function" && (r = s, s = e, e = function() {
        return o.apply(this, arguments);
      }), E(!1, e, o, r), e.prototype = f(o.prototype, s), e.prototype.constructor = e, e.class_ = t || o.class_, e.super_ = o, e;
    }
    function E(t, e, s) {
      s = u.call(arguments, 2);
      for (var r, o, c = 0, d = s.length; c < d; c++) {
        o = s[c];
        for (r in o)
          (!t || i.call(o, r)) && (e[r] = o[r]);
      }
    }
    var A = l;
    function p() {
    }
    p.class_ = "Nevis", p.super_ = Object, p.extend = A;
    var w = p, y = w, v = y.extend(function(t, e, s) {
      this.qrious = t, this.element = e, this.element.qrious = t, this.enabled = Boolean(s);
    }, {
      draw: function(t) {
      },
      getElement: function() {
        return this.enabled || (this.enabled = !0, this.render()), this.element;
      },
      getModuleSize: function(t) {
        var e = this.qrious, s = e.padding || 0, r = Math.floor((e.size - s * 2) / t.width);
        return Math.max(1, r);
      },
      getOffset: function(t) {
        var e = this.qrious, s = e.padding;
        if (s != null)
          return s;
        var r = this.getModuleSize(t), o = Math.floor((e.size - r * t.width) / 2);
        return Math.max(0, o);
      },
      render: function(t) {
        this.enabled && (this.resize(), this.reset(), this.draw(t));
      },
      reset: function() {
      },
      resize: function() {
      }
    }), S = v, ee = S.extend({
      draw: function(t) {
        var e, s, r = this.qrious, o = this.getModuleSize(t), c = this.getOffset(t), d = this.element.getContext("2d");
        for (d.fillStyle = r.foreground, d.globalAlpha = r.foregroundAlpha, e = 0; e < t.width; e++)
          for (s = 0; s < t.width; s++)
            t.buffer[s * t.width + e] && d.fillRect(o * e + c, o * s + c, o, o);
      },
      reset: function() {
        var t = this.qrious, e = this.element.getContext("2d"), s = t.size;
        e.lineWidth = 1, e.clearRect(0, 0, s, s), e.fillStyle = t.background, e.globalAlpha = t.backgroundAlpha, e.fillRect(0, 0, s, s);
      },
      resize: function() {
        var t = this.element;
        t.width = t.height = this.qrious.size;
      }
    }), H = ee, R = y.extend(null, {
      BLOCK: [
        0,
        11,
        15,
        19,
        23,
        27,
        31,
        16,
        18,
        20,
        22,
        24,
        26,
        28,
        20,
        22,
        24,
        24,
        26,
        28,
        28,
        22,
        24,
        24,
        26,
        26,
        28,
        28,
        24,
        24,
        26,
        26,
        26,
        28,
        28,
        24,
        26,
        26,
        26,
        28,
        28
      ]
    }), W = R, K = y.extend(null, {
      BLOCKS: [
        1,
        0,
        19,
        7,
        1,
        0,
        16,
        10,
        1,
        0,
        13,
        13,
        1,
        0,
        9,
        17,
        1,
        0,
        34,
        10,
        1,
        0,
        28,
        16,
        1,
        0,
        22,
        22,
        1,
        0,
        16,
        28,
        1,
        0,
        55,
        15,
        1,
        0,
        44,
        26,
        2,
        0,
        17,
        18,
        2,
        0,
        13,
        22,
        1,
        0,
        80,
        20,
        2,
        0,
        32,
        18,
        2,
        0,
        24,
        26,
        4,
        0,
        9,
        16,
        1,
        0,
        108,
        26,
        2,
        0,
        43,
        24,
        2,
        2,
        15,
        18,
        2,
        2,
        11,
        22,
        2,
        0,
        68,
        18,
        4,
        0,
        27,
        16,
        4,
        0,
        19,
        24,
        4,
        0,
        15,
        28,
        2,
        0,
        78,
        20,
        4,
        0,
        31,
        18,
        2,
        4,
        14,
        18,
        4,
        1,
        13,
        26,
        2,
        0,
        97,
        24,
        2,
        2,
        38,
        22,
        4,
        2,
        18,
        22,
        4,
        2,
        14,
        26,
        2,
        0,
        116,
        30,
        3,
        2,
        36,
        22,
        4,
        4,
        16,
        20,
        4,
        4,
        12,
        24,
        2,
        2,
        68,
        18,
        4,
        1,
        43,
        26,
        6,
        2,
        19,
        24,
        6,
        2,
        15,
        28,
        4,
        0,
        81,
        20,
        1,
        4,
        50,
        30,
        4,
        4,
        22,
        28,
        3,
        8,
        12,
        24,
        2,
        2,
        92,
        24,
        6,
        2,
        36,
        22,
        4,
        6,
        20,
        26,
        7,
        4,
        14,
        28,
        4,
        0,
        107,
        26,
        8,
        1,
        37,
        22,
        8,
        4,
        20,
        24,
        12,
        4,
        11,
        22,
        3,
        1,
        115,
        30,
        4,
        5,
        40,
        24,
        11,
        5,
        16,
        20,
        11,
        5,
        12,
        24,
        5,
        1,
        87,
        22,
        5,
        5,
        41,
        24,
        5,
        7,
        24,
        30,
        11,
        7,
        12,
        24,
        5,
        1,
        98,
        24,
        7,
        3,
        45,
        28,
        15,
        2,
        19,
        24,
        3,
        13,
        15,
        30,
        1,
        5,
        107,
        28,
        10,
        1,
        46,
        28,
        1,
        15,
        22,
        28,
        2,
        17,
        14,
        28,
        5,
        1,
        120,
        30,
        9,
        4,
        43,
        26,
        17,
        1,
        22,
        28,
        2,
        19,
        14,
        28,
        3,
        4,
        113,
        28,
        3,
        11,
        44,
        26,
        17,
        4,
        21,
        26,
        9,
        16,
        13,
        26,
        3,
        5,
        107,
        28,
        3,
        13,
        41,
        26,
        15,
        5,
        24,
        30,
        15,
        10,
        15,
        28,
        4,
        4,
        116,
        28,
        17,
        0,
        42,
        26,
        17,
        6,
        22,
        28,
        19,
        6,
        16,
        30,
        2,
        7,
        111,
        28,
        17,
        0,
        46,
        28,
        7,
        16,
        24,
        30,
        34,
        0,
        13,
        24,
        4,
        5,
        121,
        30,
        4,
        14,
        47,
        28,
        11,
        14,
        24,
        30,
        16,
        14,
        15,
        30,
        6,
        4,
        117,
        30,
        6,
        14,
        45,
        28,
        11,
        16,
        24,
        30,
        30,
        2,
        16,
        30,
        8,
        4,
        106,
        26,
        8,
        13,
        47,
        28,
        7,
        22,
        24,
        30,
        22,
        13,
        15,
        30,
        10,
        2,
        114,
        28,
        19,
        4,
        46,
        28,
        28,
        6,
        22,
        28,
        33,
        4,
        16,
        30,
        8,
        4,
        122,
        30,
        22,
        3,
        45,
        28,
        8,
        26,
        23,
        30,
        12,
        28,
        15,
        30,
        3,
        10,
        117,
        30,
        3,
        23,
        45,
        28,
        4,
        31,
        24,
        30,
        11,
        31,
        15,
        30,
        7,
        7,
        116,
        30,
        21,
        7,
        45,
        28,
        1,
        37,
        23,
        30,
        19,
        26,
        15,
        30,
        5,
        10,
        115,
        30,
        19,
        10,
        47,
        28,
        15,
        25,
        24,
        30,
        23,
        25,
        15,
        30,
        13,
        3,
        115,
        30,
        2,
        29,
        46,
        28,
        42,
        1,
        24,
        30,
        23,
        28,
        15,
        30,
        17,
        0,
        115,
        30,
        10,
        23,
        46,
        28,
        10,
        35,
        24,
        30,
        19,
        35,
        15,
        30,
        17,
        1,
        115,
        30,
        14,
        21,
        46,
        28,
        29,
        19,
        24,
        30,
        11,
        46,
        15,
        30,
        13,
        6,
        115,
        30,
        14,
        23,
        46,
        28,
        44,
        7,
        24,
        30,
        59,
        1,
        16,
        30,
        12,
        7,
        121,
        30,
        12,
        26,
        47,
        28,
        39,
        14,
        24,
        30,
        22,
        41,
        15,
        30,
        6,
        14,
        121,
        30,
        6,
        34,
        47,
        28,
        46,
        10,
        24,
        30,
        2,
        64,
        15,
        30,
        17,
        4,
        122,
        30,
        29,
        14,
        46,
        28,
        49,
        10,
        24,
        30,
        24,
        46,
        15,
        30,
        4,
        18,
        122,
        30,
        13,
        32,
        46,
        28,
        48,
        14,
        24,
        30,
        42,
        32,
        15,
        30,
        20,
        4,
        117,
        30,
        40,
        7,
        47,
        28,
        43,
        22,
        24,
        30,
        10,
        67,
        15,
        30,
        19,
        6,
        118,
        30,
        18,
        31,
        47,
        28,
        34,
        34,
        24,
        30,
        20,
        61,
        15,
        30
      ],
      FINAL_FORMAT: [
        30660,
        29427,
        32170,
        30877,
        26159,
        25368,
        27713,
        26998,
        21522,
        20773,
        24188,
        23371,
        17913,
        16590,
        20375,
        19104,
        13663,
        12392,
        16177,
        14854,
        9396,
        8579,
        11994,
        11245,
        5769,
        5054,
        7399,
        6608,
        1890,
        597,
        3340,
        2107
      ],
      LEVELS: {
        L: 1,
        M: 2,
        Q: 3,
        H: 4
      }
    }), _ = K, _e = y.extend(null, {
      EXPONENT: [
        1,
        2,
        4,
        8,
        16,
        32,
        64,
        128,
        29,
        58,
        116,
        232,
        205,
        135,
        19,
        38,
        76,
        152,
        45,
        90,
        180,
        117,
        234,
        201,
        143,
        3,
        6,
        12,
        24,
        48,
        96,
        192,
        157,
        39,
        78,
        156,
        37,
        74,
        148,
        53,
        106,
        212,
        181,
        119,
        238,
        193,
        159,
        35,
        70,
        140,
        5,
        10,
        20,
        40,
        80,
        160,
        93,
        186,
        105,
        210,
        185,
        111,
        222,
        161,
        95,
        190,
        97,
        194,
        153,
        47,
        94,
        188,
        101,
        202,
        137,
        15,
        30,
        60,
        120,
        240,
        253,
        231,
        211,
        187,
        107,
        214,
        177,
        127,
        254,
        225,
        223,
        163,
        91,
        182,
        113,
        226,
        217,
        175,
        67,
        134,
        17,
        34,
        68,
        136,
        13,
        26,
        52,
        104,
        208,
        189,
        103,
        206,
        129,
        31,
        62,
        124,
        248,
        237,
        199,
        147,
        59,
        118,
        236,
        197,
        151,
        51,
        102,
        204,
        133,
        23,
        46,
        92,
        184,
        109,
        218,
        169,
        79,
        158,
        33,
        66,
        132,
        21,
        42,
        84,
        168,
        77,
        154,
        41,
        82,
        164,
        85,
        170,
        73,
        146,
        57,
        114,
        228,
        213,
        183,
        115,
        230,
        209,
        191,
        99,
        198,
        145,
        63,
        126,
        252,
        229,
        215,
        179,
        123,
        246,
        241,
        255,
        227,
        219,
        171,
        75,
        150,
        49,
        98,
        196,
        149,
        55,
        110,
        220,
        165,
        87,
        174,
        65,
        130,
        25,
        50,
        100,
        200,
        141,
        7,
        14,
        28,
        56,
        112,
        224,
        221,
        167,
        83,
        166,
        81,
        162,
        89,
        178,
        121,
        242,
        249,
        239,
        195,
        155,
        43,
        86,
        172,
        69,
        138,
        9,
        18,
        36,
        72,
        144,
        61,
        122,
        244,
        245,
        247,
        243,
        251,
        235,
        203,
        139,
        11,
        22,
        44,
        88,
        176,
        125,
        250,
        233,
        207,
        131,
        27,
        54,
        108,
        216,
        173,
        71,
        142,
        0
      ],
      LOG: [
        255,
        0,
        1,
        25,
        2,
        50,
        26,
        198,
        3,
        223,
        51,
        238,
        27,
        104,
        199,
        75,
        4,
        100,
        224,
        14,
        52,
        141,
        239,
        129,
        28,
        193,
        105,
        248,
        200,
        8,
        76,
        113,
        5,
        138,
        101,
        47,
        225,
        36,
        15,
        33,
        53,
        147,
        142,
        218,
        240,
        18,
        130,
        69,
        29,
        181,
        194,
        125,
        106,
        39,
        249,
        185,
        201,
        154,
        9,
        120,
        77,
        228,
        114,
        166,
        6,
        191,
        139,
        98,
        102,
        221,
        48,
        253,
        226,
        152,
        37,
        179,
        16,
        145,
        34,
        136,
        54,
        208,
        148,
        206,
        143,
        150,
        219,
        189,
        241,
        210,
        19,
        92,
        131,
        56,
        70,
        64,
        30,
        66,
        182,
        163,
        195,
        72,
        126,
        110,
        107,
        58,
        40,
        84,
        250,
        133,
        186,
        61,
        202,
        94,
        155,
        159,
        10,
        21,
        121,
        43,
        78,
        212,
        229,
        172,
        115,
        243,
        167,
        87,
        7,
        112,
        192,
        247,
        140,
        128,
        99,
        13,
        103,
        74,
        222,
        237,
        49,
        197,
        254,
        24,
        227,
        165,
        153,
        119,
        38,
        184,
        180,
        124,
        17,
        68,
        146,
        217,
        35,
        32,
        137,
        46,
        55,
        63,
        209,
        91,
        149,
        188,
        207,
        205,
        144,
        135,
        151,
        178,
        220,
        252,
        190,
        97,
        242,
        86,
        211,
        171,
        20,
        42,
        93,
        158,
        132,
        60,
        57,
        83,
        71,
        109,
        65,
        162,
        31,
        45,
        67,
        216,
        183,
        123,
        164,
        118,
        196,
        23,
        73,
        236,
        127,
        12,
        111,
        246,
        108,
        161,
        59,
        82,
        41,
        157,
        85,
        170,
        251,
        96,
        134,
        177,
        187,
        204,
        62,
        90,
        203,
        89,
        95,
        176,
        156,
        169,
        160,
        81,
        11,
        245,
        22,
        235,
        122,
        117,
        44,
        215,
        79,
        174,
        213,
        233,
        230,
        231,
        173,
        232,
        116,
        214,
        244,
        234,
        168,
        80,
        88,
        175
      ]
    }), F = _e, Pe = y.extend(null, {
      BLOCK: [
        3220,
        1468,
        2713,
        1235,
        3062,
        1890,
        2119,
        1549,
        2344,
        2936,
        1117,
        2583,
        1330,
        2470,
        1667,
        2249,
        2028,
        3780,
        481,
        4011,
        142,
        3098,
        831,
        3445,
        592,
        2517,
        1776,
        2234,
        1951,
        2827,
        1070,
        2660,
        1345,
        3177
      ]
    }), Me = Pe, k = y.extend(function(t) {
      var e, s, r, o, c, d = t.value.length;
      for (this._badness = [], this._level = _.LEVELS[t.level], this._polynomial = [], this._value = t.value, this._version = 0, this._stringBuffer = []; this._version < 40 && (this._version++, r = (this._level - 1) * 4 + (this._version - 1) * 16, o = _.BLOCKS[r++], c = _.BLOCKS[r++], e = _.BLOCKS[r++], s = _.BLOCKS[r], r = e * (o + c) + c - 3 + (this._version <= 9), !(d <= r)); )
        ;
      this._dataBlock = e, this._eccBlock = s, this._neccBlock1 = o, this._neccBlock2 = c;
      var x = this.width = 17 + 4 * this._version;
      this.buffer = k._createArray(x * x), this._ecc = k._createArray(e + (e + s) * (o + c) + c), this._mask = k._createArray((x * (x + 1) + 1) / 2), this._insertFinders(), this._insertAlignments(), this.buffer[8 + x * (x - 8)] = 1, this._insertTimingGap(), this._reverseMask(), this._insertTimingRowAndColumn(), this._insertVersion(), this._syncMask(), this._convertBitStream(d), this._calculatePolynomial(), this._appendEccToData(), this._interleaveBlocks(), this._pack(), this._finish();
    }, {
      _addAlignment: function(t, e) {
        var s, r = this.buffer, o = this.width;
        for (r[t + o * e] = 1, s = -2; s < 2; s++)
          r[t + s + o * (e - 2)] = 1, r[t - 2 + o * (e + s + 1)] = 1, r[t + 2 + o * (e + s)] = 1, r[t + s + 1 + o * (e + 2)] = 1;
        for (s = 0; s < 2; s++)
          this._setMask(t - 1, e + s), this._setMask(t + 1, e - s), this._setMask(t - s, e - 1), this._setMask(t + s, e + 1);
      },
      _appendData: function(t, e, s, r) {
        var o, c, d, x = this._polynomial, g = this._stringBuffer;
        for (c = 0; c < r; c++)
          g[s + c] = 0;
        for (c = 0; c < e; c++) {
          if (o = F.LOG[g[t + c] ^ g[s]], o !== 255)
            for (d = 1; d < r; d++)
              g[s + d - 1] = g[s + d] ^ F.EXPONENT[k._modN(o + x[r - d])];
          else
            for (d = s; d < s + r; d++)
              g[d] = g[d + 1];
          g[s + r - 1] = o === 255 ? 0 : F.EXPONENT[k._modN(o + x[0])];
        }
      },
      _appendEccToData: function() {
        var t, e = 0, s = this._dataBlock, r = this._calculateMaxLength(), o = this._eccBlock;
        for (t = 0; t < this._neccBlock1; t++)
          this._appendData(e, s, r, o), e += s, r += o;
        for (t = 0; t < this._neccBlock2; t++)
          this._appendData(e, s + 1, r, o), e += s + 1, r += o;
      },
      _applyMask: function(t) {
        var e, s, r, o, c = this.buffer, d = this.width;
        switch (t) {
          case 0:
            for (o = 0; o < d; o++)
              for (r = 0; r < d; r++)
                !(r + o & 1) && !this._isMasked(r, o) && (c[r + o * d] ^= 1);
            break;
          case 1:
            for (o = 0; o < d; o++)
              for (r = 0; r < d; r++)
                !(o & 1) && !this._isMasked(r, o) && (c[r + o * d] ^= 1);
            break;
          case 2:
            for (o = 0; o < d; o++)
              for (e = 0, r = 0; r < d; r++, e++)
                e === 3 && (e = 0), !e && !this._isMasked(r, o) && (c[r + o * d] ^= 1);
            break;
          case 3:
            for (s = 0, o = 0; o < d; o++, s++)
              for (s === 3 && (s = 0), e = s, r = 0; r < d; r++, e++)
                e === 3 && (e = 0), !e && !this._isMasked(r, o) && (c[r + o * d] ^= 1);
            break;
          case 4:
            for (o = 0; o < d; o++)
              for (e = 0, s = o >> 1 & 1, r = 0; r < d; r++, e++)
                e === 3 && (e = 0, s = !s), !s && !this._isMasked(r, o) && (c[r + o * d] ^= 1);
            break;
          case 5:
            for (s = 0, o = 0; o < d; o++, s++)
              for (s === 3 && (s = 0), e = 0, r = 0; r < d; r++, e++)
                e === 3 && (e = 0), !((r & o & 1) + !(!e | !s)) && !this._isMasked(r, o) && (c[r + o * d] ^= 1);
            break;
          case 6:
            for (s = 0, o = 0; o < d; o++, s++)
              for (s === 3 && (s = 0), e = 0, r = 0; r < d; r++, e++)
                e === 3 && (e = 0), !((r & o & 1) + (e && e === s) & 1) && !this._isMasked(r, o) && (c[r + o * d] ^= 1);
            break;
          case 7:
            for (s = 0, o = 0; o < d; o++, s++)
              for (s === 3 && (s = 0), e = 0, r = 0; r < d; r++, e++)
                e === 3 && (e = 0), !((e && e === s) + (r + o & 1) & 1) && !this._isMasked(r, o) && (c[r + o * d] ^= 1);
            break;
        }
      },
      _calculateMaxLength: function() {
        return this._dataBlock * (this._neccBlock1 + this._neccBlock2) + this._neccBlock2;
      },
      _calculatePolynomial: function() {
        var t, e, s = this._eccBlock, r = this._polynomial;
        for (r[0] = 1, t = 0; t < s; t++) {
          for (r[t + 1] = 1, e = t; e > 0; e--)
            r[e] = r[e] ? r[e - 1] ^ F.EXPONENT[k._modN(F.LOG[r[e]] + t)] : r[e - 1];
          r[0] = F.EXPONENT[k._modN(F.LOG[r[0]] + t)];
        }
        for (t = 0; t <= s; t++)
          r[t] = F.LOG[r[t]];
      },
      _checkBadness: function() {
        var t, e, s, r, o, c = 0, d = this._badness, x = this.buffer, g = this.width;
        for (o = 0; o < g - 1; o++)
          for (r = 0; r < g - 1; r++)
            (x[r + g * o] && x[r + 1 + g * o] && x[r + g * (o + 1)] && x[r + 1 + g * (o + 1)] || !(x[r + g * o] || x[r + 1 + g * o] || x[r + g * (o + 1)] || x[r + 1 + g * (o + 1)])) && (c += k.N2);
        var B = 0;
        for (o = 0; o < g; o++) {
          for (s = 0, d[0] = 0, t = 0, r = 0; r < g; r++)
            e = x[r + g * o], t === e ? d[s]++ : d[++s] = 1, t = e, B += t ? 1 : -1;
          c += this._getBadness(s);
        }
        B < 0 && (B = -B);
        var xe = 0, I = B;
        for (I += I << 2, I <<= 1; I > g * g; )
          I -= g * g, xe++;
        for (c += xe * k.N4, r = 0; r < g; r++) {
          for (s = 0, d[0] = 0, t = 0, o = 0; o < g; o++)
            e = x[r + g * o], t === e ? d[s]++ : d[++s] = 1, t = e;
          c += this._getBadness(s);
        }
        return c;
      },
      _convertBitStream: function(t) {
        var e, s, r = this._ecc, o = this._version;
        for (s = 0; s < t; s++)
          r[s] = this._value.charCodeAt(s);
        var c = this._stringBuffer = r.slice(), d = this._calculateMaxLength();
        t >= d - 2 && (t = d - 2, o > 9 && t--);
        var x = t;
        if (o > 9) {
          for (c[x + 2] = 0, c[x + 3] = 0; x--; )
            e = c[x], c[x + 3] |= 255 & e << 4, c[x + 2] = e >> 4;
          c[2] |= 255 & t << 4, c[1] = t >> 4, c[0] = 64 | t >> 12;
        } else {
          for (c[x + 1] = 0, c[x + 2] = 0; x--; )
            e = c[x], c[x + 2] |= 255 & e << 4, c[x + 1] = e >> 4;
          c[1] |= 255 & t << 4, c[0] = 64 | t >> 4;
        }
        for (x = t + 3 - (o < 10); x < d; )
          c[x++] = 236, c[x++] = 17;
      },
      _getBadness: function(t) {
        var e, s = 0, r = this._badness;
        for (e = 0; e <= t; e++)
          r[e] >= 5 && (s += k.N1 + r[e] - 5);
        for (e = 3; e < t - 1; e += 2)
          r[e - 2] === r[e + 2] && r[e + 2] === r[e - 1] && r[e - 1] === r[e + 1] && r[e - 1] * 3 === r[e] && (r[e - 3] === 0 || e + 3 > t || r[e - 3] * 3 >= r[e] * 4 || r[e + 3] * 3 >= r[e] * 4) && (s += k.N3);
        return s;
      },
      _finish: function() {
        this._stringBuffer = this.buffer.slice();
        var t, e, s = 0, r = 3e4;
        for (e = 0; e < 8 && (this._applyMask(e), t = this._checkBadness(), t < r && (r = t, s = e), s !== 7); e++)
          this.buffer = this._stringBuffer.slice();
        s !== e && this._applyMask(s), r = _.FINAL_FORMAT[s + (this._level - 1 << 3)];
        var o = this.buffer, c = this.width;
        for (e = 0; e < 8; e++, r >>= 1)
          r & 1 && (o[c - 1 - e + c * 8] = 1, e < 6 ? o[8 + c * e] = 1 : o[8 + c * (e + 1)] = 1);
        for (e = 0; e < 7; e++, r >>= 1)
          r & 1 && (o[8 + c * (c - 7 + e)] = 1, e ? o[6 - e + c * 8] = 1 : o[7 + c * 8] = 1);
      },
      _interleaveBlocks: function() {
        var t, e, s = this._dataBlock, r = this._ecc, o = this._eccBlock, c = 0, d = this._calculateMaxLength(), x = this._neccBlock1, g = this._neccBlock2, B = this._stringBuffer;
        for (t = 0; t < s; t++) {
          for (e = 0; e < x; e++)
            r[c++] = B[t + e * s];
          for (e = 0; e < g; e++)
            r[c++] = B[x * s + t + e * (s + 1)];
        }
        for (e = 0; e < g; e++)
          r[c++] = B[x * s + t + e * (s + 1)];
        for (t = 0; t < o; t++)
          for (e = 0; e < x + g; e++)
            r[c++] = B[d + t + e * o];
        this._stringBuffer = r;
      },
      _insertAlignments: function() {
        var t, e, s, r = this._version, o = this.width;
        if (r > 1)
          for (t = W.BLOCK[r], s = o - 7; ; ) {
            for (e = o - 7; e > t - 3 && (this._addAlignment(e, s), !(e < t)); )
              e -= t;
            if (s <= t + 9)
              break;
            s -= t, this._addAlignment(6, s), this._addAlignment(s, 6);
          }
      },
      _insertFinders: function() {
        var t, e, s, r, o = this.buffer, c = this.width;
        for (t = 0; t < 3; t++) {
          for (e = 0, r = 0, t === 1 && (e = c - 7), t === 2 && (r = c - 7), o[r + 3 + c * (e + 3)] = 1, s = 0; s < 6; s++)
            o[r + s + c * e] = 1, o[r + c * (e + s + 1)] = 1, o[r + 6 + c * (e + s)] = 1, o[r + s + 1 + c * (e + 6)] = 1;
          for (s = 1; s < 5; s++)
            this._setMask(r + s, e + 1), this._setMask(r + 1, e + s + 1), this._setMask(r + 5, e + s), this._setMask(r + s + 1, e + 5);
          for (s = 2; s < 4; s++)
            o[r + s + c * (e + 2)] = 1, o[r + 2 + c * (e + s + 1)] = 1, o[r + 4 + c * (e + s)] = 1, o[r + s + 1 + c * (e + 4)] = 1;
        }
      },
      _insertTimingGap: function() {
        var t, e, s = this.width;
        for (e = 0; e < 7; e++)
          this._setMask(7, e), this._setMask(s - 8, e), this._setMask(7, e + s - 7);
        for (t = 0; t < 8; t++)
          this._setMask(t, 7), this._setMask(t + s - 8, 7), this._setMask(t, s - 8);
      },
      _insertTimingRowAndColumn: function() {
        var t, e = this.buffer, s = this.width;
        for (t = 0; t < s - 14; t++)
          t & 1 ? (this._setMask(8 + t, 6), this._setMask(6, 8 + t)) : (e[8 + t + s * 6] = 1, e[6 + s * (8 + t)] = 1);
      },
      _insertVersion: function() {
        var t, e, s, r, o = this.buffer, c = this._version, d = this.width;
        if (c > 6)
          for (t = Me.BLOCK[c - 7], e = 17, s = 0; s < 6; s++)
            for (r = 0; r < 3; r++, e--)
              1 & (e > 11 ? c >> e - 12 : t >> e) ? (o[5 - s + d * (2 - r + d - 11)] = 1, o[2 - r + d - 11 + d * (5 - s)] = 1) : (this._setMask(5 - s, 2 - r + d - 11), this._setMask(2 - r + d - 11, 5 - s));
      },
      _isMasked: function(t, e) {
        var s = k._getMaskBit(t, e);
        return this._mask[s] === 1;
      },
      _pack: function() {
        var t, e, s, r = 1, o = 1, c = this.width, d = c - 1, x = c - 1, g = (this._dataBlock + this._eccBlock) * (this._neccBlock1 + this._neccBlock2) + this._neccBlock2;
        for (e = 0; e < g; e++)
          for (t = this._stringBuffer[e], s = 0; s < 8; s++, t <<= 1) {
            128 & t && (this.buffer[d + c * x] = 1);
            do
              o ? d-- : (d++, r ? x !== 0 ? x-- : (d -= 2, r = !r, d === 6 && (d--, x = 9)) : x !== c - 1 ? x++ : (d -= 2, r = !r, d === 6 && (d--, x -= 8))), o = !o;
            while (this._isMasked(d, x));
          }
      },
      _reverseMask: function() {
        var t, e, s = this.width;
        for (t = 0; t < 9; t++)
          this._setMask(t, 8);
        for (t = 0; t < 8; t++)
          this._setMask(t + s - 8, 8), this._setMask(8, t);
        for (e = 0; e < 7; e++)
          this._setMask(8, e + s - 7);
      },
      _setMask: function(t, e) {
        var s = k._getMaskBit(t, e);
        this._mask[s] = 1;
      },
      _syncMask: function() {
        var t, e, s = this.width;
        for (e = 0; e < s; e++)
          for (t = 0; t <= e; t++)
            this.buffer[t + s * e] && this._setMask(t, e);
      }
    }, {
      _createArray: function(t) {
        var e, s = [];
        for (e = 0; e < t; e++)
          s[e] = 0;
        return s;
      },
      _getMaskBit: function(t, e) {
        var s;
        return t > e && (s = t, t = e, e = s), s = e, s += e * e, s >>= 1, s += t, s;
      },
      _modN: function(t) {
        for (; t >= 255; )
          t -= 255, t = (t >> 8) + (t & 255);
        return t;
      },
      N1: 3,
      N2: 3,
      N3: 40,
      N4: 10
    }), Be = k, Ne = S.extend({
      draw: function() {
        this.element.src = this.qrious.toDataURL();
      },
      reset: function() {
        this.element.src = "";
      },
      resize: function() {
        var t = this.element;
        t.width = t.height = this.qrious.size;
      }
    }), De = Ne, Fe = y.extend(function(t, e, s, r) {
      this.name = t, this.modifiable = Boolean(e), this.defaultValue = s, this._valueTransformer = r;
    }, {
      transform: function(t) {
        var e = this._valueTransformer;
        return typeof e == "function" ? e(t, this) : t;
      }
    }), M = Fe, Oe = y.extend(null, {
      abs: function(t) {
        return t != null ? Math.abs(t) : null;
      },
      hasOwn: function(t, e) {
        return Object.prototype.hasOwnProperty.call(t, e);
      },
      noop: function() {
      },
      toUpperCase: function(t) {
        return t != null ? t.toUpperCase() : null;
      }
    }), D = Oe, O = y.extend(function(t) {
      this.options = {}, t.forEach(function(e) {
        this.options[e.name] = e;
      }, this);
    }, {
      exists: function(t) {
        return this.options[t] != null;
      },
      get: function(t, e) {
        return O._get(this.options[t], e);
      },
      getAll: function(t) {
        var e, s = this.options, r = {};
        for (e in s)
          D.hasOwn(s, e) && (r[e] = O._get(s[e], t));
        return r;
      },
      init: function(t, e, s) {
        typeof s != "function" && (s = D.noop);
        var r, o;
        for (r in this.options)
          D.hasOwn(this.options, r) && (o = this.options[r], O._set(o, o.defaultValue, e), O._createAccessor(o, e, s));
        this._setAll(t, e, !0);
      },
      set: function(t, e, s) {
        return this._set(t, e, s);
      },
      setAll: function(t, e) {
        return this._setAll(t, e);
      },
      _set: function(t, e, s, r) {
        var o = this.options[t];
        if (!o)
          throw new Error("Invalid option: " + t);
        if (!o.modifiable && !r)
          throw new Error("Option cannot be modified: " + t);
        return O._set(o, e, s);
      },
      _setAll: function(t, e, s) {
        if (!t)
          return !1;
        var r, o = !1;
        for (r in t)
          D.hasOwn(t, r) && this._set(r, t[r], e, s) && (o = !0);
        return o;
      }
    }, {
      _createAccessor: function(t, e, s) {
        var r = {
          get: function() {
            return O._get(t, e);
          }
        };
        t.modifiable && (r.set = function(o) {
          O._set(t, o, e) && s(o, t);
        }), Object.defineProperty(e, t.name, r);
      },
      _get: function(t, e) {
        return e["_" + t.name];
      },
      _set: function(t, e, s) {
        var r = "_" + t.name, o = s[r], c = t.transform(e ?? t.defaultValue);
        return s[r] = c, c !== o;
      }
    }), Le = O, Te = y.extend(function() {
      this._services = {};
    }, {
      getService: function(t) {
        var e = this._services[t];
        if (!e)
          throw new Error("Service is not being managed with name: " + t);
        return e;
      },
      setService: function(t, e) {
        if (this._services[t])
          throw new Error("Service is already managed with name: " + t);
        e && (this._services[t] = e);
      }
    }), Re = Te, X = new Le([
      new M("background", !0, "white"),
      new M("backgroundAlpha", !0, 1, D.abs),
      new M("element"),
      new M("foreground", !0, "black"),
      new M("foregroundAlpha", !0, 1, D.abs),
      new M("level", !0, "L", D.toUpperCase),
      new M("mime", !0, "image/png"),
      new M("padding", !0, null, D.abs),
      new M("size", !0, 100, D.abs),
      new M("value", !0, "")
    ]), he = new Re(), fe = y.extend(function(t) {
      X.init(t, this, this.update.bind(this));
      var e = X.get("element", this), s = he.getService("element"), r = e && s.isCanvas(e) ? e : s.createCanvas(), o = e && s.isImage(e) ? e : s.createImage();
      this._canvasRenderer = new H(this, r, !0), this._imageRenderer = new De(this, o, o === e), this.update();
    }, {
      get: function() {
        return X.getAll(this);
      },
      set: function(t) {
        X.setAll(t, this) && this.update();
      },
      toDataURL: function(t) {
        return this.canvas.toDataURL(t || this.mime);
      },
      update: function() {
        var t = new Be({
          level: this.level,
          value: this.value
        });
        this._canvasRenderer.render(t), this._imageRenderer.render(t);
      }
    }, {
      use: function(t) {
        he.setService(t.getName(), t);
      }
    });
    Object.defineProperties(fe.prototype, {
      canvas: {
        get: function() {
          return this._canvasRenderer.getElement();
        }
      },
      image: {
        get: function() {
          return this._imageRenderer.getElement();
        }
      }
    });
    var Ke = fe, me = Ke, Ie = y.extend({
      getName: function() {
      }
    }), Ve = Ie, je = Ve.extend({
      createCanvas: function() {
      },
      createImage: function() {
      },
      getName: function() {
        return "element";
      },
      isCanvas: function(t) {
      },
      isImage: function(t) {
      }
    }), Ue = je, Ge = Ue.extend({
      createCanvas: function() {
        return document.createElement("canvas");
      },
      createImage: function() {
        return document.createElement("img");
      },
      isCanvas: function(t) {
        return t instanceof HTMLCanvasElement;
      },
      isImage: function(t) {
        return t instanceof HTMLImageElement;
      }
    }), qe = Ge;
    me.use(new qe());
    var ze = me;
    return ze;
  });
})(it);
const ct = ie;
const lt = (C) => {
  const { message: h, onRetry: n, onRetryLabel: i } = C;
  return /* @__PURE__ */ a.createElement("div", { className: "boxQRCode flex flex-col items-center justify-center bg-white text-center text-sm text-[color:rgb(var(--od-rgb-text),0.65)]" }, /* @__PURE__ */ a.createElement(ke, { outline: !0, className: "errorWarning" }), /* @__PURE__ */ a.createElement("div", null, h), /* @__PURE__ */ a.createElement("div", { className: "cursor-pointer text-blue-50", onClick: n }, i));
}, dt = (C) => {
  const { qrValue: h, onRetry: n } = C, i = () => new ct({ value: h }).toDataURL();
  return h ? /* @__PURE__ */ a.createElement("div", { className: "boxQRCode bg-white" }, /* @__PURE__ */ a.createElement("img", { alt: "2fa-qr-code", src: i(), loading: "lazy" })) : /* @__PURE__ */ a.createElement(lt, { message: "Failed to load QR code", onRetryLabel: "Try Again", onRetry: n });
}, ut = 10138;
class ht extends a.Component {
  constructor(h) {
    super(h), this.generateAuthenticatorSecretKey = async () => {
      this.setState({ isLoading: !0 });
      try {
        await this.appState.userAppManager.generateAuthenticatorSecretKey();
      } catch (n) {
        console.error(n);
      } finally {
        this.setState({ isLoading: !1 });
      }
    }, this.enableAuthenticator = async () => {
      this.setState({ errorInput: null, alert: null });
      try {
        const n = await this.appState.getSdk().IAM.TwoFA().enable2FAAuthenticator(this.state.TwoFACode);
        if (n.error)
          throw n.error;
        this.props.onClose(), this.props.onSuccess(), this.props.onUpdated();
      } catch (n) {
        console.error(n), we.extractServiceErrorCode(n) === ut ? this.setState({ errorInput: n }) : this.setState({
          alert: {
            type: P.danger,
            element: /* @__PURE__ */ a.createElement(z, { error: n })
          }
        });
      }
    }, this.onChangeTwoFACode = (n) => {
      const i = n.target.value;
      this.setState({ TwoFACode: i }), this.validation.set("verificationCode", Qe(i));
    }, this.renderError = () => {
      const n = this.validation.get("verificationCode"), { errorInput: i } = this.state;
      switch (n) {
        case He.empty:
          return /* @__PURE__ */ a.createElement(G, null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.twoFaCode.error.empty" }, "Code is required"));
      }
      return /* @__PURE__ */ a.createElement(G, null, /* @__PURE__ */ a.createElement(z, { error: i }));
    }, this.state = {
      authenticatorKey: { secretKey: "", uri: "" },
      TwoFACode: "",
      errorInput: null,
      isLoading: !1,
      alert: null
    }, this.appState = L.getAppState(), this.validation = new ge(), this.validation.listen(() => this.setState({}));
  }
  componentDidUpdate(h) {
    h.isOpen !== this.props.isOpen && this.generateAuthenticatorSecretKey();
  }
  render() {
    const { alert: h, isLoading: n, errorInput: i, TwoFACode: u } = this.state, { authenticatorKey: f } = this.appState.userAppManager.state, { onClose: l, isOpen: E } = this.props;
    return /* @__PURE__ */ a.createElement(Y, { title: b("AccountPasswordSecurity.2fa.authenticator.title"), isOpen: E, className: "authenticatorApp", onClose: l }, /* @__PURE__ */ a.createElement(J, null, /* @__PURE__ */ a.createElement("div", { className: "mb-4 text-[color:rgb(var(--od-rgb-text),0.65)]" }, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.authenticator.subtitle" }, "Please follow the instruction below to setup two-factor authentication")), h && /* @__PURE__ */ a.createElement(T, { type: h.type, onDismiss: () => this.setState({ alert: null }), className: "mb-3" }, h.element), /* @__PURE__ */ a.createElement("div", { className: "bg-grayD1 p-8" }, /* @__PURE__ */ a.createElement("div", { className: "flex text-[color:rgb(var(--od-rgba-text))]" }, /* @__PURE__ */ a.createElement("div", { className: "mr-3 flex h-6 w-6 justify-center rounded-full bg-blue-50" }, "1"), /* @__PURE__ */ a.createElement("div", null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.authenticator.step1.title" }, "Download an authenticator app"))), /* @__PURE__ */ a.createElement("div", { className: "descStep border-l-2 border-blue-50" }, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.authenticator.step1.desc" }, "Download and install an authenticator app for your phone or tablet.")), /* @__PURE__ */ a.createElement("div", { className: "flex text-[color:rgb(var(--od-rgba-text))]" }, /* @__PURE__ */ a.createElement("div", { className: "mr-3 flex h-6 w-6 justify-center rounded-full bg-blue-50" }, "2"), /* @__PURE__ */ a.createElement("div", null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.authenticator.step2.title" }, "Scan the QR code"))), /* @__PURE__ */ a.createElement("div", { className: "descStep border-l-2 border-blue-50" }, /* @__PURE__ */ a.createElement("div", null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.authenticator.step2.desc" }, "Open the authenticator app and follow the instruction to scan this QR Code")), /* @__PURE__ */ a.createElement("div", { className: "mt-3 items-center md:flex" }, n || !f ? /* @__PURE__ */ a.createElement(ve, null) : /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(dt, { qrValue: f.uri, onRetry: this.generateAuthenticatorSecretKey }), f.secretKey && /* @__PURE__ */ a.createElement("div", { className: "decsQRcode sm:py-3 md:p-3" }, /* @__PURE__ */ a.createElement("div", null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.authenticator.step2.desc2" }, "Can't scan the QR code? Enter this text code manually.")), /* @__PURE__ */ a.createElement("div", { className: "bg-gray-80 break-all rounded p-3" }, f.secretKey))))), /* @__PURE__ */ a.createElement("div", { className: "flex text-[color:rgb(var(--od-rgba-text))]" }, /* @__PURE__ */ a.createElement("div", { className: "mr-3 flex h-6 w-6 justify-center rounded-full bg-blue-50" }, "3"), /* @__PURE__ */ a.createElement("div", null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.authenticator.step3.title" }, "Enter the authentication code"))), /* @__PURE__ */ a.createElement("div", { className: "descStep" }, /* @__PURE__ */ a.createElement("div", { className: "mb-3" }, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.authenticator.step3.desc" }, "Once you have scanned the barcode, enter the 6-digit authentication code generated by the authenticator app.")), /* @__PURE__ */ a.createElement(q, null, /* @__PURE__ */ a.createElement(
      Ee,
      {
        className: Q("mb-3 w-3/5", {
          "border-red-40": i || this.validation.get("verificationCode")
        }),
        placeholder: b("AccountPasswordSecurity.2fa.authenticator.placeholder"),
        value: u,
        onChange: this.onChangeTwoFACode
      }
    ), (i || this.validation.get("verificationCode")) && this.renderError()), /* @__PURE__ */ a.createElement("div", null, /* @__PURE__ */ a.createElement(N, { className: "btn btn-primary", onClick: this.enableAuthenticator, disabled: !u }, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.authenticator.activate" }, "ACTIVATE")))))));
  }
}
const ue = (C) => {
  const {
    icon: h,
    title: n,
    description: i,
    enabledFactors: u,
    checkBoxLabel: f,
    onClickCheckbox: l,
    isCheckboxDisabled: E,
    isFactorEnabled: A,
    onEnable: p,
    onDisable: w,
    FactorValue: y,
    isFirstSection: v
  } = C, S = C.isPreviewMode;
  return /* @__PURE__ */ a.createElement("div", { className: Q("mb-4 flex items-center justify-between", v && "border-gray-70 border-b pb-4") }, /* @__PURE__ */ a.createElement("div", { className: "flex w-5/6 items-center" }, /* @__PURE__ */ a.createElement("div", { className: "mr-5" }, h), /* @__PURE__ */ a.createElement("div", { className: "w-3/4" }, /* @__PURE__ */ a.createElement("div", { className: "mb-2 flex items-center" }, /* @__PURE__ */ a.createElement("div", { className: "mr-3" }, n), /* @__PURE__ */ a.createElement(
    "div",
    {
      className: Q(
        "flex items-center rounded-full px-3 py-0.5 text-sm text-[color:rgb(var(--od-rgba-text))]",
        A ? "bg-green-80 " : "bg-gray-55"
      )
    },
    A ? "On" : "Off"
  )), /* @__PURE__ */ a.createElement("div", { className: "mb-2 text-[color:rgb(var(--od-rgb-text),0.65)]" }, i), u && u.enabled.includes(y) && /* @__PURE__ */ a.createElement(
    nt,
    {
      label: f,
      isChecked: u.default === y,
      isLabelFirst: !1,
      onChange: l,
      isDisabled: E
    }
  ))), /* @__PURE__ */ a.createElement("div", { className: "w-1/6" }, A ? /* @__PURE__ */ a.createElement(
    N,
    {
      className: "btn btn-ghost w-full",
      buttonType: le.TEXT,
      buttonStyle: Z.NONE,
      onClick: S ? void 0 : w
    },
    /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.btnDisable" }, "Disable")
  ) : /* @__PURE__ */ a.createElement(N, { className: "btn btn-primary w-full", onClick: S ? void 0 : p }, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.btnEnable" }, "Enable"))));
}, V = "authenticator";
class ft extends a.Component {
  constructor(h) {
    super(h), this.disableAuthenticatorFactor = async () => {
      const { onError: n, onUpdated: i, onSuccess: u, closeConfirmDialog: f } = this.props;
      try {
        const l = await this.webSdk.IAM.TwoFA().disableAuthenticator();
        if (l.error)
          throw l.error;
        u(), f(), i();
      } catch (l) {
        f(), console.error(l), n(l);
      }
    }, this.setAuthenticatorDefault = async () => {
      const { onError: n, onSuccess: i, onUpdated: u, closeConfirmDialog: f } = this.props;
      try {
        const l = await this.webSdk.IAM.TwoFA().set2FAAsDefault(V);
        if (l.error)
          throw l.error;
        i(), f(), u();
      } catch (l) {
        console.error(l), n(l), f();
      }
    }, this.enableAuthenticationApp = (n) => {
      this.setState({ isAuthenticationAppDialogOpen: n });
    }, this.isAuthenticatorEnabled = () => this.props.enabledFactors ? this.props.enabledFactors.enabled.includes(V) : !1, this.onClickDisable = () => {
      const { setConfirmDialogData: n, closeConfirmDialog: i } = this.props;
      n({
        title: b("AccountPasswordSecurity.2fa.disable.authenticator"),
        message: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.disable.message.authenticator" }, "Are you sure want to disable ", /* @__PURE__ */ a.createElement("span", { className: "font-semibold" }, "Authenticator App"), "?"),
        cancelBtnLabel: b("AccountPasswordSecurity.2fa.cancelBtn"),
        confirmBtnLabel: b("AccountPasswordSecurity.2fa.disableBtn"),
        onCancel: i,
        onConfirm: this.disableAuthenticatorFactor,
        isOpen: !0
      });
    }, this.onClickDefault = () => {
      const { setConfirmDialogData: n, closeConfirmDialog: i } = this.props;
      n({
        title: b("AccountPasswordSecurity.2fa.confirmation.label"),
        message: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.authenticator.default.message" }, "Are you sure want to set ", /* @__PURE__ */ a.createElement("span", { className: "font-semibold" }, "Authentication App"), " as default two-factor authentication method?"),
        cancelBtnLabel: b("AccountPasswordSecurity.2fa.cancelBtn"),
        confirmBtnLabel: b("AccountPasswordSecurity.2fa.yesBtn"),
        isOpen: !0,
        onCancel: i,
        onConfirm: this.setAuthenticatorDefault
      });
    }, this.state = {
      isAuthenticationAppDialogOpen: !1
    }, this.webSdk = L.getAppState().getSdk();
  }
  render() {
    const { onSuccess: h, enabledFactors: n, onUpdated: i } = this.props;
    return /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(
      ue,
      {
        icon: /* @__PURE__ */ a.createElement(at, { className: "iconMethod" }),
        title: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.authenticatorApp" }, "Authenticator App"),
        description: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.authenticatorAppDesc" }, "Use an Authenticator app to get free verification codes, even when your phone is offline. Available for Android and iPhone"),
        enabledFactors: n,
        checkBoxLabel: b("AccountPasswordSecurity.2fa.authenticatorAppCheckbox"),
        onClickCheckbox: n && n.default !== V ? this.onClickDefault : void 0,
        isCheckboxDisabled: !!n && n.default === V && n.enabled.length === 1,
        isFactorEnabled: this.isAuthenticatorEnabled(),
        onEnable: () => this.enableAuthenticationApp(!0),
        onDisable: this.onClickDisable,
        FactorValue: V,
        isFirstSection: !0,
        isPreviewMode: this.props.isPreviewMode
      }
    ), /* @__PURE__ */ a.createElement(
      ht,
      {
        isOpen: this.state.isAuthenticationAppDialogOpen,
        onClose: () => this.enableAuthenticationApp(!1),
        onSuccess: h,
        onUpdated: i
      }
    ));
  }
}
var ce = {}, mt = {
  get exports() {
    return ce;
  },
  set exports(C) {
    ce = C;
  }
};
(function(C, h) {
  (function(n, i) {
    i();
  })(Se, function() {
    function n(p, w) {
      return typeof w > "u" ? w = { autoBom: !1 } : typeof w != "object" && (console.warn("Deprecated: Expected third argument to be a object"), w = { autoBom: !w }), w.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(p.type) ? new Blob(["\uFEFF", p], { type: p.type }) : p;
    }
    function i(p, w, y) {
      var v = new XMLHttpRequest();
      v.open("GET", p), v.responseType = "blob", v.onload = function() {
        A(v.response, w, y);
      }, v.onerror = function() {
        console.error("could not download file");
      }, v.send();
    }
    function u(p) {
      var w = new XMLHttpRequest();
      w.open("HEAD", p, !1);
      try {
        w.send();
      } catch {
      }
      return 200 <= w.status && 299 >= w.status;
    }
    function f(p) {
      try {
        p.dispatchEvent(new MouseEvent("click"));
      } catch {
        var w = document.createEvent("MouseEvents");
        w.initMouseEvent("click", !0, !0, window, 0, 0, 0, 80, 20, !1, !1, !1, !1, 0, null), p.dispatchEvent(w);
      }
    }
    var l = typeof window == "object" && window.window === window ? window : typeof self == "object" && self.self === self ? self : typeof window == "object" && window.global === window ? window : void 0, E = l.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent), A = l.saveAs || (typeof window != "object" || window !== l ? function() {
    } : "download" in HTMLAnchorElement.prototype && !E ? function(p, w, y) {
      var v = l.URL || l.webkitURL, S = document.createElement("a");
      w = w || p.name || "download", S.download = w, S.rel = "noopener", typeof p == "string" ? (S.href = p, S.origin === location.origin ? f(S) : u(S.href) ? i(p, w, y) : f(S, S.target = "_blank")) : (S.href = v.createObjectURL(p), setTimeout(function() {
        v.revokeObjectURL(S.href);
      }, 4e4), setTimeout(function() {
        f(S);
      }, 0));
    } : "msSaveOrOpenBlob" in navigator ? function(p, w, y) {
      if (w = w || p.name || "download", typeof p != "string")
        navigator.msSaveOrOpenBlob(n(p, y), w);
      else if (u(p))
        i(p, w, y);
      else {
        var v = document.createElement("a");
        v.href = p, v.target = "_blank", setTimeout(function() {
          f(v);
        });
      }
    } : function(p, w, y, v) {
      if (v = v || open("", "_blank"), v && (v.document.title = v.document.body.innerText = "downloading..."), typeof p == "string")
        return i(p, w, y);
      var S = p.type === "application/octet-stream", ee = /constructor/i.test(l.HTMLElement) || l.safari, H = /CriOS\/[\d]+/.test(navigator.userAgent);
      if ((H || S && ee || E) && typeof FileReader < "u") {
        var R = new FileReader();
        R.onloadend = function() {
          var _ = R.result;
          _ = H ? _ : _.replace(/^data:[^;]*;/, "data:attachment/file;"), v ? v.location.href = _ : location = _, v = null;
        }, R.readAsDataURL(p);
      } else {
        var W = l.URL || l.webkitURL, K = W.createObjectURL(p);
        v ? v.location = K : location.href = K, v = null, setTimeout(function() {
          W.revokeObjectURL(K);
        }, 4e4);
      }
    });
    l.saveAs = A.saveAs = A, C.exports = A;
  });
})(mt);
const xt = (C) => {
  const { onRetry: h, message: n, retryLabel: i } = C;
  return /* @__PURE__ */ $.createElement("div", { className: "errorGenerateCode flex h-64 flex-col items-center justify-center text-sm" }, /* @__PURE__ */ $.createElement(ke, { outline: !0, className: "iconError mb-4 fill-current text-[color:rgb(var(--od-rgba-text))]" }), /* @__PURE__ */ $.createElement("div", { className: "mb-4 text-center" }, n), /* @__PURE__ */ $.createElement("div", { className: "cursor-pointer text-blue-50", onClick: h }, i));
};
class pt extends a.Component {
  constructor(h) {
    super(h), this.downloadCodes = async () => {
      const { backupCode: n, setAlert: i } = this.props;
      if (!n)
        return;
      this.setState({ isDownloading: !0 });
      const u = new Blob([n.validCodes], { type: "text/plain;charset=utf-8" });
      ce.saveAs(u, `backup_codes_${n && be(new Date(n.generatedAt * 1e3), "M/DD/YYYY, hh:mm a")}.txt`), i({
        type: P.success,
        element: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordsecurity.2fa.backupcode.success.download" }, "Backup codes downloaded")
      }), this.setState({ isDownloading: !1 });
    }, this.closeBackupCodeModal = () => {
      const { onClose: n, setAlert: i } = this.props;
      i(null), n();
    }, this.renderLoading = () => {
      const { isFetching: n, isGenerating: i } = this.props;
      return /* @__PURE__ */ a.createElement("div", { className: "flex justify-center" }, /* @__PURE__ */ a.createElement(We, null), /* @__PURE__ */ a.createElement("div", { className: "ml-3 leading-3" }, i && /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.backupCode.generating" }, "Generating new codes..."), n && /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.backupCode.loading" }, "Loading backup codes...")));
    }, this.renderBackupCodes = () => {
      const { backupCode: n, isFetching: i, isGenerating: u } = this.props;
      if (i || u)
        return this.renderLoading();
      if (!n)
        return null;
      let f = [];
      return n.validCodes && (f = n.validCodes.map((l) => ({ code: l, isValid: !0 }))), n.invalidCodes && (f = f.concat(n.invalidCodes.map((l) => ({ code: l, isValid: !1 })))), /* @__PURE__ */ a.createElement("div", { className: "border-gray-80 mx-6 flex flex-wrap border-b border-t pt-6 pb-3" }, f.map((l) => /* @__PURE__ */ a.createElement(
        "div",
        {
          key: l.code,
          className: Q("mb-4 w-1/2 text-center sm:w-1/5", !l.isValid && "text-gray-70 line-through")
        },
        l.code
      )));
    }, this.state = {
      isDownloading: !1
    };
  }
  render() {
    const { isOpen: h, backupCode: n, isFetching: i, isGenerating: u, alert: f, backupCodeError: l, setAlert: E, generateCodes: A } = this.props;
    return /* @__PURE__ */ a.createElement(
      Y,
      {
        isOpen: h,
        title: b("AccountPasswordSecurity.2fa.backupCode.title"),
        className: "sm:w-680 w-5/6",
        onClose: this.closeBackupCodeModal
      },
      /* @__PURE__ */ a.createElement(J, null, f && /* @__PURE__ */ a.createElement(T, { type: f.type, onDismiss: () => E(null), className: "mb-3" }, f.element), /* @__PURE__ */ a.createElement(T, { type: P.info }, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountpasswordSecurity.2fa.backupCode.info" }, "Download your backup codes and keep them somewhere safe. Treat them the same way as you save your password.")), l ? /* @__PURE__ */ a.createElement(
        xt,
        {
          onRetry: l.onRetry,
          message: l.message,
          retryLabel: l.retryLabel
        }
      ) : /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement("div", { className: "justify-between p-6 pb-2 lg:flex" }, /* @__PURE__ */ a.createElement("div", null, /* @__PURE__ */ a.createElement("div", null, /* @__PURE__ */ a.createElement("span", null, n && n.validCodes ? n.validCodes.length : 0), " ", /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.backupCode.remaining" }, "backup codes remaining")), /* @__PURE__ */ a.createElement("div", { className: "pb-6 text-[color:rgb(var(--od-rgb-text),0.65)]" }, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.backupCode.info2" }, "you can only use each code once."))), /* @__PURE__ */ a.createElement("div", { className: "italic text-[color:rgb(var(--od-rgb-text),0.65)]" }, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.backupCode.generatedAt" }, "Generated at:"), " ", n && be(new Date(n.generatedAt * 1e3), "M/DD/YYYY, hh:mm a"))), this.renderBackupCodes())),
      !l && /* @__PURE__ */ a.createElement(de, null, /* @__PURE__ */ a.createElement("div", { className: "justify-end sm:flex" }, /* @__PURE__ */ a.createElement(
        N,
        {
          className: "btn btn-ghost mr-5 w-full text-sm font-normal sm:w-48",
          buttonStyle: Z.NONE,
          onClick: A
        },
        /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.backupCode.generateCode" }, "GENERATE NEW CODES")
      ), /* @__PURE__ */ a.createElement(
        N,
        {
          className: "btn btn-primary mt-3 w-full text-sm font-normal sm:mt-0 sm:w-40",
          onClick: this.downloadCodes,
          disabled: this.state.isDownloading || !(n != null && n.validCodes) || i || u
        },
        /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.backupCode.downloadCode" }, "DOWNLOAD CODES")
      )))
    );
  }
}
const j = "backupCode";
class bt extends a.Component {
  constructor(h) {
    super(h), this.onClickOpenBackupCodes = () => {
      this.setState({ isBackupCodesModalOpen: !0 }), this.getBackupCodes();
    }, this.onCloseBackupCodes = () => {
      this.setState({ isBackupCodesModalOpen: !1 });
    }, this.enableBackupCodes = async () => {
      const { onSuccess: n, onUpdated: i } = this.props;
      this.setState({ isBackupCodesModalOpen: !0, isGenerating: !0 });
      try {
        const u = await this.webSdk.IAM.TwoFA().enable2FABackupCodes();
        if (u.error)
          throw u.error;
        n(), this.setState({ isBackupCodesModalOpen: !0 }), i(), this.getBackupCodes(), this.setState({
          alert: {
            type: P.success,
            element: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.updated" }, "Two-factor authentication has been updated.")
          }
        });
      } catch (u) {
        console.error(u), this.setState({
          backupCode: null,
          backupCodeError: {
            message: b("AccountPasswordSecurity.2fa.backupCode.error.generate"),
            retryLabel: b("AccountPasswordSecurity.2fa.backupCode.generateNewCode"),
            onRetry: this.enableBackupCodes
          }
        });
      } finally {
        this.setState({ isGenerating: !1 });
      }
    }, this.getBackupCodes = async () => {
      this.setState({ backupCodeError: null, isFetching: !0 });
      try {
        const n = await this.webSdk.IAM.TwoFA().getBackupCode();
        if (n.error)
          throw n.error;
        this.setState({ backupCode: n.response.data });
      } catch (n) {
        console.error(n), this.setState({
          backupCodeError: {
            message: b("AccountPasswordSecurity.2fa.backupCode.error.fetch"),
            retryLabel: b("AccountPasswordSecurity.2fa.backupCode.tryAgain"),
            onRetry: this.getBackupCodes
          }
        });
      } finally {
        this.setState({ isFetching: !1 });
      }
    }, this.generateCodes = async () => {
      this.setState({ backupCodeError: null, isGenerating: !0 });
      try {
        const n = await this.webSdk.IAM.TwoFA().generateBackupCodes();
        if (n.error)
          throw n.error;
        this.setState({ backupCode: n.response.data }), this.setState({
          alert: {
            type: P.success,
            element: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.backupCode.updated" }, "Backup codes updated")
          }
        });
      } catch (n) {
        console.error(n), this.setState({
          backupCodeError: {
            message: b("AccountPasswordSecurity.2fa.backupCode.error.generate"),
            retryLabel: b("AccountPasswordSecurity.2fa.backupCode.generateNewCode"),
            onRetry: this.generateCodes
          }
        });
      } finally {
        this.setState({ isGenerating: !1 });
      }
    }, this.disableBackupCodesFactor = async () => {
      const { onError: n, onSuccess: i, onUpdated: u, closeConfirmDialog: f } = this.props;
      try {
        const l = await this.webSdk.IAM.TwoFA().disableBackupCodes();
        if (l.error)
          throw l.error;
        i(), f(), u();
      } catch (l) {
        console.error(l), n(l);
      }
    }, this.setBackupcodeDefault = async () => {
      const { onError: n, onSuccess: i, onUpdated: u, closeConfirmDialog: f } = this.props;
      try {
        const l = await this.webSdk.IAM.TwoFA().set2FAAsDefault(j);
        if (l.error)
          throw l.error;
        i(), f(), u();
      } catch (l) {
        console.error(l), n(l);
      }
    }, this.onClickDisable = () => {
      const { setConfirmDialogData: n, closeConfirmDialog: i } = this.props;
      n({
        title: b("AccountPasswordSecurity.2fa.disable.backupcode"),
        message: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.disable.backupcode.message" }, "Are you sure want to disable ", /* @__PURE__ */ a.createElement("span", { className: "font-semibold" }, "Backup Codes"), "?"),
        cancelBtnLabel: b("AccountPasswordSecurity.2fa.cancelBtn"),
        confirmBtnLabel: b("AccountPasswordSecurity.2fa.disableBtn"),
        isOpen: !0,
        onCancel: i,
        onConfirm: () => this.disableBackupCodesFactor()
      });
    }, this.onClickDefault = () => {
      const { setConfirmDialogData: n, closeConfirmDialog: i } = this.props;
      n({
        title: b("AccountPasswordSecurity.2fa.confirmation.label"),
        message: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.backupcode.default.message" }, "Are you sure want to set ", /* @__PURE__ */ a.createElement("span", { className: "font-semibold" }, "Backup Codes"), " as default two-factor authentication method?"),
        cancelBtnLabel: b("AccountPasswordSecurity.2fa.cancelBtn"),
        confirmBtnLabel: b("AccountPasswordSecurity.2fa.yesBtn"),
        isOpen: !0,
        onCancel: i,
        onConfirm: () => this.setBackupcodeDefault()
      });
    }, this.isBackupCodesEnabled = () => {
      const { enabledFactors: n } = this.props;
      return n ? n.enabled.includes(j) : !1;
    }, this.state = {
      isBackupCodesModalOpen: !1,
      backupCode: null,
      isFetching: !1,
      isGenerating: !1,
      alert: null,
      backupCodeError: null
    }, this.webSdk = L.getAppState().getSdk();
  }
  render() {
    const { enabledFactors: h } = this.props, { isBackupCodesModalOpen: n, backupCode: i, isFetching: u, isGenerating: f, alert: l, backupCodeError: E } = this.state;
    return /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(
      ue,
      {
        icon: /* @__PURE__ */ a.createElement(st, { className: "iconMethod" }),
        title: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.backupCodes" }, "Backup Codes"),
        description: /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.backupCodesDesc" }, "These one-time passcodes allow you to sign in when away from your phone."), this.isBackupCodesEnabled() && /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.clickMore" }, "To manage your backup codes,", /* @__PURE__ */ a.createElement("span", { onClick: this.onClickOpenBackupCodes, className: "ml-2 cursor-pointer text-blue-50" }, "Click here."))),
        enabledFactors: h,
        checkBoxLabel: b("AccountPasswordSecurity.2fa.backupCodesCheckbox"),
        onClickCheckbox: h && h.default !== j ? this.onClickDefault : void 0,
        isCheckboxDisabled: !!h && h.default === j && h.enabled.length === 1,
        isFactorEnabled: this.isBackupCodesEnabled(),
        onEnable: this.enableBackupCodes,
        onDisable: this.onClickDisable,
        FactorValue: j,
        isFirstSection: !0,
        isPreviewMode: this.props.isPreviewMode
      }
    ), /* @__PURE__ */ a.createElement(
      pt,
      {
        isOpen: n,
        onClose: this.onCloseBackupCodes,
        backupCode: i,
        isFetching: u,
        isGenerating: f,
        alert: l,
        backupCodeError: E,
        setAlert: (A) => this.setState({ alert: A }),
        generateCodes: this.generateCodes
      }
    ));
  }
}
class wt extends a.Component {
  constructor(h) {
    super(h), this.onClickConfirm = async () => {
      this.setState({ isLoading: !0 });
      try {
        await this.props.onConfirm();
      } finally {
        this.setState({ isLoading: !1 });
      }
    }, this.state = {
      isLoading: !1
    };
  }
  render() {
    const { title: h, message: n, onCancel: i, isOpen: u, cancelBtnLabel: f, confirmBtnLabel: l } = this.props, { isLoading: E } = this.state;
    return /* @__PURE__ */ a.createElement(Y, { title: h, isOpen: u, className: "w-400" }, /* @__PURE__ */ a.createElement(J, null, /* @__PURE__ */ a.createElement("div", { className: "mb-5 text-sm" }, n)), /* @__PURE__ */ a.createElement(de, null, /* @__PURE__ */ a.createElement("div", { className: "flex justify-end" }, /* @__PURE__ */ a.createElement(
      N,
      {
        className: "btn btn-ghost mr-2 h-10 w-24",
        onClick: i,
        buttonStyle: Z.NONE,
        buttonType: le.TEXT,
        disabled: E
      },
      f || b("Common.cancel")
    ), /* @__PURE__ */ a.createElement(
      N,
      {
        loadingIndicator: "SPINNER",
        disabled: E,
        className: "btn btn-primary h-10 w-28",
        isLoading: E,
        onClick: this.onClickConfirm
      },
      l || b("Common.confirm")
    ))));
  }
}
class gt extends a.Component {
  constructor(h) {
    super(h), this.submitCode = () => {
      const { enableEmail: n } = this.props, { code: i } = this.state;
      n(i, () => this.setState({ code: "" }));
    }, this.onCodeChange = (n) => {
      const i = n.target.value;
      this.setState({ code: i });
    }, this.onCloseModal = () => {
      const { onClose: n } = this.props;
      this.setState({ code: "" }, n);
    }, this.appState = L.getAppState(), this.state = {
      code: ""
    };
  }
  render() {
    var A;
    const { isOpen: h, onResendCode: n, alert: i, closeAlert: u, isLoading: f } = this.props, { code: l } = this.state, E = (A = this.appState.getUser()) == null ? void 0 : A.emailAddress;
    return /* @__PURE__ */ a.createElement(Y, { isOpen: h, title: b("AccountPasswordSecurity.2fa.emailModal.title"), className: "w-[450px]", onClose: this.onCloseModal }, /* @__PURE__ */ a.createElement(J, null, /* @__PURE__ */ a.createElement("div", { className: "mb-3 text-sm" }, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.emailModal.desc" }, "To continue, please enter the verification code we’ve sent to your email at ", /* @__PURE__ */ a.createElement("strong", null, { email: E }), ".")), i && /* @__PURE__ */ a.createElement(T, { type: i.type, onDismiss: u, className: "mb-3" }, i.element), /* @__PURE__ */ a.createElement(q, null, /* @__PURE__ */ a.createElement(Xe, null, b("AccountPasswordSecurity.2fa.emailModal.inputLabel")), /* @__PURE__ */ a.createElement(Ee, { placeholder: b("AccountPasswordSecurity.2fa.emailModal.placeHolder"), value: l, onChange: this.onCodeChange }), /* @__PURE__ */ a.createElement("div", { className: "text-[13px]" }, /* @__PURE__ */ a.createElement("span", null, b("AccountPasswordSecurity.2fa.emailModal.helperText")), /* @__PURE__ */ a.createElement("span", { className: "ml-1 cursor-pointer text-blue-50", onClick: n }, b("AccountPasswordSecurity.2fa.emailModal.resendBtn"))))), /* @__PURE__ */ a.createElement(de, null, /* @__PURE__ */ a.createElement("div", { className: "justify-end sm:flex" }, /* @__PURE__ */ a.createElement(
      N,
      {
        className: "btn btn-ghost mr-5 w-full w-[87px] text-sm",
        buttonType: le.TEXT,
        buttonStyle: Z.NONE,
        onClick: this.onCloseModal
      },
      b("AccountPasswordSecurity.2fa.cancelBtn")
    ), /* @__PURE__ */ a.createElement(
      N,
      {
        className: "btn btn-primary mt-3 w-full w-[102px] text-sm sm:mt-0",
        onClick: this.submitCode,
        disabled: f || !l
      },
      b("AccountPasswordSecurity.2fa.btnEnable").toUpperCase()
    ))));
  }
}
const U = "email";
class vt extends a.Component {
  constructor(h) {
    super(h), this.requestEmailCode = async (n = !1) => {
      const { onError: i } = this.props;
      this.setState({ isLoading: !0 });
      try {
        const u = await this.webSdk.IAM.TwoFA().requestEmailCode();
        if (u.error)
          throw u.error;
        this.setState({ isEnableModalOpen: !0 }), n && this.setState({
          alert: {
            type: P.success,
            element: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.emailModal.sendCodeSuccess" }, "A verification code has been sent to your email")
          }
        });
      } catch (u) {
        console.error(u), i(u);
      } finally {
        this.setState({ isLoading: !1 });
      }
    }, this.enableEmailMethod = async (n, i) => {
      const { onSuccess: u, onUpdated: f } = this.props;
      this.setState({ isLoading: !0 });
      try {
        const l = await this.webSdk.IAM.TwoFA().enableEmailMethod(n);
        if (l.error)
          throw l.error;
        u(), f(), this.setState({ isEnableModalOpen: !1 });
      } catch (l) {
        console.error(l), this.setState({
          alert: {
            type: P.danger,
            element: /* @__PURE__ */ a.createElement(z, { error: l })
          }
        }), i && i();
      } finally {
        this.setState({ isLoading: !1 });
      }
    }, this.setEmailDefault = async () => {
      const { onError: n, onSuccess: i, onUpdated: u, closeConfirmDialog: f } = this.props;
      try {
        const l = await this.webSdk.IAM.TwoFA().set2FAAsDefault(U);
        if (l.error)
          throw l.error;
        i(), f(), u();
      } catch (l) {
        console.error(l), n(l);
      }
    }, this.disableEmailFactor = async () => {
      const { onError: n, onSuccess: i, onUpdated: u, closeConfirmDialog: f } = this.props;
      try {
        const l = await this.webSdk.IAM.TwoFA().disableEmailMethod();
        if (l.error)
          throw l.error;
        i(), f(), u();
      } catch (l) {
        console.error(l), n(l);
      }
    }, this.closeModal = () => {
      this.setState({ isEnableModalOpen: !1, alert: null });
    }, this.isEmailMethodEnabled = () => {
      const { enabledFactors: n } = this.props;
      return n ? n.enabled.includes(U) : !1;
    }, this.onClickDefault = () => {
      const { setConfirmDialogData: n, closeConfirmDialog: i } = this.props;
      n({
        title: b("AccountPasswordSecurity.2fa.confirmation.label"),
        message: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.backupcode.default.message" }, "Are you sure want to set ", /* @__PURE__ */ a.createElement("span", { className: "font-semibold" }, "Backup Codes"), " as default two-factor authentication method?"),
        cancelBtnLabel: b("AccountPasswordSecurity.2fa.cancelBtn"),
        confirmBtnLabel: b("AccountPasswordSecurity.2fa.yesBtn"),
        isOpen: !0,
        onCancel: i,
        onConfirm: () => this.setEmailDefault()
      });
    }, this.onClickDisable = () => {
      const { setConfirmDialogData: n, closeConfirmDialog: i } = this.props;
      n({
        title: b("AccountPasswordSecurity.2fa.disable.backupcode"),
        message: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.disable.email.message" }, "Are you sure want to disable ", /* @__PURE__ */ a.createElement("span", { className: "font-semibold" }, "Email Authentication"), "?"),
        cancelBtnLabel: b("AccountPasswordSecurity.2fa.cancelBtn"),
        confirmBtnLabel: b("AccountPasswordSecurity.2fa.disableBtn"),
        isOpen: !0,
        onCancel: i,
        onConfirm: () => this.disableEmailFactor()
      });
    }, this.state = {
      isEnableModalOpen: !1,
      isLoading: !1,
      alert: null
    }, this.webSdk = L.getAppState().getSdk();
  }
  render() {
    const { enabledFactors: h } = this.props, { isEnableModalOpen: n, alert: i, isLoading: u } = this.state;
    return /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(
      ue,
      {
        icon: /* @__PURE__ */ a.createElement(rt, { className: "iconMethod" }),
        title: b("AccountPasswordSecurity.2fa.email"),
        description: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.emailDesc" }, "Get a verification code sent to your email each time you log in."),
        enabledFactors: h,
        checkBoxLabel: b("AccountPasswordSecurity.2fa.backupCodesCheckbox"),
        onClickCheckbox: h && h.default !== U ? this.onClickDefault : void 0,
        isCheckboxDisabled: !!h && h.default === U && h.enabled.length === 1,
        isFactorEnabled: this.isEmailMethodEnabled(),
        onEnable: () => this.requestEmailCode(!1),
        onDisable: this.onClickDisable,
        FactorValue: U,
        isPreviewMode: this.props.isPreviewMode
      }
    ), /* @__PURE__ */ a.createElement(
      gt,
      {
        isOpen: n,
        onClose: this.closeModal,
        onResendCode: () => this.requestEmailCode(!0),
        closeAlert: () => this.setState({ alert: null }),
        alert: i,
        enableEmail: this.enableEmailMethod,
        isLoading: u
      }
    ));
  }
}
class Et extends a.Component {
  constructor(h) {
    super(h), this.getEnabledFactor = async () => {
      try {
        const n = await this.webSdk.IAM.TwoFA({ cache: !1 }).getEnabledMethods();
        if (n.error)
          throw n.error;
        this.setState({ enabledFactors: n.response.data });
      } catch (n) {
        console.error(n), this.setState({ enabledFactors: null });
      }
    }, this.onSuccess = () => {
      this.setState({
        alert: {
          type: P.success,
          element: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.updated" }, "Two-factor authentication has been updated.")
        }
      });
    }, this.onError = (n) => {
      this.setState({
        alert: {
          type: P.danger,
          element: /* @__PURE__ */ a.createElement(z, { error: n })
        }
      });
    }, this.setConfirmDialogInfo = (n) => {
      this.setState({ confirmDialogData: n });
    }, this.closeConfirmDialog = () => {
      this.setState({ confirmDialogData: null });
    }, this.state = {
      alert: null,
      enabledFactors: null,
      confirmDialogData: null
    }, this.webSdk = L.getAppState().getSdk();
  }
  componentDidMount() {
    this.props.isPreviewMode || this.getEnabledFactor();
  }
  render() {
    const { alert: h, enabledFactors: n, confirmDialogData: i } = this.state, { isPreviewMode: u } = this.props;
    return /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(ye, { className: "twoFactorAuthenticator" }, /* @__PURE__ */ a.createElement(Ce, null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.title" }, "Two-Factor Authentication")), /* @__PURE__ */ a.createElement(Ae, { className: "w-full" }, !!h && /* @__PURE__ */ a.createElement("div", { className: "mb-2" }, /* @__PURE__ */ a.createElement(T, { type: h.type, onDismiss: () => this.setState({ alert: null }) }, h.element)), /* @__PURE__ */ a.createElement("div", { className: "mb-2 text-[color:rgb(var(--od-rgb-text),0.65)]" }, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.desc" }, "Two-Factor Authentication is required to add protection to your account from unauthorized access.")), /* @__PURE__ */ a.createElement("div", { className: "mb-10" }, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountPasswordSecurity.2fa.availableMethod" }, "Available authentication method:")), /* @__PURE__ */ a.createElement(
      ft,
      {
        onError: this.onError,
        onSuccess: this.onSuccess,
        enabledFactors: n,
        onUpdated: this.getEnabledFactor,
        setConfirmDialogData: this.setConfirmDialogInfo,
        closeConfirmDialog: this.closeConfirmDialog,
        isPreviewMode: u
      }
    ), /* @__PURE__ */ a.createElement(
      bt,
      {
        onSuccess: this.onSuccess,
        onError: this.onError,
        enabledFactors: n,
        onUpdated: this.getEnabledFactor,
        setConfirmDialogData: this.setConfirmDialogInfo,
        closeConfirmDialog: this.closeConfirmDialog,
        isPreviewMode: u
      }
    ), /* @__PURE__ */ a.createElement(
      vt,
      {
        onSuccess: this.onSuccess,
        onError: this.onError,
        enabledFactors: n,
        onUpdated: this.getEnabledFactor,
        setConfirmDialogData: this.setConfirmDialogInfo,
        closeConfirmDialog: this.closeConfirmDialog,
        isPreviewMode: u
      }
    ))), i && /* @__PURE__ */ a.createElement(wt, { ...i }));
  }
}
class Tt extends a.Component {
  constructor(h) {
    super(h), this.resetState = () => {
      this.setState({
        currentPassword: "",
        password: "",
        passwordConfirm: "",
        alert: null
      });
    }, this.onUpdateSuccess = () => {
      this.resetState(), this.notifyUpdateSuccess(), this.updateValidationObject();
    }, this.notifyUpdateSuccess = () => {
      this.setState({
        alert: {
          type: P.success,
          element: /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountChangePasswordPage.updateSuccess" }, "Password successfully updated.")
        }
      });
    }, this.notifyUpdateError = async (n) => {
      if (await this.inputValidationManager.isInputValidationError(n)) {
        $e.openValidationOutdatedModal(), this.resetState();
        return;
      }
      const i = we.extractServiceErrorCode(n);
      this.setState({
        alert: {
          type: P.danger,
          element: i ? /* @__PURE__ */ a.createElement(z, { error: n }) : /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountChangePasswordPage.updateError" }, "We are unable to process this request. Please try again.")
        }
      });
    }, this.getValidationObject = () => {
      const { currentPassword: n, password: i, passwordConfirm: u } = this.state, f = {
        match: !1,
        differentPassword: !1
      };
      return n && i && n !== i && (f.differentPassword = !0), i && u && i === u && (f.match = !0), f;
    }, this.updateValidationObject = () => {
      this.setState({
        passwordValidation: this.getValidationObject()
      });
    }, this.onCurrentPasswordChange = (n) => {
      const i = n.target.value;
      this.setState(
        {
          currentPassword: i
        },
        () => this.updateValidationObject()
      );
    }, this.onPasswordChange = (n) => {
      const i = n.target.value, { validations: u } = this.inputValidationManager.state;
      this.validation.set("password", pe.validatePassword(i, u)), this.setState(
        {
          password: i
        },
        () => this.updateValidationObject()
      );
    }, this.onPasswordConfirmChange = (n) => {
      const i = n.target.value;
      this.setState(
        {
          passwordConfirm: i
        },
        () => this.updateValidationObject()
      );
    }, this.onSubmit = async (n) => {
      n.preventDefault();
      const { currentPassword: i, password: u } = this.state;
      this.setState({ alert: null });
      try {
        await this.userAppManager.updatePassword(i, u, te()), this.onUpdateSuccess();
      } catch (f) {
        this.notifyUpdateError(f);
      }
    }, this.onReload = () => {
      this.setState({ alert: null }), this.inputValidationManager.fetchValidations(te()).catch((n) => this.notifyUpdateError(n));
    }, this.userAppManager = L.getAppState().getUserManager(), this.inputValidationManager = L.getAppState().getInputValidationManager(), this.state = {
      currentPassword: "",
      password: "",
      passwordConfirm: "",
      passwordValidation: {
        match: !1,
        differentPassword: !1
      },
      alert: null
    }, this.inputValidationManager.subscribe(() => this.setState({})), this.validation = new ge(), this.validation.listen(() => this.setState({}));
  }
  async componentDidMount() {
    this.props.isPreviewMode || this.inputValidationManager.state.validations.length === 0 && await this.inputValidationManager.fetchValidations(te());
  }
  isFieldValid() {
    const { currentPassword: h, password: n, passwordConfirm: i, passwordValidation: u } = this.state, f = !!h && !!n && !!i, l = Object.keys(u).reduce(
      (E, A) => E && u[A],
      !0
    );
    return f && l && this.validation.isAllValid();
  }
  render() {
    const { isUpdating: h } = this.userAppManager.state, { fetchError: n, isFetching: i, validations: u } = this.inputValidationManager.state, { alert: f, currentPassword: l, password: E, passwordConfirm: A } = this.state, p = this.props.isPreviewMode, w = p ? ot : u, y = Boolean(E && A && E !== A), v = Boolean(l && E && l === E), S = Boolean(E && !v && this.validation.get("password"));
    return /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(ye, { className: "accountChangePasswordPage" }, /* @__PURE__ */ a.createElement(Ce, null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountChangePasswordPage.title" }, "Change Password")), /* @__PURE__ */ a.createElement(Ae, { className: "w-full" }, !!f && /* @__PURE__ */ a.createElement("div", null, /* @__PURE__ */ a.createElement(T, { type: f.type, onDismiss: () => this.setState({ alert: null }) }, f.element), !!n && /* @__PURE__ */ a.createElement(N, { className: "btn btn-primary mt-4", onClick: this.onReload }, /* @__PURE__ */ a.createElement(m, { i18nKey: "Common.reload" }, "Reload"))), w.length <= 0 && i && /* @__PURE__ */ a.createElement(ve, { className: Ye.medium }), w.length > 0 && !n && /* @__PURE__ */ a.createElement("form", { onSubmit: this.onSubmit, className: "mt-4 w-full" }, /* @__PURE__ */ a.createElement("div", { className: "md:flex md:items-center" }, /* @__PURE__ */ a.createElement("div", { className: "md:w-2/3" }, /* @__PURE__ */ a.createElement("div", { className: "w-full" }, /* @__PURE__ */ a.createElement(se, null, /* @__PURE__ */ a.createElement(re, null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountChangePasswordPage.form.currentPasswordLabel" }, "Current password")), /* @__PURE__ */ a.createElement(ne, { className: "flex items-center" }, /* @__PURE__ */ a.createElement(q, { className: "w-full" }, /* @__PURE__ */ a.createElement(
      ae,
      {
        value: p ? oe : l,
        name: "currentPassword",
        placeholder: b("AccountChangePasswordPage.form.currentPasswordPlaceholder"),
        onChange: this.onCurrentPasswordChange,
        togglePassword: !0,
        readOnly: p
      }
    )))), /* @__PURE__ */ a.createElement(se, null, /* @__PURE__ */ a.createElement(re, null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountChangePasswordPage.form.newPasswordLabel" }, "New password")), /* @__PURE__ */ a.createElement(ne, { className: "flex items-center" }, /* @__PURE__ */ a.createElement(q, { className: "w-full" }, /* @__PURE__ */ a.createElement(
      ae,
      {
        value: p ? `${oe}new` : E,
        name: "password",
        onChange: this.onPasswordChange,
        togglePassword: !0,
        hasStrengthMeter: !v && !S && !!E,
        readOnly: p
      }
    ), v && /* @__PURE__ */ a.createElement(G, null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountChangePasswordPage.form.newPasswordLabelError" }, "Your new password cannot be the same as the previous one")), S && /* @__PURE__ */ a.createElement(G, null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountChangePasswordPage.form.newPasswordInvalid" }, "Please enter a valid password")), /* @__PURE__ */ a.createElement(
      Je,
      {
        descriptions: pe.getValidationDescription(
          Ze.enum.password,
          w
        )
      }
    )))), /* @__PURE__ */ a.createElement(se, null, /* @__PURE__ */ a.createElement(re, null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountChangePasswordPage.form.confirmPasswordLabel" }, "Confirm new password")), /* @__PURE__ */ a.createElement(ne, { className: "flex items-center" }, /* @__PURE__ */ a.createElement(q, { className: "w-full", hasError: y }, /* @__PURE__ */ a.createElement(
      ae,
      {
        value: p ? `${oe}new` : A,
        name: "passwordConfirm",
        onChange: this.onPasswordConfirmChange,
        togglePassword: !0,
        readOnly: p
      }
    ), y && /* @__PURE__ */ a.createElement(G, null, /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountChangePasswordPage.form.confirmPasswordLabelError" }, "The password that you entered does not match"))))))), /* @__PURE__ */ a.createElement("div", { className: "md:w-1/3" })), /* @__PURE__ */ a.createElement("div", { className: "border-gray-90 block border-t pt-6 text-right" }, /* @__PURE__ */ a.createElement("div", { className: "inline-block" }, /* @__PURE__ */ a.createElement(
      "button",
      {
        type: "submit",
        className: Q("btn btn-primary uppercase"),
        disabled: h || !this.isFieldValid()
      },
      h ? /* @__PURE__ */ a.createElement(et, { className: tt.inline }) : /* @__PURE__ */ a.createElement(m, { i18nKey: "AccountChangePasswordPage.form.updatePassword" }, "Update Password")
    )))))), /* @__PURE__ */ a.createElement(Et, { isPreviewMode: p }));
  }
}
export {
  Tt as default
};
