@it-enterprise/digital-signature 1.4.7 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -143,25 +143,25 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
143
143
  }), n.d(t, "EndUserCCSType", function() {
144
144
  return z;
145
145
  }), n.d(t, "EU_REVOCATION_REASON_UNKNOWN", function() {
146
- return U;
146
+ return ee;
147
147
  }), n.d(t, "EU_REVOCATION_REASON_KEY_COMPROMISE", function() {
148
- return W;
148
+ return U;
149
149
  }), n.d(t, "EU_REVOCATION_REASON_NEW_ISSUED", function() {
150
- return G;
150
+ return W;
151
151
  }), n.d(t, "EndUserRevocationReason", function() {
152
152
  return H;
153
153
  }), n.d(t, "EU_KEYS_TYPE_NONE", function() {
154
- return q;
154
+ return K;
155
155
  }), n.d(t, "EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_GOST", function() {
156
- return J;
156
+ return q;
157
157
  }), n.d(t, "EU_KEYS_TYPE_RSA_WITH_SHA", function() {
158
- return ee;
158
+ return J;
159
159
  }), n.d(t, "EU_KEYS_TYPE_ECDSA_WITH_SHA", function() {
160
160
  return te;
161
161
  }), n.d(t, "EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_DSTU", function() {
162
162
  return ne;
163
163
  }), n.d(t, "EndUserKeysType", function() {
164
- return K;
164
+ return G;
165
165
  }), n.d(t, "EU_KEYS_LENGTH_DS_UA_191", function() {
166
166
  return re;
167
167
  }), n.d(t, "EU_KEYS_LENGTH_DS_UA_257", function() {
@@ -407,14 +407,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
407
407
  (function(e) {
408
408
  e[e.Revoke = B] = "Revoke", e[e.Hold = V] = "Hold";
409
409
  })(z ||= {});
410
- var H, U = 0, W = 1, G = 2;
410
+ var H, ee = 0, U = 1, W = 2;
411
411
  (function(e) {
412
- e[e.Unknown = U] = "Unknown", e[e.KeyCompromise = W] = "KeyCompromise", e[e.NewIssued = G] = "NewIssued";
412
+ e[e.Unknown = ee] = "Unknown", e[e.KeyCompromise = U] = "KeyCompromise", e[e.NewIssued = W] = "NewIssued";
413
413
  })(H ||= {});
414
- var K, q = 0, J = 1, ee = 2, te = 4, ne = 8;
414
+ var G, K = 0, q = 1, J = 2, te = 4, ne = 8;
415
415
  (function(e) {
416
- e[e.None = q] = "None", e[e.DSTUAndECDHWithGOST = J] = "DSTUAndECDHWithGOST", e[e.RSAWithSHA = ee] = "RSAWithSHA", e[e.ECDSAWithSHA = te] = "ECDSAWithSHA", e[e.DSTUAndECDHWithDSTU = ne] = "DSTUAndECDHWithDSTU";
417
- })(K ||= {});
416
+ e[e.None = K] = "None", e[e.DSTUAndECDHWithGOST = q] = "DSTUAndECDHWithGOST", e[e.RSAWithSHA = J] = "RSAWithSHA", e[e.ECDSAWithSHA = te] = "ECDSAWithSHA", e[e.DSTUAndECDHWithDSTU = ne] = "DSTUAndECDHWithDSTU";
417
+ })(G ||= {});
418
418
  var Y, re = 1, ie = 2, X = 3, Z = 4, Q = 5;
419
419
  (function(e) {
420
420
  e[e.EC_191 = re] = "EC_191", e[e.EC_257 = ie] = "EC_257", e[e.EC_307 = X] = "EC_307", e[e.File = Z] = "File", e[e.Cert = Q] = "Cert";
@@ -574,21 +574,21 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
574
574
  }), n.d(t, "EU_ERROR_TSP_SERVER_CERT_INVALID", function() {
575
575
  return H;
576
576
  }), n.d(t, "EU_ERROR_GET_OCSP_STATUS", function() {
577
- return U;
577
+ return ee;
578
578
  }), n.d(t, "EU_ERROR_BAD_OCSP_RESPONSE", function() {
579
- return W;
579
+ return U;
580
580
  }), n.d(t, "EU_ERROR_CERT_BAD_BY_OCSP", function() {
581
- return G;
581
+ return W;
582
582
  }), n.d(t, "EU_ERROR_OCSP_SERVER_CERT_NOT_FOUND", function() {
583
- return K;
583
+ return G;
584
584
  }), n.d(t, "EU_ERROR_OCSP_SERVER_CERT_INVALID", function() {
585
- return q;
585
+ return K;
586
586
  }), n.d(t, "EU_ERROR_LDAP_ERROR", function() {
587
- return J;
587
+ return q;
588
588
  }), n.d(t, "EndUserError", function() {
589
- return ee;
589
+ return J;
590
590
  });
591
- var r = 0, i = 65535, a = 65534, o = 1, s = 2, c = 3, l = 4, u = 5, d = 6, f = 7, p = 8, m = 9, h = 10, g = 11, _ = 12, v = 13, y = 17, b = 18, x = 19, S = 20, C = 21, w = 22, T = 23, E = 24, D = 33, O = 34, k = 35, A = 36, j = 37, M = 49, N = 50, P = 51, F = 52, I = 53, L = 54, R = 55, z = 65, B = 66, V = 67, H = 68, U = 81, W = 82, G = 83, K = 84, q = 85, J = 97, ee = function() {};
591
+ var r = 0, i = 65535, a = 65534, o = 1, s = 2, c = 3, l = 4, u = 5, d = 6, f = 7, p = 8, m = 9, h = 10, g = 11, _ = 12, v = 13, y = 17, b = 18, x = 19, S = 20, C = 21, w = 22, T = 23, E = 24, D = 33, O = 34, k = 35, A = 36, j = 37, M = 49, N = 50, P = 51, F = 52, I = 53, L = 54, R = 55, z = 65, B = 66, V = 67, H = 68, ee = 81, U = 82, W = 83, G = 84, K = 85, q = 97, J = function() {};
592
592
  },
593
593
  function(e, t, n) {
594
594
  n.d(t, "a", function() {
@@ -2867,28 +2867,28 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
2867
2867
  }, H.prototype.SetRAAdminSN = function(e) {
2868
2868
  this.RAAdminSN = e;
2869
2869
  };
2870
- var U = function() {
2870
+ var ee = function() {
2871
2871
  this.setClassInfo("EndUserOperationContext", 1), this.fields = { handle: "string" }, this.initializeFields(), this.handle = null;
2872
2872
  };
2873
- h.makeTransferable(U), U.prototype.GetHandle = function() {
2873
+ h.makeTransferable(ee), ee.prototype.GetHandle = function() {
2874
2874
  return this.handle;
2875
2875
  };
2876
- var W = function() {
2876
+ var U = function() {
2877
2877
  this.setClassInfo("EndUserSession", 1), this.fields = {
2878
2878
  handle: "string",
2879
2879
  data: "byteArray"
2880
2880
  }, this.initializeFields();
2881
2881
  };
2882
- h.makeTransferable(W), W.prototype.GetHandle = function() {
2882
+ h.makeTransferable(U), U.prototype.GetHandle = function() {
2883
2883
  return this.handle;
2884
- }, W.prototype.SetHandle = function(e) {
2884
+ }, U.prototype.SetHandle = function(e) {
2885
2885
  this.handle = e;
2886
- }, W.prototype.GetData = function() {
2886
+ }, U.prototype.GetData = function() {
2887
2887
  return this.data;
2888
- }, W.prototype.SetData = function(e) {
2888
+ }, U.prototype.SetData = function(e) {
2889
2889
  this.data = e;
2890
2890
  };
2891
- var G = function() {
2891
+ var W = function() {
2892
2892
  this.setClassInfo("EndUserSCClientStatistic", 1), this.fields = {
2893
2893
  activeSessions: "number",
2894
2894
  gatedSessions: "number",
@@ -2896,33 +2896,33 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
2896
2896
  protectedData: "number"
2897
2897
  }, this.initializeFields();
2898
2898
  };
2899
- h.makeTransferable(G), G.prototype.GetActiveSessions = function() {
2899
+ h.makeTransferable(W), W.prototype.GetActiveSessions = function() {
2900
2900
  return this.activeSessions;
2901
- }, G.prototype.GetGatedSessions = function() {
2901
+ }, W.prototype.GetGatedSessions = function() {
2902
2902
  return this.gatedSessions;
2903
- }, G.prototype.GetUnprotectedData = function() {
2903
+ }, W.prototype.GetUnprotectedData = function() {
2904
2904
  return this.unprotectedData;
2905
- }, G.prototype.GetProtectedData = function() {
2905
+ }, W.prototype.GetProtectedData = function() {
2906
2906
  return this.protectedData;
2907
2907
  };
2908
- var K = function() {
2908
+ var G = function() {
2909
2909
  this.setClassInfo("EndUserDeviceContext", 1), this.fields = { handle: "string" }, this.initializeFields(), this.handle = null;
2910
2910
  };
2911
- h.makeTransferable(K), K.prototype.GetHandle = function() {
2911
+ h.makeTransferable(G), G.prototype.GetHandle = function() {
2912
2912
  return this.handle;
2913
2913
  };
2914
- var q = function() {
2914
+ var K = function() {
2915
2915
  this.setClassInfo("EndUserTransportHeader", 1), this.fields = {
2916
2916
  receiptNumber: "number",
2917
2917
  cryptoData: "byteArray"
2918
2918
  }, this.initializeFields();
2919
2919
  };
2920
- h.makeTransferable(q), q.prototype.GetReceiptNumber = function() {
2920
+ h.makeTransferable(K), K.prototype.GetReceiptNumber = function() {
2921
2921
  return this.receiptNumber;
2922
- }, q.prototype.GetCryptoData = function() {
2922
+ }, K.prototype.GetCryptoData = function() {
2923
2923
  return this.cryptoData;
2924
2924
  };
2925
- var J = function() {
2925
+ var q = function() {
2926
2926
  this.setClassInfo("EndUserCryptoHeader", 1), this.fields = {
2927
2927
  caType: "string",
2928
2928
  headerType: "number",
@@ -2930,19 +2930,19 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
2930
2930
  cryptoData: "byteArray"
2931
2931
  }, this.initializeFields();
2932
2932
  };
2933
- h.makeTransferable(J), J.prototype.GetCAType = function() {
2933
+ h.makeTransferable(q), q.prototype.GetCAType = function() {
2934
2934
  return this.caType;
2935
- }, J.prototype.GetHeaderType = function() {
2935
+ }, q.prototype.GetHeaderType = function() {
2936
2936
  return this.headerType;
2937
- }, J.prototype.GetHeaderSize = function() {
2937
+ }, q.prototype.GetHeaderSize = function() {
2938
2938
  return this.headerSize;
2939
- }, J.prototype.GetCryptoData = function() {
2939
+ }, q.prototype.GetCryptoData = function() {
2940
2940
  return this.cryptoData;
2941
2941
  };
2942
- var ee = function() {
2942
+ var J = function() {
2943
2943
  this.setClassInfo("EndUserContext", 1), this.fields = { handle: "string" }, this.initializeFields();
2944
2944
  };
2945
- h.makeTransferable(ee), ee.prototype.GetHandle = function() {
2945
+ h.makeTransferable(J), J.prototype.GetHandle = function() {
2946
2946
  return this.handle;
2947
2947
  };
2948
2948
  var te = function() {
@@ -4589,7 +4589,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
4589
4589
  return this.VerifyFileOnTime(e, n, t, r, i, a, o, s, c);
4590
4590
  }, $.prototype.ContinueSignCtx = function(e, t, n, r) {
4591
4591
  var i;
4592
- if (e ??= new U(), typeof t != "string" || (t = this._stringToBytes(t, r)) != null) return i = this._funcMakeParams([e, new g(t)]), this._funcCall("ContinueSignCtx", i, n, r, null);
4592
+ if (e ??= new ee(), typeof t != "string" || (t = this._stringToBytes(t, r)) != null) return i = this._funcMakeParams([e, new g(t)]), this._funcCall("ContinueSignCtx", i, n, r, null);
4593
4593
  }, $.prototype.ContinueSignCtxWithOffset = function(e, t, n, r, i, a) {
4594
4594
  return t = t.slice(n, n + r), this.ContinueSignCtx(e, t, i, a);
4595
4595
  }, $.prototype.EndSignCtx = function(e, t, n, r) {
@@ -4634,7 +4634,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
4634
4634
  ]), this._funcCall("SignRSAFile", a, r, i, null);
4635
4635
  }, $.prototype.ContinueRSASignCtx = function(e, t, n, r) {
4636
4636
  var i;
4637
- if (e ??= new U(), typeof t != "string" || (t = this._stringToBytes(t, r)) != null) return i = this._funcMakeParams([e, new g(t)]), this._funcCall("ContinueRSASignCtx", i, n, r, null);
4637
+ if (e ??= new ee(), typeof t != "string" || (t = this._stringToBytes(t, r)) != null) return i = this._funcMakeParams([e, new g(t)]), this._funcCall("ContinueRSASignCtx", i, n, r, null);
4638
4638
  }, $.prototype.ContinueRSASignCtxWithOffset = function(e, t, n, r, i, a) {
4639
4639
  return t = t.slice(n, n + r), this.ContinueRSASignCtx(t, i, a);
4640
4640
  }, $.prototype.EndRSASignCtx = function(e, t, n, r) {
@@ -5021,7 +5021,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
5021
5021
  var i;
5022
5022
  if (typeof e == "string" || (e = this._base64Encode(e, r)) != null) return i = this._funcMakeParams([e, t]), this._funcCall("UnprotectDataByPassword", i, n, r, null);
5023
5023
  }, $.prototype.CreateEndUserSession = function() {
5024
- return new W();
5024
+ return new U();
5025
5025
  }, $.prototype.SessionIsInitialized = function(e, t, n) {
5026
5026
  var r;
5027
5027
  return e.SetData(null), r = this._funcMakeParams([e]), this._funcCall("SessionIsInitialized", r, t, n, null);
@@ -5178,7 +5178,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
5178
5178
  n
5179
5179
  ]), this._funcCall("DevCtxOpen", a, r, i, null);
5180
5180
  }, $.prototype.CreateDeviceContext = function() {
5181
- return new K();
5181
+ return new G();
5182
5182
  }, $.prototype.DevCtxEnumVirtual = function(e, t, n) {
5183
5183
  var r, i = this;
5184
5184
  return r = this._funcMakeParams([e]), this._funcCall("DevCtxEnumVirtual", r, t, n, function(t, n, r) {
@@ -9576,6 +9576,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9576
9576
  ]);
9577
9577
  });
9578
9578
  })), d = /* @__PURE__ */ s({
9579
+ EndUserBase64Coder: () => j,
9580
+ EndUserUTF16LECoder: () => N,
9581
+ EndUserUTF8Coder: () => M,
9579
9582
  IS_DSTU_7564_DAY: () => k,
9580
9583
  arrayToBase64: () => _,
9581
9584
  arrayToString: () => b,
@@ -9636,7 +9639,7 @@ function p(e, t, n, r) {
9636
9639
  }
9637
9640
  function m(e) {
9638
9641
  let t = location.origin, n = location.pathname;
9639
- return e.indexOf("http://") === 0 || e.indexOf("https://") === 0 ? e : e.indexOf("/") === 0 && t ? t + e : t && n ? t + n.substr(0, n.lastIndexOf("/")) + "/" + e : e;
9642
+ return e.indexOf("http://") === 0 || e.indexOf("https://") === 0 ? e : e.indexOf("/") === 0 && t ? t + e : t && n ? t + n.substring(0, n.lastIndexOf("/")) + "/" + e : e;
9640
9643
  }
9641
9644
  function h(e) {
9642
9645
  let t = Array.prototype.slice.call(arguments, 1);
@@ -9653,28 +9656,16 @@ function g(e) {
9653
9656
  });
9654
9657
  }
9655
9658
  function _(e) {
9656
- let t = "", n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", r = new Uint8Array(e), i = r.length;
9657
- for (let e = 0; e < i; e += 3) t += n[r[e] >> 2], t += n[(r[e] & 3) << 4 | r[e + 1] >> 4], t += n[(r[e + 1] & 15) << 2 | r[e + 2] >> 6], t += n[r[e + 2] & 63];
9658
- return i % 3 == 2 ? t = t.substring(0, t.length - 1) + "=" : i % 3 == 1 && (t = t.substring(0, t.length - 2) + "=="), t;
9659
+ return typeof e.toBase64 == "function" ? e.toBase64() : new j().encode(e);
9659
9660
  }
9660
9661
  function v(e) {
9661
- let t = window.atob(e), n = t.length, r = new Uint8Array(new ArrayBuffer(n));
9662
- for (let e = 0; e < n; e++) r[e] = t.charCodeAt(e);
9663
- return r;
9662
+ return typeof Uint8Array.fromBase64 == "function" ? Uint8Array.fromBase64(e) : new j().decode(e);
9664
9663
  }
9665
9664
  function y(e) {
9666
- let t = unescape(encodeURIComponent(e)), n = [];
9667
- for (let e = 0; e < t.length; e++) n.push(t.charCodeAt(e));
9668
- return n;
9665
+ return new Uint8Array(new N().encode(e));
9669
9666
  }
9670
9667
  function b(e) {
9671
- let t = [], n = e.length;
9672
- n > 0 && e[n - 1] == 0 && --n;
9673
- for (let r = 0; r < n; r++) {
9674
- let n = e[r];
9675
- n > 255 && (n &= 255), t.push(String.fromCharCode(n));
9676
- }
9677
- return decodeURIComponent(escape(t.join("")));
9668
+ return new N().decode(e);
9678
9669
  }
9679
9670
  function x(e) {
9680
9671
  return _(y(e));
@@ -9758,9 +9749,151 @@ function A(e) {
9758
9749
  let t = e.getTimezoneOffset() * 6e4;
9759
9750
  return new Date(e.valueOf() - t).toISOString().slice(0, -1);
9760
9751
  }
9761
- //#endregion
9762
- //#region src/GlSign.js
9763
9752
  var j = class {
9753
+ constructor() {
9754
+ this.m_map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", this.m_codes = [
9755
+ 65,
9756
+ 66,
9757
+ 67,
9758
+ 68,
9759
+ 69,
9760
+ 70,
9761
+ 71,
9762
+ 72,
9763
+ 73,
9764
+ 74,
9765
+ 75,
9766
+ 76,
9767
+ 77,
9768
+ 78,
9769
+ 79,
9770
+ 80,
9771
+ 81,
9772
+ 82,
9773
+ 83,
9774
+ 84,
9775
+ 85,
9776
+ 86,
9777
+ 87,
9778
+ 88,
9779
+ 89,
9780
+ 90,
9781
+ 97,
9782
+ 98,
9783
+ 99,
9784
+ 100,
9785
+ 101,
9786
+ 102,
9787
+ 103,
9788
+ 104,
9789
+ 105,
9790
+ 106,
9791
+ 107,
9792
+ 108,
9793
+ 109,
9794
+ 110,
9795
+ 111,
9796
+ 112,
9797
+ 113,
9798
+ 114,
9799
+ 115,
9800
+ 116,
9801
+ 117,
9802
+ 118,
9803
+ 119,
9804
+ 120,
9805
+ 121,
9806
+ 122,
9807
+ 48,
9808
+ 49,
9809
+ 50,
9810
+ 51,
9811
+ 52,
9812
+ 53,
9813
+ 54,
9814
+ 55,
9815
+ 56,
9816
+ 57,
9817
+ 43,
9818
+ 47
9819
+ ];
9820
+ }
9821
+ _getTextDecoder() {
9822
+ try {
9823
+ if (typeof TextDecoder > "u") return null;
9824
+ let e = new TextDecoder("utf-8");
9825
+ return e.encoding == "utf-8" ? e : null;
9826
+ } catch {
9827
+ return null;
9828
+ }
9829
+ }
9830
+ _encodePart(e, t, n) {
9831
+ let r = [], i, a;
9832
+ for (let o = t; o < n; o += 3) i = e[o] << 16 | e[o + 1] << 8 | e[o + 2], a = this.m_map[i >> 18 & 63] + this.m_map[i >> 12 & 63] + this.m_map[i >> 6 & 63] + this.m_map[i & 63], r.push(a);
9833
+ return r.join("");
9834
+ }
9835
+ encode(e) {
9836
+ let t, n, r, i, a, o = "", s;
9837
+ if (t = typeof Uint8Array > "u" ? typeof EndUserUint8Array > "u" ? e.slice(0) : new EndUserUint8Array(e) : new Uint8Array(e), a = t.length, a == 0) return "";
9838
+ let c = this._getTextDecoder();
9839
+ if (c != null) {
9840
+ for (s = new Uint8Array(parseInt((a + 2) / 3) * 4), n = 0, r = 0; n < a - a % 3; n += 3, r += 4) i = t[n] << 16 | t[n + 1] << 8 | t[n + 2], s[r] = this.m_codes[i >> 18 & 63], s[r + 1] = this.m_codes[i >> 12 & 63], s[r + 2] = this.m_codes[i >> 6 & 63], s[r + 3] = this.m_codes[i & 63];
9841
+ switch (a % 3) {
9842
+ case 1:
9843
+ i = t[n] << 16, s[r] = this.m_codes[i >> 18 & 63], s[r + 1] = this.m_codes[i >> 12 & 63], s[r + 2] = 61, s[r + 3] = 61;
9844
+ break;
9845
+ case 2: i = t[n] << 16 | t[n + 1] << 8, s[r] = this.m_codes[i >> 18 & 63], s[r + 1] = this.m_codes[i >> 12 & 63], s[r + 2] = this.m_codes[i >> 6 & 63], s[r + 3] = 61;
9846
+ }
9847
+ o = c.decode(s);
9848
+ } else {
9849
+ let e = null, r = 15360, c = a - a % 3, l = parseInt(c / r), u;
9850
+ for (s = [], n = 0; n < l; n++) e = this._encodePart(t, n * r, n * r + r), s.push(e);
9851
+ switch (l * r < c && (e = this._encodePart(t, n * r, c), s.push(e)), a % 3) {
9852
+ case 1:
9853
+ i = t[a - 1] << 16, u = this.m_map[i >> 18 & 63], u += this.m_map[i >> 12 & 63], u += "=", u += "=", s.push(u);
9854
+ break;
9855
+ case 2: i = t[a - 2] << 16 | t[a - 1] << 8, u = this.m_map[i >> 18 & 63], u += this.m_map[i >> 12 & 63], u += this.m_map[i >> 6 & 63], u += "=", s.push(u);
9856
+ }
9857
+ o = s.join("");
9858
+ }
9859
+ return o;
9860
+ }
9861
+ decode(e) {
9862
+ let t, n, r, i, a, o, s, c, l, u, d;
9863
+ if (e == "" || (e.length & 3) > 0) return typeof Uint8Array > "u" ? typeof EndUserUint8Array > "u" ? [] : new EndUserUint8Array(0) : /* @__PURE__ */ new Uint8Array();
9864
+ for (o = e.length, s = e[o - 1] == "=" ? e[o - 2] == "=" ? 2 : 1 : 0, n = o / 4 * 3 - s, t = typeof Uint8Array > "u" ? typeof EndUserUint8Array > "u" ? [] : new EndUserUint8Array(n) : new Uint8Array(n), r = 0, i = 0, a = 0; r < Math.floor((o - s) / 4); r++) c = this.m_map.indexOf(e[i++]), l = this.m_map.indexOf(e[i++]), u = this.m_map.indexOf(e[i++]), d = this.m_map.indexOf(e[i++]), t[a++] = c << 2 | l >> 4, t[a++] = (l & 15) << 4 | u >> 2, t[a++] = (u & 3) << 6 | d & 63;
9865
+ switch (s) {
9866
+ case 2:
9867
+ c = this.m_map.indexOf(e[i]), l = this.m_map.indexOf(e[i + 1]), t[a++] = c << 2 | l >> 4;
9868
+ break;
9869
+ case 1: c = this.m_map.indexOf(e[i]), l = this.m_map.indexOf(e[i + 1]), u = this.m_map.indexOf(e[i + 2]), t[a++] = c << 2 | l >> 4, t[a++] = (l & 15) << 4 | u >> 2;
9870
+ }
9871
+ return t;
9872
+ }
9873
+ }, M = class {
9874
+ encode(e) {
9875
+ for (var t = [], n = 0, r = 0; r < e.length; r++) {
9876
+ var i = e.charCodeAt(r);
9877
+ i < 128 ? t[n++] = i : i < 2048 ? (t[n++] = i >> 6 | 192, t[n++] = i & 63 | 128) : (t[n++] = i >> 12 | 224, t[n++] = i >> 6 & 63 | 128, t[n++] = i & 63 | 128);
9878
+ }
9879
+ return t;
9880
+ }
9881
+ decode(e) {
9882
+ for (var t = [], n = 0, r = 0, i, a, o; n < e.length;) i = e[n++], i < 128 ? t[r++] = String.fromCharCode(i) : i > 191 && i < 224 ? (a = e[n++], t[r++] = String.fromCharCode((i & 31) << 6 | a & 63)) : (a = e[n++], o = e[n++], t[r++] = String.fromCharCode((i & 15) << 12 | (a & 63) << 6 | o & 63));
9883
+ return t.join("");
9884
+ }
9885
+ }, N = class {
9886
+ encode(e) {
9887
+ for (var t = [], n, r = 0; r < e.length; r++) n = e.charCodeAt(r), t.push(n & 255), t.push((n & 65280) >> 8);
9888
+ return t;
9889
+ }
9890
+ decode(e) {
9891
+ var t = 0, n = "", r;
9892
+ if (e.length % 2 != 0) return null;
9893
+ for (r = e.length, r > 0 && e[r - 2] == 0 && e[r - 1] == 0 && (r -= 2); t < r;) n += String.fromCharCode(e[t] | e[t + 1] << 8), t += 2;
9894
+ return n;
9895
+ }
9896
+ }, P = class {
9764
9897
  constructor(e) {
9765
9898
  e ||= "";
9766
9899
  let t = e.split(";");
@@ -9770,15 +9903,15 @@ var j = class {
9770
9903
  let r = this._getZoneValue(t, 24), i = this._getZoneValue(t, 25) === "+" || this._getZoneValue(t, 25) !== "-" && null;
9771
9904
  this.DirectAccess = i === !0 || i !== !1 && !this.ApplyProxySettings && !this.UseProxy, this.PreLoadClientLibraries = this._getZoneValue(t, 26) === "+";
9772
9905
  let a = parseInt(this._getZoneValue(t, 27));
9773
- if (this.WebClientFileSize = a < 5 ? 5 : a > 127 ? 127 : a, this.UseTSL = this._getZoneValue(t, 28) === "+", this.UmcaservicePort = this._getZoneValue(t, 29), !r) this.KSPs = J(this.AllowTestKeys);
9906
+ if (this.WebClientFileSize = a < 5 ? 5 : a > 127 ? 127 : a, this.UseTSL = this._getZoneValue(t, 28) === "+", this.UmcaservicePort = this._getZoneValue(t, 29), !r) this.KSPs = ne(this.AllowTestKeys);
9774
9907
  else {
9775
9908
  try {
9776
9909
  r = S(r), this.KSPs = JSON.parse(r);
9777
9910
  } catch (e) {
9778
9911
  console.error("error parsing KSPs from GlSign"), console.error(e);
9779
9912
  }
9780
- (!this.KSPs || this.KSPs.length === 0) && (this.KSPs = J(this.AllowTestKeys)), this.KSPs.forEach((e) => {
9781
- if (e.ksp === H.DIIA || e.ksp === H.IIT || e.ksp === H.PB || e.ksp === H.VTOKEN) {
9913
+ (!this.KSPs || this.KSPs.length === 0) && (this.KSPs = ne(this.AllowTestKeys)), this.KSPs.forEach((e) => {
9914
+ if (e.ksp === W.DIIA || e.ksp === W.IIT || e.ksp === W.PB || e.ksp === W.VTOKEN) {
9782
9915
  if (e.address.includes("cabinet.e-life.com.ua") || e.address.includes("sserver.amokey.com") || e.address.includes("smart-sign.dpsu.gov.ua") || e.address.includes("sign-ca.mvs.gov.ua") || e.address.includes("id.edin.ua") || e.address.includes("business.ukrsibbank.com")) return;
9783
9916
  (!Array.isArray(e.signAlgos) || e.signAlgos.length == 0) && (e.signAlgos = [f.EndUserConstants.EndUserSignAlgo.DSTU4145WithDSTU7564, f.EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311]);
9784
9917
  }
@@ -9794,46 +9927,46 @@ var j = class {
9794
9927
  let a = i.split(n);
9795
9928
  return this._getZoneValue(a, r);
9796
9929
  }
9797
- }, M = /* @__PURE__ */ s({
9798
- CertificatesProvider: () => L,
9799
- DefaultCertificatesProvider: () => R,
9800
- DefaultSettingProvider: () => P,
9801
- DigitalSignatureKeyType: () => V,
9930
+ }, F = /* @__PURE__ */ s({
9931
+ CertificatesProvider: () => B,
9932
+ DefaultCertificatesProvider: () => V,
9933
+ DefaultSettingProvider: () => L,
9934
+ DigitalSignatureKeyType: () => U,
9802
9935
  DigitalSignatureKeyTypeFile: () => 0,
9803
9936
  DigitalSignatureKeyTypeKSP: () => 2,
9804
9937
  DigitalSignatureKeyTypeToken: () => 1,
9805
9938
  DigitalSignatureKeyTypeUmCAService: () => 4,
9806
9939
  DigitalSignatureKeyTypeWindowsCertStore: () => 3,
9807
- DigitalSignatureLibraryType: () => B,
9940
+ DigitalSignatureLibraryType: () => ee,
9808
9941
  DigitalSignatureLibraryTypeJS: () => 0,
9809
9942
  DigitalSignatureLibraryTypeSW: () => 1,
9810
- DigitalSignatureSettings: () => N,
9943
+ DigitalSignatureSettings: () => I,
9811
9944
  EU_KSP_ClientIdType: () => -1,
9812
9945
  EU_KSP_DIIA: () => 7,
9813
9946
  EU_KSP_GRYADA: () => -1,
9814
9947
  EU_KSP_IIT: () => 4,
9815
9948
  EU_KSP_PB: () => 6,
9816
9949
  EU_KSP_VTOKEN: () => -2,
9817
- EndUserKSP: () => H,
9818
- EndUserKSPClientIdType: () => U,
9819
- FilePrivateKeyInfo: () => G,
9820
- HardwarePrivateKeyInfo: () => K,
9821
- KSPKeyMedia: () => te,
9822
- KSPKeyMediasResponse: () => ee,
9823
- KSPPrivateKeyAuthData: () => Y,
9824
- KSPUserAuthData: () => ne,
9825
- KspPrivateKeyInfo: () => q,
9826
- LegacyCertificatesProvider: () => z,
9827
- LegacySettingsProvider: () => I,
9828
- PrivateKeyInfo: () => W,
9829
- ProtectTaxReportParams: () => re,
9830
- WebserviceSettingProvider: () => F,
9831
- getDefaultKSPs: () => J
9832
- }), N = class {
9950
+ EndUserKSP: () => W,
9951
+ EndUserKSPClientIdType: () => G,
9952
+ FilePrivateKeyInfo: () => q,
9953
+ HardwarePrivateKeyInfo: () => J,
9954
+ KSPKeyMedia: () => re,
9955
+ KSPKeyMediasResponse: () => Y,
9956
+ KSPPrivateKeyAuthData: () => X,
9957
+ KSPUserAuthData: () => ie,
9958
+ KspPrivateKeyInfo: () => te,
9959
+ LegacyCertificatesProvider: () => H,
9960
+ LegacySettingsProvider: () => z,
9961
+ PrivateKeyInfo: () => K,
9962
+ ProtectTaxReportParams: () => Z,
9963
+ WebserviceSettingProvider: () => R,
9964
+ getDefaultKSPs: () => ne
9965
+ }), I = class {
9833
9966
  constructor(e, t, n, r, i) {
9834
9967
  this.language = e || "en", this.userId = t, this.httpProxyServiceURL = n, this.certificatesProvider = r, this.libraryUrl = i;
9835
9968
  }
9836
- }, P = class {
9969
+ }, L = class {
9837
9970
  constructor(e, t, n, r) {
9838
9971
  if (typeof n != "string") throw {
9839
9972
  code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
@@ -9842,17 +9975,17 @@ var j = class {
9842
9975
  n.endsWith("/") && (n = n.substring(0, n.length - 1)), this.language = e, this.userId = t, this.apiPath = n, this.workerPath = r;
9843
9976
  }
9844
9977
  async getGlSign() {
9845
- return new j(await p(this.apiPath + "/files?name=glsign", "string"));
9978
+ return new P(await p(this.apiPath + "/files?name=glsign", "string"));
9846
9979
  }
9847
9980
  async getSettings() {
9848
- return this._settings ||= new N(this.language, this.userId, this.apiPath + "/ProxyHandler", new R(this.apiPath + "/files?name=CAs.json", this.apiPath + "/files?name=CACertificates.p7b"), this.workerPath || "/euscp.worker.js"), this._settings;
9981
+ return this._settings ||= new I(this.language, this.userId, this.apiPath + "/ProxyHandler", new V(this.apiPath + "/files?name=CAs.json", this.apiPath + "/files?name=CACertificates.p7b"), this.workerPath || "/euscp.worker.js"), this._settings;
9849
9982
  }
9850
- }, F = class {
9983
+ }, R = class {
9851
9984
  constructor(e, t, n, r) {
9852
9985
  this.language = e, this.userId = t, this.apiPath = n, this.workerPath = r;
9853
9986
  }
9854
9987
  async getGlSign() {
9855
- return new j(await p(`${this.apiPath}/webservice.asmx/ExecuteEx?pureJSON=`, void 0, void 0, {
9988
+ return new P(await p(`${this.apiPath}/webservice.asmx/ExecuteEx?pureJSON=`, void 0, void 0, {
9856
9989
  calcId: "GETGLSIGNBEFORELOGIN",
9857
9990
  args: "",
9858
9991
  ticket: ""
@@ -9865,9 +9998,9 @@ var j = class {
9865
9998
  args: "",
9866
9999
  ticket: ""
9867
10000
  });
9868
- return this._settings = new N(this.language, this.userId, `${this.apiPath}/ProxyHandler`, new R(`${this.apiPath}/GetFile.ashx?file=${e.FILECAS}`, `${this.apiPath}/GetFile.ashx?file=${e.FILECERT}`), this.workerPath || "/euscp.worker.js"), this._settings;
10001
+ return this._settings = new I(this.language, this.userId, `${this.apiPath}/ProxyHandler`, new V(`${this.apiPath}/GetFile.ashx?file=${e.FILECAS}`, `${this.apiPath}/GetFile.ashx?file=${e.FILECERT}`), this.workerPath || "/euscp.worker.js"), this._settings;
9869
10002
  }
9870
- }, I = class {
10003
+ }, z = class {
9871
10004
  constructor(e, t, n, r, i) {
9872
10005
  if (typeof n != "string") throw {
9873
10006
  code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
@@ -9876,12 +10009,12 @@ var j = class {
9876
10009
  n.endsWith("/") && (n = n.substring(0, n.length - 1)), this.language = e, this.userId = t, this.basePath = n, this.glsign = r, this.workerPath = i;
9877
10010
  }
9878
10011
  getGlSign() {
9879
- return typeof this.glsign == "string" ? new j(this.glsign) : this.glsign;
10012
+ return typeof this.glsign == "string" ? new P(this.glsign) : this.glsign;
9880
10013
  }
9881
10014
  getSettings(e) {
9882
- return new N(this.language, this.userId, this.basePath + "/ProxyHandler.ashx", new z(e, this.basePath + "/Data/version.txt", this.basePath + (e ? "/Data/CAs.Test.json" : "/Data/CAs.json"), this.basePath + (e ? "/Data/CACertificates.Test.p7b" : "/Data/CACertificates.p7b")), this.workerPath || "/euscp.worker.js");
10015
+ return new I(this.language, this.userId, this.basePath + "/ProxyHandler.ashx", new H(e, this.basePath + "/Data/version.txt", this.basePath + (e ? "/Data/CAs.Test.json" : "/Data/CAs.json"), this.basePath + (e ? "/Data/CACertificates.Test.p7b" : "/Data/CACertificates.p7b")), this.workerPath || "/euscp.worker.js");
9883
10016
  }
9884
- }, L = class {
10017
+ }, B = class {
9885
10018
  constructor(e) {
9886
10019
  this.testMode = e;
9887
10020
  }
@@ -9903,7 +10036,7 @@ var j = class {
9903
10036
  _removeItem(e) {
9904
10037
  localStorage.removeItem(this._storagePrefix + e);
9905
10038
  }
9906
- }, R = class extends L {
10039
+ }, V = class extends B {
9907
10040
  constructor(e, t) {
9908
10041
  super(!1), this.CAsUri = e, this.CACertificatesUri = t;
9909
10042
  }
@@ -9921,7 +10054,7 @@ var j = class {
9921
10054
  };
9922
10055
  }
9923
10056
  }
9924
- }, z = class extends L {
10057
+ }, H = class extends B {
9925
10058
  constructor(e, t, n, r) {
9926
10059
  super(e), this.versionUri = t, this.CAsUri = n, this.CACertificatesUri = r;
9927
10060
  }
@@ -9950,28 +10083,28 @@ var j = class {
9950
10083
  };
9951
10084
  }
9952
10085
  }
9953
- }, B = {
10086
+ }, ee = {
9954
10087
  JS: 0,
9955
10088
  SW: 1
9956
- }, V = {
10089
+ }, U = {
9957
10090
  File: 0,
9958
10091
  Token: 1,
9959
10092
  KSP: 2,
9960
10093
  WindowsCertStore: 3,
9961
10094
  UmCAService: 4
9962
- }, H = {
10095
+ }, W = {
9963
10096
  IIT: 4,
9964
10097
  PB: 6,
9965
10098
  DIIA: 7,
9966
10099
  GRYADA: -1,
9967
10100
  VTOKEN: -2
9968
- }, U = {
10101
+ }, G = {
9969
10102
  Default: f.EndUserConstants.EndUserKSPClientIdType.Default,
9970
10103
  Name: f.EndUserConstants.EndUserKSPClientIdType.Name,
9971
10104
  Phone: f.EndUserConstants.EndUserKSPClientIdType.Phone,
9972
10105
  Email: f.EndUserConstants.EndUserKSPClientIdType.Email,
9973
10106
  NamePassword: -1
9974
- }, W = class {
10107
+ }, K = class {
9975
10108
  constructor(e, t, n, r, i) {
9976
10109
  this.keyType = e, this.ownerInfo = t, this.certificates = n, this.visibleName = r, this.id = i;
9977
10110
  }
@@ -10017,20 +10150,20 @@ var j = class {
10017
10150
  }
10018
10151
  return C(this.getSignAlgo());
10019
10152
  }
10020
- }, G = class extends W {
10153
+ }, q = class extends K {
10021
10154
  constructor(e, t, n, r, i) {
10022
10155
  super(e, t, n, n[0].infoEx.subjCN, n[0].infoEx.serial), this.privateKey = r, this.password = i;
10023
10156
  }
10024
- }, K = class extends W {
10157
+ }, J = class extends K {
10025
10158
  constructor(e, t, n, r) {
10026
10159
  super(e, t, n, n[0].infoEx.subjCN, n[0].infoEx.serial), this.keyMedia = r;
10027
10160
  }
10028
- }, q = class extends W {
10161
+ }, te = class extends K {
10029
10162
  constructor(e, t, n, r, i, a) {
10030
10163
  super(e, t, n, r, r), this.userId = r, this.ksp = i, this.keyId = a;
10031
10164
  }
10032
10165
  };
10033
- function J(e) {
10166
+ function ne(e) {
10034
10167
  let t = new f.KSPSettings();
10035
10168
  t.id = "DEPOSITSIGN", t.name = "DepositSign", t.ksp = f.EndUserConstants.EU_KSP_PB, t.address = "https://depositsign.com/api/v1/it-enterprise/sign-server", t.clientIdPrefix = "", t.directAccess = !0, t.needQRCode = !1;
10036
10169
  let n = new f.KSPSettings();
@@ -10046,25 +10179,25 @@ function J(e) {
10046
10179
  let s = new f.KSPSettings();
10047
10180
  s.id = "ESIGN", s.name = "ESign - хмарний підпис", s.ksp = f.EndUserConstants.EU_KSP_PB, s.address = "https://cabinet.e-life.com.ua/api/EDG/Sign", s.clientIdPrefix = "", s.directAccess = !0, s.needQRCode = !1;
10048
10181
  let c = new f.KSPSettings();
10049
- c.id = "SMARTSIGNTAX", c.name = "ДПС - хмарний підпис", c.ksp = f.EndUserConstants.EU_KSP_PB, c.address = "https://smart-sign.tax.gov.ua/", c.port = "443", c.directAccess = !0, c.clientIdType = U.Name, c.needQRCode = !1;
10182
+ c.id = "SMARTSIGNTAX", c.name = "ДПС - хмарний підпис", c.ksp = f.EndUserConstants.EU_KSP_PB, c.address = "https://smart-sign.tax.gov.ua/", c.port = "443", c.directAccess = !0, c.clientIdType = G.Name, c.needQRCode = !1;
10050
10183
  let l = new f.KSPSettings();
10051
10184
  l.id = "PUMB", l.name = "ПУМБ - хмарний підпис", l.ksp = f.EndUserConstants.EU_KSP_PB, l.address = "https://apiext.pumb.ua/hogsmeade/striga/v1", l.directAccess = !1, l.clientIdPrefix = "SMARTTENDER_", l.confirmationURL = "https://www.pumb.ua/qes", l.mobileAppName = "", l.needQRCode = !0;
10052
10185
  let u = new f.KSPSettings();
10053
- u.id = "UGB", u.name = "Укргазбанк - хмарний підпис «EcoSign»", u.ksp = H.VTOKEN, u.address = "https://vtms-api-qca.ukrgasbank.com/vtco/api/v1", u.systemId = "cihsmVtcoServiceClientSmartTender", u.directAccess = !0, u.clientIdType = U.NamePassword, u.needQRCode = !1;
10186
+ u.id = "UGB", u.name = "Укргазбанк - хмарний підпис «EcoSign»", u.ksp = W.VTOKEN, u.address = "https://vtms-api-qca.ukrgasbank.com/vtco/api/v1", u.systemId = "cihsmVtcoServiceClientSmartTender", u.directAccess = !0, u.clientIdType = G.NamePassword, u.needQRCode = !1;
10054
10187
  let d = new f.KSPSettings();
10055
- d.id = "ALLIANCE", d.name = "Банк Альянс - хмарний підпис", d.ksp = H.VTOKEN, d.address = "https://cihsm-api.bankalliance.ua/vtco/api/v1", d.systemId = "cihsmVtcoServiceClientSmartTender", d.directAccess = !0, d.clientIdType = U.NamePassword, d.needQRCode = !1;
10188
+ d.id = "ALLIANCE", d.name = "Банк Альянс - хмарний підпис", d.ksp = W.VTOKEN, d.address = "https://cihsm-api.bankalliance.ua/vtco/api/v1", d.systemId = "cihsmVtcoServiceClientSmartTender", d.directAccess = !0, d.clientIdType = G.NamePassword, d.needQRCode = !1;
10056
10189
  let p = new f.KSPSettings();
10057
- p.id = "VTOKEN", p.name = "Хмарний сервіс Шифр-vToken (тестовий)", p.ksp = H.VTOKEN, p.address = "https://cihsm-dev-api.cipher.com.ua/vtco/api/v1", p.systemId = "cipherVTokenIntegrationClient", p.directAccess = !0, p.clientIdType = U.NamePassword, p.needQRCode = !1;
10190
+ p.id = "VTOKEN", p.name = "Хмарний сервіс Шифр-vToken (тестовий)", p.ksp = W.VTOKEN, p.address = "https://cihsm-dev-api.cipher.com.ua/vtco/api/v1", p.systemId = "cipherVTokenIntegrationClient", p.directAccess = !0, p.clientIdType = G.NamePassword, p.needQRCode = !1;
10058
10191
  let m = new f.KSPSettings();
10059
- m.id = "AMOKEY", m.name = "АМО ФІНТЕХ – хмарний підпис AMOKEY", m.ksp = H.PB, m.address = "https://sserver.amokey.com", m.port = "443", m.clientIdPrefix = "", m.directAccess = !0, m.clientIdType = U.Name, m.needQRCode = !1;
10192
+ m.id = "AMOKEY", m.name = "АМО ФІНТЕХ – хмарний підпис AMOKEY", m.ksp = W.PB, m.address = "https://sserver.amokey.com", m.port = "443", m.clientIdPrefix = "", m.directAccess = !0, m.clientIdType = G.Name, m.needQRCode = !1;
10060
10193
  let h = new f.KSPSettings();
10061
- h.id = "TASCOMBANK", h.name = "Сервер підпису КНЕДП АТ \"ТАСКОМБАНК\"", h.ksp = H.PB, h.address = "https://smartsign.tascombank.ua", h.port = "443", h.clientIdPrefix = "", h.directAccess = !0, h.clientIdType = U.Name, h.needQRCode = !1;
10194
+ h.id = "TASCOMBANK", h.name = "Сервер підпису КНЕДП АТ \"ТАСКОМБАНК\"", h.ksp = W.PB, h.address = "https://smartsign.tascombank.ua", h.port = "443", h.clientIdPrefix = "", h.directAccess = !0, h.clientIdType = G.Name, h.needQRCode = !1;
10062
10195
  let g = new f.KSPSettings();
10063
- g.id = "EDINQR", g.name = "EDIN ID - хмарний підпис (QR)", g.ksp = H.PB, g.address = "https://id.edin.ua/api/ess/v1/", g.confirmationURL = "https://id.edin.ua/mobile/sign", g.port = "", g.clientIdPrefix = "EDIN_", g.directAccess = !0, g.mobileAppName = "edinid", g.needQRCode = !0;
10196
+ g.id = "EDINQR", g.name = "EDIN ID - хмарний підпис (QR)", g.ksp = W.PB, g.address = "https://id.edin.ua/api/ess/v1/", g.confirmationURL = "https://id.edin.ua/mobile/sign", g.port = "", g.clientIdPrefix = "EDIN_", g.directAccess = !0, g.mobileAppName = "edinid", g.needQRCode = !0;
10064
10197
  let _ = new f.KSPSettings();
10065
- _.id = "EDIN", _.name = "EDIN ID - хмарний підпис", _.ksp = H.PB, _.address = "https://id.edin.ua/api/ess/v1/", _.port = "", _.clientIdPrefix = "", _.directAccess = !0, _.clientIdType = U.Name, _.needQRCode = !1;
10198
+ _.id = "EDIN", _.name = "EDIN ID - хмарний підпис", _.ksp = W.PB, _.address = "https://id.edin.ua/api/ess/v1/", _.port = "", _.clientIdPrefix = "", _.directAccess = !0, _.clientIdType = G.Name, _.needQRCode = !1;
10066
10199
  let v = new f.KSPSettings();
10067
- v.id = "UKRSIBBANK", v.name = "УКРСИББАНК - хмарний підпис", v.ksp = H.PB, v.address = "https://business.ukrsibbank.com/morpheus/smart-sign/", v.confirmationURL = "https://business.ukrsibbank.com/smartsign", v.port = "", v.clientIdPrefix = "USB_", v.directAccess = !0, v.mobileAppName = "UKRSIB business", v.needQRCode = !0;
10200
+ v.id = "UKRSIBBANK", v.name = "УКРСИББАНК - хмарний підпис", v.ksp = W.PB, v.address = "https://business.ukrsibbank.com/morpheus/smart-sign/", v.confirmationURL = "https://business.ukrsibbank.com/smartsign", v.port = "", v.clientIdPrefix = "USB_", v.directAccess = !0, v.mobileAppName = "UKRSIB business", v.needQRCode = !0;
10068
10201
  let y = [
10069
10202
  t,
10070
10203
  n,
@@ -10085,27 +10218,27 @@ function J(e) {
10085
10218
  ];
10086
10219
  return e && y.push(p), y;
10087
10220
  }
10088
- var ee = class {
10221
+ var Y = class {
10089
10222
  constructor(e, t, n) {
10090
10223
  this.token = e, this.isTwoFactor = t, this.keys = n;
10091
10224
  }
10092
- }, te = class {
10225
+ }, re = class {
10093
10226
  constructor(e, t, n, r, i) {
10094
10227
  this.keyId = e, this.visibleName = t, this.subject = n, this.issuer = r, this.isStamp = i;
10095
10228
  }
10096
- }, ne = class {
10229
+ }, ie = class {
10097
10230
  constructor(e, t) {
10098
10231
  this.userName = e, this.password = t;
10099
10232
  }
10100
- }, Y = class {
10233
+ }, X = class {
10101
10234
  constructor(e, t, n) {
10102
10235
  this.pin = e, this.token = t, this.twoFactorCode = n;
10103
10236
  }
10104
- }, re = class {
10237
+ }, Z = class {
10105
10238
  constructor(e, t, n, r, i, a, o) {
10106
10239
  this.accountantPrivateKeyContext = e, this.directorPrivateKeyContext = t, this.stampPrivateKeyContext = n, this.senderEMail = r, this.recipientCertificate = i, this.reports = a, this.returnIntermediateSign = o;
10107
10240
  }
10108
- }, ie = class {
10241
+ }, Q = class {
10109
10242
  constructor(e) {
10110
10243
  e ||= "25989", typeof e != "string" && (e = String(e)), this.baseUrl = `https://localhost:${e.trim()}/`;
10111
10244
  }
@@ -10143,10 +10276,10 @@ var ee = class {
10143
10276
  Array.isArray(t) ? t = [...t] : (a = !1, t = [t]);
10144
10277
  for (let e = 0; e < t.length; e++) {
10145
10278
  let n = t[e];
10146
- n.val ? t[e] = {
10279
+ n.val ? (typeof n.val == "string" && (n.val = x(n.val)), t[e] = {
10147
10280
  name: n.name,
10148
- val: X(n.val, !0)
10149
- } : t[e] = X(n, !0);
10281
+ val: $(n.val, !0)
10282
+ }) : (typeof n == "string" && (n = x(n)), t[e] = $(n, !0));
10150
10283
  }
10151
10284
  let o = [];
10152
10285
  for (let n of t) {
@@ -10180,12 +10313,12 @@ var ee = class {
10180
10313
  let t = o[e];
10181
10314
  t.val ? o[e] = {
10182
10315
  name: t.name,
10183
- val: X(t.val, !r)
10184
- } : o[e] = X(t, !r);
10316
+ val: $(t.val, !r)
10317
+ } : o[e] = $(t, !r);
10185
10318
  }
10186
10319
  return a ? o : o[0];
10187
10320
  }
10188
- }, X = (e, t) => t && typeof e != "string" ? _(e) : !t && typeof e == "string" ? v(e) : e, Z = {
10321
+ }, $ = (e, t) => t && typeof e != "string" ? _(e) : !t && typeof e == "string" ? v(e) : e, ae = {
10189
10322
  uk: {
10190
10323
  LibraryNotSupported: "Бібліотека web-підпису не підтримується в вашому браузері або ОС.",
10191
10324
  LibraryNeedsInstall: "Бібліотека web-підпису не запущена або потребує встановлення. Будь ласка, запустіть або встановіть бібліотеку за посиланням та оновіть сторінку.",
@@ -10261,9 +10394,9 @@ var ee = class {
10261
10394
  UmCAServiceConnectError: "Unable to connect to UmCAService. Check if the service is running. If using a non-standard port, specify it in the global parameter GlSign.",
10262
10395
  UmCAServiceWrongPassword: "Wrong password"
10263
10396
  }
10264
- }, Q = "PKType", $ = "PKInfo", ae = class {
10397
+ }, oe = "PKType", se = "PKInfo", ce = class {
10265
10398
  constructor(e) {
10266
- this._settingsProvider = e, this._glSign = null, this._settings = null, this._euSignFile, this._euSignKeyMedia, this._euSign = null, this._selectedCA = null, this._KSPs = [], this._readedKey = null;
10399
+ this._settingsProvider = e, this._glSign = null, this._settings = null, this._euSignFile, this._euSignKeyMedia, this._euSign = null, this._selectedCA = null, this._KSPs = [], this._readedKey = null, this._isInitializing = !1, this._initializationPromise = Promise.resolve(U.File);
10267
10400
  }
10268
10401
  get readedKey() {
10269
10402
  return this._readedKey;
@@ -10276,11 +10409,11 @@ var ee = class {
10276
10409
  }
10277
10410
  async setLibraryType(e) {
10278
10411
  switch (e) {
10279
- case V.Token:
10412
+ case U.Token:
10280
10413
  if (this._euSign === this._euSignKeyMedia && await this._euSign.IsInitialized()) return;
10281
10414
  this._euSign = this._euSignKeyMedia;
10282
10415
  break;
10283
- case V.UmCAService:
10416
+ case U.UmCAService:
10284
10417
  this._euSign = this._euSignFile;
10285
10418
  break;
10286
10419
  default:
@@ -10289,12 +10422,27 @@ var ee = class {
10289
10422
  }
10290
10423
  e != null && e != null && (this._preferredKeyType = e), this.keyType = e, await this.initialise();
10291
10424
  }
10292
- async initialise() {
10293
- if (this._glSign ||= await Promise.resolve(this._settingsProvider.getGlSign()), this._settings ||= await Promise.resolve(this._settingsProvider.getSettings(this._glSign.AllowTestKeys)), this._euSignFile ||= new f.EndUser(this._settings.libraryUrl, f.EndUserConstants.EndUserLibraryType.JS, this._glSign.WebClientFileSize), this._euSignKeyMedia ||= new f.EndUser(this._settings.libraryUrl, f.EndUserConstants.EndUserLibraryType.SW, this._glSign.WebClientFileSize), this._euSign || (this._euSign = this._glSign.PreferHarware ? this._euSignKeyMedia : this._euSignFile, this.keyType = this._glSign.PreferHarware ? V.Token : this._preferredKeyType), this.keyType === V.UmCAService && (this.UmCAService ||= new ie(this.glSign.UmcaservicePort), !await this.UmCAService.tryConnect())) throw {
10425
+ initialise() {
10426
+ return this.initialize();
10427
+ }
10428
+ initialize() {
10429
+ return this._isInitializing ? this._initializationPromise : (this._isInitializing = !0, this._initializationPromise = new Promise(async (e, t) => {
10430
+ try {
10431
+ e(await this._initialize());
10432
+ } catch (e) {
10433
+ t(e);
10434
+ } finally {
10435
+ this._isInitializing = !1;
10436
+ }
10437
+ }), this._initializationPromise);
10438
+ }
10439
+ async _initialize() {
10440
+ if (this._glSign ||= await Promise.resolve(this._settingsProvider.getGlSign()), this._settings ||= await Promise.resolve(this._settingsProvider.getSettings(this._glSign.AllowTestKeys)), this._euSignFile ||= new f.EndUser(this._settings.libraryUrl, f.EndUserConstants.EndUserLibraryType.JS, this._glSign.WebClientFileSize), this._euSignKeyMedia ||= new f.EndUser(this._settings.libraryUrl, f.EndUserConstants.EndUserLibraryType.SW, this._glSign.WebClientFileSize), this._euSign || (this._euSign = this._glSign.PreferHarware ? this._euSignKeyMedia : this._euSignFile, this.keyType = this._glSign.PreferHarware ? U.Token : this._preferredKeyType), this.keyType === U.UmCAService && (this.UmCAService ||= new Q(this.glSign.UmcaservicePort), !await this.UmCAService.tryConnect())) throw {
10294
10441
  code: f.EndUserError.EU_ERROR_LIBRARY_LOAD,
10295
10442
  message: this._resourses.UmCAServiceConnectError
10296
10443
  };
10297
10444
  let e = this._euSign;
10445
+ if (await e.IsInitialized()) return this.getLibraryType();
10298
10446
  if (e === this._euSignKeyMedia) {
10299
10447
  let t = await e.GetLibraryInfo();
10300
10448
  if (!t.supported) throw {
@@ -10336,7 +10484,6 @@ var ee = class {
10336
10484
  }]
10337
10485
  };
10338
10486
  }
10339
- if (await e.IsInitialized()) return this.getLibraryType();
10340
10487
  if (!this._euSettings) {
10341
10488
  let e;
10342
10489
  try {
@@ -10391,12 +10538,12 @@ var ee = class {
10391
10538
  await this._euSignFile.SetLanguage(e), await this._euSignKeyMedia.IsInitialized() && await this._euSignKeyMedia.SetLanguage(e);
10392
10539
  }
10393
10540
  async parseCertificate(e) {
10394
- await this.setLibraryType(V.File), typeof e == "string" && (e = v(e));
10541
+ await this.setLibraryType(U.File), typeof e == "string" && (e = v(e));
10395
10542
  let t = new f.EndUserCertificate();
10396
10543
  return t.data = e, t.infoEx = await this._euSign.m_library.m_worker.postMessage("ParseCertificateEx", [e]), t;
10397
10544
  }
10398
10545
  async getKeyMedias() {
10399
- return await this.setLibraryType(V.Token), this._euSignKeyMedia.GetKeyMedias();
10546
+ return await this.setLibraryType(U.Token), this._euSignKeyMedia.GetKeyMedias();
10400
10547
  }
10401
10548
  async readPrivateKeyByInfo(e) {
10402
10549
  if (!e) throw {
@@ -10404,16 +10551,16 @@ var ee = class {
10404
10551
  message: this._resourses.BadParameter + " keyInfo"
10405
10552
  };
10406
10553
  switch (await this.setLibraryType(e.keyType), e.keyType) {
10407
- case V.File: return await this.readFileKey(e.privateKey, e.password, e.certificates);
10408
- case V.Token: return await this.readHardwareKey(e.keyMedia, e.certificates);
10409
- case V.KSP: return await this.readPrivateKeyKSP(e.ksp, e.userId, !1, e.keyId);
10410
- case V.UmCAService: return await this.readPrivateKeyUmCAService(e.keyMedia);
10411
- case V.WindowsCertStore: return await this.readWindowsCertStorePrivateKey();
10554
+ case U.File: return await this.readFileKey(e.privateKey, e.password, e.certificates);
10555
+ case U.Token: return await this.readHardwareKey(e.keyMedia, e.certificates);
10556
+ case U.KSP: return await this.readPrivateKeyKSP(e.ksp, e.userId, !1, e.keyId);
10557
+ case U.UmCAService: return await this.readPrivateKeyUmCAService(e.keyMedia);
10558
+ case U.WindowsCertStore: return await this.readWindowsCertStorePrivateKey();
10412
10559
  default: return null;
10413
10560
  }
10414
10561
  }
10415
10562
  async readHardwareKey(e, t) {
10416
- if (await this.setLibraryType(V.Token), !e) throw {
10563
+ if (await this.setLibraryType(U.Token), !e) throw {
10417
10564
  code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
10418
10565
  message: this._resourses.BadParameter + " keyMedia"
10419
10566
  };
@@ -10424,7 +10571,7 @@ var ee = class {
10424
10571
  t = Array.isArray(t) && t.length > 0 ? await Promise.all(t.map((e) => e instanceof File || e instanceof Blob ? g(e) : e instanceof f.EndUserCertificate ? e.data : e)) : null;
10425
10572
  try {
10426
10573
  let n = await this._euSign.ReadPrivateKey(e, t, this._selectedIssuerCN);
10427
- return this._readedKey = new K(V.Token, n, await this._euSign.GetOwnCertificates(), e), this._readedKey._glSign = this._glSign, this._readedKey;
10574
+ return this._readedKey = new J(U.Token, n, await this._euSign.GetOwnCertificates(), e), this._readedKey._glSign = this._glSign, this._readedKey;
10428
10575
  } catch (e) {
10429
10576
  if (e && e.code === f.EndUserError.EU_ERROR_CERT_NOT_FOUND) {
10430
10577
  if (!this._selectedIssuerCN) throw {
@@ -10443,7 +10590,7 @@ var ee = class {
10443
10590
  }
10444
10591
  }
10445
10592
  async readFileKey(e, t, n) {
10446
- if (await this.setLibraryType(V.File), !e) throw {
10593
+ if (await this.setLibraryType(U.File), !e) throw {
10447
10594
  code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
10448
10595
  message: this._resourses.BadParameter + " keyMedia"
10449
10596
  };
@@ -10453,8 +10600,17 @@ var ee = class {
10453
10600
  };
10454
10601
  (e instanceof File || e instanceof Blob) && (e = await g(e)), n = Array.isArray(n) && n.length > 0 ? await Promise.all(n.map((e) => e instanceof File || e instanceof Blob ? g(e) : e instanceof f.EndUserCertificate ? e.data : e)) : null;
10455
10602
  try {
10456
- let r = await this._euSign.ReadPrivateKeyBinary(e, t, n, this._selectedIssuerCN);
10457
- return this._readedKey = new G(V.File, r, await this._euSign.GetOwnCertificates(), e, t), this._readedKey._glSign = this._glSign, this._readedKey;
10603
+ let r;
10604
+ try {
10605
+ r = await this._euSign.ReadPrivateKeyBinary(e, t, n, this._selectedIssuerCN);
10606
+ } catch (n) {
10607
+ if (n && n.code === f.EndUserError.EU_ERROR_CERT_BAD_BY_OCSP) {
10608
+ let { certs: n } = await this._searchPrivateKeyCertificatesWithCMP_JS(e, t, this._selectedIssuerCN);
10609
+ r = await this._euSign.ReadPrivateKeyBinary(e, t, n, this._selectedIssuerCN);
10610
+ } else throw n;
10611
+ }
10612
+ let i = await this._euSign.GetOwnCertificates();
10613
+ return this._readedKey = new q(U.File, r, i, e, t), this._readedKey._glSign = this._glSign, this._readedKey;
10458
10614
  } catch (e) {
10459
10615
  if (e && e.code === f.EndUserError.EU_ERROR_CERT_NOT_FOUND) {
10460
10616
  if (!this._selectedIssuerCN) throw {
@@ -10473,11 +10629,18 @@ var ee = class {
10473
10629
  }
10474
10630
  }
10475
10631
  async getJKSPrivateKeys(e) {
10476
- return await this.setLibraryType(V.File), (e instanceof File || e instanceof Blob) && (e = await g(e)), await this._euSign.GetJKSPrivateKeys(e);
10632
+ return await this.setLibraryType(U.File), (e instanceof File || e instanceof Blob) && (e = await g(e)), await this._euSign.GetJKSPrivateKeys(e);
10477
10633
  }
10478
10634
  isJKSContainer(e) {
10479
10635
  return e.name.endsWith(".jks");
10480
10636
  }
10637
+ async _searchPrivateKeyCertificatesWithCMP_JS(e, t, n) {
10638
+ return await this._euSignFile.m_library.m_worker.postMessage("CallSearchPrivateKeyCertificatesWithCMP", [
10639
+ e,
10640
+ t,
10641
+ n
10642
+ ]);
10643
+ }
10481
10644
  async readPrivateKeyDepositsign(e, t = !1) {
10482
10645
  let n = this.KSPs.find((e) => e.id === "DEPOSITSIGN");
10483
10646
  return await this.readPrivateKeyKSP(n, e, t);
@@ -10487,19 +10650,19 @@ var ee = class {
10487
10650
  return await this.readPrivateKeyKSP(t, null, e);
10488
10651
  }
10489
10652
  async readPrivateKeyKSP(e, t, n = !1, r, i, a) {
10490
- await this.setLibraryType(V.KSP), e.ksp === f.EndUserConstants.EU_KSP_DIIA && await this._diiaCheckAccess(e), a = Array.isArray(a) && a.length > 0 ? await Promise.all(a.map((e) => e instanceof File || e instanceof Blob ? g(e) : e instanceof f.EndUserCertificate ? e.data : e)) : null;
10653
+ await this.setLibraryType(U.KSP), e.ksp === f.EndUserConstants.EU_KSP_DIIA && await this._diiaCheckAccess(e), a = Array.isArray(a) && a.length > 0 ? await Promise.all(a.map((e) => e instanceof File || e instanceof Blob ? g(e) : e instanceof f.EndUserCertificate ? e.data : e)) : null;
10491
10654
  let o = await this._euSign.ReadPrivateKeyKSP(t, e.name, n, r, null, i, a);
10492
10655
  if ((n || a) && !o) throw {
10493
10656
  code: f.EndUserError.EU_ERROR_KEY_MEDIAS_READ_FAILED,
10494
10657
  message: this._resourses.PrivateKeyNotReaded
10495
10658
  };
10496
- return this._readedKey = new q(V.KSP, o, n || a ? await this._euSign.GetOwnCertificates() : [], t, e, r), this._readedKey._glSign = this._glSign, this._readedKey;
10659
+ return this._readedKey = new te(U.KSP, o, n || a ? await this._euSign.GetOwnCertificates() : [], t, e, r), this._readedKey._glSign = this._glSign, this._readedKey;
10497
10660
  }
10498
10661
  async getKeyMediasKSP(e, t) {
10499
- return await this.setLibraryType(V.KSP), this._euSign.m_library.m_worker.postMessage("GetKeyMediasKSP", [e, t]);
10662
+ return await this.setLibraryType(U.KSP), this._euSign.m_library.m_worker.postMessage("GetKeyMediasKSP", [e, t]);
10500
10663
  }
10501
10664
  async setTwoFactorCodeKSP(e) {
10502
- return await this.setLibraryType(V.KSP), this._euSign.m_library.m_worker.postMessage("SetTwoFactorCodeKSP", [e]);
10665
+ return await this.setLibraryType(U.KSP), this._euSign.m_library.m_worker.postMessage("SetTwoFactorCodeKSP", [e]);
10503
10666
  }
10504
10667
  async addConfirmKSPOperationEventListener(e) {
10505
10668
  await this._euSignFile.AddEventListener(f.EndUserConstants.EndUserEventType.ConfirmKSPOperation, function(t) {
@@ -10507,7 +10670,7 @@ var ee = class {
10507
10670
  });
10508
10671
  }
10509
10672
  async readPrivateKeyUmCAService(e) {
10510
- await this.setLibraryType(V.UmCAService);
10673
+ await this.setLibraryType(U.UmCAService);
10511
10674
  let t = [];
10512
10675
  for (let n of e.certificates) {
10513
10676
  let e = await this.parseCertificate(n);
@@ -10517,7 +10680,7 @@ var ee = class {
10517
10680
  let n = new f.EndUserSignContainerInfo();
10518
10681
  n.type = f.EndUserConstants.EndUserSignContainerType.CAdES, n.subType = f.EndUserConstants.EndUserCAdESType.Enveloped, n.signLevel = f.EndUserConstants.EndUserSignType.CAdES_BES;
10519
10682
  let r = await this.UmCAService.signData(e, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=", n), i = await this._euSignFile.VerifyDataInternal(r);
10520
- return this._readedKey = new W(V.UmCAService, i[0].ownerInfo, t, e.visibleName, e.alias), this._readedKey.glSign = this.glSign, this._readedKey.keyMedia = e, this._readedKey;
10683
+ return this._readedKey = new K(U.UmCAService, i[0].ownerInfo, t, e.visibleName, e.alias), this._readedKey.glSign = this.glSign, this._readedKey.keyMedia = e, this._readedKey;
10521
10684
  } catch (e) {
10522
10685
  throw e.message && e.message == "KeyStoreException: KSE_INVALID_PASSWORD" ? {
10523
10686
  code: f.EndUserError.EU_ERROR_BAD_PRIVATE_KEY,
@@ -10526,10 +10689,10 @@ var ee = class {
10526
10689
  }
10527
10690
  }
10528
10691
  async getKeyMediasUmCAService() {
10529
- return await this.setLibraryType(V.UmCAService), this.UmCAService.getKeys();
10692
+ return await this.setLibraryType(U.UmCAService), this.UmCAService.getKeys();
10530
10693
  }
10531
10694
  async readWindowsCertStorePrivateKey() {
10532
- await this.setLibraryType(V.File);
10695
+ await this.setLibraryType(U.File);
10533
10696
  let e;
10534
10697
  try {
10535
10698
  e = await SignerDigital.getSelectedCertificate();
@@ -10541,14 +10704,14 @@ var ee = class {
10541
10704
  }
10542
10705
  e = JSON.parse(e);
10543
10706
  let t = await this.parseCertificate(e.Cert);
10544
- return this._readedKey = new W(V.WindowsCertStore, t.infoEx, [t], t.infoEx.subjCN, e.CertThumbPrint), this._readedKey._glSign = this._glSign, this._readedKey;
10707
+ return this._readedKey = new K(U.WindowsCertStore, t.infoEx, [t], t.infoEx.subjCN, e.CertThumbPrint), this._readedKey._glSign = this._glSign, this._readedKey;
10545
10708
  }
10546
10709
  get KSPs() {
10547
10710
  return this._glSign.KSPs;
10548
10711
  }
10549
10712
  async isPrivateKeyReaded() {
10550
10713
  if (!this._readedKey) return !1;
10551
- if (this._readedKey.keyType === V.WindowsCertStore || this._readedKey.keyType === V.UmCAService) return !0;
10714
+ if (this._readedKey.keyType === U.WindowsCertStore || this._readedKey.keyType === U.UmCAService) return !0;
10552
10715
  try {
10553
10716
  return await this._euSign.IsPrivateKeyReaded();
10554
10717
  } catch {
@@ -10571,29 +10734,29 @@ var ee = class {
10571
10734
  return this._selectedCA && !this._selectedCA.cmpAddress;
10572
10735
  }
10573
10736
  async signData(e, t, n) {
10574
- if (t === !0 ? (t = new f.EndUserSignContainerInfo(), t.type = f.EndUserConstants.EndUserSignContainerType.CAdES, t.subType = f.EndUserConstants.EndUserCAdESType.Enveloped, t.signLevel = f.EndUserConstants.EndUserSignType.CAdES_X_Long) : O(t) && (t = new f.EndUserSignContainerInfo(), t.type = f.EndUserConstants.EndUserSignContainerType.CAdES, t.subType = f.EndUserConstants.EndUserCAdESType.Detached, t.signLevel = f.EndUserConstants.EndUserSignType.CAdES_X_Long), typeof n != "boolean" && (n = !1), this.readedKey.keyType === V.KSP) {
10737
+ if (t === !0 ? (t = new f.EndUserSignContainerInfo(), t.type = f.EndUserConstants.EndUserSignContainerType.CAdES, t.subType = f.EndUserConstants.EndUserCAdESType.Enveloped, t.signLevel = f.EndUserConstants.EndUserSignType.CAdES_X_Long) : O(t) && (t = new f.EndUserSignContainerInfo(), t.type = f.EndUserConstants.EndUserSignContainerType.CAdES, t.subType = f.EndUserConstants.EndUserCAdESType.Detached, t.signLevel = f.EndUserConstants.EndUserSignType.CAdES_X_Long), typeof n != "boolean" && (n = !1), this.readedKey.keyType === U.KSP) {
10575
10738
  if (t.type !== f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES && t.type !== f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES) throw {
10576
10739
  code: f.EndUserError.EU_ERROR_NOT_SUPPORTED,
10577
10740
  message: this._resourses.KSPSignFormatError
10578
10741
  };
10579
- if (t.type === f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES && (typeof this.readedKey.ksp == "object" ? this.readedKey.ksp.ksp : this.readedKey.ksp) != H.GRYADA) throw {
10742
+ if (t.type === f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES && (typeof this.readedKey.ksp == "object" ? this.readedKey.ksp.ksp : this.readedKey.ksp) != W.GRYADA) throw {
10580
10743
  code: f.EndUserError.EU_ERROR_NOT_SUPPORTED,
10581
10744
  message: this._resourses.KSPSignPAdESError
10582
10745
  };
10583
10746
  }
10584
- if (this.readedKey.keyType === V.WindowsCertStore) {
10747
+ if (this.readedKey.keyType === U.WindowsCertStore) {
10585
10748
  if (t.type !== f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES) throw {
10586
10749
  code: f.EndUserError.EU_ERROR_NOT_SUPPORTED,
10587
10750
  message: this._resourses.KSPSignFormatError
10588
10751
  };
10589
- let r = await this._euSign.HashData(this._readedKey.getHashAlgo(), e, !n), i = await this._signHashWindowsCertificateStore(r, t, n);
10752
+ let r = await this._euSign.HashData(this._readedKey.getHashAlgo(), e, !0), i = await this._signHashWindowsCertificateStore(r, t, n);
10590
10753
  return this._euSign.m_library.m_worker.postMessage("AppendDataToSignedData", [
10591
10754
  i,
10592
10755
  e,
10593
10756
  !n
10594
10757
  ]);
10595
10758
  }
10596
- if (this.readedKey.keyType === V.UmCAService) {
10759
+ if (this.readedKey.keyType === U.UmCAService) {
10597
10760
  if (t.type !== f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES && t.type !== f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES) throw {
10598
10761
  code: f.EndUserError.EU_ERROR_NOT_SUPPORTED,
10599
10762
  message: this._resourses.KSPSignFormatError
@@ -10639,8 +10802,8 @@ var ee = class {
10639
10802
  return await D(e, async (e) => await this.signData(e, t, n));
10640
10803
  }
10641
10804
  async signHash(e, t) {
10642
- if (typeof t != "boolean" && (t = !1), this._readedKey.keyType == V.WindowsCertStore) return this._signHashWindowsCertificateStore(e, !1, t);
10643
- if (this._readedKey.keyType == V.UmCAService) throw {
10805
+ if (typeof t != "boolean" && (t = !1), this._readedKey.keyType == U.WindowsCertStore) return this._signHashWindowsCertificateStore(e, !1, t);
10806
+ if (this._readedKey.keyType == U.UmCAService) throw {
10644
10807
  code: f.EndUserError.EU_ERROR_NOT_SUPPORTED,
10645
10808
  message: this._resourses.KSPSignFormatError
10646
10809
  };
@@ -10658,12 +10821,12 @@ var ee = class {
10658
10821
  if (r.type === f.EndUserConstants.EndUserSignContainerType.ASiC) return await this._euSign.ASiCVerifyData(t.val || t, n);
10659
10822
  if (r.type === f.EndUserConstants.EndUserSignContainerType.PAdES) return await this._euSign.PDFVerifyData(t.val || t, n);
10660
10823
  if (r.type === f.EndUserConstants.EndUserSignContainerType.XAdES) return await this._euSign.XAdESVerifyData(e, t.val || t, n);
10661
- if (r.type === f.EndUserConstants.EndUserSignContainerType.CAdES && !e) {
10662
- if (r.subType === f.EndUserConstants.EndUserCAdESType.Detached) throw {
10824
+ if (r.type === f.EndUserConstants.EndUserSignContainerType.CAdES) {
10825
+ if (r.subType === f.EndUserConstants.EndUserCAdESType.Enveloped) return await this._euSign.VerifyDataInternal(t.val || t, n);
10826
+ if (!e) throw {
10663
10827
  code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
10664
10828
  message: this._resourses.BadParameter + " data"
10665
10829
  };
10666
- return await this._euSign.VerifyDataInternal(t.val || t, n);
10667
10830
  }
10668
10831
  return await this._euSign.VerifyData(e.val || e, t.val || t, n);
10669
10832
  }
@@ -10716,19 +10879,19 @@ var ee = class {
10716
10879
  i.ownerInfo.certBeginTime = A(o.certBeginTime), i.ownerInfo.certEndTime = A(o.certEndTime), i.ownerInfo.publicKeyType = o.publicKeyType, i.ownerInfo.keyUsageType = o.keyUsageType, i.ownerInfo.certHashType = r._readedKey.getHashAlgo();
10717
10880
  let s = i.timeInfo, c = A(s.isSignTimeStampAvail ? s.signTimeStamp : s.time);
10718
10881
  switch ((s.isSignTimeStampAvail || s.isTimeStamp) && (i.ownerInfo.timestamp = A(s.isSignTimeStampAvail ? s.signTimeStamp : s.time)), r._readedKey.keyType) {
10719
- case V.File:
10882
+ case U.File:
10720
10883
  i.ownerInfo.privateKeyType = "FileKey";
10721
10884
  break;
10722
- case V.Token:
10885
+ case U.Token:
10723
10886
  i.ownerInfo.privateKeyType = "HardwareKey";
10724
10887
  break;
10725
- case V.UmCAService:
10888
+ case U.UmCAService:
10726
10889
  i.ownerInfo.privateKeyType = "UmCAService";
10727
10890
  break;
10728
- case V.WindowsCertStore:
10891
+ case U.WindowsCertStore:
10729
10892
  i.ownerInfo.privateKeyType = "WindowsCertStore";
10730
10893
  break;
10731
- case V.KSP: i.ownerInfo.privateKeyType = r._readedKey.ksp.ksp == H.GRYADA ? "GRYADA" : r._readedKey.ksp.id;
10894
+ case U.KSP: i.ownerInfo.privateKeyType = r._readedKey.ksp.ksp == W.GRYADA ? "GRYADA" : r._readedKey.ksp.id;
10732
10895
  }
10733
10896
  return {
10734
10897
  Success: !0,
@@ -10781,7 +10944,7 @@ var ee = class {
10781
10944
  }
10782
10945
  let i = this;
10783
10946
  async function a(e) {
10784
- typeof e != "string" && (e = x(e));
10947
+ typeof e != "string" && (e = _(e));
10785
10948
  let t;
10786
10949
  try {
10787
10950
  t = await SignerDigital.signHashCms(e, r, 2, i._readedKey.id);
@@ -10832,7 +10995,7 @@ var ee = class {
10832
10995
  return await this._euSign.ProtectTaxReports(e.accountantPrivateKeyContext?.keyContext, Array.isArray(e.directorPrivateKeyContext) ? e.directorPrivateKeyContext.map((e) => e.keyContext) : e.directorPrivateKeyContext?.keyContext, Array.isArray(e.stampPrivateKeyContext) ? e.stampPrivateKeyContext.map((e) => e.keyContext) : e.stampPrivateKeyContext?.keyContext, e.senderEMail, e.recipientCertificate, e.reports, e.returnIntermediateSign);
10833
10996
  }
10834
10997
  async ctxReadHardwareKey(e, t) {
10835
- if (await this.setLibraryType(V.Token), !e) throw {
10998
+ if (await this.setLibraryType(U.Token), !e) throw {
10836
10999
  code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
10837
11000
  message: this._resourses.BadParameter + " keyMedia"
10838
11001
  };
@@ -10842,7 +11005,7 @@ var ee = class {
10842
11005
  };
10843
11006
  Array.isArray(t) && t.length > 0 && (t = await Promise.all(t.map((e) => e instanceof File || e instanceof Blob ? g(e) : e instanceof f.EndUserCertificate ? e.data : e)));
10844
11007
  try {
10845
- let n = await this._euSign.CtxCreate(), r = await this._euSign.CtxReadPrivateKey(n, e, t, this._selectedIssuerCN), i = new K(V.Token, r.ownerInfo, await this._euSign.CtxGetOwnCertificates(r), e);
11008
+ let n = await this._euSign.CtxCreate(), r = await this._euSign.CtxReadPrivateKey(n, e, t, this._selectedIssuerCN), i = new J(U.Token, r.ownerInfo, await this._euSign.CtxGetOwnCertificates(r), e);
10846
11009
  return i.context = n, i.keyContext = r, i._glSign = this._glSign, i;
10847
11010
  } catch (e) {
10848
11011
  if (e && e.code === f.EndUserError.EU_ERROR_CERT_NOT_FOUND) {
@@ -10862,7 +11025,7 @@ var ee = class {
10862
11025
  }
10863
11026
  }
10864
11027
  async ctxReadFileKey(e, t, n) {
10865
- if (await this.setLibraryType(V.File), !e) throw {
11028
+ if (await this.setLibraryType(U.File), !e) throw {
10866
11029
  code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
10867
11030
  message: this._resourses.BadParameter + " keyMedia"
10868
11031
  };
@@ -10872,7 +11035,7 @@ var ee = class {
10872
11035
  };
10873
11036
  (e instanceof File || e instanceof Blob) && (e = await g(e)), Array.isArray(n) && n.length > 0 && (n = await Promise.all(n.map((e) => e instanceof File || e instanceof Blob ? g(e) : e instanceof f.EndUserCertificate ? e.data : e)));
10874
11037
  try {
10875
- let r = await this._euSign.CtxCreate(), i = await this._euSign.CtxReadPrivateKeyBinary(r, e, t, n, this._selectedIssuerCN), a = new G(V.File, i.ownerInfo, await this._euSign.CtxGetOwnCertificates(i), e, t);
11038
+ let r = await this._euSign.CtxCreate(), i = await this._euSign.CtxReadPrivateKeyBinary(r, e, t, n, this._selectedIssuerCN), a = new q(U.File, i.ownerInfo, await this._euSign.CtxGetOwnCertificates(i), e, t);
10876
11039
  return a.context = r, a.keyContext = i, a._glSign = this._glSign, a;
10877
11040
  } catch (e) {
10878
11041
  if (e && e.code === f.EndUserError.EU_ERROR_CERT_NOT_FOUND) {
@@ -10892,10 +11055,10 @@ var ee = class {
10892
11055
  }
10893
11056
  }
10894
11057
  async ctxFreePrivateKey(e) {
10895
- e.keyType === V.Token ? await this.setLibraryType(V.Token) : await this.setLibraryType(V.File), await this._euSign.CtxFreePrivateKey(e.keyContext), await this._euSign.CtxFree(e.context);
11058
+ e.keyType === U.Token ? await this.setLibraryType(U.Token) : await this.setLibraryType(U.File), await this._euSign.CtxFreePrivateKey(e.keyContext), await this._euSign.CtxFree(e.context);
10896
11059
  }
10897
11060
  async getPrivateKeyInfoFromStorage(e, t) {
10898
- let n = (e ? localStorage : sessionStorage)[this._userId + $], r, i = [];
11061
+ let n = (e ? localStorage : sessionStorage)[this._userId + se], r, i = [];
10899
11062
  if (!n) return i;
10900
11063
  let a = await this._euSignFile.UnprotectDataByPassword(n, "", !0);
10901
11064
  try {
@@ -10905,13 +11068,13 @@ var ee = class {
10905
11068
  }
10906
11069
  return r.forEach((e) => {
10907
11070
  let t = e.password;
10908
- if (e.keyType == V.File) e.privateKey = new Uint8Array(Object.assign([], e.privateKey)), e = new G(e.keyType, e.ownerInfo, e.certificates, e.privateKey, e.password);
10909
- else if (e.keyType == V.Token) e = new K(e.keyType, e.ownerInfo, e.certificates, e.keyMedia);
10910
- else if (e.keyType == V.KSP) e = new q(e.keyType, e.ownerInfo, e.certificates, e.userId, e.ksp, e.keyId);
10911
- else if (e.keyType == V.UmCAService) {
11071
+ if (e.keyType == U.File) e.privateKey = new Uint8Array(Object.assign([], e.privateKey)), e = new q(e.keyType, e.ownerInfo, e.certificates, e.privateKey, e.password);
11072
+ else if (e.keyType == U.Token) e = new J(e.keyType, e.ownerInfo, e.certificates, e.keyMedia);
11073
+ else if (e.keyType == U.KSP) e = new te(e.keyType, e.ownerInfo, e.certificates, e.userId, e.ksp, e.keyId);
11074
+ else if (e.keyType == U.UmCAService) {
10912
11075
  let t = e.keyMedia;
10913
- e = new W(e.keyType, e.ownerInfo, e.certificates, e.visibleName, e.id), e.keyMedia = t;
10914
- } else e.keyType == V.WindowsCertStore && (e = new W(e.keyType, e.ownerInfo, e.certificates, e.visibleName, e.id));
11076
+ e = new K(e.keyType, e.ownerInfo, e.certificates, e.visibleName, e.id), e.keyMedia = t;
11077
+ } else e.keyType == U.WindowsCertStore && (e = new K(e.keyType, e.ownerInfo, e.certificates, e.visibleName, e.id));
10915
11078
  let n = [];
10916
11079
  e.certificates.forEach((e) => {
10917
11080
  let t = Object.assign(new f.EndUserCertificate(), e);
@@ -10926,7 +11089,7 @@ var ee = class {
10926
11089
  let r = await this.getPrivateKeyInfoFromStorage(t);
10927
11090
  r.push(e);
10928
11091
  let i = await this._euSignFile.ProtectDataByPassword(JSON.stringify(r), "", !0);
10929
- n[this._userId + $] = i;
11092
+ n[this._userId + se] = i;
10930
11093
  }
10931
11094
  }
10932
11095
  async getStoredPrivateKeyInfo(e) {
@@ -10934,25 +11097,25 @@ var ee = class {
10934
11097
  return t.concat(n);
10935
11098
  }
10936
11099
  async removeStoredPrivateKeyInfo(e) {
10937
- if (e === void 0) localStorage.removeItem(this._userId + $), sessionStorage.removeItem(this._userId + $);
11100
+ if (e === void 0) localStorage.removeItem(this._userId + se), sessionStorage.removeItem(this._userId + se);
10938
11101
  else {
10939
11102
  let t = await this.getPrivateKeyInfoFromStorage(!0), n = await this.getPrivateKeyInfoFromStorage(!1), r = t.filter((t) => t.id == e).length > 0 ? localStorage : sessionStorage, i = r == localStorage ? t : n, a = i.findIndex((t) => t.id == e);
10940
11103
  if (a > -1) {
10941
11104
  i.splice(a, 1);
10942
11105
  let e = await this._euSignFile.ProtectDataByPassword(JSON.stringify(i), "", !0);
10943
- r[this._userId + $] = e;
11106
+ r[this._userId + se] = e;
10944
11107
  }
10945
11108
  }
10946
11109
  }
10947
11110
  get _preferredKeyType() {
10948
- let e = parseInt(localStorage[this._userId + Q]);
10949
- return typeof e == "number" && e > -1 ? e : (localStorage[this._userId + Q] = V.File, V.File);
11111
+ let e = parseInt(localStorage[this._userId + oe]);
11112
+ return typeof e == "number" && e > -1 ? e : (localStorage[this._userId + oe] = U.File, U.File);
10950
11113
  }
10951
11114
  set _preferredKeyType(e) {
10952
- typeof e == "number" && e > -1 && (localStorage[this._userId + Q] = e);
11115
+ typeof e == "number" && e > -1 && (localStorage[this._userId + oe] = e);
10953
11116
  }
10954
11117
  get _resourses() {
10955
- return Z[this._language];
11118
+ return ae[this._language];
10956
11119
  }
10957
11120
  get _userId() {
10958
11121
  return typeof this._settingsProvider.userId == "function" ? this._settingsProvider.userId() : this._settingsProvider.userId;
@@ -10984,6 +11147,6 @@ var ee = class {
10984
11147
  }
10985
11148
  };
10986
11149
  //#endregion
10987
- export { ae as DigitalSignature, f as EUSignCP, j as GlSign, M as Models, d as Utils };
11150
+ export { ce as DigitalSignature, f as EUSignCP, P as GlSign, F as Models, d as Utils };
10988
11151
 
10989
11152
  //# sourceMappingURL=it-digital-signature.mjs.map