choco-one-click-payment 1.1.27 → 1.1.29

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.
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.choco-one-click-widget{position:fixed;top:0;left:0;right:0;bottom:0;z-index:999999;font-family:Sirius,sans-serif;--choco-widget-accent-color: #2F2F2F;pointer-events:none}.choco-one-click-widget--embedded{position:static;top:auto;left:auto;right:auto;bottom:auto;z-index:auto;pointer-events:auto;min-height:1px}.choco-one-click-widget--embedded .choco-widget-bottom-bar{position:static;box-shadow:none;border-radius:24px}.choco-one-click-widget--embedded .choco-widget-payment-sheet{position:fixed}.choco-one-click-widget *{box-sizing:border-box;font-family:Sirius,sans-serif}.choco-one-click-widget .choco-widget-bottom-bar{opacity:0;transform:translateY(16px)}.choco-one-click-widget .choco-widget-balance-section,.choco-one-click-widget .choco-widget-payment-info{opacity:0;transform:translateY(8px)}.choco-one-click-widget--visible .choco-widget-bottom-bar,.choco-one-click-widget--visible .choco-widget-balance-section,.choco-one-click-widget--visible .choco-widget-payment-info{opacity:1;transform:translateY(0)}.choco-widget-bottom-bar{position:absolute;bottom:0;left:0;right:0;background:#fff;border-radius:24px 24px 0 0;padding:16px;box-shadow:0 -4px 20px #0000001a;transition:transform .24s cubic-bezier(.4,0,.2,1),opacity .2s ease;pointer-events:auto}.choco-widget-payment-info{display:flex;flex-direction:column;gap:12px;align-items:stretch;transition:transform .22s ease,opacity .2s ease}.choco-widget-payment-info-main{display:flex;gap:12px;align-items:center}.choco-widget-payment-method{gap:12px;background:#f1f2f7;border-radius:16px;padding:5px 8px;cursor:pointer;transition:background .2s ease;border:none;font-family:inherit;text-align:left;width:100%;position:relative;height:46px}.choco-widget-payment-method:disabled{cursor:not-allowed;pointer-events:none;opacity:.5}.choco-widget-payment-method.google_pay,.choco-widget-payment-method.apple_pay{max-width:140px}.choco-widget-method-icon-placeholder{font-size:24px}.choco-widget-method-details{flex:1}.choco-widget-method-label{font-size:14px;color:#000}.choco-widget-method-value{font-size:14px;font-weight:600;color:#000;display:flex;align-items:center;gap:4px}.choco-widget-method-icon-wrapper svg{display:block;width:100%;max-width:29px;max-height:18px;margin-top:2px}.choco-widget-method-icon-wrapper:empty{display:none}.choco-widget-method-icon-wrapper.google_pay svg{height:17px;max-width:35px;border:1px solid #3C4043;padding:3px 4px 2px;border-radius:8px}.choco-widget-method-name{font-size:14px;font-weight:700}.choco-widget-method-name.google_pay,.choco-widget-method-name.apple_pay{display:none}.choco-widget-method-chevron{position:absolute;right:5px;top:0;bottom:0;margin:auto 0;width:24px;height:24px}.choco-widget-pay-button{background:var(--choco-widget-accent-color);color:#fff;border:none;border-radius:16px;height:46px;padding:0 16px;font-size:16px;font-weight:600;cursor:pointer;transition:all .2s ease;white-space:nowrap;width:100%;overflow:hidden}.choco-widget-pay-button--loading{cursor:not-allowed;pointer-events:none;position:relative}.choco-widget-pay-button--loading:before{content:"";display:block;width:16px;height:16px;border:2px solid #ffffff;border-top:2px solid transparent;border-radius:50%;animation:choco-spin 1s linear infinite;position:absolute;left:0;right:0;margin:0 auto;z-index:2}.choco-widget-pay-button--loading:after{content:"";display:block;width:100%;height:100%;background:#2f2f2f;position:absolute;left:0;top:0}.choco-widget-pay-button:disabled{opacity:.5;pointer-events:none}.choco-widget-pay-button--hidden{display:none}.choco-widget-google-pay-amount{min-width:124px;height:46px;display:flex;flex-direction:column;justify-content:center;text-align:right;width:100%}.choco-widget-google-pay-amount--hidden{display:none}.choco-widget-google-pay-amount-label{font-size:20px;font-weight:700;line-height:24px;color:#1d1d1d}.choco-widget-google-pay-amount-value{font-size:14px;line-height:18px;color:#1d1d1d;white-space:nowrap;opacity:.5}.choco-widget-google-pay-amount-value--hidden{display:none}.choco-widget-google-pay-amount-value-number{text-decoration:line-through}.choco-widget-google-pay-row--hidden{display:none}.choco-widget-wallet-blocked{pointer-events:none;opacity:.6}.choco-widget-google-pay-button-slot{width:100%}.choco-widget-google-pay-button-slot>button{width:100%!important;height:52px;min-height:52px;border-radius:12px!important;font-size:16px!important}.choco-widget-apple-pay-row--hidden{display:none}.choco-widget-apple-pay-button-slot{width:100%}.choco-widget-apple-pay-button-wrapper{position:relative;width:100%;height:52px}.choco-widget-apple-pay-button{width:100%;height:52px;min-height:52px;border:0;border-radius:12px;cursor:pointer;background:#000;color:#fff;font-size:16px;display:flex;align-items:center;justify-content:center;gap:8px;padding:0 16px}.choco-widget-apple-pay-button--native{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:52px;opacity:.01;z-index:2}.choco-widget-apple-pay-button-overlay{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;gap:8px;background:#000;border-radius:12px;pointer-events:none;z-index:1}.choco-widget-apple-pay-button-text{font-size:16px;line-height:20px;font-weight:600;color:#fff}.choco-widget-apple-pay-button-icon{display:inline-flex;align-items:center;justify-content:center}.choco-widget-payment-sheet{position:absolute;bottom:0;left:0;right:0;top:0;background:#00000080;display:flex;align-items:flex-end;opacity:0;pointer-events:none;transition:opacity .3s ease}.choco-widget-payment-sheet--open{opacity:1;pointer-events:auto}.choco-widget-payment-sheet--open .choco-widget-sheet-content{transform:translateY(0)}.choco-widget-sheet-content{background:#fff;border-radius:24px 24px 0 0;width:100%;max-height:70vh;overflow-y:auto;transform:translateY(100%);transition:transform .3s cubic-bezier(.4,0,.2,1);padding:8px 16px 16px;position:relative;will-change:transform}.choco-widget-sheet-content--dragging{transition:none}.choco-widget-sheet-grabber{flex-shrink:0;display:flex;align-items:center;justify-content:center;cursor:grab;touch-action:none;margin-bottom:8px;-webkit-user-select:none;user-select:none}.choco-widget-sheet-grabber:active{cursor:grabbing}.choco-widget-sheet-grabber:before{content:"";width:72px;height:6px;background:#e5e5e7;border-radius:42px}.choco-widget-sheet-content{-webkit-overflow-scrolling:touch;overscroll-behavior:contain}.choco-widget-sheet-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;position:relative}.choco-widget-sheet-title{font-size:20px;font-weight:700;color:#000;margin:0;flex:1;text-align:center}.choco-widget-payment-sheet--edit .choco-widget-sheet-title{padding-left:30px}.choco-widget-payment-sheet--no-cards .choco-widget-sheet-title{padding-right:30px}.choco-widget-payment-sheet--delete-confirm .choco-widget-sheet-title{padding:0}.choco-widget-sheet-button{background:none;border:none;width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0}.choco-widget-sheet-button svg{color:#000}.choco-widget-sheet-delete-confirm{display:none;padding-top:16px}.choco-widget-payment-sheet--delete-confirm .choco-widget-payment-methods,.choco-widget-payment-sheet--delete-confirm .choco-widget-cashback-section{display:none!important}.choco-widget-payment-sheet--delete-confirm .choco-widget-sheet-delete-confirm{display:block}.choco-widget-sheet-delete-confirm-text{margin:0 0 24px;font-size:16px;line-height:1.4;color:#242424;text-align:center}.choco-widget-sheet-delete-confirm-actions{display:flex;gap:12px}.choco-widget-delete-confirm-btn{flex:1;padding:14px 20px;font-size:16px;font-weight:600;font-family:inherit;border-radius:16px;border:none;cursor:pointer;transition:background .2s ease,opacity .2s ease}.choco-widget-delete-confirm-btn--cancel{background:#f1f2f7;color:#242424}.choco-widget-delete-confirm-btn--delete{background:var(--choco-widget-accent-color);color:#fff}.choco-widget-delete-confirm-btn--loading{cursor:not-allowed;pointer-events:none;position:relative}.choco-widget-sheet-delete-confirm-actions.choco-widget-sheet-delete-confirm-actions--loading .choco-widget-delete-confirm-btn{pointer-events:none;cursor:not-allowed;opacity:.7}.choco-widget-delete-confirm-btn--delete.choco-widget-delete-confirm-btn--loading:before{content:"";display:block;width:16px;height:16px;border:2px solid #ffffff;border-top:2px solid transparent;border-radius:50%;animation:choco-spin 1s linear infinite;position:absolute;left:0;right:0;margin:0 auto;z-index:2}.choco-widget-delete-confirm-btn--delete.choco-widget-delete-confirm-btn--loading:after{content:"";display:block;width:100%;height:100%;background:#cc3434;position:absolute;left:0;top:0;border-radius:16px}.choco-widget-add-card-sheet{align-items:stretch}.choco-widget-add-card-sheet .choco-widget-add-card-sheet-content{max-height:none;height:100%;display:flex;flex-direction:column;transform:none;border-radius:0;padding:0}.choco-widget-add-card-sheet--open .choco-widget-add-card-sheet-content{transform:none}.choco-widget-add-card-sheet .choco-widget-sheet-header{flex-shrink:0;margin-bottom:0;padding:12px 0;border-bottom:1px solid #eee}.choco-widget-add-card-iframe-wrapper{flex:1;min-height:0;background:#fff}.choco-widget-add-card-iframe{width:100%;height:100%;border:none;display:block}.choco-widget-balance-section{margin-bottom:12px;padding:12px 8px;background:#f1f2f7;border-radius:12px;transition:transform .22s ease,opacity .2s ease}.choco-widget-balance-section.disabled{opacity:.5;pointer-events:none}.choco-widget-balance-toggle{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;padding:4px 0}.choco-widget-balance-toggle:last-child{margin-bottom:0}.choco-widget-balance-info{display:flex;align-items:center;gap:12px}.choco-widget-balance-text{display:flex;flex-direction:column}.choco-widget-balance-label-wrapper{display:flex;align-items:center;gap:8px}.choco-widget-balance-label{font-size:16px;font-weight:500}.choco-widget-balance-sublabel{font-size:12px;color:#767485;margin-top:2px}.choco-widget-balance-icon{width:22px;height:22px}.choco-widget-balance-amount{font-size:16px;font-weight:500;color:#000}.choco-widget-toggle{position:relative;display:inline-block;width:42px;height:26px}.choco-widget-toggle input{opacity:0;width:0;height:0}.choco-widget-toggle-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#d4d3df;transition:.3s;border-radius:28px}.choco-widget-toggle-slider:before{position:absolute;content:"";height:22px;width:22px;left:2px;bottom:0;top:0;margin:auto;background-color:#fff;transition:.3s;border-radius:50%}.choco-widget-toggle input:checked+.choco-widget-toggle-slider{background-color:var(--choco-widget-accent-color)}.choco-widget-toggle input:checked+.choco-widget-toggle-slider:before{transform:translate(16px)}.choco-widget-cashback-section{margin-top:20px;padding-top:20px;border-top:1px solid #f0f0f0}.choco-widget-cashback-info{display:flex;align-items:center;gap:8px;padding:12px 16px;background:#fff5ee;border-radius:12px;font-size:14px;color:#ff6b00}.choco-widget-cashback-icon{font-size:20px}.choco-widget-cashback-text strong{font-weight:700}.choco-widget-payment-methods{display:flex;flex-direction:column;gap:8px}.choco-widget-method-item{display:flex;align-items:center;gap:12px;padding:10px 0;cursor:pointer;transition:all .2s ease;border:2px solid transparent;width:100%;border:0;background:none;text-align:left;font-family:inherit;font-size:inherit}.choco-widget-method-item-icon-wrapper{width:37px}.choco-widget-method-item-icon-wrapper svg{display:block;width:100%;max-width:29px;height:29px;margin:0 auto}.choco-widget-method-item-icon-wrapper.google_pay{outline:1px solid #3C4043;padding:3px 5px 2px;border-radius:15px}.choco-widget-method-item-icon-wrapper.google_pay svg{height:15px;max-width:29px}.choco-widget-method-item-label{flex:1;font-size:16px;color:#000}.choco-widget-method-item-check,.choco-widget-method-item-trash-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:6px;margin:-6px 0 -6px 6px;background:none;border:none;cursor:pointer;border-radius:8px;-webkit-tap-highlight-color:transparent}.choco-widget-method-item-check{height:30px;width:30px}.choco-widget-method-item-trash-btn:hover{background:#cc343414}.choco-widget-method-item-trash{flex-shrink:0;width:20px;height:20px}.choco-widget-bottom-bar-prerender{position:absolute;bottom:0;left:0;right:0;background:#fff;border-radius:24px 24px 0 0;box-shadow:0 -4px 20px #0000001a;transition:transform .3s cubic-bezier(.4,0,.2,1);height:78px}.choco-widget-payment-loading{width:30px;height:30px;animation:choco-spin 1s linear infinite;border:3px solid var(--choco-widget-accent-color);border-top:3px solid transparent;border-radius:50%;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto}@keyframes choco-spin{to{transform:rotate(360deg)}}@keyframes choco-fade-in{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@media(max-width:768px){.choco-widget-bottom-bar{padding:16px 16px 20px}.choco-widget-sheet-content{max-height:80vh}.choco-widget-sheet-title{font-size:18px}.choco-widget-method-item-label{font-size:17px}}@media(max-width:768px)and (min-height:812px){.choco-widget-bottom-bar,.choco-widget-sheet-content{padding-bottom:calc(20px + env(safe-area-inset-bottom,20px))}}@supports (padding: env(safe-area-inset-bottom)){.choco-widget-bottom-bar{padding-bottom:calc(16px + env(safe-area-inset-bottom))}.choco-widget-sheet-content{padding-bottom:calc(20px + env(safe-area-inset-bottom))}}')),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
- const yt = {
2
+ const mt = {
3
3
  ru: {
4
4
  paymentMethod: "Способ оплаты",
5
5
  selectMethod: "Выберите метод",
@@ -144,40 +144,40 @@ const yt = {
144
144
  errorWidgetInit: "ვიჯეტის ინიციალიზაციის შეცდომა",
145
145
  errorPaymentProcess: "გადახდის შეცდომა"
146
146
  }
147
- }, mt = {
147
+ }, bt = {
148
148
  KZT: "₸",
149
149
  GEL: "₾"
150
150
  };
151
- function bt(e) {
151
+ function Et(e) {
152
152
  return e === "production" ? "https://api-proxy.choco.kz" : "https://api-proxy.chocodev.kz";
153
153
  }
154
154
  let de;
155
- const Et = new Uint8Array(16);
156
- function vt() {
155
+ const vt = new Uint8Array(16);
156
+ function Bt() {
157
157
  if (!de && (de = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !de))
158
158
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
159
- return de(Et);
159
+ return de(vt);
160
160
  }
161
161
  const H = [];
162
162
  for (let e = 0; e < 256; ++e)
163
163
  H.push((e + 256).toString(16).slice(1));
164
- function Bt(e, n = 0) {
165
- return H[e[n + 0]] + H[e[n + 1]] + H[e[n + 2]] + H[e[n + 3]] + "-" + H[e[n + 4]] + H[e[n + 5]] + "-" + H[e[n + 6]] + H[e[n + 7]] + "-" + H[e[n + 8]] + H[e[n + 9]] + "-" + H[e[n + 10]] + H[e[n + 11]] + H[e[n + 12]] + H[e[n + 13]] + H[e[n + 14]] + H[e[n + 15]];
164
+ function It(e, t = 0) {
165
+ return H[e[t + 0]] + H[e[t + 1]] + H[e[t + 2]] + H[e[t + 3]] + "-" + H[e[t + 4]] + H[e[t + 5]] + "-" + H[e[t + 6]] + H[e[t + 7]] + "-" + H[e[t + 8]] + H[e[t + 9]] + "-" + H[e[t + 10]] + H[e[t + 11]] + H[e[t + 12]] + H[e[t + 13]] + H[e[t + 14]] + H[e[t + 15]];
166
166
  }
167
- const It = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ze = {
168
- randomUUID: It
167
+ const Qt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ze = {
168
+ randomUUID: Qt
169
169
  };
170
- function Be(e, n, o) {
170
+ function Be(e, t, o) {
171
171
  if (ze.randomUUID && !e)
172
172
  return ze.randomUUID();
173
173
  e = e || {};
174
- const s = e.random || (e.rng || vt)();
175
- return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, Bt(s);
174
+ const i = e.random || (e.rng || Bt)();
175
+ return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, It(i);
176
176
  }
177
177
  const Ke = "choco_device_id";
178
- function G(e, n = "ru", o = "KZT") {
179
- const s = Number(e), i = n === "ru" ? "ru-RU" : "en-US";
180
- return `${s.toLocaleString(i)} ${mt[o]}`;
178
+ function G(e, t = "ru", o = "KZT") {
179
+ const i = Number(e), s = t === "ru" ? "ru-RU" : "en-US";
180
+ return `${i.toLocaleString(s)} ${bt[o]}`;
181
181
  }
182
182
  function nt() {
183
183
  let e = localStorage.getItem(Ke);
@@ -185,19 +185,19 @@ function nt() {
185
185
  }
186
186
  function Ce() {
187
187
  if (typeof window > "u") return !1;
188
- const e = window.safari !== void 0, n = window.navigator.userAgent || "", o = !!n.match(/iPad/i) || !!n.match(/iPhone/i), s = !!n.match(/WebKit/i), i = o && s && !n.match(/CriOS/i);
189
- return e || i;
188
+ const e = window.safari !== void 0, t = window.navigator.userAgent || "", o = !!t.match(/iPad/i) || !!t.match(/iPhone/i), i = !!t.match(/WebKit/i), s = o && i && !t.match(/CriOS/i);
189
+ return e || s;
190
190
  }
191
191
  function rt() {
192
192
  if (typeof navigator > "u") return 0;
193
- const e = navigator.userAgent || "", n = e.indexOf("OS");
194
- return (e.indexOf("iPhone") > -1 || e.indexOf("iPad") > -1) && n > -1 ? Number(e.substring(n + 3, n + 6).replace("_", ".")) : 0;
193
+ const e = navigator.userAgent || "", t = e.indexOf("OS");
194
+ return (e.indexOf("iPhone") > -1 || e.indexOf("iPad") > -1) && t > -1 ? Number(e.substring(t + 3, t + 6).replace("_", ".")) : 0;
195
195
  }
196
196
  function De() {
197
197
  var u;
198
198
  if (typeof navigator > "u") return "unknown";
199
- const e = (navigator.userAgent || navigator.vendor || "").toLowerCase(), n = (navigator.platform || "").toLowerCase(), o = (((u = navigator.userAgentData) == null ? void 0 : u.platform) || "").toLowerCase(), s = `${e} ${n} ${o}`;
200
- return /iphone|ipad|ipod/.test(s) || s.includes("macintosh") && typeof document < "u" && "ontouchend" in document ? "ios" : s.includes("android") ? "android" : s.includes("windows") ? "windows" : s.includes("mac") ? "macos" : "other";
199
+ const e = (navigator.userAgent || navigator.vendor || "").toLowerCase(), t = (navigator.platform || "").toLowerCase(), o = (((u = navigator.userAgentData) == null ? void 0 : u.platform) || "").toLowerCase(), i = `${e} ${t} ${o}`;
200
+ return /iphone|ipad|ipod/.test(i) || i.includes("macintosh") && typeof document < "u" && "ontouchend" in document ? "ios" : i.includes("android") ? "android" : i.includes("windows") ? "windows" : i.includes("mac") ? "macos" : "other";
201
201
  }
202
202
  function ye() {
203
203
  if (typeof navigator > "u") return !1;
@@ -206,18 +206,18 @@ function ye() {
206
206
  }
207
207
  function me(e) {
208
208
  if (typeof sessionStorage > "u") return !1;
209
- const n = e === "apple_pay" ? "disableApplePay" : e === "google_pay" ? "disableGooglePay" : null;
210
- return n ? sessionStorage.getItem(n) === "true" : !1;
209
+ const t = e === "apple_pay" ? "disableApplePay" : e === "google_pay" ? "disableGooglePay" : null;
210
+ return t ? sessionStorage.getItem(t) === "true" : !1;
211
211
  }
212
- function Qt(e) {
212
+ function St(e) {
213
213
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
214
214
  }
215
- var fe = { exports: {} }, St = fe.exports, Ve;
216
- function Pt() {
217
- return Ve || (Ve = 1, (function(e, n) {
218
- (function(s, i) {
219
- e.exports = i();
220
- })(St, function() {
215
+ var fe = { exports: {} }, Pt = fe.exports, We;
216
+ function kt() {
217
+ return We || (We = 1, (function(e, t) {
218
+ (function(i, s) {
219
+ e.exports = s();
220
+ })(Pt, function() {
221
221
  return (
222
222
  /******/
223
223
  (function() {
@@ -225,11 +225,11 @@ function Pt() {
225
225
  /***/
226
226
  382: (
227
227
  /***/
228
- (function(c, d, g) {
228
+ (function(a, d, g) {
229
229
  Object.defineProperty(d, "__esModule", {
230
230
  value: !0
231
231
  }), d.Centrifuge = void 0;
232
- var C = Q(g(187)), S = Q(g(471)), T = g(147), v = g(853);
232
+ var C = Q(g(187)), S = Q(g(471)), T = g(147), E = g(853);
233
233
  function Q(f) {
234
234
  return f && f.__esModule ? f : { default: f };
235
235
  }
@@ -260,20 +260,20 @@ function Pt() {
260
260
  f.prototype = Object.create(h && h.prototype, { constructor: { value: f, writable: !0, configurable: !0 } }), h && L(f, h);
261
261
  }
262
262
  function L(f, h) {
263
- return L = Object.setPrototypeOf || function(A, t) {
264
- return A.__proto__ = t, A;
263
+ return L = Object.setPrototypeOf || function(A, n) {
264
+ return A.__proto__ = n, A;
265
265
  }, L(f, h);
266
266
  }
267
267
  function O(f) {
268
268
  var h = J();
269
269
  return function() {
270
- var A = x(f), t;
270
+ var A = x(f), n;
271
271
  if (h) {
272
272
  var r = x(this).constructor;
273
- t = Reflect.construct(A, arguments, r);
273
+ n = Reflect.construct(A, arguments, r);
274
274
  } else
275
- t = A.apply(this, arguments);
276
- return F(this, t);
275
+ n = A.apply(this, arguments);
276
+ return F(this, n);
277
277
  };
278
278
  }
279
279
  function F(f, h) {
@@ -306,7 +306,7 @@ function Pt() {
306
306
  var q = "timeout", N = "connection closed", b = /* @__PURE__ */ (function(f) {
307
307
  w(p, f);
308
308
  var h = O(p);
309
- function p(A, t) {
309
+ function p(A, n) {
310
310
  var r;
311
311
  return m(this, p), r = h.call(this), r._url = A, r._websocket = null, r._sockjs = null, r._isSockjs = !1, r._xmlhttprequest = null, r._binary = !1, r._methodType = null, r._pushType = null, r._encoder = null, r._decoder = null, r._status = "disconnected", r._reconnect = !0, r._reconnecting = !1, r._transport = null, r._transportName = null, r._transportClosed = !0, r._messageId = 0, r._clientID = null, r._refreshRequired = !1, r._subs = {}, r._serverSubs = {}, r._lastSeq = {}, r._lastGen = {}, r._lastOffset = {}, r._lastEpoch = {}, r._messages = [], r._isBatching = !1, r._isSubscribeBatching = !1, r._privateChannels = {}, r._numRefreshFailed = 0, r._refreshTimeout = null, r._pingTimeout = null, r._pongTimeout = null, r._subRefreshTimeouts = {}, r._retries = 0, r._callbacks = {}, r._latency = null, r._latencyStart = null, r._connectData = null, r._token = null, r._xhrID = 0, r._xhrs = {}, r._dispatchPromise = Promise.resolve(), r._protocol = "", r._config = {
312
312
  protocol: "",
@@ -341,55 +341,55 @@ function Pt() {
341
341
  subRefreshInterval: 1e3,
342
342
  onPrivateSubscribe: null,
343
343
  disableWithCredentials: !1
344
- }, r._configure(t), r;
344
+ }, r._configure(n), r;
345
345
  }
346
346
  return k(p, [{
347
347
  key: "setToken",
348
- value: function(t) {
349
- this._token = t;
348
+ value: function(n) {
349
+ this._token = n;
350
350
  }
351
351
  }, {
352
352
  key: "setConnectData",
353
- value: function(t) {
354
- this._connectData = t;
353
+ value: function(n) {
354
+ this._connectData = n;
355
355
  }
356
356
  }, {
357
357
  key: "setRefreshHeaders",
358
- value: function(t) {
359
- this._config.refreshHeaders = t;
358
+ value: function(n) {
359
+ this._config.refreshHeaders = n;
360
360
  }
361
361
  }, {
362
362
  key: "setRefreshParams",
363
- value: function(t) {
364
- this._config.refreshParams = t;
363
+ value: function(n) {
364
+ this._config.refreshParams = n;
365
365
  }
366
366
  }, {
367
367
  key: "setRefreshData",
368
- value: function(t) {
369
- this._config.refreshData = t;
368
+ value: function(n) {
369
+ this._config.refreshData = n;
370
370
  }
371
371
  }, {
372
372
  key: "setSubscribeHeaders",
373
- value: function(t) {
374
- this._config.subscribeHeaders = t;
373
+ value: function(n) {
374
+ this._config.subscribeHeaders = n;
375
375
  }
376
376
  }, {
377
377
  key: "setSubscribeParams",
378
- value: function(t) {
379
- this._config.subscribeParams = t;
378
+ value: function(n) {
379
+ this._config.subscribeParams = n;
380
380
  }
381
381
  }, {
382
382
  key: "_ajax",
383
- value: function(t, r, a, l, y) {
384
- var E = this, I = "";
385
- this._debug("sending AJAX request to", t, "with data", JSON.stringify(l));
383
+ value: function(n, r, c, l, y) {
384
+ var v = this, I = "";
385
+ this._debug("sending AJAX request to", n, "with data", JSON.stringify(l));
386
386
  var B;
387
387
  this._xmlhttprequest !== null ? B = new this._xmlhttprequest() : B = g.g.XMLHttpRequest ? new g.g.XMLHttpRequest() : new g.g.ActiveXObject("Microsoft.XMLHTTP");
388
388
  for (var R in r)
389
389
  r.hasOwnProperty(R) && (I.length > 0 && (I += "&"), I += encodeURIComponent(R) + "=" + encodeURIComponent(r[R]));
390
- I.length > 0 && (I = "?" + I), B.open("POST", t + I, !0), "withCredentials" in B && (B.withCredentials = !this._config.disableWithCredentials), B.setRequestHeader("X-Requested-With", "XMLHttpRequest"), B.setRequestHeader("Content-Type", "application/json");
391
- for (var X in a)
392
- a.hasOwnProperty(X) && B.setRequestHeader(X, a[X]);
390
+ I.length > 0 && (I = "?" + I), B.open("POST", n + I, !0), "withCredentials" in B && (B.withCredentials = !this._config.disableWithCredentials), B.setRequestHeader("X-Requested-With", "XMLHttpRequest"), B.setRequestHeader("Content-Type", "application/json");
391
+ for (var X in c)
392
+ c.hasOwnProperty(X) && B.setRequestHeader(X, c[X]);
393
393
  return B.onreadystatechange = function() {
394
394
  if (B.readyState === 4)
395
395
  if (B.status === 200) {
@@ -408,7 +408,7 @@ function Pt() {
408
408
  status: 200
409
409
  });
410
410
  } else
411
- E._log("wrong status code in AJAX response", B.status), y({
411
+ v._log("wrong status code in AJAX response", B.status), y({
412
412
  status: B.status,
413
413
  data: null
414
414
  });
@@ -419,12 +419,12 @@ function Pt() {
419
419
  }, {
420
420
  key: "_log",
421
421
  value: function() {
422
- (0, v.log)("info", arguments);
422
+ (0, E.log)("info", arguments);
423
423
  }
424
424
  }, {
425
425
  key: "_debug",
426
426
  value: function() {
427
- this._config.debug === !0 && (0, v.log)("debug", arguments);
427
+ this._config.debug === !0 && (0, E.log)("debug", arguments);
428
428
  }
429
429
  }, {
430
430
  key: "_websocketSupported",
@@ -433,26 +433,26 @@ function Pt() {
433
433
  }
434
434
  }, {
435
435
  key: "_setFormat",
436
- value: function(t) {
437
- if (!this._formatOverride(t)) {
438
- if (t === "protobuf")
436
+ value: function(n) {
437
+ if (!this._formatOverride(n)) {
438
+ if (n === "protobuf")
439
439
  throw new Error("not implemented by JSON only Centrifuge client – use client with Protobuf");
440
440
  this._binary = !1, this._methodType = T.JsonMethodType, this._pushType = T.JsonPushType, this._encoder = new T.JsonEncoder(), this._decoder = new T.JsonDecoder();
441
441
  }
442
442
  }
443
443
  }, {
444
444
  key: "_formatOverride",
445
- value: function(t) {
445
+ value: function(n) {
446
446
  return !1;
447
447
  }
448
448
  }, {
449
449
  key: "_configure",
450
- value: function(t) {
450
+ value: function(n) {
451
451
  if (!("Promise" in g.g))
452
452
  throw new Error("Promise polyfill required");
453
- if ((0, v.extend)(this._config, t || {}), this._debug("centrifuge config", this._config), !this._url)
453
+ if ((0, E.extend)(this._config, n || {}), this._debug("centrifuge config", this._config), !this._url)
454
454
  throw new Error("url required");
455
- var r = (0, v.startsWith)(this._url, "ws") && this._url.indexOf("format=protobuf") > -1;
455
+ var r = (0, E.startsWith)(this._url, "ws") && this._url.indexOf("format=protobuf") > -1;
456
456
  if (r || this._config.protocol === "protobuf")
457
457
  this._setFormat("protobuf"), this._protocol = "protobuf";
458
458
  else {
@@ -460,7 +460,7 @@ function Pt() {
460
460
  throw new Error("unsupported protocol " + this._config.protocol);
461
461
  this._setFormat("json");
462
462
  }
463
- if ((0, v.startsWith)(this._url, "http"))
463
+ if ((0, E.startsWith)(this._url, "http"))
464
464
  if (this._debug("client will try to connect to SockJS endpoint"), this._config.sockjs !== null)
465
465
  this._debug("SockJS explicitly provided in options"), this._sockjs = this._config.sockjs;
466
466
  else {
@@ -474,8 +474,8 @@ function Pt() {
474
474
  }
475
475
  }, {
476
476
  key: "_setStatus",
477
- value: function(t) {
478
- this._status !== t && (this._debug("Status", this._status, "->", t), this._status = t);
477
+ value: function(n) {
478
+ this._status !== n && (this._debug("Status", this._status, "->", n), this._status = n);
479
479
  }
480
480
  }, {
481
481
  key: "_isDisconnected",
@@ -505,30 +505,30 @@ function Pt() {
505
505
  }, {
506
506
  key: "_getRetryInterval",
507
507
  value: function() {
508
- var t = (0, v.backoff)(this._retries, this._config.minRetry, this._config.maxRetry);
509
- return this._retries += 1, t;
508
+ var n = (0, E.backoff)(this._retries, this._config.minRetry, this._config.maxRetry);
509
+ return this._retries += 1, n;
510
510
  }
511
511
  }, {
512
512
  key: "_abortInflightXHRs",
513
513
  value: function() {
514
- for (var t in this._xhrs) {
514
+ for (var n in this._xhrs) {
515
515
  try {
516
- this._xhrs[t].abort();
516
+ this._xhrs[n].abort();
517
517
  } catch (r) {
518
518
  this._debug("error aborting xhr", r);
519
519
  }
520
- delete this._xhrs[t];
520
+ delete this._xhrs[n];
521
521
  }
522
522
  }
523
523
  }, {
524
524
  key: "_clearConnectedState",
525
- value: function(t) {
525
+ value: function(n) {
526
526
  this._clientID = null, this._stopPing();
527
527
  for (var r in this._callbacks)
528
528
  if (this._callbacks.hasOwnProperty(r)) {
529
- var a = this._callbacks[r];
530
- clearTimeout(a.timeout);
531
- var l = a.errback;
529
+ var c = this._callbacks[r];
530
+ clearTimeout(c.timeout);
531
+ var l = c.errback;
532
532
  if (!l)
533
533
  continue;
534
534
  l({
@@ -538,8 +538,8 @@ function Pt() {
538
538
  this._callbacks = {};
539
539
  for (var y in this._subs)
540
540
  if (this._subs.hasOwnProperty(y)) {
541
- var E = this._subs[y];
542
- t ? (E._isSuccess() && (E._triggerUnsubscribe(), E._recover = !0), E._shouldResubscribe() && E._setSubscribing()) : E._setUnsubscribed();
541
+ var v = this._subs[y];
542
+ n ? (v._isSuccess() && (v._triggerUnsubscribe(), v._recover = !0), v._shouldResubscribe() && v._setSubscribing()) : v._setUnsubscribed();
543
543
  }
544
544
  this._abortInflightXHRs(), this._refreshTimeout !== null && (clearTimeout(this._refreshTimeout), this._refreshTimeout = null);
545
545
  for (var I in this._subRefreshTimeouts)
@@ -553,15 +553,15 @@ function Pt() {
553
553
  }
554
554
  }, {
555
555
  key: "_transportSend",
556
- value: function(t) {
557
- if (!t.length)
556
+ value: function(n) {
557
+ if (!n.length)
558
558
  return !0;
559
559
  if (!this._isTransportOpen()) {
560
- for (var r in t) {
561
- var a = r.id;
562
- if (a in this._callbacks) {
563
- var l = this._callbacks[a];
564
- clearTimeout(this._callbacks[a].timeout), delete this._callbacks[a];
560
+ for (var r in n) {
561
+ var c = r.id;
562
+ if (c in this._callbacks) {
563
+ var l = this._callbacks[c];
564
+ clearTimeout(this._callbacks[c].timeout), delete this._callbacks[c];
565
565
  var y = l.errback;
566
566
  y({
567
567
  error: this._createErrorObject(N, 0)
@@ -570,7 +570,7 @@ function Pt() {
570
570
  }
571
571
  return !1;
572
572
  }
573
- return this._transport.send(this._encoder.encodeCommands(t)), !0;
573
+ return this._transport.send(this._encoder.encodeCommands(n)), !0;
574
574
  }
575
575
  }, {
576
576
  key: "_getSubProtocol",
@@ -580,7 +580,7 @@ function Pt() {
580
580
  }, {
581
581
  key: "_setupTransport",
582
582
  value: function() {
583
- var t = this;
583
+ var n = this;
584
584
  if (this._isSockjs = !1, this._sockjs !== null) {
585
585
  var r = {
586
586
  transports: this._config.sockjsTransports
@@ -590,79 +590,79 @@ function Pt() {
590
590
  if (!this._websocketSupported())
591
591
  throw this._debug("No Websocket support and no SockJS configured, can not connect"), new Error("No Websocket support and no SockJS configured, can not connect");
592
592
  this._config.websocket !== null ? this._websocket = this._config.websocket : this._websocket = WebSocket;
593
- var a = this._getSubProtocol();
594
- a !== "" ? this._transport = new this._websocket(this._url, a) : this._transport = new this._websocket(this._url), this._binary === !0 && (this._transport.binaryType = "arraybuffer");
593
+ var c = this._getSubProtocol();
594
+ c !== "" ? this._transport = new this._websocket(this._url, c) : this._transport = new this._websocket(this._url), this._binary === !0 && (this._transport.binaryType = "arraybuffer");
595
595
  }
596
596
  this._transport.onopen = function() {
597
- t._transportClosed = !1, t._isSockjs ? (t._transportName = "sockjs-" + t._transport.transport, t._transport.onheartbeat = function() {
598
- return t._restartPing();
599
- }) : t._transportName = "websocket";
597
+ n._transportClosed = !1, n._isSockjs ? (n._transportName = "sockjs-" + n._transport.transport, n._transport.onheartbeat = function() {
598
+ return n._restartPing();
599
+ }) : n._transportName = "websocket";
600
600
  var l = {
601
601
  // method: this._methodType.CONNECT
602
602
  };
603
- (t._token || t._connectData || t._config.name || t._config.version) && (l.params = {}), t._token && (l.params.token = t._token), t._connectData && (l.params.data = t._connectData), t._config.name && (l.params.name = t._config.name), t._config.version && (l.params.version = t._config.version);
604
- var y = {}, E = !1;
605
- for (var I in t._serverSubs)
606
- if (t._serverSubs.hasOwnProperty(I) && t._serverSubs[I].recoverable) {
607
- E = !0;
603
+ (n._token || n._connectData || n._config.name || n._config.version) && (l.params = {}), n._token && (l.params.token = n._token), n._connectData && (l.params.data = n._connectData), n._config.name && (l.params.name = n._config.name), n._config.version && (l.params.version = n._config.version);
604
+ var y = {}, v = !1;
605
+ for (var I in n._serverSubs)
606
+ if (n._serverSubs.hasOwnProperty(I) && n._serverSubs[I].recoverable) {
607
+ v = !0;
608
608
  var B = {
609
609
  recover: !0
610
610
  };
611
- t._serverSubs[I].seq || t._serverSubs[I].gen ? (t._serverSubs[I].seq && (B.seq = t._serverSubs[I].seq), t._serverSubs[I].gen && (B.gen = t._serverSubs[I].gen)) : t._serverSubs[I].offset && (B.offset = t._serverSubs[I].offset), t._serverSubs[I].epoch && (B.epoch = t._serverSubs[I].epoch), y[I] = B;
611
+ n._serverSubs[I].seq || n._serverSubs[I].gen ? (n._serverSubs[I].seq && (B.seq = n._serverSubs[I].seq), n._serverSubs[I].gen && (B.gen = n._serverSubs[I].gen)) : n._serverSubs[I].offset && (B.offset = n._serverSubs[I].offset), n._serverSubs[I].epoch && (B.epoch = n._serverSubs[I].epoch), y[I] = B;
612
612
  }
613
- E && (l.params || (l.params = {}), l.params.subs = y), t._latencyStart = /* @__PURE__ */ new Date(), t._call(l).then(function(R) {
614
- t._connectResponse(t._decoder.decodeCommandResult(t._methodType.CONNECT, R.result), E), R.next && R.next();
613
+ v && (l.params || (l.params = {}), l.params.subs = y), n._latencyStart = /* @__PURE__ */ new Date(), n._call(l).then(function(R) {
614
+ n._connectResponse(n._decoder.decodeCommandResult(n._methodType.CONNECT, R.result), v), R.next && R.next();
615
615
  }, function(R) {
616
616
  var X = R.error;
617
- X.code === 109 && (t._refreshRequired = !0), t._disconnect("connect error", !0), R.next && R.next();
617
+ X.code === 109 && (n._refreshRequired = !0), n._disconnect("connect error", !0), R.next && R.next();
618
618
  });
619
619
  }, this._transport.onerror = function(l) {
620
- t._debug("transport level error", l);
620
+ n._debug("transport level error", l);
621
621
  }, this._transport.onclose = function(l) {
622
- t._transportClosed = !0;
623
- var y = N, E = !0;
622
+ n._transportClosed = !0;
623
+ var y = N, v = !0;
624
624
  if (l && "reason" in l && l.reason)
625
625
  try {
626
626
  var I = JSON.parse(l.reason);
627
- t._debug("reason is an advice object", I), y = I.reason, E = I.reconnect;
627
+ n._debug("reason is an advice object", I), y = I.reason, v = I.reconnect;
628
628
  } catch {
629
- y = l.reason, t._debug("reason is a plain string", y);
629
+ y = l.reason, n._debug("reason is a plain string", y);
630
630
  }
631
- if (t._config.onTransportClose !== null && t._config.onTransportClose({
631
+ if (n._config.onTransportClose !== null && n._config.onTransportClose({
632
632
  event: l,
633
633
  reason: y,
634
- reconnect: E
635
- }), t._disconnect(y, E), t._reconnect === !0) {
636
- t._reconnecting = !0;
637
- var B = t._getRetryInterval();
638
- t._debug("reconnect after " + B + " milliseconds"), setTimeout(function() {
639
- t._reconnect === !0 && (t._refreshRequired ? t._refresh() : t._connect());
634
+ reconnect: v
635
+ }), n._disconnect(y, v), n._reconnect === !0) {
636
+ n._reconnecting = !0;
637
+ var B = n._getRetryInterval();
638
+ n._debug("reconnect after " + B + " milliseconds"), setTimeout(function() {
639
+ n._reconnect === !0 && (n._refreshRequired ? n._refresh() : n._connect());
640
640
  }, B);
641
641
  }
642
642
  }, this._transport.onmessage = function(l) {
643
- t._dataReceived(l.data);
643
+ n._dataReceived(l.data);
644
644
  };
645
645
  }
646
646
  }, {
647
647
  key: "rpc",
648
- value: function(t) {
649
- return this._rpc("", t);
648
+ value: function(n) {
649
+ return this._rpc("", n);
650
650
  }
651
651
  }, {
652
652
  key: "namedRPC",
653
- value: function(t, r) {
654
- return this._rpc(t, r);
653
+ value: function(n, r) {
654
+ return this._rpc(n, r);
655
655
  }
656
656
  }, {
657
657
  key: "_rpc",
658
- value: function(t, r) {
659
- var a = {
658
+ value: function(n, r) {
659
+ var c = {
660
660
  data: r
661
661
  };
662
- t !== "" && (a.method = t);
662
+ n !== "" && (c.method = n);
663
663
  var l = {
664
664
  method: this._methodType.RPC,
665
- params: a
665
+ params: c
666
666
  };
667
667
  return this._methodCall(l, function(y) {
668
668
  return y;
@@ -670,60 +670,60 @@ function Pt() {
670
670
  }
671
671
  }, {
672
672
  key: "send",
673
- value: function(t) {
673
+ value: function(n) {
674
674
  var r = {
675
675
  method: this._methodType.SEND,
676
676
  params: {
677
- data: t
677
+ data: n
678
678
  }
679
679
  };
680
680
  if (!this.isConnected())
681
681
  return Promise.reject(this._createErrorObject(N, 0));
682
- var a = this._transportSend([r]);
683
- return a ? Promise.resolve({}) : Promise.reject(this._createErrorObject(N, 0));
682
+ var c = this._transportSend([r]);
683
+ return c ? Promise.resolve({}) : Promise.reject(this._createErrorObject(N, 0));
684
684
  }
685
685
  }, {
686
686
  key: "_getHistoryParams",
687
- value: function(t, r) {
688
- var a = {
689
- channel: t
687
+ value: function(n, r) {
688
+ var c = {
689
+ channel: n
690
690
  };
691
- return r !== void 0 && (r.since && (a.since = {
691
+ return r !== void 0 && (r.since && (c.since = {
692
692
  offset: r.since.offset
693
- }, r.since.epoch && (a.since.epoch = r.since.epoch)), r.limit !== void 0 && (a.limit = r.limit), r.reverse === !0 && (a.reverse = !0)), a;
693
+ }, r.since.epoch && (c.since.epoch = r.since.epoch)), r.limit !== void 0 && (c.limit = r.limit), r.reverse === !0 && (c.reverse = !0)), c;
694
694
  }
695
695
  }, {
696
696
  key: "_methodCall",
697
- value: function(t, r) {
698
- var a = this;
697
+ value: function(n, r) {
698
+ var c = this;
699
699
  return this.isConnected() ? new Promise(function(l, y) {
700
- a._call(t).then(function(E) {
701
- l(r(a._decoder.decodeCommandResult(t.method, E.result))), E.next && E.next();
702
- }, function(E) {
703
- y(E.error), E.next && E.next();
700
+ c._call(n).then(function(v) {
701
+ l(r(c._decoder.decodeCommandResult(n.method, v.result))), v.next && v.next();
702
+ }, function(v) {
703
+ y(v.error), v.next && v.next();
704
704
  });
705
705
  }) : Promise.reject(this._createErrorObject(N, 0));
706
706
  }
707
707
  }, {
708
708
  key: "publish",
709
- value: function(t, r) {
710
- var a = {
709
+ value: function(n, r) {
710
+ var c = {
711
711
  method: this._methodType.PUBLISH,
712
712
  params: {
713
- channel: t,
713
+ channel: n,
714
714
  data: r
715
715
  }
716
716
  };
717
- return this._methodCall(a, function() {
717
+ return this._methodCall(c, function() {
718
718
  return {};
719
719
  });
720
720
  }
721
721
  }, {
722
722
  key: "history",
723
- value: function(t, r) {
724
- var a = this._getHistoryParams(t, r), l = {
723
+ value: function(n, r) {
724
+ var c = this._getHistoryParams(n, r), l = {
725
725
  method: this._methodType.HISTORY,
726
- params: a
726
+ params: c
727
727
  };
728
728
  return this._methodCall(l, function(y) {
729
729
  return {
@@ -735,78 +735,78 @@ function Pt() {
735
735
  }
736
736
  }, {
737
737
  key: "presence",
738
- value: function(t) {
738
+ value: function(n) {
739
739
  var r = {
740
740
  method: this._methodType.PRESENCE,
741
741
  params: {
742
- channel: t
742
+ channel: n
743
743
  }
744
744
  };
745
- return this._methodCall(r, function(a) {
745
+ return this._methodCall(r, function(c) {
746
746
  return {
747
- presence: a.presence
747
+ presence: c.presence
748
748
  };
749
749
  });
750
750
  }
751
751
  }, {
752
752
  key: "presenceStats",
753
- value: function(t) {
753
+ value: function(n) {
754
754
  var r = {
755
755
  method: this._methodType.PRESENCE_STATS,
756
756
  params: {
757
- channel: t
757
+ channel: n
758
758
  }
759
759
  };
760
- return this._methodCall(r, function(a) {
760
+ return this._methodCall(r, function(c) {
761
761
  return {
762
- num_users: a.num_users,
763
- num_clients: a.num_clients
762
+ num_users: c.num_users,
763
+ num_clients: c.num_clients
764
764
  };
765
765
  });
766
766
  }
767
767
  }, {
768
768
  key: "_dataReceived",
769
- value: function(t) {
770
- var r = this, a = this._decoder.decodeReplies(t);
769
+ value: function(n) {
770
+ var r = this, c = this._decoder.decodeReplies(n);
771
771
  this._dispatchPromise = this._dispatchPromise.then(function() {
772
772
  var l;
773
773
  r._dispatchPromise = new Promise(function(y) {
774
774
  l = y;
775
- }), r._dispatchSynchronized(a, l);
775
+ }), r._dispatchSynchronized(c, l);
776
776
  }), this._restartPing();
777
777
  }
778
778
  }, {
779
779
  key: "_dispatchSynchronized",
780
- value: function(t, r) {
781
- var a = this, l = Promise.resolve(), y = function(B) {
782
- t.hasOwnProperty(B) && (l = l.then(function() {
783
- return a._dispatchReply(t[B]);
780
+ value: function(n, r) {
781
+ var c = this, l = Promise.resolve(), y = function(B) {
782
+ n.hasOwnProperty(B) && (l = l.then(function() {
783
+ return c._dispatchReply(n[B]);
784
784
  }));
785
785
  };
786
- for (var E in t)
787
- y(E);
786
+ for (var v in n)
787
+ y(v);
788
788
  l = l.then(function() {
789
789
  r();
790
790
  });
791
791
  }
792
792
  }, {
793
793
  key: "_dispatchReply",
794
- value: function(t) {
795
- var r, a = new Promise(function(y) {
794
+ value: function(n) {
795
+ var r, c = new Promise(function(y) {
796
796
  r = y;
797
797
  });
798
- if (t == null)
799
- return this._debug("dispatch: got undefined or null reply"), r(), a;
800
- var l = t.id;
801
- return l && l > 0 ? this._handleReply(t, r) : this._handlePush(t.result, r), a;
798
+ if (n == null)
799
+ return this._debug("dispatch: got undefined or null reply"), r(), c;
800
+ var l = n.id;
801
+ return l && l > 0 ? this._handleReply(n, r) : this._handlePush(n.result, r), c;
802
802
  }
803
803
  }, {
804
804
  key: "_call",
805
- value: function(t) {
805
+ value: function(n) {
806
806
  var r = this;
807
- return new Promise(function(a, l) {
808
- var y = r._addMessage(t);
809
- r._registerCall(y, a, l);
807
+ return new Promise(function(c, l) {
808
+ var y = r._addMessage(n);
809
+ r._registerCall(y, c, l);
810
810
  });
811
811
  }
812
812
  }, {
@@ -820,23 +820,23 @@ function Pt() {
820
820
  }
821
821
  }, {
822
822
  key: "_disconnect",
823
- value: function(t, r) {
824
- var a = r || !1;
825
- if (a === !1 && (this._reconnect = !1), this._isDisconnected()) {
826
- a || this._clearConnectedState(a);
823
+ value: function(n, r) {
824
+ var c = r || !1;
825
+ if (c === !1 && (this._reconnect = !1), this._isDisconnected()) {
826
+ c || this._clearConnectedState(c);
827
827
  return;
828
828
  }
829
- if (this._clearConnectedState(a), this._debug("disconnected:", t, r), this._setStatus("disconnected"), this._refreshTimeout && (clearTimeout(this._refreshTimeout), this._refreshTimeout = null), this._reconnecting === !1) {
829
+ if (this._clearConnectedState(c), this._debug("disconnected:", n, r), this._setStatus("disconnected"), this._refreshTimeout && (clearTimeout(this._refreshTimeout), this._refreshTimeout = null), this._reconnecting === !1) {
830
830
  for (var l in this._serverSubs)
831
831
  this._serverSubs.hasOwnProperty(l) && this.emit("unsubscribe", {
832
832
  channel: l
833
833
  });
834
834
  this.emit("disconnect", {
835
- reason: t,
836
- reconnect: a
835
+ reason: n,
836
+ reconnect: c
837
837
  });
838
838
  }
839
- a === !1 && (this._subs = {}, this._serverSubs = {}), this._transportClosed || this._transport.close();
839
+ c === !1 && (this._subs = {}, this._serverSubs = {}), this._transportClosed || this._transport.close();
840
840
  }
841
841
  }, {
842
842
  key: "_refreshFailed",
@@ -846,43 +846,43 @@ function Pt() {
846
846
  }, {
847
847
  key: "_refresh",
848
848
  value: function() {
849
- var t = this;
849
+ var n = this;
850
850
  if (this._debug("refresh token"), this._config.refreshAttempts === 0) {
851
851
  this._debug("refresh attempts set to 0, do not send refresh request at all"), this._refreshFailed();
852
852
  return;
853
853
  }
854
854
  this._refreshTimeout !== null && (clearTimeout(this._refreshTimeout), this._refreshTimeout = null);
855
- var r = this._clientID, a = this._newXHRID(), l = function(B) {
856
- if (a in t._xhrs && delete t._xhrs[a], t._clientID === r) {
855
+ var r = this._clientID, c = this._newXHRID(), l = function(B) {
856
+ if (c in n._xhrs && delete n._xhrs[c], n._clientID === r) {
857
857
  if (B.error || B.status !== 200) {
858
- if (B.error ? t._debug("error refreshing connection token", B.error) : t._debug("error refreshing connection token: wrong status code", B.status), t._numRefreshFailed++, t._refreshTimeout !== null && (clearTimeout(t._refreshTimeout), t._refreshTimeout = null), t._config.refreshAttempts !== null && t._numRefreshFailed >= t._config.refreshAttempts) {
859
- t._refreshFailed();
858
+ if (B.error ? n._debug("error refreshing connection token", B.error) : n._debug("error refreshing connection token: wrong status code", B.status), n._numRefreshFailed++, n._refreshTimeout !== null && (clearTimeout(n._refreshTimeout), n._refreshTimeout = null), n._config.refreshAttempts !== null && n._numRefreshFailed >= n._config.refreshAttempts) {
859
+ n._refreshFailed();
860
860
  return;
861
861
  }
862
- var R = Math.round(Math.random() * 1e3 * Math.max(t._numRefreshFailed, 20)), X = t._config.refreshInterval + R;
863
- t._refreshTimeout = setTimeout(function() {
864
- return t._refresh();
862
+ var R = Math.round(Math.random() * 1e3 * Math.max(n._numRefreshFailed, 20)), X = n._config.refreshInterval + R;
863
+ n._refreshTimeout = setTimeout(function() {
864
+ return n._refresh();
865
865
  }, X);
866
866
  return;
867
867
  }
868
- if (t._numRefreshFailed = 0, t._token = B.data.token, !t._token) {
869
- t._refreshFailed();
868
+ if (n._numRefreshFailed = 0, n._token = B.data.token, !n._token) {
869
+ n._refreshFailed();
870
870
  return;
871
871
  }
872
- if (t._isDisconnected() && t._reconnect)
873
- t._debug("token refreshed, connect from scratch"), t._connect();
872
+ if (n._isDisconnected() && n._reconnect)
873
+ n._debug("token refreshed, connect from scratch"), n._connect();
874
874
  else {
875
- t._debug("send refreshed token");
875
+ n._debug("send refreshed token");
876
876
  var U = {
877
- method: t._methodType.REFRESH,
877
+ method: n._methodType.REFRESH,
878
878
  params: {
879
- token: t._token
879
+ token: n._token
880
880
  }
881
881
  };
882
- t._call(U).then(function(D) {
883
- t._refreshResponse(t._decoder.decodeCommandResult(t._methodType.REFRESH, D.result)), D.next && D.next();
882
+ n._call(U).then(function(D) {
883
+ n._refreshResponse(n._decoder.decodeCommandResult(n._methodType.REFRESH, D.result)), D.next && D.next();
884
884
  }, function(D) {
885
- t._refreshError(D.error), D.next && D.next();
885
+ n._refreshError(D.error), D.next && D.next();
886
886
  });
887
887
  }
888
888
  }
@@ -891,27 +891,27 @@ function Pt() {
891
891
  var y = {};
892
892
  this._config.onRefresh(y, l);
893
893
  } else {
894
- var E = this._ajax(this._config.refreshEndpoint, this._config.refreshParams, this._config.refreshHeaders, this._config.refreshData, l);
895
- this._xhrs[a] = E;
894
+ var v = this._ajax(this._config.refreshEndpoint, this._config.refreshParams, this._config.refreshHeaders, this._config.refreshData, l);
895
+ this._xhrs[c] = v;
896
896
  }
897
897
  }
898
898
  }, {
899
899
  key: "_refreshError",
900
- value: function(t) {
900
+ value: function(n) {
901
901
  var r = this;
902
- this._debug("refresh error", t), this._refreshTimeout && (clearTimeout(this._refreshTimeout), this._refreshTimeout = null);
903
- var a = this._config.refreshInterval + Math.round(Math.random() * 1e3);
902
+ this._debug("refresh error", n), this._refreshTimeout && (clearTimeout(this._refreshTimeout), this._refreshTimeout = null);
903
+ var c = this._config.refreshInterval + Math.round(Math.random() * 1e3);
904
904
  this._refreshTimeout = setTimeout(function() {
905
905
  return r._refresh();
906
- }, a);
906
+ }, c);
907
907
  }
908
908
  }, {
909
909
  key: "_refreshResponse",
910
- value: function(t) {
910
+ value: function(n) {
911
911
  var r = this;
912
- this._refreshTimeout && (clearTimeout(this._refreshTimeout), this._refreshTimeout = null), t.expires && (this._clientID = t.client, this._refreshTimeout = setTimeout(function() {
912
+ this._refreshTimeout && (clearTimeout(this._refreshTimeout), this._refreshTimeout = null), n.expires && (this._clientID = n.client, this._refreshTimeout = setTimeout(function() {
913
913
  return r._refresh();
914
- }, this._getTTLMilliseconds(t.ttl)));
914
+ }, this._getTTLMilliseconds(n.ttl)));
915
915
  }
916
916
  }, {
917
917
  key: "_newXHRID",
@@ -920,102 +920,102 @@ function Pt() {
920
920
  }
921
921
  }, {
922
922
  key: "_subRefresh",
923
- value: function(t) {
923
+ value: function(n) {
924
924
  var r = this;
925
- if (this._debug("refresh subscription token for channel", t), this._subRefreshTimeouts[t] !== void 0)
926
- this._clearSubRefreshTimeout(t);
925
+ if (this._debug("refresh subscription token for channel", n), this._subRefreshTimeouts[n] !== void 0)
926
+ this._clearSubRefreshTimeout(n);
927
927
  else
928
928
  return;
929
- var a = this._clientID, l = this._newXHRID(), y = function(R) {
930
- if (l in r._xhrs && delete r._xhrs[l], !(R.error || R.status !== 200 || r._clientID !== a)) {
929
+ var c = this._clientID, l = this._newXHRID(), y = function(R) {
930
+ if (l in r._xhrs && delete r._xhrs[l], !(R.error || R.status !== 200 || r._clientID !== c)) {
931
931
  var X = {};
932
932
  if (R.data.channels)
933
933
  for (var U in R.data.channels) {
934
934
  var D = R.data.channels[U];
935
935
  D.channel && (X[D.channel] = D.token);
936
936
  }
937
- var ne = X[t];
938
- if (ne) {
937
+ var re = X[n];
938
+ if (re) {
939
939
  var Pe = {
940
940
  method: r._methodType.SUB_REFRESH,
941
941
  params: {
942
- channel: t,
943
- token: ne
942
+ channel: n,
943
+ token: re
944
944
  }
945
- }, le = r._getSub(t);
946
- le !== null && r._call(Pe).then(function(V) {
947
- r._subRefreshResponse(t, r._decoder.decodeCommandResult(r._methodType.SUB_REFRESH, V.result)), V.next && V.next();
948
- }, function(V) {
949
- r._subRefreshError(t, V.error), V.next && V.next();
945
+ }, le = r._getSub(n);
946
+ le !== null && r._call(Pe).then(function(W) {
947
+ r._subRefreshResponse(n, r._decoder.decodeCommandResult(r._methodType.SUB_REFRESH, W.result)), W.next && W.next();
948
+ }, function(W) {
949
+ r._subRefreshError(n, W.error), W.next && W.next();
950
950
  });
951
951
  }
952
952
  }
953
- }, E = {
953
+ }, v = {
954
954
  client: this._clientID,
955
- channels: [t]
955
+ channels: [n]
956
956
  };
957
957
  if (this._config.onPrivateSubscribe !== null)
958
958
  this._config.onPrivateSubscribe({
959
- data: E
959
+ data: v
960
960
  }, y);
961
961
  else {
962
- var I = this._ajax(this._config.subscribeEndpoint, this._config.subscribeParams, this._config.subscribeHeaders, E, y);
962
+ var I = this._ajax(this._config.subscribeEndpoint, this._config.subscribeParams, this._config.subscribeHeaders, v, y);
963
963
  this._xhrs[l] = I;
964
964
  }
965
965
  }
966
966
  }, {
967
967
  key: "_clearSubRefreshTimeout",
968
- value: function(t) {
969
- this._subRefreshTimeouts[t] !== void 0 && (clearTimeout(this._subRefreshTimeouts[t]), delete this._subRefreshTimeouts[t]);
968
+ value: function(n) {
969
+ this._subRefreshTimeouts[n] !== void 0 && (clearTimeout(this._subRefreshTimeouts[n]), delete this._subRefreshTimeouts[n]);
970
970
  }
971
971
  }, {
972
972
  key: "_subRefreshError",
973
- value: function(t, r) {
974
- var a = this;
975
- this._debug("subscription refresh error", t, r), this._clearSubRefreshTimeout(t);
976
- var l = this._getSub(t);
973
+ value: function(n, r) {
974
+ var c = this;
975
+ this._debug("subscription refresh error", n, r), this._clearSubRefreshTimeout(n);
976
+ var l = this._getSub(n);
977
977
  if (l !== null) {
978
- var y = Math.round(Math.random() * 1e3), E = setTimeout(function() {
979
- return a._subRefresh(t);
978
+ var y = Math.round(Math.random() * 1e3), v = setTimeout(function() {
979
+ return c._subRefresh(n);
980
980
  }, this._config.subRefreshInterval + y);
981
- this._subRefreshTimeouts[t] = E;
981
+ this._subRefreshTimeouts[n] = v;
982
982
  }
983
983
  }
984
984
  }, {
985
985
  key: "_subRefreshResponse",
986
- value: function(t, r) {
987
- var a = this;
988
- this._debug("subscription refresh success", t), this._clearSubRefreshTimeout(t);
989
- var l = this._getSub(t);
986
+ value: function(n, r) {
987
+ var c = this;
988
+ this._debug("subscription refresh success", n), this._clearSubRefreshTimeout(n);
989
+ var l = this._getSub(n);
990
990
  if (l !== null && r.expires === !0) {
991
991
  var y = setTimeout(function() {
992
- return a._subRefresh(t);
992
+ return c._subRefresh(n);
993
993
  }, this._getTTLMilliseconds(r.ttl));
994
- this._subRefreshTimeouts[t] = y;
994
+ this._subRefreshTimeouts[n] = y;
995
995
  }
996
996
  }
997
997
  }, {
998
998
  key: "_subscribe",
999
- value: function(t, r) {
1000
- var a = this;
1001
- this._debug("subscribing on", t.channel);
1002
- var l = t.channel;
1003
- if (l in this._subs || (this._subs[l] = t), !this.isConnected()) {
1004
- t._setNew();
999
+ value: function(n, r) {
1000
+ var c = this;
1001
+ this._debug("subscribing on", n.channel);
1002
+ var l = n.channel;
1003
+ if (l in this._subs || (this._subs[l] = n), !this.isConnected()) {
1004
+ n._setNew();
1005
1005
  return;
1006
1006
  }
1007
- t._setSubscribing(r);
1007
+ n._setSubscribing(r);
1008
1008
  var y = {
1009
1009
  method: this._methodType.SUBSCRIBE,
1010
1010
  params: {
1011
1011
  channel: l
1012
1012
  }
1013
1013
  };
1014
- if (t._subscribeData && (y.params.data = t._subscribeData), (0, v.startsWith)(l, this._config.privateChannelPrefix))
1015
- this._isSubscribeBatching ? this._privateChannels[l] = !0 : (this.startSubscribeBatching(), this._subscribe(t), this.stopSubscribeBatching());
1014
+ if (n._subscribeData && (y.params.data = n._subscribeData), (0, E.startsWith)(l, this._config.privateChannelPrefix))
1015
+ this._isSubscribeBatching ? this._privateChannels[l] = !0 : (this.startSubscribeBatching(), this._subscribe(n), this.stopSubscribeBatching());
1016
1016
  else {
1017
- var E = t._needRecover();
1018
- if (E === !0) {
1017
+ var v = n._needRecover();
1018
+ if (v === !0) {
1019
1019
  y.params.recover = !0;
1020
1020
  var I = this._getLastSeq(l), B = this._getLastGen(l);
1021
1021
  if (I || B)
@@ -1028,88 +1028,88 @@ function Pt() {
1028
1028
  X && (y.params.epoch = X);
1029
1029
  }
1030
1030
  this._call(y).then(function(U) {
1031
- a._subscribeResponse(l, E, a._decoder.decodeCommandResult(a._methodType.SUBSCRIBE, U.result)), U.next && U.next();
1031
+ c._subscribeResponse(l, v, c._decoder.decodeCommandResult(c._methodType.SUBSCRIBE, U.result)), U.next && U.next();
1032
1032
  }, function(U) {
1033
- a._subscribeError(l, U.error), U.next && U.next();
1033
+ c._subscribeError(l, U.error), U.next && U.next();
1034
1034
  });
1035
1035
  }
1036
1036
  }
1037
1037
  }, {
1038
1038
  key: "_unsubscribe",
1039
- value: function(t) {
1040
- delete this._subs[t.channel], delete this._lastOffset[t.channel], delete this._lastSeq[t.channel], delete this._lastGen[t.channel], this.isConnected() && this._addMessage({
1039
+ value: function(n) {
1040
+ delete this._subs[n.channel], delete this._lastOffset[n.channel], delete this._lastSeq[n.channel], delete this._lastGen[n.channel], this.isConnected() && this._addMessage({
1041
1041
  method: this._methodType.UNSUBSCRIBE,
1042
1042
  params: {
1043
- channel: t.channel
1043
+ channel: n.channel
1044
1044
  }
1045
1045
  });
1046
1046
  }
1047
1047
  }, {
1048
1048
  key: "_getTTLMilliseconds",
1049
- value: function(t) {
1050
- return Math.min(t * 1e3, 2147483647);
1049
+ value: function(n) {
1050
+ return Math.min(n * 1e3, 2147483647);
1051
1051
  }
1052
1052
  }, {
1053
1053
  key: "getSub",
1054
- value: function(t) {
1055
- return this._getSub(t);
1054
+ value: function(n) {
1055
+ return this._getSub(n);
1056
1056
  }
1057
1057
  }, {
1058
1058
  key: "_getSub",
1059
- value: function(t) {
1060
- var r = this._subs[t];
1059
+ value: function(n) {
1060
+ var r = this._subs[n];
1061
1061
  return r || null;
1062
1062
  }
1063
1063
  }, {
1064
1064
  key: "_isServerSub",
1065
- value: function(t) {
1066
- return this._serverSubs[t] !== void 0;
1065
+ value: function(n) {
1066
+ return this._serverSubs[n] !== void 0;
1067
1067
  }
1068
1068
  }, {
1069
1069
  key: "_connectResponse",
1070
- value: function(t, r) {
1071
- var a = this, l = this._reconnecting;
1070
+ value: function(n, r) {
1071
+ var c = this, l = this._reconnecting;
1072
1072
  if (this._reconnecting = !1, this._resetRetry(), this._refreshRequired = !1, !this.isConnected()) {
1073
- this._latencyStart !== null && (this._latency = (/* @__PURE__ */ new Date()).getTime() - this._latencyStart.getTime(), this._latencyStart = null), this._clientID = t.client, this._setStatus("connected"), this._refreshTimeout && clearTimeout(this._refreshTimeout), t.expires && (this._refreshTimeout = setTimeout(function() {
1074
- return a._refresh();
1075
- }, this._getTTLMilliseconds(t.ttl))), this.startBatching(), this.startSubscribeBatching();
1073
+ this._latencyStart !== null && (this._latency = (/* @__PURE__ */ new Date()).getTime() - this._latencyStart.getTime(), this._latencyStart = null), this._clientID = n.client, this._setStatus("connected"), this._refreshTimeout && clearTimeout(this._refreshTimeout), n.expires && (this._refreshTimeout = setTimeout(function() {
1074
+ return c._refresh();
1075
+ }, this._getTTLMilliseconds(n.ttl))), this.startBatching(), this.startSubscribeBatching();
1076
1076
  for (var y in this._subs)
1077
1077
  if (this._subs.hasOwnProperty(y)) {
1078
- var E = this._subs[y];
1079
- E._shouldResubscribe() && this._subscribe(E, l);
1078
+ var v = this._subs[y];
1079
+ v._shouldResubscribe() && this._subscribe(v, l);
1080
1080
  }
1081
1081
  this.stopSubscribeBatching(), this.stopBatching(), this._startPing();
1082
1082
  var I = {
1083
- client: t.client,
1083
+ client: n.client,
1084
1084
  transport: this._transportName,
1085
1085
  latency: this._latency
1086
1086
  };
1087
- t.data && (I.data = t.data), this.emit("connect", I), t.subs && this._processServerSubs(t.subs);
1087
+ n.data && (I.data = n.data), this.emit("connect", I), n.subs && this._processServerSubs(n.subs);
1088
1088
  }
1089
1089
  }
1090
1090
  }, {
1091
1091
  key: "_processServerSubs",
1092
- value: function(t) {
1093
- for (var r in t)
1094
- if (t.hasOwnProperty(r)) {
1095
- var a = t[r], l = this._serverSubs[r] !== void 0, y = {
1092
+ value: function(n) {
1093
+ for (var r in n)
1094
+ if (n.hasOwnProperty(r)) {
1095
+ var c = n[r], l = this._serverSubs[r] !== void 0, y = {
1096
1096
  channel: r,
1097
1097
  isResubscribe: l
1098
1098
  };
1099
- y = this._expandSubscribeContext(y, a), this.emit("subscribe", y);
1099
+ y = this._expandSubscribeContext(y, c), this.emit("subscribe", y);
1100
1100
  }
1101
- for (var E in t)
1102
- if (t.hasOwnProperty(E)) {
1103
- var I = t[E];
1101
+ for (var v in n)
1102
+ if (n.hasOwnProperty(v)) {
1103
+ var I = n[v];
1104
1104
  if (I.recovered) {
1105
1105
  var B = I.publications;
1106
1106
  if (B && B.length > 0) {
1107
1107
  B.length > 1 && (!B[0].offset || B[0].offset > B[1].offset) && (B = B.reverse());
1108
1108
  for (var R in B)
1109
- B.hasOwnProperty(R) && this._handlePublication(E, B[R]);
1109
+ B.hasOwnProperty(R) && this._handlePublication(v, B[R]);
1110
1110
  }
1111
1111
  }
1112
- this._serverSubs[E] = {
1112
+ this._serverSubs[v] = {
1113
1113
  seq: I.seq,
1114
1114
  gen: I.gen,
1115
1115
  offset: I.offset,
@@ -1126,15 +1126,15 @@ function Pt() {
1126
1126
  }, {
1127
1127
  key: "_startPing",
1128
1128
  value: function() {
1129
- var t = this;
1129
+ var n = this;
1130
1130
  this._config.ping !== !0 || this._config.pingInterval <= 0 || this.isConnected() && (this._pingTimeout = setTimeout(function() {
1131
- if (!t.isConnected()) {
1132
- t._stopPing();
1131
+ if (!n.isConnected()) {
1132
+ n._stopPing();
1133
1133
  return;
1134
1134
  }
1135
- t.ping(), t._pongTimeout = setTimeout(function() {
1136
- t._disconnect("no ping", !0);
1137
- }, t._config.pongWaitTimeout);
1135
+ n.ping(), n._pongTimeout = setTimeout(function() {
1136
+ n._disconnect("no ping", !0);
1137
+ }, n._config.pongWaitTimeout);
1138
1138
  }, this._config.pingInterval));
1139
1139
  }
1140
1140
  }, {
@@ -1144,76 +1144,76 @@ function Pt() {
1144
1144
  }
1145
1145
  }, {
1146
1146
  key: "_subscribeError",
1147
- value: function(t, r) {
1148
- var a = this._getSub(t);
1149
- if (a && a._isSubscribing()) {
1147
+ value: function(n, r) {
1148
+ var c = this._getSub(n);
1149
+ if (c && c._isSubscribing()) {
1150
1150
  if (r.code === 0 && r.message === q) {
1151
1151
  this._disconnect("timeout", !0);
1152
1152
  return;
1153
1153
  }
1154
- a._setSubscribeError(r);
1154
+ c._setSubscribeError(r);
1155
1155
  }
1156
1156
  }
1157
1157
  }, {
1158
1158
  key: "_expandSubscribeContext",
1159
- value: function(t, r) {
1160
- var a = !1;
1161
- "recovered" in r && (a = r.recovered), t.recovered = a;
1159
+ value: function(n, r) {
1160
+ var c = !1;
1161
+ "recovered" in r && (c = r.recovered), n.recovered = c;
1162
1162
  var l = !1;
1163
1163
  "positioned" in r && (l = r.positioned);
1164
1164
  var y = "";
1165
1165
  "epoch" in r && (y = r.epoch);
1166
- var E = 0;
1167
- return "offset" in r && (E = r.offset), l && (t.streamPosition = {
1168
- offset: E,
1166
+ var v = 0;
1167
+ return "offset" in r && (v = r.offset), l && (n.streamPosition = {
1168
+ offset: v,
1169
1169
  epoch: y
1170
- }), r.data && (t.data = r.data), t;
1170
+ }), r.data && (n.data = r.data), n;
1171
1171
  }
1172
1172
  }, {
1173
1173
  key: "_subscribeResponse",
1174
- value: function(t, r, a) {
1175
- var l = this, y = this._getSub(t);
1174
+ value: function(n, r, c) {
1175
+ var l = this, y = this._getSub(n);
1176
1176
  if (y && y._isSubscribing()) {
1177
- y._setSubscribeSuccess(a);
1178
- var E = a.publications;
1179
- if (E && E.length > 0) {
1180
- E.length >= 2 && !E[0].offset && !E[1].offset && (E = E.reverse());
1181
- for (var I in E)
1182
- E.hasOwnProperty(I) && this._handlePublication(t, E[I]);
1177
+ y._setSubscribeSuccess(c);
1178
+ var v = c.publications;
1179
+ if (v && v.length > 0) {
1180
+ v.length >= 2 && !v[0].offset && !v[1].offset && (v = v.reverse());
1181
+ for (var I in v)
1182
+ v.hasOwnProperty(I) && this._handlePublication(n, v[I]);
1183
1183
  }
1184
- if (a.recoverable && (!r || !a.recovered) && (this._lastSeq[t] = a.seq || 0, this._lastGen[t] = a.gen || 0, this._lastOffset[t] = a.offset || 0), this._lastEpoch[t] = a.epoch || "", a.recoverable && (y._recoverable = !0), a.expires === !0) {
1184
+ if (c.recoverable && (!r || !c.recovered) && (this._lastSeq[n] = c.seq || 0, this._lastGen[n] = c.gen || 0, this._lastOffset[n] = c.offset || 0), this._lastEpoch[n] = c.epoch || "", c.recoverable && (y._recoverable = !0), c.expires === !0) {
1185
1185
  var B = setTimeout(function() {
1186
- return l._subRefresh(t);
1187
- }, this._getTTLMilliseconds(a.ttl));
1188
- this._subRefreshTimeouts[t] = B;
1186
+ return l._subRefresh(n);
1187
+ }, this._getTTLMilliseconds(c.ttl));
1188
+ this._subRefreshTimeouts[n] = B;
1189
1189
  }
1190
1190
  }
1191
1191
  }
1192
1192
  }, {
1193
1193
  key: "_handleReply",
1194
- value: function(t, r) {
1195
- var a = t.id, l = t.result;
1196
- if (!(a in this._callbacks)) {
1194
+ value: function(n, r) {
1195
+ var c = n.id, l = n.result;
1196
+ if (!(c in this._callbacks)) {
1197
1197
  r();
1198
1198
  return;
1199
1199
  }
1200
- var y = this._callbacks[a];
1201
- if (clearTimeout(this._callbacks[a].timeout), delete this._callbacks[a], (0, v.errorExists)(t)) {
1200
+ var y = this._callbacks[c];
1201
+ if (clearTimeout(this._callbacks[c].timeout), delete this._callbacks[c], (0, E.errorExists)(n)) {
1202
1202
  var I = y.errback;
1203
1203
  if (!I) {
1204
1204
  r();
1205
1205
  return;
1206
1206
  }
1207
- var B = t.error;
1207
+ var B = n.error;
1208
1208
  I({
1209
1209
  error: B,
1210
1210
  next: r
1211
1211
  });
1212
1212
  } else {
1213
- var E = y.callback;
1214
- if (!E)
1213
+ var v = y.callback;
1214
+ if (!v)
1215
1215
  return;
1216
- E({
1216
+ v({
1217
1217
  result: l,
1218
1218
  next: r
1219
1219
  });
@@ -1221,97 +1221,97 @@ function Pt() {
1221
1221
  }
1222
1222
  }, {
1223
1223
  key: "_handleJoin",
1224
- value: function(t, r) {
1225
- var a = {
1224
+ value: function(n, r) {
1225
+ var c = {
1226
1226
  info: r.info
1227
- }, l = this._getSub(t);
1227
+ }, l = this._getSub(n);
1228
1228
  if (!l) {
1229
- this._isServerSub(t) && (a.channel = t, this.emit("join", a));
1229
+ this._isServerSub(n) && (c.channel = n, this.emit("join", c));
1230
1230
  return;
1231
1231
  }
1232
- l.emit("join", a);
1232
+ l.emit("join", c);
1233
1233
  }
1234
1234
  }, {
1235
1235
  key: "_handleLeave",
1236
- value: function(t, r) {
1237
- var a = {
1236
+ value: function(n, r) {
1237
+ var c = {
1238
1238
  info: r.info
1239
- }, l = this._getSub(t);
1239
+ }, l = this._getSub(n);
1240
1240
  if (!l) {
1241
- this._isServerSub(t) && (a.channel = t, this.emit("leave", a));
1241
+ this._isServerSub(n) && (c.channel = n, this.emit("leave", c));
1242
1242
  return;
1243
1243
  }
1244
- l.emit("leave", a);
1244
+ l.emit("leave", c);
1245
1245
  }
1246
1246
  }, {
1247
1247
  key: "_handleUnsub",
1248
- value: function(t, r) {
1249
- var a = {}, l = this._getSub(t);
1248
+ value: function(n, r) {
1249
+ var c = {}, l = this._getSub(n);
1250
1250
  if (!l) {
1251
- this._isServerSub(t) && (delete this._serverSubs[t], a.channel = t, this.emit("unsubscribe", a));
1251
+ this._isServerSub(n) && (delete this._serverSubs[n], c.channel = n, this.emit("unsubscribe", c));
1252
1252
  return;
1253
1253
  }
1254
1254
  l.unsubscribe(), r.resubscribe === !0 && l.subscribe();
1255
1255
  }
1256
1256
  }, {
1257
1257
  key: "_handleSub",
1258
- value: function(t, r) {
1259
- this._serverSubs[t] = {
1258
+ value: function(n, r) {
1259
+ this._serverSubs[n] = {
1260
1260
  seq: r.seq,
1261
1261
  gen: r.gen,
1262
1262
  offset: r.offset,
1263
1263
  epoch: r.epoch,
1264
1264
  recoverable: r.recoverable
1265
1265
  };
1266
- var a = {
1267
- channel: t,
1266
+ var c = {
1267
+ channel: n,
1268
1268
  isResubscribe: !1
1269
1269
  };
1270
- a = this._expandSubscribeContext(a, r), this.emit("subscribe", a);
1270
+ c = this._expandSubscribeContext(c, r), this.emit("subscribe", c);
1271
1271
  }
1272
1272
  }, {
1273
1273
  key: "_handlePublication",
1274
- value: function(t, r) {
1275
- var a = this._getSub(t), l = {
1274
+ value: function(n, r) {
1275
+ var c = this._getSub(n), l = {
1276
1276
  data: r.data,
1277
1277
  seq: r.seq,
1278
1278
  gen: r.gen,
1279
1279
  offset: r.offset
1280
1280
  };
1281
- if (r.info && (l.info = r.info), !a) {
1282
- this._isServerSub(t) && (r.seq !== void 0 && (this._serverSubs[t].seq = r.seq), r.gen !== void 0 && (this._serverSubs[t].gen = r.gen), r.offset !== void 0 && (this._serverSubs[t].offset = r.offset), l.channel = t, this.emit("publish", l));
1281
+ if (r.info && (l.info = r.info), !c) {
1282
+ this._isServerSub(n) && (r.seq !== void 0 && (this._serverSubs[n].seq = r.seq), r.gen !== void 0 && (this._serverSubs[n].gen = r.gen), r.offset !== void 0 && (this._serverSubs[n].offset = r.offset), l.channel = n, this.emit("publish", l));
1283
1283
  return;
1284
1284
  }
1285
- r.seq !== void 0 && (this._lastSeq[t] = r.seq), r.gen !== void 0 && (this._lastGen[t] = r.gen), r.offset !== void 0 && (this._lastOffset[t] = r.offset), a.emit("publish", l);
1285
+ r.seq !== void 0 && (this._lastSeq[n] = r.seq), r.gen !== void 0 && (this._lastGen[n] = r.gen), r.offset !== void 0 && (this._lastOffset[n] = r.offset), c.emit("publish", l);
1286
1286
  }
1287
1287
  }, {
1288
1288
  key: "_handleMessage",
1289
- value: function(t) {
1290
- this.emit("message", t.data);
1289
+ value: function(n) {
1290
+ this.emit("message", n.data);
1291
1291
  }
1292
1292
  }, {
1293
1293
  key: "_handlePush",
1294
- value: function(t, r) {
1295
- var a = this._decoder.decodePush(t), l = 0;
1296
- "type" in a && (l = a.type);
1297
- var y = a.channel;
1294
+ value: function(n, r) {
1295
+ var c = this._decoder.decodePush(n), l = 0;
1296
+ "type" in c && (l = c.type);
1297
+ var y = c.channel;
1298
1298
  if (l === this._pushType.PUBLICATION) {
1299
- var E = this._decoder.decodePushData(this._pushType.PUBLICATION, a.data);
1300
- this._handlePublication(y, E);
1299
+ var v = this._decoder.decodePushData(this._pushType.PUBLICATION, c.data);
1300
+ this._handlePublication(y, v);
1301
1301
  } else if (l === this._pushType.MESSAGE) {
1302
- var I = this._decoder.decodePushData(this._pushType.MESSAGE, a.data);
1302
+ var I = this._decoder.decodePushData(this._pushType.MESSAGE, c.data);
1303
1303
  this._handleMessage(I);
1304
1304
  } else if (l === this._pushType.JOIN) {
1305
- var B = this._decoder.decodePushData(this._pushType.JOIN, a.data);
1305
+ var B = this._decoder.decodePushData(this._pushType.JOIN, c.data);
1306
1306
  this._handleJoin(y, B);
1307
1307
  } else if (l === this._pushType.LEAVE) {
1308
- var R = this._decoder.decodePushData(this._pushType.LEAVE, a.data);
1308
+ var R = this._decoder.decodePushData(this._pushType.LEAVE, c.data);
1309
1309
  this._handleLeave(y, R);
1310
1310
  } else if (l === this._pushType.UNSUBSCRIBE) {
1311
- var X = this._decoder.decodePushData(this._pushType.UNSUBSCRIBE, a.data);
1311
+ var X = this._decoder.decodePushData(this._pushType.UNSUBSCRIBE, c.data);
1312
1312
  this._handleUnsub(y, X);
1313
1313
  } else if (l === this._pushType.SUBSCRIBE) {
1314
- var U = this._decoder.decodePushData(this._pushType.UNSUBSCRIBE, a.data);
1314
+ var U = this._decoder.decodePushData(this._pushType.UNSUBSCRIBE, c.data);
1315
1315
  this._handleSub(y, U);
1316
1316
  }
1317
1317
  r();
@@ -1319,78 +1319,78 @@ function Pt() {
1319
1319
  }, {
1320
1320
  key: "_flush",
1321
1321
  value: function() {
1322
- var t = this._messages.slice(0);
1323
- this._messages = [], this._transportSend(t);
1322
+ var n = this._messages.slice(0);
1323
+ this._messages = [], this._transportSend(n);
1324
1324
  }
1325
1325
  }, {
1326
1326
  key: "_ping",
1327
1327
  value: function() {
1328
- var t = this, r = {
1328
+ var n = this, r = {
1329
1329
  method: this._methodType.PING
1330
1330
  };
1331
- this._call(r).then(function(a) {
1332
- t._pingResponse(t._decoder.decodeCommandResult(t._methodType.PING, a.result)), a.next && a.next();
1333
- }, function(a) {
1334
- t._debug("ping error", a.error), a.next && a.next();
1331
+ this._call(r).then(function(c) {
1332
+ n._pingResponse(n._decoder.decodeCommandResult(n._methodType.PING, c.result)), c.next && c.next();
1333
+ }, function(c) {
1334
+ n._debug("ping error", c.error), c.next && c.next();
1335
1335
  });
1336
1336
  }
1337
1337
  }, {
1338
1338
  key: "_pingResponse",
1339
- value: function(t) {
1339
+ value: function(n) {
1340
1340
  this.isConnected() && (this._stopPing(), this._startPing());
1341
1341
  }
1342
1342
  }, {
1343
1343
  key: "_getLastSeq",
1344
- value: function(t) {
1345
- var r = this._lastSeq[t];
1344
+ value: function(n) {
1345
+ var r = this._lastSeq[n];
1346
1346
  return r || 0;
1347
1347
  }
1348
1348
  }, {
1349
1349
  key: "_getLastOffset",
1350
- value: function(t) {
1351
- var r = this._lastOffset[t];
1350
+ value: function(n) {
1351
+ var r = this._lastOffset[n];
1352
1352
  return r || 0;
1353
1353
  }
1354
1354
  }, {
1355
1355
  key: "_getLastGen",
1356
- value: function(t) {
1357
- var r = this._lastGen[t];
1356
+ value: function(n) {
1357
+ var r = this._lastGen[n];
1358
1358
  return r || 0;
1359
1359
  }
1360
1360
  }, {
1361
1361
  key: "_getLastEpoch",
1362
- value: function(t) {
1363
- var r = this._lastEpoch[t];
1362
+ value: function(n) {
1363
+ var r = this._lastEpoch[n];
1364
1364
  return r || "";
1365
1365
  }
1366
1366
  }, {
1367
1367
  key: "_createErrorObject",
1368
- value: function(t, r) {
1369
- var a = {
1370
- message: t,
1368
+ value: function(n, r) {
1369
+ var c = {
1370
+ message: n,
1371
1371
  code: r || 0
1372
1372
  };
1373
- return a;
1373
+ return c;
1374
1374
  }
1375
1375
  }, {
1376
1376
  key: "_registerCall",
1377
- value: function(t, r, a) {
1377
+ value: function(n, r, c) {
1378
1378
  var l = this;
1379
- this._callbacks[t] = {
1379
+ this._callbacks[n] = {
1380
1380
  callback: r,
1381
- errback: a,
1381
+ errback: c,
1382
1382
  timeout: null
1383
- }, this._callbacks[t].timeout = setTimeout(function() {
1384
- delete l._callbacks[t], (0, v.isFunction)(a) && a({
1383
+ }, this._callbacks[n].timeout = setTimeout(function() {
1384
+ delete l._callbacks[n], (0, E.isFunction)(c) && c({
1385
1385
  error: l._createErrorObject(q)
1386
1386
  });
1387
1387
  }, this._config.timeout);
1388
1388
  }
1389
1389
  }, {
1390
1390
  key: "_addMessage",
1391
- value: function(t) {
1391
+ value: function(n) {
1392
1392
  var r = this._nextMessageId();
1393
- return t.id = r, this._isBatching === !0 ? this._messages.push(t) : this._transportSend([t]), r;
1393
+ return n.id = r, this._isBatching === !0 ? this._messages.push(n) : this._transportSend([n]), r;
1394
1394
  }
1395
1395
  }, {
1396
1396
  key: "isConnected",
@@ -1430,106 +1430,106 @@ function Pt() {
1430
1430
  }, {
1431
1431
  key: "stopSubscribeBatching",
1432
1432
  value: function() {
1433
- var t = this;
1433
+ var n = this;
1434
1434
  this._isSubscribeBatching = !1;
1435
1435
  var r = this._privateChannels;
1436
1436
  this._privateChannels = {};
1437
- var a = [];
1437
+ var c = [];
1438
1438
  for (var l in r)
1439
1439
  if (r.hasOwnProperty(l)) {
1440
1440
  var y = this._getSub(l);
1441
1441
  if (!y)
1442
1442
  continue;
1443
- a.push(l);
1443
+ c.push(l);
1444
1444
  }
1445
- if (a.length === 0) {
1445
+ if (c.length === 0) {
1446
1446
  this._debug("no private channels found, no need to make request");
1447
1447
  return;
1448
1448
  }
1449
- var E = {
1449
+ var v = {
1450
1450
  client: this._clientID,
1451
- channels: a
1451
+ channels: c
1452
1452
  }, I = this._clientID, B = this._newXHRID(), R = function(D) {
1453
- if (B in t._xhrs && delete t._xhrs[B], t._clientID === I) {
1453
+ if (B in n._xhrs && delete n._xhrs[B], n._clientID === I) {
1454
1454
  if (D.error || D.status !== 200) {
1455
- t._debug("authorization request failed");
1456
- for (var ne in a)
1457
- if (a.hasOwnProperty(ne)) {
1458
- var Pe = a[ne];
1459
- t._subscribeError(Pe, t._createErrorObject("authorization request failed"));
1455
+ n._debug("authorization request failed");
1456
+ for (var re in c)
1457
+ if (c.hasOwnProperty(re)) {
1458
+ var Pe = c[re];
1459
+ n._subscribeError(Pe, n._createErrorObject("authorization request failed"));
1460
1460
  }
1461
1461
  return;
1462
1462
  }
1463
1463
  var le = {};
1464
1464
  if (D.data.channels)
1465
- for (var V in D.data.channels) {
1466
- var ke = D.data.channels[V];
1465
+ for (var W in D.data.channels) {
1466
+ var ke = D.data.channels[W];
1467
1467
  ke.channel && (le[ke.channel] = ke.token);
1468
1468
  }
1469
1469
  var Ue = !1;
1470
- t._isBatching || (t.startBatching(), Ue = !0);
1471
- for (var He in a)
1472
- if (a.hasOwnProperty(He)) {
1473
- var Ct = (function() {
1474
- var z = a[He], xe = le[z];
1470
+ n._isBatching || (n.startBatching(), Ue = !0);
1471
+ for (var He in c)
1472
+ if (c.hasOwnProperty(He)) {
1473
+ var yt = (function() {
1474
+ var z = c[He], xe = le[z];
1475
1475
  if (xe) {
1476
- var re = {
1477
- method: t._methodType.SUBSCRIBE,
1476
+ var oe = {
1477
+ method: n._methodType.SUBSCRIBE,
1478
1478
  params: {
1479
1479
  channel: z,
1480
1480
  token: xe
1481
1481
  }
1482
- }, Fe = t._getSub(z);
1482
+ }, Fe = n._getSub(z);
1483
1483
  if (Fe === null)
1484
1484
  return "continue";
1485
1485
  var Je = Fe._needRecover();
1486
1486
  if (Je === !0) {
1487
- re.params.recover = !0;
1488
- var we = t._getLastSeq(z), _e = t._getLastGen(z);
1487
+ oe.params.recover = !0;
1488
+ var we = n._getLastSeq(z), _e = n._getLastGen(z);
1489
1489
  if (we || _e)
1490
- we && (re.params.seq = we), _e && (re.params.gen = _e);
1490
+ we && (oe.params.seq = we), _e && (oe.params.gen = _e);
1491
1491
  else {
1492
- var qe = t._getLastOffset(z);
1493
- qe && (re.params.offset = qe);
1492
+ var qe = n._getLastOffset(z);
1493
+ qe && (oe.params.offset = qe);
1494
1494
  }
1495
- var je = t._getLastEpoch(z);
1496
- je && (re.params.epoch = je);
1495
+ var je = n._getLastEpoch(z);
1496
+ je && (oe.params.epoch = je);
1497
1497
  }
1498
- t._call(re).then(function(Y) {
1499
- t._subscribeResponse(z, Je, t._decoder.decodeCommandResult(t._methodType.SUBSCRIBE, Y.result)), Y.next && Y.next();
1498
+ n._call(oe).then(function(Y) {
1499
+ n._subscribeResponse(z, Je, n._decoder.decodeCommandResult(n._methodType.SUBSCRIBE, Y.result)), Y.next && Y.next();
1500
1500
  }, function(Y) {
1501
- t._subscribeError(z, Y.error), Y.next && Y.next();
1501
+ n._subscribeError(z, Y.error), Y.next && Y.next();
1502
1502
  });
1503
1503
  } else
1504
- return t._subscribeError(z, t._createErrorObject("permission denied", 103)), "continue";
1504
+ return n._subscribeError(z, n._createErrorObject("permission denied", 103)), "continue";
1505
1505
  })();
1506
- if (Ct === "continue") continue;
1506
+ if (yt === "continue") continue;
1507
1507
  }
1508
- Ue && t.stopBatching();
1508
+ Ue && n.stopBatching();
1509
1509
  }
1510
1510
  };
1511
1511
  if (this._config.onPrivateSubscribe !== null)
1512
1512
  this._config.onPrivateSubscribe({
1513
- data: E
1513
+ data: v
1514
1514
  }, R);
1515
1515
  else {
1516
- var X = this._ajax(this._config.subscribeEndpoint, this._config.subscribeParams, this._config.subscribeHeaders, E, R);
1516
+ var X = this._ajax(this._config.subscribeEndpoint, this._config.subscribeParams, this._config.subscribeHeaders, v, R);
1517
1517
  this._xhrs[B] = X;
1518
1518
  }
1519
1519
  }
1520
1520
  }, {
1521
1521
  key: "_setSubscribeSince",
1522
- value: function(t, r) {
1523
- this._lastOffset[t.channel] = r.offset, this._lastEpoch[t.channel] = r.epoch, t._setNeedRecover(!0);
1522
+ value: function(n, r) {
1523
+ this._lastOffset[n.channel] = r.offset, this._lastEpoch[n.channel] = r.epoch, n._setNeedRecover(!0);
1524
1524
  }
1525
1525
  }, {
1526
1526
  key: "subscribe",
1527
- value: function(t, r, a) {
1528
- var l = this._getSub(t);
1527
+ value: function(n, r, c) {
1528
+ var l = this._getSub(n);
1529
1529
  if (l !== null)
1530
- return l._setEvents(r), l._isUnsubscribed() && l.subscribe(a), l;
1531
- var y = new S.default(this, t, r);
1532
- return this._subs[t] = y, y.subscribe(a), y;
1530
+ return l._setEvents(r), l._isUnsubscribed() && l.subscribe(c), l;
1531
+ var y = new S.default(this, n, r);
1532
+ return this._subs[n] = y, y.subscribe(c), y;
1533
1533
  }
1534
1534
  }]), p;
1535
1535
  })(C.default);
@@ -1539,18 +1539,18 @@ function Pt() {
1539
1539
  /***/
1540
1540
  579: (
1541
1541
  /***/
1542
- (function(c, d, g) {
1542
+ (function(a, d, g) {
1543
1543
  Object.defineProperty(d, "__esModule", {
1544
1544
  value: !0
1545
1545
  }), d.default = void 0;
1546
1546
  var C = g(382), S = C.Centrifuge;
1547
- d.default = S, c.exports = d.default;
1547
+ d.default = S, a.exports = d.default;
1548
1548
  })
1549
1549
  ),
1550
1550
  /***/
1551
1551
  147: (
1552
1552
  /***/
1553
- (function(c, d) {
1553
+ (function(a, d) {
1554
1554
  Object.defineProperty(d, "__esModule", {
1555
1555
  value: !0
1556
1556
  }), d.JsonPushType = d.JsonMethodType = d.JsonEncoder = d.JsonDecoder = void 0;
@@ -1582,7 +1582,7 @@ function Pt() {
1582
1582
  SUB_REFRESH: 11
1583
1583
  };
1584
1584
  d.JsonMethodType = T;
1585
- var v = {
1585
+ var E = {
1586
1586
  PUBLICATION: 0,
1587
1587
  JOIN: 1,
1588
1588
  LEAVE: 2,
@@ -1590,7 +1590,7 @@ function Pt() {
1590
1590
  MESSAGE: 4,
1591
1591
  SUBSCRIBE: 5
1592
1592
  };
1593
- d.JsonPushType = v;
1593
+ d.JsonPushType = E;
1594
1594
  var Q = /* @__PURE__ */ (function() {
1595
1595
  function m() {
1596
1596
  g(this, m);
@@ -1643,7 +1643,7 @@ function Pt() {
1643
1643
  /***/
1644
1644
  471: (
1645
1645
  /***/
1646
- (function(c, d, g) {
1646
+ (function(a, d, g) {
1647
1647
  function C(h) {
1648
1648
  "@babel/helpers - typeof";
1649
1649
  return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? C = function(A) {
@@ -1655,8 +1655,8 @@ function Pt() {
1655
1655
  Object.defineProperty(d, "__esModule", {
1656
1656
  value: !0
1657
1657
  }), d.default = void 0;
1658
- var S = v(g(187)), T = g(853);
1659
- function v(h) {
1658
+ var S = E(g(187)), T = g(853);
1659
+ function E(h) {
1660
1660
  return h && h.__esModule ? h : { default: h };
1661
1661
  }
1662
1662
  function Q(h, p) {
@@ -1665,8 +1665,8 @@ function Pt() {
1665
1665
  }
1666
1666
  function _(h, p) {
1667
1667
  for (var A = 0; A < p.length; A++) {
1668
- var t = p[A];
1669
- t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(h, t.key, t);
1668
+ var n = p[A];
1669
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(h, n.key, n);
1670
1670
  }
1671
1671
  }
1672
1672
  function m(h, p, A) {
@@ -1678,19 +1678,19 @@ function Pt() {
1678
1678
  h.prototype = Object.create(p && p.prototype, { constructor: { value: h, writable: !0, configurable: !0 } }), p && k(h, p);
1679
1679
  }
1680
1680
  function k(h, p) {
1681
- return k = Object.setPrototypeOf || function(t, r) {
1682
- return t.__proto__ = r, t;
1681
+ return k = Object.setPrototypeOf || function(n, r) {
1682
+ return n.__proto__ = r, n;
1683
1683
  }, k(h, p);
1684
1684
  }
1685
1685
  function w(h) {
1686
1686
  var p = F();
1687
1687
  return function() {
1688
- var t = M(h), r;
1688
+ var n = M(h), r;
1689
1689
  if (p) {
1690
- var a = M(this).constructor;
1691
- r = Reflect.construct(t, arguments, a);
1690
+ var c = M(this).constructor;
1691
+ r = Reflect.construct(n, arguments, c);
1692
1692
  } else
1693
- r = t.apply(this, arguments);
1693
+ r = n.apply(this, arguments);
1694
1694
  return L(this, r);
1695
1695
  };
1696
1696
  }
@@ -1724,9 +1724,9 @@ function Pt() {
1724
1724
  var J = 0, x = 1, q = 2, N = 3, b = 4, f = /* @__PURE__ */ (function(h) {
1725
1725
  P(A, h);
1726
1726
  var p = w(A);
1727
- function A(t, r, a) {
1727
+ function A(n, r, c) {
1728
1728
  var l;
1729
- return Q(this, A), l = p.call(this), l.channel = r, l._centrifuge = t, l._status = J, l._error = null, l._isResubscribe = !1, l._ready = !1, l._subscriptionPromise = null, l._noResubscribe = !1, l._recoverable = !1, l._recover = !1, l._setEvents(a), l._initializePromise(), l._promises = {}, l._promiseId = 0, l._subscribeData = null, l.on("error", function(y) {
1729
+ return Q(this, A), l = p.call(this), l.channel = r, l._centrifuge = n, l._status = J, l._error = null, l._isResubscribe = !1, l._ready = !1, l._subscriptionPromise = null, l._noResubscribe = !1, l._recoverable = !1, l._recover = !1, l._setEvents(c), l._initializePromise(), l._promises = {}, l._promiseId = 0, l._subscribeData = null, l.on("error", function(y) {
1730
1730
  this._centrifuge._debug("subscription error", y);
1731
1731
  }), l;
1732
1732
  }
@@ -1739,9 +1739,9 @@ function Pt() {
1739
1739
  key: "_initializePromise",
1740
1740
  value: function() {
1741
1741
  var r = this;
1742
- this._ready = !1, this._subscriptionPromise = new Promise(function(a, l) {
1742
+ this._ready = !1, this._subscriptionPromise = new Promise(function(c, l) {
1743
1743
  r._resolve = function(y) {
1744
- r._ready = !0, a(y);
1744
+ r._ready = !0, c(y);
1745
1745
  }, r._reject = function(y) {
1746
1746
  r._ready = !0, l(y);
1747
1747
  };
@@ -1766,9 +1766,9 @@ function Pt() {
1766
1766
  if ((0, T.isFunction)(r))
1767
1767
  this.on("publish", r);
1768
1768
  else if (Object.prototype.toString.call(r) === Object.prototype.toString.call({}))
1769
- for (var a = ["publish", "join", "leave", "unsubscribe", "subscribe", "error"], l = 0, y = a.length; l < y; l++) {
1770
- var E = a[l];
1771
- E in r && this.on(E, r[E]);
1769
+ for (var c = ["publish", "join", "leave", "unsubscribe", "subscribe", "error"], l = 0, y = c.length; l < y; l++) {
1770
+ var v = c[l];
1771
+ v in r && this.on(v, r[v]);
1772
1772
  }
1773
1773
  }
1774
1774
  }
@@ -1817,8 +1817,8 @@ function Pt() {
1817
1817
  value: function(r) {
1818
1818
  if (this._status !== q) {
1819
1819
  this._status = q;
1820
- var a = this._getSubscribeSuccessContext(r);
1821
- this._recover = !1, this.emit("subscribe", a), this._resolve(a);
1820
+ var c = this._getSubscribeSuccessContext(r);
1821
+ this._recover = !1, this.emit("subscribe", c), this._resolve(c);
1822
1822
  for (var l in this._promises)
1823
1823
  clearTimeout(this._promises[l].timeout), this._promises[l].resolve(), delete this._promises[l];
1824
1824
  }
@@ -1828,8 +1828,8 @@ function Pt() {
1828
1828
  value: function(r) {
1829
1829
  if (this._status !== N) {
1830
1830
  this._status = N, this._error = r;
1831
- var a = this._getSubscribeErrorContext();
1832
- this.emit("error", a), this._reject(a);
1831
+ var c = this._getSubscribeErrorContext();
1832
+ this.emit("error", c), this._reject(c);
1833
1833
  for (var l in this._promises)
1834
1834
  clearTimeout(this._promises[l].timeout), this._promises[l].reject(r), delete this._promises[l];
1835
1835
  }
@@ -1845,8 +1845,8 @@ function Pt() {
1845
1845
  key: "_setUnsubscribed",
1846
1846
  value: function(r) {
1847
1847
  if (this._centrifuge._clearSubRefreshTimeout(this.channel), this._status !== b) {
1848
- var a = this._status === q;
1849
- this._status = b, r === !0 && (this._recover = !1, this._noResubscribe = !0, delete this._centrifuge._lastSeq[this.channel], delete this._centrifuge._lastGen[this.channel], delete this._centrifuge._lastEpoch[this.channel]), a && this._triggerUnsubscribe();
1848
+ var c = this._status === q;
1849
+ this._status = b, r === !0 && (this._recover = !1, this._noResubscribe = !0, delete this._centrifuge._lastSeq[this.channel], delete this._centrifuge._lastGen[this.channel], delete this._centrifuge._lastEpoch[this.channel]), c && this._triggerUnsubscribe();
1850
1850
  }
1851
1851
  }
1852
1852
  }, {
@@ -1857,11 +1857,11 @@ function Pt() {
1857
1857
  }, {
1858
1858
  key: "_getSubscribeSuccessContext",
1859
1859
  value: function(r) {
1860
- var a = {
1860
+ var c = {
1861
1861
  channel: this.channel,
1862
1862
  isResubscribe: this._isResubscribe
1863
1863
  };
1864
- return r && (a = this._centrifuge._expandSubscribeContext(a, r)), a;
1864
+ return r && (c = this._centrifuge._expandSubscribeContext(c, r)), c;
1865
1865
  }
1866
1866
  }, {
1867
1867
  key: "_getSubscribeErrorContext",
@@ -1876,8 +1876,8 @@ function Pt() {
1876
1876
  }
1877
1877
  }, {
1878
1878
  key: "ready",
1879
- value: function(r, a) {
1880
- this._ready && (this._isSuccess() ? r(this._getSubscribeSuccessContext()) : a(this._getSubscribeErrorContext()));
1879
+ value: function(r, c) {
1880
+ this._ready && (this._isSuccess() ? r(this._getSubscribeSuccessContext()) : c(this._getSubscribeErrorContext()));
1881
1881
  }
1882
1882
  }, {
1883
1883
  key: "subscribe",
@@ -1897,27 +1897,27 @@ function Pt() {
1897
1897
  return Promise.resolve();
1898
1898
  if (this._isError())
1899
1899
  return Promise.reject(this._error);
1900
- var a = new Promise(function(l, y) {
1901
- var E = setTimeout(function() {
1900
+ var c = new Promise(function(l, y) {
1901
+ var v = setTimeout(function() {
1902
1902
  y({
1903
1903
  code: 0,
1904
1904
  message: "timeout"
1905
1905
  });
1906
1906
  }, r._centrifuge._config.timeout);
1907
1907
  r._promises[r._nextPromiseId()] = {
1908
- timeout: E,
1908
+ timeout: v,
1909
1909
  resolve: l,
1910
1910
  reject: y
1911
1911
  };
1912
1912
  });
1913
- return a;
1913
+ return c;
1914
1914
  }
1915
1915
  }, {
1916
1916
  key: "publish",
1917
1917
  value: function(r) {
1918
- var a = this;
1918
+ var c = this;
1919
1919
  return this._methodCall().then(function() {
1920
- return a._centrifuge.publish(a.channel, r);
1920
+ return c._centrifuge.publish(c.channel, r);
1921
1921
  });
1922
1922
  }
1923
1923
  }, {
@@ -1939,23 +1939,23 @@ function Pt() {
1939
1939
  }, {
1940
1940
  key: "history",
1941
1941
  value: function(r) {
1942
- var a = this;
1942
+ var c = this;
1943
1943
  return this._methodCall().then(function() {
1944
- return a._centrifuge.history(a.channel, r);
1944
+ return c._centrifuge.history(c.channel, r);
1945
1945
  });
1946
1946
  }
1947
1947
  }]), A;
1948
1948
  })(S.default);
1949
- d.default = f, c.exports = d.default;
1949
+ d.default = f, a.exports = d.default;
1950
1950
  })
1951
1951
  ),
1952
1952
  /***/
1953
1953
  853: (
1954
1954
  /***/
1955
- (function(c, d, g) {
1955
+ (function(a, d, g) {
1956
1956
  Object.defineProperty(d, "__esModule", {
1957
1957
  value: !0
1958
- }), d.backoff = v, d.errorExists = Q, d.extend = _, d.isFunction = S, d.log = T, d.startsWith = C;
1958
+ }), d.backoff = E, d.errorExists = Q, d.extend = _, d.isFunction = S, d.log = T, d.startsWith = C;
1959
1959
  function C(m, P) {
1960
1960
  return m.lastIndexOf(P, 0) === 0;
1961
1961
  }
@@ -1968,7 +1968,7 @@ function Pt() {
1968
1968
  S(k) && k.apply(g.g.console, P);
1969
1969
  }
1970
1970
  }
1971
- function v(m, P, k) {
1971
+ function E(m, P, k) {
1972
1972
  var w = 0.5 * Math.random(), L = Math.min(k, P * Math.pow(2, m + 1));
1973
1973
  return Math.floor((1 - w) * L);
1974
1974
  }
@@ -1985,7 +1985,7 @@ function Pt() {
1985
1985
  /***/
1986
1986
  187: (
1987
1987
  /***/
1988
- (function(c) {
1988
+ (function(a) {
1989
1989
  var d = typeof Reflect == "object" ? Reflect : null, g = d && typeof d.apply == "function" ? d.apply : function(f, h, p) {
1990
1990
  return Function.prototype.apply.call(f, h, p);
1991
1991
  }, C;
@@ -2000,16 +2000,16 @@ function Pt() {
2000
2000
  var T = Number.isNaN || function(f) {
2001
2001
  return f !== f;
2002
2002
  };
2003
- function v() {
2004
- v.init.call(this);
2003
+ function E() {
2004
+ E.init.call(this);
2005
2005
  }
2006
- c.exports = v, c.exports.once = x, v.EventEmitter = v, v.prototype._events = void 0, v.prototype._eventsCount = 0, v.prototype._maxListeners = void 0;
2006
+ a.exports = E, a.exports.once = x, E.EventEmitter = E, E.prototype._events = void 0, E.prototype._eventsCount = 0, E.prototype._maxListeners = void 0;
2007
2007
  var Q = 10;
2008
2008
  function _(b) {
2009
2009
  if (typeof b != "function")
2010
2010
  throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof b);
2011
2011
  }
2012
- Object.defineProperty(v, "defaultMaxListeners", {
2012
+ Object.defineProperty(E, "defaultMaxListeners", {
2013
2013
  enumerable: !0,
2014
2014
  get: function() {
2015
2015
  return Q;
@@ -2019,60 +2019,60 @@ function Pt() {
2019
2019
  throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + b + ".");
2020
2020
  Q = b;
2021
2021
  }
2022
- }), v.init = function() {
2022
+ }), E.init = function() {
2023
2023
  (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
2024
- }, v.prototype.setMaxListeners = function(f) {
2024
+ }, E.prototype.setMaxListeners = function(f) {
2025
2025
  if (typeof f != "number" || f < 0 || T(f))
2026
2026
  throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + f + ".");
2027
2027
  return this._maxListeners = f, this;
2028
2028
  };
2029
2029
  function m(b) {
2030
- return b._maxListeners === void 0 ? v.defaultMaxListeners : b._maxListeners;
2030
+ return b._maxListeners === void 0 ? E.defaultMaxListeners : b._maxListeners;
2031
2031
  }
2032
- v.prototype.getMaxListeners = function() {
2032
+ E.prototype.getMaxListeners = function() {
2033
2033
  return m(this);
2034
- }, v.prototype.emit = function(f) {
2034
+ }, E.prototype.emit = function(f) {
2035
2035
  for (var h = [], p = 1; p < arguments.length; p++) h.push(arguments[p]);
2036
- var A = f === "error", t = this._events;
2037
- if (t !== void 0)
2038
- A = A && t.error === void 0;
2036
+ var A = f === "error", n = this._events;
2037
+ if (n !== void 0)
2038
+ A = A && n.error === void 0;
2039
2039
  else if (!A)
2040
2040
  return !1;
2041
2041
  if (A) {
2042
2042
  var r;
2043
2043
  if (h.length > 0 && (r = h[0]), r instanceof Error)
2044
2044
  throw r;
2045
- var a = new Error("Unhandled error." + (r ? " (" + r.message + ")" : ""));
2046
- throw a.context = r, a;
2045
+ var c = new Error("Unhandled error." + (r ? " (" + r.message + ")" : ""));
2046
+ throw c.context = r, c;
2047
2047
  }
2048
- var l = t[f];
2048
+ var l = n[f];
2049
2049
  if (l === void 0)
2050
2050
  return !1;
2051
2051
  if (typeof l == "function")
2052
2052
  g(l, this, h);
2053
2053
  else
2054
- for (var y = l.length, E = F(l, y), p = 0; p < y; ++p)
2055
- g(E[p], this, h);
2054
+ for (var y = l.length, v = F(l, y), p = 0; p < y; ++p)
2055
+ g(v[p], this, h);
2056
2056
  return !0;
2057
2057
  };
2058
2058
  function P(b, f, h, p) {
2059
- var A, t, r;
2060
- if (_(h), t = b._events, t === void 0 ? (t = b._events = /* @__PURE__ */ Object.create(null), b._eventsCount = 0) : (t.newListener !== void 0 && (b.emit(
2059
+ var A, n, r;
2060
+ if (_(h), n = b._events, n === void 0 ? (n = b._events = /* @__PURE__ */ Object.create(null), b._eventsCount = 0) : (n.newListener !== void 0 && (b.emit(
2061
2061
  "newListener",
2062
2062
  f,
2063
2063
  h.listener ? h.listener : h
2064
- ), t = b._events), r = t[f]), r === void 0)
2065
- r = t[f] = h, ++b._eventsCount;
2066
- else if (typeof r == "function" ? r = t[f] = p ? [h, r] : [r, h] : p ? r.unshift(h) : r.push(h), A = m(b), A > 0 && r.length > A && !r.warned) {
2064
+ ), n = b._events), r = n[f]), r === void 0)
2065
+ r = n[f] = h, ++b._eventsCount;
2066
+ else if (typeof r == "function" ? r = n[f] = p ? [h, r] : [r, h] : p ? r.unshift(h) : r.push(h), A = m(b), A > 0 && r.length > A && !r.warned) {
2067
2067
  r.warned = !0;
2068
- var a = new Error("Possible EventEmitter memory leak detected. " + r.length + " " + String(f) + " listeners added. Use emitter.setMaxListeners() to increase limit");
2069
- a.name = "MaxListenersExceededWarning", a.emitter = b, a.type = f, a.count = r.length, S(a);
2068
+ var c = new Error("Possible EventEmitter memory leak detected. " + r.length + " " + String(f) + " listeners added. Use emitter.setMaxListeners() to increase limit");
2069
+ c.name = "MaxListenersExceededWarning", c.emitter = b, c.type = f, c.count = r.length, S(c);
2070
2070
  }
2071
2071
  return b;
2072
2072
  }
2073
- v.prototype.addListener = function(f, h) {
2073
+ E.prototype.addListener = function(f, h) {
2074
2074
  return P(this, f, h, !1);
2075
- }, v.prototype.on = v.prototype.addListener, v.prototype.prependListener = function(f, h) {
2075
+ }, E.prototype.on = E.prototype.addListener, E.prototype.prependListener = function(f, h) {
2076
2076
  return P(this, f, h, !0);
2077
2077
  };
2078
2078
  function k() {
@@ -2083,12 +2083,12 @@ function Pt() {
2083
2083
  var p = { fired: !1, wrapFn: void 0, target: b, type: f, listener: h }, A = k.bind(p);
2084
2084
  return A.listener = h, p.wrapFn = A, A;
2085
2085
  }
2086
- v.prototype.once = function(f, h) {
2086
+ E.prototype.once = function(f, h) {
2087
2087
  return _(h), this.on(f, w(this, f, h)), this;
2088
- }, v.prototype.prependOnceListener = function(f, h) {
2088
+ }, E.prototype.prependOnceListener = function(f, h) {
2089
2089
  return _(h), this.prependListener(f, w(this, f, h)), this;
2090
- }, v.prototype.removeListener = function(f, h) {
2091
- var p, A, t, r, a;
2090
+ }, E.prototype.removeListener = function(f, h) {
2091
+ var p, A, n, r, c;
2092
2092
  if (_(h), A = this._events, A === void 0)
2093
2093
  return this;
2094
2094
  if (p = A[f], p === void 0)
@@ -2096,26 +2096,26 @@ function Pt() {
2096
2096
  if (p === h || p.listener === h)
2097
2097
  --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete A[f], A.removeListener && this.emit("removeListener", f, p.listener || h));
2098
2098
  else if (typeof p != "function") {
2099
- for (t = -1, r = p.length - 1; r >= 0; r--)
2099
+ for (n = -1, r = p.length - 1; r >= 0; r--)
2100
2100
  if (p[r] === h || p[r].listener === h) {
2101
- a = p[r].listener, t = r;
2101
+ c = p[r].listener, n = r;
2102
2102
  break;
2103
2103
  }
2104
- if (t < 0)
2104
+ if (n < 0)
2105
2105
  return this;
2106
- t === 0 ? p.shift() : M(p, t), p.length === 1 && (A[f] = p[0]), A.removeListener !== void 0 && this.emit("removeListener", f, a || h);
2106
+ n === 0 ? p.shift() : M(p, n), p.length === 1 && (A[f] = p[0]), A.removeListener !== void 0 && this.emit("removeListener", f, c || h);
2107
2107
  }
2108
2108
  return this;
2109
- }, v.prototype.off = v.prototype.removeListener, v.prototype.removeAllListeners = function(f) {
2109
+ }, E.prototype.off = E.prototype.removeListener, E.prototype.removeAllListeners = function(f) {
2110
2110
  var h, p, A;
2111
2111
  if (p = this._events, p === void 0)
2112
2112
  return this;
2113
2113
  if (p.removeListener === void 0)
2114
2114
  return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : p[f] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete p[f]), this;
2115
2115
  if (arguments.length === 0) {
2116
- var t = Object.keys(p), r;
2117
- for (A = 0; A < t.length; ++A)
2118
- r = t[A], r !== "removeListener" && this.removeAllListeners(r);
2116
+ var n = Object.keys(p), r;
2117
+ for (A = 0; A < n.length; ++A)
2118
+ r = n[A], r !== "removeListener" && this.removeAllListeners(r);
2119
2119
  return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
2120
2120
  }
2121
2121
  if (h = p[f], typeof h == "function")
@@ -2132,13 +2132,13 @@ function Pt() {
2132
2132
  var A = p[f];
2133
2133
  return A === void 0 ? [] : typeof A == "function" ? h ? [A.listener || A] : [A] : h ? J(A) : F(A, A.length);
2134
2134
  }
2135
- v.prototype.listeners = function(f) {
2135
+ E.prototype.listeners = function(f) {
2136
2136
  return L(this, f, !0);
2137
- }, v.prototype.rawListeners = function(f) {
2137
+ }, E.prototype.rawListeners = function(f) {
2138
2138
  return L(this, f, !1);
2139
- }, v.listenerCount = function(b, f) {
2139
+ }, E.listenerCount = function(b, f) {
2140
2140
  return typeof b.listenerCount == "function" ? b.listenerCount(f) : O.call(b, f);
2141
- }, v.prototype.listenerCount = O;
2141
+ }, E.prototype.listenerCount = O;
2142
2142
  function O(b) {
2143
2143
  var f = this._events;
2144
2144
  if (f !== void 0) {
@@ -2150,7 +2150,7 @@ function Pt() {
2150
2150
  }
2151
2151
  return 0;
2152
2152
  }
2153
- v.prototype.eventNames = function() {
2153
+ E.prototype.eventNames = function() {
2154
2154
  return this._eventsCount > 0 ? C(this._events) : [];
2155
2155
  };
2156
2156
  function F(b, f) {
@@ -2171,12 +2171,12 @@ function Pt() {
2171
2171
  function x(b, f) {
2172
2172
  return new Promise(function(h, p) {
2173
2173
  function A(r) {
2174
- b.removeListener(f, t), p(r);
2174
+ b.removeListener(f, n), p(r);
2175
2175
  }
2176
- function t() {
2176
+ function n() {
2177
2177
  typeof b.removeListener == "function" && b.removeListener("error", A), h([].slice.call(arguments));
2178
2178
  }
2179
- N(b, f, t, { once: !0 }), f !== "error" && q(b, A, { once: !0 });
2179
+ N(b, f, n, { once: !0 }), f !== "error" && q(b, A, { once: !0 });
2180
2180
  });
2181
2181
  }
2182
2182
  function q(b, f, h) {
@@ -2186,8 +2186,8 @@ function Pt() {
2186
2186
  if (typeof b.on == "function")
2187
2187
  p.once ? b.once(f, h) : b.on(f, h);
2188
2188
  else if (typeof b.addEventListener == "function")
2189
- b.addEventListener(f, function A(t) {
2190
- p.once && b.removeEventListener(f, A), h(t);
2189
+ b.addEventListener(f, function A(n) {
2190
+ p.once && b.removeEventListener(f, A), h(n);
2191
2191
  });
2192
2192
  else
2193
2193
  throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof b);
@@ -2195,12 +2195,12 @@ function Pt() {
2195
2195
  })
2196
2196
  )
2197
2197
  /******/
2198
- }, s = {};
2199
- function i(c) {
2200
- var d = s[c];
2198
+ }, i = {};
2199
+ function s(a) {
2200
+ var d = i[a];
2201
2201
  if (d !== void 0)
2202
2202
  return d.exports;
2203
- var g = s[c] = {
2203
+ var g = i[a] = {
2204
2204
  /******/
2205
2205
  // no module.id needed
2206
2206
  /******/
@@ -2209,10 +2209,10 @@ function Pt() {
2209
2209
  exports: {}
2210
2210
  /******/
2211
2211
  };
2212
- return o[c](g, g.exports, i), g.exports;
2212
+ return o[a](g, g.exports, s), g.exports;
2213
2213
  }
2214
2214
  (function() {
2215
- i.g = (function() {
2215
+ s.g = (function() {
2216
2216
  if (typeof globalThis == "object") return globalThis;
2217
2217
  try {
2218
2218
  return this || new Function("return this")();
@@ -2221,52 +2221,52 @@ function Pt() {
2221
2221
  }
2222
2222
  })();
2223
2223
  })();
2224
- var u = i(579);
2224
+ var u = s(579);
2225
2225
  return u;
2226
2226
  })()
2227
2227
  );
2228
2228
  });
2229
2229
  })(fe)), fe.exports;
2230
2230
  }
2231
- var kt = Pt();
2232
- const wt = /* @__PURE__ */ Qt(kt);
2231
+ var wt = kt();
2232
+ const _t = /* @__PURE__ */ St(wt);
2233
2233
  let he = null;
2234
- function We(e, n) {
2234
+ function Ve(e, t) {
2235
2235
  if (!(e != null && e.client_url) || !(e != null && e.token) || !(e != null && e.channel))
2236
2236
  return console.error("[Centrifuge] Invalid socket_connections"), null;
2237
- const { client_url: o, token: s, channel: i } = e;
2238
- if (i.includes("#") || console.warn("[Centrifuge] Channel should contain #user_id"), he) {
2237
+ const { client_url: o, token: i, channel: s } = e;
2238
+ if (s.includes("#") || console.warn("[Centrifuge] Channel should contain #user_id"), he) {
2239
2239
  try {
2240
2240
  console.log("[Centrifuge] Disconnecting previous instance..."), he.disconnect();
2241
- } catch (c) {
2242
- console.error("[Centrifuge] Error while disconnecting previous instance:", c);
2241
+ } catch (a) {
2242
+ console.error("[Centrifuge] Error while disconnecting previous instance:", a);
2243
2243
  }
2244
2244
  he = null;
2245
2245
  }
2246
2246
  console.log("[Centrifuge] Creating new instance:", o);
2247
- const u = new wt(o);
2248
- return u.setToken(s), u.on("connect", (c) => {
2249
- console.log("[Centrifuge] Connected", c), console.log("[Centrifuge] Subscribing to channel:", i);
2250
- const d = u.subscribe(i);
2247
+ const u = new _t(o);
2248
+ return u.setToken(i), u.on("connect", (a) => {
2249
+ console.log("[Centrifuge] Connected", a), console.log("[Centrifuge] Subscribing to channel:", s);
2250
+ const d = u.subscribe(s);
2251
2251
  d.on("publish", (g) => {
2252
2252
  console.log("[Centrifuge] Publish event received:", g);
2253
- const C = _t(g);
2254
- C && n(C);
2253
+ const C = Tt(g);
2254
+ C && t(C);
2255
2255
  }), d.on("subscribe", (g) => {
2256
- console.log("[Centrifuge] ✅ Channel subscribed successfully:", i, g);
2256
+ console.log("[Centrifuge] ✅ Channel subscribed successfully:", s, g);
2257
2257
  }), d.on("error", (g) => {
2258
2258
  console.error("[Centrifuge] ❌ Subscription error:", g);
2259
2259
  }), d.on("unsubscribe", (g) => {
2260
2260
  console.log("[Centrifuge] Channel unsubscribed:", g);
2261
2261
  });
2262
- }), u.on("disconnect", (c) => console.log("[Centrifuge] Disconnected", c)), u.on("error", (c) => console.error("[Centrifuge] Error", c)), console.log("[Centrifuge] Calling connect()..."), u.connect(), he = u, { centrifuge: u };
2262
+ }), u.on("disconnect", (a) => console.log("[Centrifuge] Disconnected", a)), u.on("error", (a) => console.error("[Centrifuge] Error", a)), console.log("[Centrifuge] Calling connect()..."), u.connect(), he = u, { centrifuge: u };
2263
2263
  }
2264
- function _t(e) {
2265
- var o, s, i;
2264
+ function Tt(e) {
2265
+ var o, i, s;
2266
2266
  if (console.log("[Centrifuge] Raw message received:", JSON.stringify(e)), !(e != null && e.data))
2267
2267
  return console.warn("[Centrifuge] Empty or invalid response"), null;
2268
- let n = e.data;
2269
- return (o = n.data) != null && o.type ? n = n.data : (i = (s = n.data) == null ? void 0 : s.data) != null && i.type && (n = n.data.data), console.log("[Centrifuge] Parsed message:", n), n.type ? n : (console.warn("[Centrifuge] Message has no type:", n), null);
2268
+ let t = e.data;
2269
+ return (o = t.data) != null && o.type ? t = t.data : (s = (i = t.data) == null ? void 0 : i.data) != null && s.type && (t = t.data.data), console.log("[Centrifuge] Parsed message:", t), t.type ? t : (console.warn("[Centrifuge] Message has no type:", t), null);
2270
2270
  }
2271
2271
  function ge(e) {
2272
2272
  return /^4[0-9]/.test(e) ? "visa" : /^5[1-5]/.test(e) || /^2[2-7]/.test(e) ? "mastercard" : "card";
@@ -2289,27 +2289,27 @@ function K(e) {
2289
2289
  }
2290
2290
  function Ye(e) {
2291
2291
  if (!e) return null;
2292
- let n = String(e).trim().toLowerCase();
2293
- return n.startsWith("payment_method_") && (n = n.replace("payment_method_", "")), n === "kaspi" ? "kaspi_pay" : n === "apple" ? "apple_pay" : n === "google" ? "google_pay" : n === "newcard" ? "new_card" : n === "card" ? "card" : ["kaspi_pay", "apple_pay", "google_pay", "new_card"].includes(n) ? n : null;
2292
+ let t = String(e).trim().toLowerCase();
2293
+ return t.startsWith("payment_method_") && (t = t.replace("payment_method_", "")), t === "kaspi" ? "kaspi_pay" : t === "apple" ? "apple_pay" : t === "google" ? "google_pay" : t === "newcard" ? "new_card" : t === "card" ? "card" : ["kaspi_pay", "apple_pay", "google_pay", "new_card"].includes(t) ? t : null;
2294
2294
  }
2295
- function Tt(e) {
2296
- var u, c, d;
2297
- const n = e, o = ((u = n == null ? void 0 : n.context) == null ? void 0 : u.last_payment_method) ?? (n == null ? void 0 : n.last_payment_method) ?? ((c = n == null ? void 0 : n.attributes) == null ? void 0 : c.last_payment_method);
2295
+ function Lt(e) {
2296
+ var u, a, d;
2297
+ const t = e, o = ((u = t == null ? void 0 : t.context) == null ? void 0 : u.last_payment_method) ?? (t == null ? void 0 : t.last_payment_method) ?? ((a = t == null ? void 0 : t.attributes) == null ? void 0 : a.last_payment_method);
2298
2298
  if (!o) return null;
2299
2299
  if (typeof o == "string")
2300
2300
  return { type: Ye(o), cardId: null };
2301
2301
  if (typeof o != "object") return null;
2302
- const s = o.type ?? o.payment_method ?? o.method, i = o.card_id ?? o.cardId ?? o.id ?? ((d = o.card) == null ? void 0 : d.id) ?? null;
2302
+ const i = o.type ?? o.payment_method ?? o.method, s = o.card_id ?? o.cardId ?? o.id ?? ((d = o.card) == null ? void 0 : d.id) ?? null;
2303
2303
  return {
2304
- type: Ye(s),
2305
- cardId: i != null ? String(i) : null
2304
+ type: Ye(i),
2305
+ cardId: s != null ? String(s) : null
2306
2306
  };
2307
2307
  }
2308
- function Lt(e, n, o = {}) {
2308
+ function Rt(e, t, o = {}) {
2309
2309
  var P, k, w, L;
2310
- const s = [], i = (P = e == null ? void 0 : e.kaspi) == null ? void 0 : P.data, u = ((k = e == null ? void 0 : e.cards_v2) == null ? void 0 : k.data) || [], c = ((L = (w = e == null ? void 0 : e.payment_methods) == null ? void 0 : w.data) == null ? void 0 : L.attributes) || {}, d = K(c.payment_method_kaspi), g = K(c.payment_method_card), C = typeof window < "u" && window.self === window.top, T = De() === "ios", v = !!(o != null && o.onlyKaspiAvailable), Q = !!(o != null && o.disableKaspi);
2311
- return i != null && i.isKaspiOnly && d && !Q ? [Z] : v ? i != null && i.isAvailable && d && !Q ? [Z] : [] : (K(c.payment_method_apple_pay) && !me("apple_pay") && (Ce() && C || ye() || T || rt() === 16) && s.push(ot), i != null && i.isAvailable && d && !Q && s.push(Z), g && u.filter((O) => !O.isExpired).forEach((O) => {
2312
- s.push({
2310
+ const i = [], s = (P = e == null ? void 0 : e.kaspi) == null ? void 0 : P.data, u = ((k = e == null ? void 0 : e.cards_v2) == null ? void 0 : k.data) || [], a = ((L = (w = e == null ? void 0 : e.payment_methods) == null ? void 0 : w.data) == null ? void 0 : L.attributes) || {}, d = K(a.payment_method_kaspi), g = K(a.payment_method_card), C = typeof window < "u" && window.self === window.top, T = De() === "ios", E = !!(o != null && o.onlyKaspiAvailable), Q = !!(o != null && o.disableKaspi);
2311
+ return s != null && s.isKaspiOnly && d && !Q ? [Z] : E ? s != null && s.isAvailable && d && !Q ? [Z] : [] : (K(a.payment_method_apple_pay) && !me("apple_pay") && (Ce() && C || ye() || T || rt() === 16) && i.push(ot), s != null && s.isAvailable && d && !Q && i.push(Z), g && u.filter((O) => !O.isExpired).forEach((O) => {
2312
+ i.push({
2313
2313
  iconType: ge(O.attributes.mask),
2314
2314
  type: "card",
2315
2315
  cardId: O.id,
@@ -2317,26 +2317,26 @@ function Lt(e, n, o = {}) {
2317
2317
  cardType: O.type,
2318
2318
  isDefault: O.attributes.isDefault
2319
2319
  });
2320
- }), K(c.payment_method_google_pay) && !me("google_pay") && !Ce() && !ye() && s.push(st), K(c.payment_method_new_card) && s.push({
2320
+ }), K(a.payment_method_google_pay) && !me("google_pay") && !(o != null && o.disableGooglePay) && !Ce() && !ye() && i.push(st), K(a.payment_method_new_card) && i.push({
2321
2321
  iconType: "new_card",
2322
2322
  type: "new_card",
2323
- label: n ? n("newCard") : "Оплата новой картой"
2324
- }), s);
2323
+ label: t ? t("newCard") : "Оплата новой картой"
2324
+ }), i);
2325
2325
  }
2326
- function Le(e, n = {}) {
2326
+ function Le(e, t = {}) {
2327
2327
  var m, P, k, w;
2328
- const o = (m = e == null ? void 0 : e.kaspi) == null ? void 0 : m.data, s = ((P = e == null ? void 0 : e.cards_v2) == null ? void 0 : P.data) || [], i = ((w = (k = e == null ? void 0 : e.payment_methods) == null ? void 0 : k.data) == null ? void 0 : w.attributes) || {}, u = K(i.payment_method_kaspi), c = K(i.payment_method_card), d = !!(n != null && n.disableKaspi), g = typeof window < "u" && window.self === window.top, S = De() === "ios", T = K(i.payment_method_apple_pay) && !me("apple_pay") && (Ce() && g || ye() || S || rt() === 16), v = K(i.payment_method_google_pay) && !me("google_pay") && !Ce() && !ye();
2329
- if (o != null && o.isKaspiOnly && u && !d || n != null && n.onlyKaspiAvailable && (o != null && o.isAvailable) && u && !d)
2328
+ const o = (m = e == null ? void 0 : e.kaspi) == null ? void 0 : m.data, i = ((P = e == null ? void 0 : e.cards_v2) == null ? void 0 : P.data) || [], s = ((w = (k = e == null ? void 0 : e.payment_methods) == null ? void 0 : k.data) == null ? void 0 : w.attributes) || {}, u = K(s.payment_method_kaspi), a = K(s.payment_method_card), d = !!(t != null && t.disableKaspi), g = typeof window < "u" && window.self === window.top, S = De() === "ios", T = K(s.payment_method_apple_pay) && !me("apple_pay") && (Ce() && g || ye() || S || rt() === 16), E = K(s.payment_method_google_pay) && !me("google_pay") && !(t != null && t.disableGooglePay) && !Ce() && !ye();
2329
+ if (o != null && o.isKaspiOnly && u && !d || t != null && t.onlyKaspiAvailable && (o != null && o.isAvailable) && u && !d)
2330
2330
  return Z;
2331
- const Q = Tt(e);
2331
+ const Q = Lt(e);
2332
2332
  if ((Q == null ? void 0 : Q.type) === "kaspi_pay" && (o != null && o.isAvailable) && u && !d)
2333
2333
  return Z;
2334
2334
  if ((Q == null ? void 0 : Q.type) === "apple_pay" && T) return ot;
2335
- if ((Q == null ? void 0 : Q.type) === "google_pay" && v) return st;
2336
- if ((Q == null ? void 0 : Q.type) === "new_card" && K(i.payment_method_new_card))
2335
+ if ((Q == null ? void 0 : Q.type) === "google_pay" && E) return st;
2336
+ if ((Q == null ? void 0 : Q.type) === "new_card" && K(s.payment_method_new_card))
2337
2337
  return { iconType: "new_card", type: "new_card", label: "Оплата новой картой" };
2338
- if ((Q == null ? void 0 : Q.type) === "card" && c) {
2339
- const L = Q.cardId != null ? s.find((O) => !O.isExpired && String(O.id) === Q.cardId) : null;
2338
+ if ((Q == null ? void 0 : Q.type) === "card" && a) {
2339
+ const L = Q.cardId != null ? i.find((O) => !O.isExpired && String(O.id) === Q.cardId) : null;
2340
2340
  if (L)
2341
2341
  return {
2342
2342
  iconType: ge(L.attributes.mask),
@@ -2346,8 +2346,8 @@ function Le(e, n = {}) {
2346
2346
  cardType: L.type
2347
2347
  };
2348
2348
  }
2349
- if (c) {
2350
- const L = s.find((O) => {
2349
+ if (a) {
2350
+ const L = i.find((O) => {
2351
2351
  var F;
2352
2352
  return ((F = O.attributes) == null ? void 0 : F.isDefault) && !O.isExpired;
2353
2353
  });
@@ -2361,7 +2361,7 @@ function Le(e, n = {}) {
2361
2361
  };
2362
2362
  }
2363
2363
  if (o != null && o.isAvailable && u && !d) return Z;
2364
- const _ = c ? s.find((L) => !L.isExpired) : null;
2364
+ const _ = a ? i.find((L) => !L.isExpired) : null;
2365
2365
  return _ ? {
2366
2366
  iconType: ge(_.attributes.mask),
2367
2367
  type: "card",
@@ -2378,10 +2378,10 @@ function it(e) {
2378
2378
  return null;
2379
2379
  }
2380
2380
  }
2381
- function Re(e, n) {
2381
+ function Re(e, t) {
2382
2382
  if (!(typeof localStorage > "u"))
2383
2383
  try {
2384
- localStorage.setItem(e, n);
2384
+ localStorage.setItem(e, t);
2385
2385
  } catch {
2386
2386
  }
2387
2387
  }
@@ -2392,28 +2392,28 @@ function be(e) {
2392
2392
  } catch {
2393
2393
  }
2394
2394
  }
2395
- async function Rt(e, n) {
2395
+ async function Ot(e, t) {
2396
2396
  var o;
2397
2397
  try {
2398
- const s = await e.json(), i = (o = s == null ? void 0 : s.errors) == null ? void 0 : o[0];
2399
- return (i == null ? void 0 : i.title) || (i == null ? void 0 : i.detail) || (s == null ? void 0 : s.message) || (s == null ? void 0 : s.error) || n;
2398
+ const i = await e.json(), s = (o = i == null ? void 0 : i.errors) == null ? void 0 : o[0];
2399
+ return (s == null ? void 0 : s.title) || (s == null ? void 0 : s.detail) || (i == null ? void 0 : i.message) || (i == null ? void 0 : i.error) || t;
2400
2400
  } catch {
2401
2401
  return `HTTP ${e.status}: ${e.statusText}`;
2402
2402
  }
2403
2403
  }
2404
- async function te(e, n) {
2405
- const o = await Rt(e, n);
2404
+ async function ne(e, t) {
2405
+ const o = await Ot(e, t);
2406
2406
  throw Object.assign(new Error(o), { status: e.status });
2407
2407
  }
2408
- function Ie(e, n, o = {}) {
2409
- const s = Number.isFinite(o.checkoutAmount) && o.checkoutAmount >= 0 ? Number(o.checkoutAmount) : e.amount, i = !!o.forceBalanceMethod, u = !!o.useBalance;
2408
+ function Ie(e, t, o = {}) {
2409
+ const i = Number.isFinite(o.checkoutAmount) && o.checkoutAmount >= 0 ? Number(o.checkoutAmount) : e.amount, s = !!o.forceBalanceMethod, u = !!o.useBalance;
2410
2410
  return {
2411
- checkoutAmount: s,
2412
- checkoutPaymentMethod: i ? { type: "balance" } : n,
2411
+ checkoutAmount: i,
2412
+ checkoutPaymentMethod: s ? { type: "balance" } : t,
2413
2413
  useBalanceFlag: u
2414
2414
  };
2415
2415
  }
2416
- function Qe(e, n, o, s) {
2416
+ function Qe(e, t, o, i) {
2417
2417
  return {
2418
2418
  preorder_id: e.preorderId,
2419
2419
  terminal_id: e.terminalId,
@@ -2422,28 +2422,28 @@ function Qe(e, n, o, s) {
2422
2422
  amount: String(o),
2423
2423
  currency: e.currency
2424
2424
  },
2425
- payment_method: n,
2425
+ payment_method: t,
2426
2426
  ...e.backlink && { backlink: e.backlink },
2427
- ...s && { use_balance: !0 }
2427
+ ...i && { use_balance: !0 }
2428
2428
  };
2429
2429
  }
2430
- async function Se(e, n, o, s, i) {
2430
+ async function Se(e, t, o, i, s) {
2431
2431
  const u = await fetch(`${e}/orders/v1/checkout`, {
2432
2432
  method: "POST",
2433
2433
  headers: {
2434
2434
  "Content-Type": "application/json",
2435
- Authorization: `Bearer ${n.accessToken}`,
2436
- "X-Idempotency-Key": Be(),
2435
+ Authorization: `Bearer ${t.accessToken}`,
2436
+ "X-Idempotency-Key": t.idempotencyKey ?? Be(),
2437
2437
  "X-Device-Id": o,
2438
2438
  "X-OS": "WEB"
2439
2439
  },
2440
- body: JSON.stringify(s)
2440
+ body: JSON.stringify(i)
2441
2441
  });
2442
- return u.ok || await te(u, i), u.json();
2442
+ return u.ok || await ne(u, s), u.json();
2443
2443
  }
2444
- async function Ot(e, n, o) {
2444
+ async function Mt(e, t, o) {
2445
2445
  var d, g, C, S;
2446
- const s = await fetch(`${e}/api/v2/oauth2/tokens`, {
2446
+ const i = await fetch(`${e}/api/v2/oauth2/tokens`, {
2447
2447
  method: "POST",
2448
2448
  headers: {
2449
2449
  "Content-Type": "application/json",
@@ -2451,166 +2451,166 @@ async function Ot(e, n, o) {
2451
2451
  "X-Fingerprint": nt()
2452
2452
  },
2453
2453
  body: JSON.stringify({
2454
- client_id: n,
2454
+ client_id: t,
2455
2455
  grant_type: "authorization_track_id",
2456
2456
  track_id: o
2457
2457
  })
2458
2458
  });
2459
- s.ok || await te(s, "Не удалось авторизоваться через track_id");
2460
- const i = await s.json(), u = (i == null ? void 0 : i.access_token) ?? ((g = (d = i == null ? void 0 : i.data) == null ? void 0 : d.attributes) == null ? void 0 : g.access_token), c = (i == null ? void 0 : i.refresh_token) ?? ((S = (C = i == null ? void 0 : i.data) == null ? void 0 : C.attributes) == null ? void 0 : S.refresh_token) ?? null;
2459
+ i.ok || await ne(i, "Не удалось авторизоваться через track_id");
2460
+ const s = await i.json(), u = (s == null ? void 0 : s.access_token) ?? ((g = (d = s == null ? void 0 : s.data) == null ? void 0 : d.attributes) == null ? void 0 : g.access_token), a = (s == null ? void 0 : s.refresh_token) ?? ((S = (C = s == null ? void 0 : s.data) == null ? void 0 : C.attributes) == null ? void 0 : S.refresh_token) ?? null;
2461
2461
  if (!u) throw new Error("В ответе отсутствует access_token");
2462
- return { access_token: u, refresh_token: c };
2462
+ return { access_token: u, refresh_token: a };
2463
2463
  }
2464
- async function Mt(e, n, o) {
2464
+ async function Nt(e, t, o) {
2465
2465
  var d, g, C, S;
2466
- const s = await fetch(`${e}/api/v2/oauth2/tokens`, {
2466
+ const i = await fetch(`${e}/api/v2/oauth2/tokens`, {
2467
2467
  method: "POST",
2468
2468
  headers: { "Content-Type": "application/json" },
2469
2469
  body: JSON.stringify({
2470
- client_id: n,
2470
+ client_id: t,
2471
2471
  grant_type: "refresh_token",
2472
2472
  refresh_token: o
2473
2473
  })
2474
2474
  });
2475
- s.ok || await te(s, "Не удалось обновить токен по refresh_token");
2476
- const i = await s.json(), u = (i == null ? void 0 : i.access_token) ?? ((g = (d = i == null ? void 0 : i.data) == null ? void 0 : d.attributes) == null ? void 0 : g.access_token), c = (i == null ? void 0 : i.refresh_token) ?? ((S = (C = i == null ? void 0 : i.data) == null ? void 0 : C.attributes) == null ? void 0 : S.refresh_token) ?? null;
2475
+ i.ok || await ne(i, "Не удалось обновить токен по refresh_token");
2476
+ const s = await i.json(), u = (s == null ? void 0 : s.access_token) ?? ((g = (d = s == null ? void 0 : s.data) == null ? void 0 : d.attributes) == null ? void 0 : g.access_token), a = (s == null ? void 0 : s.refresh_token) ?? ((S = (C = s == null ? void 0 : s.data) == null ? void 0 : C.attributes) == null ? void 0 : S.refresh_token) ?? null;
2477
2477
  if (!u) throw new Error("В ответе отсутствует access_token");
2478
- return { access_token: u, refresh_token: c };
2478
+ return { access_token: u, refresh_token: a };
2479
2479
  }
2480
- async function Oe(e, n) {
2480
+ async function Oe(e, t) {
2481
2481
  const o = await fetch(`${e}/orders/v1/checkout/context`, {
2482
2482
  method: "POST",
2483
2483
  headers: {
2484
2484
  "Content-Type": "application/json",
2485
- Authorization: `Bearer ${n.accessToken}`,
2486
- "X-Idempotency-Key": Be()
2485
+ Authorization: `Bearer ${t.accessToken}`,
2486
+ "X-Idempotency-Key": t.idempotencyKey ?? Be()
2487
2487
  },
2488
2488
  body: JSON.stringify({
2489
- terminal_id: n.terminalId,
2489
+ terminal_id: t.terminalId,
2490
2490
  include: ["cards", "payment_methods", "balance", "cashback"],
2491
2491
  money: {
2492
- amount: String(n.amount),
2493
- currency: n.currency
2492
+ amount: String(t.amount),
2493
+ currency: t.currency
2494
2494
  }
2495
2495
  })
2496
2496
  });
2497
- return o.ok || await te(o, "Ошибка получения контекста оплаты"), o.json();
2497
+ return o.ok || await ne(o, "Ошибка получения контекста оплаты"), o.json();
2498
2498
  }
2499
- async function Nt(e, n, o) {
2500
- const s = await fetch(`${e}/payment-gateway/v1/cards/${o}`, {
2499
+ async function Dt(e, t, o) {
2500
+ const i = await fetch(`${e}/payment-gateway/v1/cards/${o}`, {
2501
2501
  method: "DELETE",
2502
2502
  headers: {
2503
2503
  "Content-Type": "application/json",
2504
- Authorization: `Bearer ${n.accessToken}`
2504
+ Authorization: `Bearer ${t.accessToken}`
2505
2505
  }
2506
2506
  });
2507
- return s.ok || await te(s, "Не удалось удалить карту"), s.json().catch(() => ({}));
2507
+ return i.ok || await ne(i, "Не удалось удалить карту"), i.json().catch(() => ({}));
2508
2508
  }
2509
- async function Dt(e, n, o) {
2510
- const s = await fetch(
2509
+ async function Xt(e, t, o) {
2510
+ const i = await fetch(
2511
2511
  `${e}/payment-gateway/v1/cards/${o}/mark_as_default`,
2512
2512
  {
2513
2513
  method: "PUT",
2514
2514
  headers: {
2515
2515
  "Content-Type": "application/json",
2516
- Authorization: `Bearer ${n.accessToken}`
2516
+ Authorization: `Bearer ${t.accessToken}`
2517
2517
  }
2518
2518
  }
2519
2519
  );
2520
- return s.ok || await te(s, "Не удалось отметить карту как основную"), s.json().catch(() => ({}));
2520
+ return i.ok || await ne(i, "Не удалось отметить карту как основную"), i.json().catch(() => ({}));
2521
2521
  }
2522
- async function Xt(e, n, o) {
2523
- const s = await fetch(`${e}/orders/v1/orders/${o}/status`, {
2522
+ async function Ut(e, t, o) {
2523
+ const i = await fetch(`${e}/orders/v1/orders/${o}/status`, {
2524
2524
  method: "GET",
2525
2525
  headers: {
2526
2526
  "Content-Type": "application/json",
2527
- Authorization: `Bearer ${n.accessToken}`
2527
+ Authorization: `Bearer ${t.accessToken}`
2528
2528
  }
2529
2529
  });
2530
- if (!s.ok)
2530
+ if (!i.ok)
2531
2531
  throw Object.assign(
2532
- new Error(`Ошибка проверки статуса заказа: ${s.status} ${s.statusText}`),
2533
- { status: s.status }
2532
+ new Error(`Ошибка проверки статуса заказа: ${i.status} ${i.statusText}`),
2533
+ { status: i.status }
2534
2534
  );
2535
- const i = await s.json(), u = (i == null ? void 0 : i.data) ?? i;
2535
+ const s = await i.json(), u = (s == null ? void 0 : s.data) ?? s;
2536
2536
  return { data: { status: u == null ? void 0 : u.status, payload: (u == null ? void 0 : u.payload) ?? {} } };
2537
2537
  }
2538
- async function Ge(e, n, o, s, i = {}) {
2539
- const { checkoutAmount: u, checkoutPaymentMethod: c, useBalanceFlag: d } = Ie(
2540
- n,
2538
+ async function Ge(e, t, o, i, s = {}) {
2539
+ const { checkoutAmount: u, checkoutPaymentMethod: a, useBalanceFlag: d } = Ie(
2540
+ t,
2541
2541
  {
2542
- type: s.type,
2543
- ...s.cardId && { card_id: s.cardId }
2542
+ type: i.type,
2543
+ ...i.cardId && { card_id: i.cardId }
2544
2544
  },
2545
- i
2545
+ s
2546
2546
  );
2547
2547
  return Se(
2548
2548
  e,
2549
- n,
2549
+ t,
2550
2550
  o,
2551
- Qe(n, c, u, d),
2551
+ Qe(t, a, u, d),
2552
2552
  "Ошибка создания заказа"
2553
2553
  );
2554
2554
  }
2555
- async function Ut(e, n, o, s = {}) {
2556
- const { checkoutAmount: i, checkoutPaymentMethod: u, useBalanceFlag: c } = Ie(
2557
- n,
2555
+ async function Ht(e, t, o, i = {}) {
2556
+ const { checkoutAmount: s, checkoutPaymentMethod: u, useBalanceFlag: a } = Ie(
2557
+ t,
2558
2558
  { type: "new_card" },
2559
- s
2559
+ i
2560
2560
  );
2561
2561
  return Se(
2562
2562
  e,
2563
- n,
2563
+ t,
2564
2564
  o,
2565
- Qe(n, u, i, c),
2565
+ Qe(t, u, s, a),
2566
2566
  "Ошибка создания заказа для новой карты"
2567
2567
  );
2568
2568
  }
2569
- async function Ht(e, n, o) {
2570
- const s = window.location.hostname, i = await fetch(`${e}/payment-gateway/v1/apple/session`, {
2569
+ async function xt(e, t, o) {
2570
+ const i = window.location.hostname, s = await fetch(`${e}/payment-gateway/v1/apple/session`, {
2571
2571
  method: "POST",
2572
2572
  headers: {
2573
2573
  "Content-Type": "application/json",
2574
2574
  Accept: "application/vnd.api+json",
2575
- Authorization: `Bearer ${n.accessToken}`
2575
+ Authorization: `Bearer ${t.accessToken}`
2576
2576
  },
2577
- body: JSON.stringify({ validationUrl: o, domainName: s })
2577
+ body: JSON.stringify({ validationUrl: o, domainName: i })
2578
2578
  });
2579
- return i.ok || await te(i, "Ошибка получения Apple Pay сессии"), i.json();
2579
+ return s.ok || await ne(s, "Ошибка получения Apple Pay сессии"), s.json();
2580
2580
  }
2581
- async function xt(e, n, o, s, i = {}) {
2582
- const { checkoutAmount: u, checkoutPaymentMethod: c, useBalanceFlag: d } = Ie(
2583
- n,
2584
- { type: "apple_pay", data: s },
2585
- i
2581
+ async function Ft(e, t, o, i, s = {}) {
2582
+ const { checkoutAmount: u, checkoutPaymentMethod: a, useBalanceFlag: d } = Ie(
2583
+ t,
2584
+ { type: "apple_pay", data: i },
2585
+ s
2586
2586
  );
2587
2587
  return Se(
2588
2588
  e,
2589
- n,
2589
+ t,
2590
2590
  o,
2591
- Qe(n, c, u, d),
2591
+ Qe(t, a, u, d),
2592
2592
  "Ошибка создания заказа с Apple Pay"
2593
2593
  );
2594
2594
  }
2595
- async function Ft(e, n, o, s, i = {}) {
2596
- const { checkoutAmount: u, checkoutPaymentMethod: c, useBalanceFlag: d } = Ie(
2597
- n,
2598
- { type: "google_pay", data: s },
2599
- i
2595
+ async function at(e, t, o, i, s = {}) {
2596
+ const { checkoutAmount: u, checkoutPaymentMethod: a, useBalanceFlag: d } = Ie(
2597
+ t,
2598
+ { type: "google_pay", data: i },
2599
+ s
2600
2600
  );
2601
2601
  return Se(
2602
2602
  e,
2603
- n,
2603
+ t,
2604
2604
  o,
2605
- Qe(n, c, u, d),
2605
+ Qe(t, a, u, d),
2606
2606
  "Ошибка создания заказа с Google Pay"
2607
2607
  );
2608
2608
  }
2609
2609
  function Jt(e) {
2610
- const n = typeof e.color == "string" ? e.color.trim() : "", o = n && /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/.test(n) ? `#${n}` : n, s = e.bonuses, i = s && typeof s == "object" && Number.isFinite(s.amount) && Number.isFinite(s.percent) ? {
2611
- availableBonus: Number.isFinite(s.availableBonus) ? Number(s.availableBonus) : 0,
2612
- amount: Number(s.amount),
2613
- percent: Number(s.percent)
2610
+ const t = typeof e.color == "string" ? e.color.trim() : "", o = t && /^[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/.test(t) ? `#${t}` : t, i = e.bonuses, s = i && typeof i == "object" && Number.isFinite(i.amount) && Number.isFinite(i.percent) ? {
2611
+ availableBonus: Number.isFinite(i.availableBonus) ? Number(i.availableBonus) : 0,
2612
+ amount: Number(i.amount),
2613
+ percent: Number(i.percent)
2614
2614
  } : null;
2615
2615
  return {
2616
2616
  preorderId: e.preorderId,
@@ -2634,32 +2634,36 @@ function Jt(e) {
2634
2634
  onConfirmPay: typeof e.onConfirmPay == "function" ? e.onConfirmPay : null,
2635
2635
  onPaymentMethodSelected: typeof e.onPaymentMethodSelected == "function" ? e.onPaymentMethodSelected : null,
2636
2636
  onKaspiLink: typeof e.onKaspiLink == "function" ? e.onKaspiLink : null,
2637
+ onPayWithGooglePay: typeof e.onPayWithGooglePay == "function" ? e.onPayWithGooglePay : null,
2637
2638
  onUserEvent: typeof e.onUserEvent == "function" ? e.onUserEvent : null,
2638
2639
  onBeforeCheckout: typeof e.onBeforeCheckout == "function" ? e.onBeforeCheckout : null,
2640
+ idempotencyKey: e.idempotencyKey,
2639
2641
  locale: e.locale || "ru",
2640
2642
  containerSelector: typeof e.containerSelector == "string" ? e.containerSelector.trim() : "",
2641
2643
  color: o || "#2F2F2F",
2642
2644
  onlyKaspiAvailable: !!e.onlyKaspiAvailable,
2643
2645
  disableKaspi: !!e.disableKaspi,
2644
- bonuses: i
2646
+ disableGooglePay: !!e.disableGooglePay,
2647
+ isNativeAndroid: !!e.isNativeAndroid,
2648
+ bonuses: s
2645
2649
  };
2646
2650
  }
2647
- function Me(e, n) {
2648
- Re("webPayToken", e), n && Re("webPayRefreshToken", n);
2651
+ function Me(e, t) {
2652
+ Re("webPayToken", e), t && Re("webPayRefreshToken", t);
2649
2653
  }
2650
2654
  function Ze() {
2651
2655
  be("webPayToken"), be("webPayRefreshToken");
2652
2656
  }
2653
2657
  async function qt(e) {
2654
- const n = it("webPayRefreshToken");
2655
- if (n && e.config.clientId)
2658
+ const t = it("webPayRefreshToken");
2659
+ if (t && e.config.clientId)
2656
2660
  try {
2657
- const s = await Mt(
2661
+ const i = await Nt(
2658
2662
  e.apiUrl,
2659
2663
  e.config.clientId,
2660
- n
2664
+ t
2661
2665
  );
2662
- Me(s.access_token, s.refresh_token), e.accessToken = s.access_token;
2666
+ Me(i.access_token, i.refresh_token), e.accessToken = i.access_token;
2663
2667
  return;
2664
2668
  } catch {
2665
2669
  be("webPayRefreshToken");
@@ -2668,7 +2672,7 @@ async function qt(e) {
2668
2672
  e.config.onError({ attributes: { message: e.t("errorMissingTrackClient") } });
2669
2673
  return;
2670
2674
  }
2671
- const o = await Ot(
2675
+ const o = await Mt(
2672
2676
  e.apiUrl,
2673
2677
  e.config.clientId,
2674
2678
  e.config.trackId
@@ -2692,7 +2696,7 @@ const jt = `<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="h
2692
2696
  </clipPath>
2693
2697
  </defs>
2694
2698
  </svg>
2695
- `, Vt = `<svg width="52" height="21" viewBox="0 0 52 21" fill="none" xmlns="http://www.w3.org/2000/svg">
2699
+ `, Wt = `<svg width="52" height="21" viewBox="0 0 52 21" fill="none" xmlns="http://www.w3.org/2000/svg">
2696
2700
  <g clip-path="url(#clip0_23934_4296)">
2697
2701
  <path d="M24.5944 10.0883V16.1414H22.6741V1.19278H27.7671C28.375 1.18008 28.9794 1.2879 29.5455 1.51002C30.1115 1.73213 30.628 2.06415 31.065 2.4869C31.5065 2.88399 31.8578 3.37098 32.0954 3.91513C32.3331 4.45929 32.4514 5.048 32.4426 5.64171C32.4553 6.23859 32.3387 6.83115 32.1009 7.37877C31.8631 7.92639 31.5098 8.41612 31.065 8.8144C30.1744 9.66364 29.0751 10.0879 27.7671 10.0871H24.5944V10.0883ZM24.5944 3.03318V8.25143H27.8148C28.1678 8.26189 28.5192 8.19856 28.8464 8.06547C29.1735 7.93238 29.4693 7.73247 29.7148 7.47853C29.959 7.2411 30.1532 6.95711 30.2857 6.64336C30.4183 6.3296 30.4866 5.99245 30.4866 5.65184C30.4866 5.31124 30.4183 4.97409 30.2857 4.66033C30.1532 4.34658 29.959 4.06259 29.7148 3.82516C29.4724 3.56587 29.1776 3.36106 28.8501 3.22432C28.5225 3.08757 28.1696 3.02201 27.8148 3.03199H24.5944V3.03318Z" fill="black"/>
2698
2702
  <path d="M36.8677 5.57959C38.2871 5.57959 39.4075 5.95888 40.2289 6.71747C41.0503 7.47605 41.4606 8.51612 41.4598 9.83768V16.1413H39.623V14.722H39.5395C38.7443 15.8909 37.6868 16.4753 36.3668 16.4753C35.24 16.4753 34.2974 16.1413 33.5388 15.4734C33.1747 15.1668 32.8837 14.7829 32.6868 14.3496C32.49 13.9163 32.3923 13.4445 32.4009 12.9686C32.4009 11.9103 32.8009 11.0686 33.6008 10.4436C34.4007 9.8186 35.4686 9.5053 36.8045 9.50371C37.9448 9.50371 38.8839 9.71244 39.6218 10.1299V9.69097C39.624 9.36657 39.5539 9.04574 39.4167 8.75177C39.2795 8.45779 39.0786 8.19803 38.8286 7.99132C38.3208 7.53316 37.659 7.28317 36.9751 7.29118C35.9024 7.29118 35.0536 7.74362 34.4286 8.64852L32.7373 7.5834C33.6676 6.24753 35.0444 5.57959 36.8677 5.57959ZM34.3833 13.0104C34.382 13.2548 34.4391 13.4959 34.5499 13.7138C34.6607 13.9316 34.8219 14.1198 35.0202 14.2628C35.4449 14.5968 35.972 14.7738 36.5123 14.7637C37.3226 14.7624 38.0994 14.4398 38.6724 13.8668C39.3085 13.268 39.6266 12.5655 39.6266 11.7592C39.0278 11.2821 38.1929 11.0435 37.1218 11.0435C36.3417 11.0435 35.6913 11.2316 35.1705 11.6077C34.6445 11.9894 34.3833 12.4534 34.3833 13.0104Z" fill="black"/>
@@ -2708,7 +2712,7 @@ const jt = `<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="h
2708
2712
  </clipPath>
2709
2713
  </defs>
2710
2714
  </svg>
2711
- `, Wt = `<svg width="25" height="12" viewBox="0 0 25 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2715
+ `, Vt = `<svg width="25" height="12" viewBox="0 0 25 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2712
2716
  <rect width="25" height="11.5385" rx="2.88462" fill="#00579F"/>
2713
2717
  <g clip-path="url(#clip0_22788_48747)">
2714
2718
  <path d="M9.84078 8.57012H8.36084L9.2865 2.98535H10.7664L9.84078 8.57012Z" fill="white"/>
@@ -2736,38 +2740,38 @@ const jt = `<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="h
2736
2740
  kaspi_pay: jt,
2737
2741
  new_card: zt,
2738
2742
  apple_pay: Kt,
2739
- google_pay: Vt,
2740
- visa: Wt,
2743
+ google_pay: Wt,
2744
+ visa: Vt,
2741
2745
  mastercard: Yt
2742
2746
  };
2743
2747
  function Zt(e) {
2744
- const n = e == null ? void 0 : e.toLowerCase();
2745
- return n && Gt[n] || "";
2748
+ const t = e == null ? void 0 : e.toLowerCase();
2749
+ return t && Gt[t] || "";
2746
2750
  }
2747
- const at = `<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
2751
+ const ct = `<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
2748
2752
  <path d="M19.7045 10.7313C15.0567 10.7313 11.2687 6.94328 11.2687 2.26866C11.2687 2.10746 11.1612 2 11 2C10.8388 2 10.7313 2.10746 10.7313 2.26866C10.7313 6.94328 6.94328 10.7313 2.26866 10.7313C2.10746 10.7313 2 10.8388 2 11C2 11.1612 2.10746 11.2687 2.26866 11.2687C6.94328 11.2687 10.7313 15.0567 10.7313 19.7313C10.7313 19.8925 10.8388 20 11 20C11.1612 20 11.2687 19.8925 11.2687 19.7313C11.2687 15.0567 15.0567 11.2687 19.7313 11.2687C19.8925 11.2687 20 11.1612 20 11C20 10.8388 19.8657 10.7313 19.7045 10.7313Z" fill="#2F2F2F"/>
2749
2753
  </svg>
2750
2754
  `, $t = '<svg class="choco-widget-method-item-trash" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.16663 5.83317H15.8333" stroke="#CC3434" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M15 5.8335V15.0002C15 15.921 14.2542 16.6668 13.3333 16.6668H6.66667C5.74583 16.6668 5 15.921 5 15.0002V5.8335" stroke="#CC3434" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M12.5 3.12516H7.5" stroke="#CC3434" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M8.33329 9.1665V13.3332" stroke="#CC3434" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M11.6667 9.1665V13.3332" stroke="#CC3434" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>', en = '<svg class="choco-widget-method-item-check" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.3333 4.3335L5.99996 11.6668L2.66663 8.3335" stroke="#242424" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
2751
2755
  function Ee(e) {
2752
2756
  return Zt(e == null ? void 0 : e.iconType);
2753
2757
  }
2754
- function ct(e, n, o, s = {}) {
2755
- const { editMode: i = !1 } = s;
2756
- return (i ? e.filter((c) => c.type === "card") : e).map((c) => {
2757
- const d = !i && !!n && n.type === c.type && n.cardId === c.cardId, g = JSON.stringify(c).replace(/'/g, "&apos;");
2758
- return i ? `
2758
+ function At(e, t, o, i = {}) {
2759
+ const { editMode: s = !1 } = i;
2760
+ return (s ? e.filter((a) => a.type === "card") : e).map((a) => {
2761
+ const d = !s && !!t && t.type === a.type && t.cardId === a.cardId, g = JSON.stringify(a).replace(/'/g, "&apos;");
2762
+ return s ? `
2759
2763
  <div
2760
2764
  class="choco-widget-method-item choco-widget-method-item--edit"
2761
2765
  role="listitem"
2762
2766
  >
2763
- <div class="choco-widget-method-item-icon-wrapper" aria-hidden="true">${Ee(c)}</div>
2764
- <div class="choco-widget-method-item-label">${c.label}</div>
2767
+ <div class="choco-widget-method-item-icon-wrapper" aria-hidden="true">${Ee(a)}</div>
2768
+ <div class="choco-widget-method-item-label">${a.label}</div>
2765
2769
  <button
2766
2770
  type="button"
2767
2771
  class="choco-widget-method-item-trash-btn"
2768
2772
  data-action="delete-card"
2769
2773
  data-method='${g}'
2770
- aria-label="${c.label} — Удалить"
2774
+ aria-label="${a.label} — Удалить"
2771
2775
  >
2772
2776
  ${$t}
2773
2777
  </button>
@@ -2778,19 +2782,19 @@ function ct(e, n, o, s = {}) {
2778
2782
  data-method='${g}'
2779
2783
  data-action="select-method"
2780
2784
  role="listitem"
2781
- aria-label="${c.label}${d ? " (выбрано)" : ""}"
2785
+ aria-label="${a.label}${d ? " (выбрано)" : ""}"
2782
2786
  type="button"
2783
2787
  >
2784
- <div class="choco-widget-method-item-icon-wrapper ${c.type}" aria-hidden="true">${Ee(c)}</div>
2785
- <div class="choco-widget-method-item-label">${c.label}</div>
2788
+ <div class="choco-widget-method-item-icon-wrapper ${a.type}" aria-hidden="true">${Ee(a)}</div>
2789
+ <div class="choco-widget-method-item-label">${a.label}</div>
2786
2790
  ${d ? en : ""}
2787
2791
  </button>
2788
2792
  `;
2789
2793
  }).join("");
2790
2794
  }
2791
- function tn(e, n, o, s) {
2795
+ function tn(e, t, o, i) {
2792
2796
  if (!e) return "";
2793
- const i = typeof e.amount == "number" && Number.isFinite(e.amount), u = typeof e.percent == "number" && Number.isFinite(e.percent);
2797
+ const s = typeof e.amount == "number" && Number.isFinite(e.amount), u = typeof e.percent == "number" && Number.isFinite(e.percent);
2794
2798
  return `
2795
2799
  <div class="choco-widget-balance-toggle" data-action="toggle-bonuses">
2796
2800
  <div class="choco-widget-balance-info">
@@ -2801,50 +2805,50 @@ function tn(e, n, o, s) {
2801
2805
  </div>
2802
2806
  <div class="choco-widget-balance-label-wrapper">
2803
2807
  <div class="choco-widget-balance-icon">
2804
- ${at}
2808
+ ${ct}
2805
2809
  </div>
2806
- <div class="choco-widget-balance-amount">${i ? G(e.amount, "ru", s) : 0}</div>
2810
+ <div class="choco-widget-balance-amount">${s ? G(e.amount, "ru", i) : 0}</div>
2807
2811
  <label class="choco-widget-toggle">
2808
- <input type="checkbox" ${n ? "checked" : ""} />
2812
+ <input type="checkbox" ${t ? "checked" : ""} />
2809
2813
  <span class="choco-widget-toggle-slider"></span>
2810
2814
  </label>
2811
2815
  </div>
2812
2816
  </div>
2813
2817
  `;
2814
2818
  }
2815
- function nn(e, n, o, s, i, u) {
2819
+ function nn(e, t, o, i, s, u) {
2816
2820
  return !e && !o ? "" : `
2817
2821
  <div class="choco-widget-balance-section">
2818
2822
  ${e ? `
2819
2823
  <div class="choco-widget-balance-toggle" data-action="toggle-balance">
2820
2824
  <div class="choco-widget-balance-info">
2821
2825
  <div class="choco-widget-balance-text">
2822
- <div class="choco-widget-balance-label">${i("balance")}</div>
2826
+ <div class="choco-widget-balance-label">${s("balance")}</div>
2823
2827
  </div>
2824
2828
  </div>
2825
2829
  <div class="choco-widget-balance-label-wrapper">
2826
2830
  <div class="choco-widget-balance-icon">
2827
- ${at}
2831
+ ${ct}
2828
2832
  </div>
2829
2833
  <div class="choco-widget-balance-amount">${e}</div>
2830
2834
  <label class="choco-widget-toggle">
2831
- <input type="checkbox" ${n ? "checked" : ""} />
2835
+ <input type="checkbox" ${t ? "checked" : ""} />
2832
2836
  <span class="choco-widget-toggle-slider"></span>
2833
2837
  </label>
2834
2838
  </div>
2835
2839
  </div>
2836
2840
  ` : ""}
2837
- ${tn(o, s, i, u)}
2841
+ ${tn(o, i, s, u)}
2838
2842
  </div>
2839
2843
  `;
2840
2844
  }
2841
- function rn(e, n) {
2845
+ function rn(e, t) {
2842
2846
  return e ? `
2843
2847
  <div class="choco-widget-cashback-section">
2844
2848
  <div class="choco-widget-cashback-info">
2845
2849
  <span class="choco-widget-cashback-icon">🎁</span>
2846
2850
  <span class="choco-widget-cashback-text">
2847
- ${n("willGet")} <strong>${e}</strong> ${n("cashback").toLowerCase()}
2851
+ ${t("willGet")} <strong>${e}</strong> ${t("cashback").toLowerCase()}
2848
2852
  </span>
2849
2853
  </div>
2850
2854
  </div>
@@ -2852,40 +2856,40 @@ function rn(e, n) {
2852
2856
  }
2853
2857
  function on(e) {
2854
2858
  const {
2855
- amountFormatted: n,
2859
+ amountFormatted: t,
2856
2860
  originalAmountFormatted: o,
2857
- showOriginalAmount: s = !1,
2858
- paymentMethod: i,
2861
+ showOriginalAmount: i = !1,
2862
+ paymentMethod: s,
2859
2863
  methods: u,
2860
- selectedMethod: c,
2864
+ selectedMethod: a,
2861
2865
  balanceFormatted: d,
2862
2866
  useBalance: g,
2863
2867
  bonuses: C,
2864
2868
  useBonuses: S,
2865
2869
  cashbackFormatted: T,
2866
- disabled: v,
2870
+ disabled: E,
2867
2871
  paymentMethodDisabled: Q = !1,
2868
2872
  loading: _,
2869
2873
  t: m,
2870
2874
  currency: P
2871
- } = e, k = (i == null ? void 0 : i.label) ?? m("selectMethod"), w = Ee(i), L = ct(u, c), O = nn(d, g, C, S, m, P), F = rn(T, m), M = (c == null ? void 0 : c.type) === "google_pay", J = (c == null ? void 0 : c.type) === "apple_pay", x = M || J;
2875
+ } = e, k = (s == null ? void 0 : s.label) ?? m("selectMethod"), w = Ee(s), L = At(u, a), O = nn(d, g, C, S, m, P), F = rn(T, m), M = (a == null ? void 0 : a.type) === "google_pay", J = (a == null ? void 0 : a.type) === "apple_pay", x = M || J;
2872
2876
  return `
2873
2877
  <div class="choco-widget-bottom-bar" role="region" aria-label="${m("paymentMethod")}">
2874
2878
  ${O}
2875
2879
  <div class="choco-widget-payment-info">
2876
2880
  <div class="choco-widget-payment-info-main">
2877
2881
  <button
2878
- class="choco-widget-payment-method ${(i == null ? void 0 : i.type) || ""}"
2882
+ class="choco-widget-payment-method ${(s == null ? void 0 : s.type) || ""}"
2879
2883
  data-action="change-method"
2880
2884
  aria-label="${m("paymentMethod")}: ${k}"
2881
2885
  type="button"
2882
- ${Q || v || _ ? "disabled" : ""}
2886
+ ${Q || E || _ ? "disabled" : ""}
2883
2887
  >
2884
2888
  <div class="choco-widget-method-label">${m("paymentMethod")}</div>
2885
2889
  <div class="choco-widget-method-value">
2886
- <div class="choco-widget-method-icon-wrapper ${i == null ? void 0 : i.type}" aria-hidden="true">${w}</div>
2890
+ <div class="choco-widget-method-icon-wrapper ${s == null ? void 0 : s.type}" aria-hidden="true">${w}</div>
2887
2891
  <div class="choco-widget-method-details">
2888
- <div class="choco-widget-method-name ${i == null ? void 0 : i.type}">${k}</div>
2892
+ <div class="choco-widget-method-name ${s == null ? void 0 : s.type}">${k}</div>
2889
2893
  <div class="choco-widget-method-chevron">
2890
2894
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2891
2895
  <path d="M8 10L12 14L16 10" stroke="#242424" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
@@ -2895,17 +2899,17 @@ function on(e) {
2895
2899
  </div>
2896
2900
  </button>
2897
2901
  <div class="choco-widget-google-pay-amount ${x ? "" : "choco-widget-google-pay-amount--hidden"}" aria-live="polite">
2898
- <div class="choco-widget-google-pay-amount-label">${m("total")} ${n}</div>
2899
- ${s ? `<div class="choco-widget-google-pay-amount-value">${m("instead")} <span class="choco-widget-google-pay-amount-value-number">${o || ""}</span></div>` : ""}
2902
+ <div class="choco-widget-google-pay-amount-label">${m("total")} ${t}</div>
2903
+ ${i ? `<div class="choco-widget-google-pay-amount-value">${m("instead")} <span class="choco-widget-google-pay-amount-value-number">${o || ""}</span></div>` : ""}
2900
2904
  </div>
2901
2905
  <button
2902
2906
  class="choco-widget-pay-button ${_ ? "choco-widget-pay-button--loading" : ""} ${x ? "choco-widget-pay-button--hidden" : ""}"
2903
2907
  data-action="pay"
2904
- aria-label="${m("pay")} ${n}"
2908
+ aria-label="${m("pay")} ${t}"
2905
2909
  type="button"
2906
- ${v || _ ? "disabled" : ""}
2910
+ ${E || _ ? "disabled" : ""}
2907
2911
  >
2908
- ${m("pay")} ${n}
2912
+ ${m("pay")} ${t}
2909
2913
  </button>
2910
2914
  </div>
2911
2915
  <div class="choco-widget-google-pay-row ${M ? "" : "choco-widget-google-pay-row--hidden"}">
@@ -2994,35 +2998,35 @@ function sn() {
2994
2998
  </div>
2995
2999
  `;
2996
3000
  }
2997
- function an(e, n, o, s = {}) {
2998
- return ct(e, n, o, s);
3001
+ function an(e, t, o, i = {}) {
3002
+ return At(e, t, o, i);
2999
3003
  }
3000
3004
  function cn(e) {
3001
3005
  return Ee(e);
3002
3006
  }
3003
3007
  function An(e) {
3004
3008
  if (typeof document > "u") return { mountTarget: null, isEmbedded: !1 };
3005
- const n = e.config.containerSelector;
3006
- if (n) {
3007
- const o = document.querySelector(n);
3009
+ const t = e.config.containerSelector;
3010
+ if (t) {
3011
+ const o = document.querySelector(t);
3008
3012
  if (o instanceof HTMLElement) return { mountTarget: o, isEmbedded: !0 };
3009
3013
  }
3010
3014
  return { mountTarget: document.body, isEmbedded: !1 };
3011
3015
  }
3012
- function At(e) {
3016
+ function ut(e) {
3013
3017
  if (typeof document > "u") return !1;
3014
3018
  e.container || (e.container = document.createElement("div"), e.container.id = "choco-one-click-widget", e.container.className = "choco-one-click-widget");
3015
- const { mountTarget: n, isEmbedded: o } = An(e);
3016
- return n ? (e.container.parentElement !== n && n.appendChild(e.container), e.container.classList.toggle("choco-one-click-widget--embedded", o), !0) : !1;
3019
+ const { mountTarget: t, isEmbedded: o } = An(e);
3020
+ return t ? (e.container.parentElement !== t && t.appendChild(e.container), e.container.classList.toggle("choco-one-click-widget--embedded", o), !0) : !1;
3017
3021
  }
3018
3022
  function un(e) {
3019
- At(e) && (e.container.style.setProperty("--choco-widget-accent-color", e.config.color), e.container.innerHTML = sn());
3023
+ ut(e) && (e.container.style.setProperty("--choco-widget-accent-color", e.config.color), e.container.innerHTML = sn());
3020
3024
  }
3021
3025
  function ln(e) {
3022
- var S, T, v, Q, _;
3023
- if (!At(e)) return;
3026
+ var S, T, E, Q, _;
3027
+ if (!ut(e)) return;
3024
3028
  e.container.style.setProperty("--choco-widget-accent-color", e.config.color), e.container.classList.remove("choco-one-click-widget--visible");
3025
- const n = e.getAvailablePaymentMethods(), o = (S = e.checkoutContext) == null ? void 0 : S.data, s = e.config.currency || "KZT", i = (Q = (v = (T = o == null ? void 0 : o.balance) == null ? void 0 : T.data) == null ? void 0 : v.money) == null ? void 0 : Q[s], u = i > 0 ? G(i, e.config.locale, e.config.currency) : null, c = (_ = o == null ? void 0 : o.cashback) == null ? void 0 : _.data, d = (c == null ? void 0 : c.cashbackAmount) > 0 ? G(c.cashbackAmount, e.config.locale, e.config.currency) : null, g = e._getPayableAmount(), C = g < e.config.amount;
3029
+ const t = e.getAvailablePaymentMethods(), o = (S = e.checkoutContext) == null ? void 0 : S.data, i = e.config.currency || "KZT", s = (Q = (E = (T = o == null ? void 0 : o.balance) == null ? void 0 : T.data) == null ? void 0 : E.money) == null ? void 0 : Q[i], u = s > 0 ? G(s, e.config.locale, e.config.currency) : null, a = (_ = o == null ? void 0 : o.cashback) == null ? void 0 : _.data, d = (a == null ? void 0 : a.cashbackAmount) > 0 ? G(a.cashbackAmount, e.config.locale, e.config.currency) : null, g = e._getPayableAmount(), C = g < e.config.amount;
3026
3030
  e.container.innerHTML = on({
3027
3031
  amountFormatted: G(g, e.config.locale, e.config.currency),
3028
3032
  originalAmountFormatted: G(
@@ -3032,7 +3036,7 @@ function ln(e) {
3032
3036
  ),
3033
3037
  showOriginalAmount: C,
3034
3038
  paymentMethod: e.selectedPaymentMethod,
3035
- methods: n,
3039
+ methods: t,
3036
3040
  selectedMethod: e.selectedPaymentMethod,
3037
3041
  balanceFormatted: u,
3038
3042
  useBalance: e.useBalance,
@@ -3043,7 +3047,7 @@ function ln(e) {
3043
3047
  paymentMethodDisabled: e.paymentMethodDisabled,
3044
3048
  loading: e.loading,
3045
3049
  t: (m, P) => e.t(m, P),
3046
- currency: s
3050
+ currency: i
3047
3051
  }), e._attachEventListeners(), e.isOpen = !0, e._emitUserEvent("one_click_pay_cta_rendered", {
3048
3052
  terminal_id: e.config.terminalId,
3049
3053
  project_id: e.config.clientId
@@ -3056,74 +3060,74 @@ function ln(e) {
3056
3060
  });
3057
3061
  });
3058
3062
  }
3059
- function ce(e) {
3060
- var s;
3061
- const n = (s = e.container) == null ? void 0 : s.querySelector(
3063
+ function Ae(e) {
3064
+ var i;
3065
+ const t = (i = e.container) == null ? void 0 : i.querySelector(
3062
3066
  ".choco-widget-payment-methods"
3063
3067
  );
3064
- if (!n) return;
3068
+ if (!t) return;
3065
3069
  const o = e.getAvailablePaymentMethods();
3066
- n.innerHTML = an(
3070
+ t.innerHTML = an(
3067
3071
  o,
3068
3072
  e.selectedPaymentMethod,
3069
- (i) => e.t(i),
3073
+ (s) => e.t(s),
3070
3074
  { editMode: e.isPaymentSheetEditMode }
3071
- ), n.querySelectorAll("[data-action='delete-card']").forEach((i) => {
3072
- i.addEventListener("click", (u) => {
3075
+ ), t.querySelectorAll("[data-action='delete-card']").forEach((s) => {
3076
+ s.addEventListener("click", (u) => {
3073
3077
  u.stopPropagation();
3074
- const c = JSON.parse(i.getAttribute("data-method") || "{}");
3075
- pn(e, c);
3078
+ const a = JSON.parse(s.getAttribute("data-method") || "{}");
3079
+ pn(e, a);
3076
3080
  });
3077
- }), n.querySelectorAll("[data-action='select-method']").forEach((i) => {
3078
- i.addEventListener("click", (u) => {
3079
- const c = JSON.parse(
3081
+ }), t.querySelectorAll("[data-action='select-method']").forEach((s) => {
3082
+ s.addEventListener("click", (u) => {
3083
+ const a = JSON.parse(
3080
3084
  u.currentTarget.getAttribute("data-method") || "{}"
3081
3085
  );
3082
- ht(e, c);
3086
+ ft(e, a);
3083
3087
  });
3084
3088
  });
3085
3089
  }
3086
- function ut(e) {
3087
- var i, u, c;
3088
- const n = (i = e.container) == null ? void 0 : i.querySelector(".choco-widget-payment-method"), o = (u = e.container) == null ? void 0 : u.querySelector(".choco-widget-method-name"), s = (c = e.container) == null ? void 0 : c.querySelector(
3090
+ function lt(e) {
3091
+ var s, u, a;
3092
+ const t = (s = e.container) == null ? void 0 : s.querySelector(".choco-widget-payment-method"), o = (u = e.container) == null ? void 0 : u.querySelector(".choco-widget-method-name"), i = (a = e.container) == null ? void 0 : a.querySelector(
3089
3093
  ".choco-widget-method-icon-wrapper"
3090
3094
  );
3091
- n && e.selectedPaymentMethod && (n.className = `choco-widget-payment-method ${e.selectedPaymentMethod.type}`), o && e.selectedPaymentMethod && (o.className = `choco-widget-method-name ${e.selectedPaymentMethod.type}`, o.textContent = e.selectedPaymentMethod.label), s && e.selectedPaymentMethod && (s.className = `choco-widget-method-icon-wrapper ${e.selectedPaymentMethod.type}`, s.innerHTML = cn(e.selectedPaymentMethod)), lt(e);
3095
+ t && e.selectedPaymentMethod && (t.className = `choco-widget-payment-method ${e.selectedPaymentMethod.type}`), o && e.selectedPaymentMethod && (o.className = `choco-widget-method-name ${e.selectedPaymentMethod.type}`, o.textContent = e.selectedPaymentMethod.label), i && e.selectedPaymentMethod && (i.className = `choco-widget-method-icon-wrapper ${e.selectedPaymentMethod.type}`, i.innerHTML = cn(e.selectedPaymentMethod)), dt(e);
3092
3096
  }
3093
3097
  function pe(e) {
3094
- var S, T, v, Q, _;
3095
- const n = (S = e.container) == null ? void 0 : S.querySelector(".choco-widget-pay-button"), o = (T = e.container) == null ? void 0 : T.querySelector(
3098
+ var S, T, E, Q, _;
3099
+ const t = (S = e.container) == null ? void 0 : S.querySelector(".choco-widget-pay-button"), o = (T = e.container) == null ? void 0 : T.querySelector(
3096
3100
  ".choco-widget-google-pay-amount"
3097
- ), s = (v = e.container) == null ? void 0 : v.querySelector(
3101
+ ), i = (E = e.container) == null ? void 0 : E.querySelector(
3098
3102
  ".choco-widget-google-pay-amount-label"
3099
3103
  );
3100
- let i = (Q = e.container) == null ? void 0 : Q.querySelector(
3104
+ let s = (Q = e.container) == null ? void 0 : Q.querySelector(
3101
3105
  ".choco-widget-google-pay-amount-value"
3102
3106
  ), u = (_ = e.container) == null ? void 0 : _.querySelector(
3103
3107
  ".choco-widget-google-pay-amount-value-number"
3104
3108
  );
3105
- const c = e._getPayableAmount(), d = G(c, e.config.locale, e.config.currency), g = c < e.config.amount, C = G(
3109
+ const a = e._getPayableAmount(), d = G(a, e.config.locale, e.config.currency), g = a < e.config.amount, C = G(
3106
3110
  e.config.amount,
3107
3111
  e.config.locale,
3108
3112
  e.config.currency
3109
3113
  );
3110
- if (n && (n.textContent = `${e.t("pay")} ${d}`, n.setAttribute("aria-label", `${e.t("pay")} ${d}`)), s && (s.textContent = `${e.t("total")} ${d}`), !g) {
3111
- i == null || i.remove();
3114
+ if (t && (t.textContent = `${e.t("pay")} ${d}`, t.setAttribute("aria-label", `${e.t("pay")} ${d}`)), i && (i.textContent = `${e.t("total")} ${d}`), !g) {
3115
+ s == null || s.remove();
3112
3116
  return;
3113
3117
  }
3114
- !i && o && (i = document.createElement("div"), i.className = "choco-widget-google-pay-amount-value", i.innerHTML = `${e.t("instead")} <span class="choco-widget-google-pay-amount-value-number"></span>`, o.appendChild(i), u = i.querySelector(
3118
+ !s && o && (s = document.createElement("div"), s.className = "choco-widget-google-pay-amount-value", s.innerHTML = `${e.t("instead")} <span class="choco-widget-google-pay-amount-value-number"></span>`, o.appendChild(s), u = s.querySelector(
3115
3119
  ".choco-widget-google-pay-amount-value-number"
3116
- )), u ? u.textContent = C : i && (i.textContent = `${e.t("instead")} ${C}`);
3120
+ )), u ? u.textContent = C : s && (s.textContent = `${e.t("instead")} ${C}`);
3117
3121
  }
3118
- function lt(e) {
3119
- var g, C, S, T, v, Q, _, m, P, k;
3120
- const n = ((g = e.selectedPaymentMethod) == null ? void 0 : g.type) === "google_pay", o = ((C = e.selectedPaymentMethod) == null ? void 0 : C.type) === "apple_pay", s = n || o, i = (S = e.container) == null ? void 0 : S.querySelector(".choco-widget-pay-button"), u = (T = e.container) == null ? void 0 : T.querySelector(
3122
+ function dt(e) {
3123
+ var g, C, S, T, E, Q, _, m, P, k;
3124
+ const t = ((g = e.selectedPaymentMethod) == null ? void 0 : g.type) === "google_pay", o = ((C = e.selectedPaymentMethod) == null ? void 0 : C.type) === "apple_pay", i = t || o, s = (S = e.container) == null ? void 0 : S.querySelector(".choco-widget-pay-button"), u = (T = e.container) == null ? void 0 : T.querySelector(
3121
3125
  ".choco-widget-google-pay-amount"
3122
- ), c = (v = e.container) == null ? void 0 : v.querySelector(".choco-widget-google-pay-row"), d = (Q = e.container) == null ? void 0 : Q.querySelector(".choco-widget-apple-pay-row");
3123
- if (i == null || i.classList.toggle("choco-widget-pay-button--hidden", s), u == null || u.classList.toggle(
3126
+ ), a = (E = e.container) == null ? void 0 : E.querySelector(".choco-widget-google-pay-row"), d = (Q = e.container) == null ? void 0 : Q.querySelector(".choco-widget-apple-pay-row");
3127
+ if (s == null || s.classList.toggle("choco-widget-pay-button--hidden", i), u == null || u.classList.toggle(
3124
3128
  "choco-widget-google-pay-amount--hidden",
3125
- !s
3126
- ), c == null || c.classList.toggle("choco-widget-google-pay-row--hidden", !n), d == null || d.classList.toggle("choco-widget-apple-pay-row--hidden", !o), n) {
3129
+ !i
3130
+ ), a == null || a.classList.toggle("choco-widget-google-pay-row--hidden", !t), d == null || d.classList.toggle("choco-widget-apple-pay-row--hidden", !o), t) {
3127
3131
  dn(e);
3128
3132
  const w = (_ = e.container) == null ? void 0 : _.querySelector(
3129
3133
  '[data-action="apple-pay-button-slot"]'
@@ -3147,11 +3151,11 @@ function lt(e) {
3147
3151
  pe(e), ee(e);
3148
3152
  }
3149
3153
  async function dn(e) {
3150
- var c, d, g, C, S;
3151
- const n = (c = e.container) == null ? void 0 : c.querySelector(
3154
+ var a, d, g, C, S;
3155
+ const t = (a = e.container) == null ? void 0 : a.querySelector(
3152
3156
  '[data-action="google-pay-button-slot"]'
3153
3157
  );
3154
- if (!n || (n.innerHTML = "", ((d = e.selectedPaymentMethod) == null ? void 0 : d.type) !== "google_pay")) return;
3158
+ if (!t || (t.innerHTML = "", ((d = e.selectedPaymentMethod) == null ? void 0 : d.type) !== "google_pay")) return;
3155
3159
  const o = ++e._googlePayButtonRenderVersion;
3156
3160
  try {
3157
3161
  await e._loadGooglePaySdk();
@@ -3164,8 +3168,8 @@ async function dn(e) {
3164
3168
  e.config.onError({ attributes: { message: e.t("errorGooglePayUnsupported") } });
3165
3169
  return;
3166
3170
  }
3167
- const s = e.config.environment === "production", u = new window.google.payments.api.PaymentsClient({
3168
- environment: s ? "PRODUCTION" : "TEST"
3171
+ const i = e.config.environment === "production", u = new window.google.payments.api.PaymentsClient({
3172
+ environment: i ? "PRODUCTION" : "TEST"
3169
3173
  }).createButton({
3170
3174
  onClick: () => e.handlePayment(),
3171
3175
  buttonType: "pay",
@@ -3175,20 +3179,20 @@ async function dn(e) {
3175
3179
  });
3176
3180
  u.classList.add("choco-widget-google-pay-button"), u.style.setProperty("width", "100%", "important"), u.style.setProperty("height", "52px", "important"), u.style.setProperty("min-height", "52px", "important"), u.style.setProperty("border-radius", "12px", "important"), u.style.setProperty("font-size", "16px", "important"), u.style.setProperty("font-weight", "bold", "important"), u.querySelectorAll("*").forEach((T) => {
3177
3181
  T.style.setProperty("border-radius", "12px", "important"), T.style.setProperty("font-weight", "bold", "important"), T.style.setProperty("font-size", "16px", "important");
3178
- }), n.appendChild(u), ee(e);
3182
+ }), t.appendChild(u), ee(e);
3179
3183
  }
3180
3184
  function hn(e) {
3181
- var u, c;
3182
- const n = (u = e.container) == null ? void 0 : u.querySelector(
3185
+ var u, a;
3186
+ const t = (u = e.container) == null ? void 0 : u.querySelector(
3183
3187
  '[data-action="apple-pay-button-slot"]'
3184
3188
  );
3185
- if (!n || (n.innerHTML = "", ((c = e.selectedPaymentMethod) == null ? void 0 : c.type) !== "apple_pay")) return;
3189
+ if (!t || (t.innerHTML = "", ((a = e.selectedPaymentMethod) == null ? void 0 : a.type) !== "apple_pay")) return;
3186
3190
  const o = document.createElement("div");
3187
3191
  o.className = "choco-widget-apple-pay-button-wrapper";
3188
- const s = document.createElement("button");
3189
- s.type = "button", s.className = "choco-widget-apple-pay-button choco-widget-apple-pay-button--native", s.setAttribute("aria-label", "Оплатить с Apple Pay"), s.style.setProperty("width", "100%", "important"), s.style.setProperty("height", "52px", "important"), s.style.setProperty("min-height", "52px", "important"), s.style.setProperty("border-radius", "12px", "important"), s.style.setProperty("-webkit-appearance", "-apple-pay-button"), s.style.setProperty("-apple-pay-button-type", "buy"), s.style.setProperty("-apple-pay-button-style", "black"), s.addEventListener("click", () => e.handlePayment());
3190
- const i = document.createElement("div");
3191
- i.className = "choco-widget-apple-pay-button-overlay", i.setAttribute("aria-hidden", "true"), i.innerHTML = `
3192
+ const i = document.createElement("button");
3193
+ i.type = "button", i.className = "choco-widget-apple-pay-button choco-widget-apple-pay-button--native", i.setAttribute("aria-label", "Оплатить с Apple Pay"), i.style.setProperty("width", "100%", "important"), i.style.setProperty("height", "52px", "important"), i.style.setProperty("min-height", "52px", "important"), i.style.setProperty("border-radius", "12px", "important"), i.style.setProperty("-webkit-appearance", "-apple-pay-button"), i.style.setProperty("-apple-pay-button-type", "buy"), i.style.setProperty("-apple-pay-button-style", "black"), i.addEventListener("click", () => e.handlePayment());
3194
+ const s = document.createElement("div");
3195
+ s.className = "choco-widget-apple-pay-button-overlay", s.setAttribute("aria-hidden", "true"), s.innerHTML = `
3192
3196
  <span class="choco-widget-apple-pay-button-text">Оплатить с</span>
3193
3197
  <span class="choco-widget-apple-pay-button-icon">
3194
3198
  <svg width="52" height="24" viewBox="0 0 52 24" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -3202,154 +3206,154 @@ function hn(e) {
3202
3206
  </defs>
3203
3207
  </svg>
3204
3208
  </span>
3205
- `, o.appendChild(s), o.appendChild(i), n.appendChild(o), ee(e);
3209
+ `, o.appendChild(i), o.appendChild(s), t.appendChild(o), ee(e);
3206
3210
  }
3207
- function ie(e) {
3211
+ function te(e) {
3208
3212
  e.loading = !0, ee(e);
3209
3213
  }
3210
3214
  function j(e) {
3211
- var T, v, Q, _, m, P, k, w;
3215
+ var T, E, Q, _, m, P, k, w;
3212
3216
  e.loading = !1;
3213
- const n = (T = e.container) == null ? void 0 : T.querySelector(".choco-widget-payment-method"), o = (v = e.container) == null ? void 0 : v.querySelector(".choco-widget-pay-button"), s = (Q = e.container) == null ? void 0 : Q.querySelector(
3217
+ const t = (T = e.container) == null ? void 0 : T.querySelector(".choco-widget-payment-method"), o = (E = e.container) == null ? void 0 : E.querySelector(".choco-widget-pay-button"), i = (Q = e.container) == null ? void 0 : Q.querySelector(
3214
3218
  ".choco-widget-google-pay-button-slot button"
3215
- ), i = (_ = e.container) == null ? void 0 : _.querySelector(
3219
+ ), s = (_ = e.container) == null ? void 0 : _.querySelector(
3216
3220
  ".choco-widget-apple-pay-button-slot button"
3217
3221
  ), u = (m = e.container) == null ? void 0 : m.querySelector(
3218
3222
  ".choco-widget-google-pay-amount"
3219
- ), c = (P = e.container) == null ? void 0 : P.querySelector(".choco-widget-google-pay-row"), d = (k = e.container) == null ? void 0 : k.querySelector(".choco-widget-apple-pay-row"), g = (w = e.container) == null ? void 0 : w.querySelector(
3223
+ ), a = (P = e.container) == null ? void 0 : P.querySelector(".choco-widget-google-pay-row"), d = (k = e.container) == null ? void 0 : k.querySelector(".choco-widget-apple-pay-row"), g = (w = e.container) == null ? void 0 : w.querySelector(
3220
3224
  ".choco-widget-balance-section"
3221
3225
  ), C = e._isInteractionBlocked(), S = e.paymentMethodDisabled || C;
3222
- n && (n.disabled = S), o && (o.disabled = C, o.classList.remove("choco-widget-pay-button--loading")), s && (s.disabled = C), i && (i.disabled = C), u == null || u.classList.toggle("choco-widget-wallet-blocked", C), u == null || u.setAttribute("aria-disabled", String(C)), c == null || c.classList.toggle("choco-widget-wallet-blocked", C), c == null || c.setAttribute("aria-disabled", String(C)), d == null || d.classList.toggle("choco-widget-wallet-blocked", C), d == null || d.setAttribute("aria-disabled", String(C)), g == null || g.classList.remove("disabled");
3226
+ t && (t.disabled = S), o && (o.disabled = C, o.classList.remove("choco-widget-pay-button--loading")), i && (i.disabled = C), s && (s.disabled = C), u == null || u.classList.toggle("choco-widget-wallet-blocked", C), u == null || u.setAttribute("aria-disabled", String(C)), a == null || a.classList.toggle("choco-widget-wallet-blocked", C), a == null || a.setAttribute("aria-disabled", String(C)), d == null || d.classList.toggle("choco-widget-wallet-blocked", C), d == null || d.setAttribute("aria-disabled", String(C)), g == null || g.classList.remove("disabled");
3223
3227
  }
3224
3228
  function ee(e) {
3225
- var T, v, Q, _, m, P, k, w;
3226
- const n = (T = e.container) == null ? void 0 : T.querySelector(".choco-widget-payment-method"), o = (v = e.container) == null ? void 0 : v.querySelector(".choco-widget-pay-button"), s = (Q = e.container) == null ? void 0 : Q.querySelector(
3229
+ var T, E, Q, _, m, P, k, w;
3230
+ const t = (T = e.container) == null ? void 0 : T.querySelector(".choco-widget-payment-method"), o = (E = e.container) == null ? void 0 : E.querySelector(".choco-widget-pay-button"), i = (Q = e.container) == null ? void 0 : Q.querySelector(
3227
3231
  ".choco-widget-google-pay-button-slot button"
3228
- ), i = (_ = e.container) == null ? void 0 : _.querySelector(
3232
+ ), s = (_ = e.container) == null ? void 0 : _.querySelector(
3229
3233
  ".choco-widget-apple-pay-button-slot button"
3230
3234
  ), u = (m = e.container) == null ? void 0 : m.querySelector(
3231
3235
  ".choco-widget-google-pay-amount"
3232
- ), c = (P = e.container) == null ? void 0 : P.querySelector(".choco-widget-google-pay-row"), d = (k = e.container) == null ? void 0 : k.querySelector(".choco-widget-apple-pay-row"), g = (w = e.container) == null ? void 0 : w.querySelector(
3236
+ ), a = (P = e.container) == null ? void 0 : P.querySelector(".choco-widget-google-pay-row"), d = (k = e.container) == null ? void 0 : k.querySelector(".choco-widget-apple-pay-row"), g = (w = e.container) == null ? void 0 : w.querySelector(
3233
3237
  ".choco-widget-balance-section"
3234
3238
  ), C = e._isInteractionBlocked(), S = e.paymentMethodDisabled || C;
3235
- g == null || g.classList.toggle("disabled", C), n && (n.disabled = S), o && (o.disabled = C, o.classList.toggle("choco-widget-pay-button--loading", e.loading)), s && (s.disabled = C), i && (i.disabled = C), u == null || u.classList.toggle("choco-widget-wallet-blocked", C), u == null || u.setAttribute("aria-disabled", String(C)), c == null || c.classList.toggle("choco-widget-wallet-blocked", C), c == null || c.setAttribute("aria-disabled", String(C)), d == null || d.classList.toggle("choco-widget-wallet-blocked", C), d == null || d.setAttribute("aria-disabled", String(C));
3239
+ g == null || g.classList.toggle("disabled", C), t && (t.disabled = S), o && (o.disabled = C, o.classList.toggle("choco-widget-pay-button--loading", e.loading)), i && (i.disabled = C), s && (s.disabled = C), u == null || u.classList.toggle("choco-widget-wallet-blocked", C), u == null || u.setAttribute("aria-disabled", String(C)), a == null || a.classList.toggle("choco-widget-wallet-blocked", C), a == null || a.setAttribute("aria-disabled", String(C)), d == null || d.classList.toggle("choco-widget-wallet-blocked", C), d == null || d.setAttribute("aria-disabled", String(C));
3236
3240
  }
3237
- function dt(e) {
3241
+ function ht(e) {
3238
3242
  var o;
3239
3243
  if (e._isInteractionBlocked()) return;
3240
- const n = (o = e.container) == null ? void 0 : o.querySelector('[data-sheet="payment"]');
3241
- n && (n.classList.add("choco-widget-payment-sheet--open"), e.isPaymentSheetOpen = !0, Ae(e));
3244
+ const t = (o = e.container) == null ? void 0 : o.querySelector('[data-sheet="payment"]');
3245
+ t && (t.classList.add("choco-widget-payment-sheet--open"), e.isPaymentSheetOpen = !0, ue(e));
3242
3246
  }
3243
- function W(e) {
3247
+ function V(e) {
3244
3248
  var o;
3245
- const n = (o = e.container) == null ? void 0 : o.querySelector('[data-sheet="payment"]');
3246
- if (n) {
3249
+ const t = (o = e.container) == null ? void 0 : o.querySelector('[data-sheet="payment"]');
3250
+ if (t) {
3247
3251
  ve(e);
3248
- const s = n.querySelector(".choco-widget-sheet-content");
3249
- s && (s.style.transform = "", s.classList.remove("choco-widget-sheet-content--dragging")), n.classList.remove("choco-widget-payment-sheet--open"), e.isPaymentSheetOpen = !1, e.isPaymentSheetEditMode && (e.isPaymentSheetEditMode = !1, ce(e), Ae(e));
3252
+ const i = t.querySelector(".choco-widget-sheet-content");
3253
+ i && (i.style.transform = "", i.classList.remove("choco-widget-sheet-content--dragging")), t.classList.remove("choco-widget-payment-sheet--open"), e.isPaymentSheetOpen = !1, e.isPaymentSheetEditMode && (e.isPaymentSheetEditMode = !1, Ae(e), ue(e));
3250
3254
  }
3251
3255
  }
3252
- function Ae(e) {
3256
+ function ue(e) {
3253
3257
  var g;
3254
- const n = (g = e.container) == null ? void 0 : g.querySelector('[data-sheet="payment"]');
3255
- if (!n) return;
3256
- const o = n.querySelector(".choco-widget-sheet-title"), s = n.querySelector('[data-action="close-sheet"]'), i = n.querySelector('[data-action="edit-sheet"]'), u = n.querySelector('[data-action="previous-sheet"]'), d = e.getAvailablePaymentMethods().some((C) => C.type === "card");
3257
- e.isPaymentSheetEditMode ? (n.classList.add("choco-widget-payment-sheet--edit"), o && (o.textContent = e.t("editCards")), s && (s.style.display = "none"), i && (i.style.display = "none"), u && (u.style.display = "")) : (n.classList.remove("choco-widget-payment-sheet--edit"), n.classList.toggle("choco-widget-payment-sheet--no-cards", !d), o && (o.textContent = e.t("paymentMethods")), s && (s.style.display = ""), i && (i.style.display = d ? "" : "none"), u && (u.style.display = "none"));
3258
+ const t = (g = e.container) == null ? void 0 : g.querySelector('[data-sheet="payment"]');
3259
+ if (!t) return;
3260
+ const o = t.querySelector(".choco-widget-sheet-title"), i = t.querySelector('[data-action="close-sheet"]'), s = t.querySelector('[data-action="edit-sheet"]'), u = t.querySelector('[data-action="previous-sheet"]'), d = e.getAvailablePaymentMethods().some((C) => C.type === "card");
3261
+ e.isPaymentSheetEditMode ? (t.classList.add("choco-widget-payment-sheet--edit"), o && (o.textContent = e.t("editCards")), i && (i.style.display = "none"), s && (s.style.display = "none"), u && (u.style.display = "")) : (t.classList.remove("choco-widget-payment-sheet--edit"), t.classList.toggle("choco-widget-payment-sheet--no-cards", !d), o && (o.textContent = e.t("paymentMethods")), i && (i.style.display = ""), s && (s.style.display = d ? "" : "none"), u && (u.style.display = "none"));
3258
3262
  }
3259
3263
  function $e(e) {
3260
3264
  if (!e.addCardActionUrl || !e.container) return;
3261
- const n = e.container.querySelector('[data-sheet="add-card"]'), o = e.container.querySelector(
3265
+ const t = e.container.querySelector('[data-sheet="add-card"]'), o = e.container.querySelector(
3262
3266
  "#choco-widget-add-card-iframe"
3263
3267
  );
3264
- n && o && (o.src = e.addCardActionUrl, n.classList.add("choco-widget-payment-sheet--open"), n.style.display = "flex", n.setAttribute("aria-hidden", "false"), e.isAddCardViewOpen = !0, fn(e));
3268
+ t && o && (o.src = e.addCardActionUrl, t.classList.add("choco-widget-payment-sheet--open"), t.style.display = "flex", t.setAttribute("aria-hidden", "false"), e.isAddCardViewOpen = !0, fn(e));
3265
3269
  }
3266
3270
  function ae(e) {
3267
- var s, i;
3268
- const n = (s = e.container) == null ? void 0 : s.querySelector('[data-sheet="add-card"]'), o = (i = e.container) == null ? void 0 : i.querySelector(
3271
+ var i, s;
3272
+ const t = (i = e.container) == null ? void 0 : i.querySelector('[data-sheet="add-card"]'), o = (s = e.container) == null ? void 0 : s.querySelector(
3269
3273
  "#choco-widget-add-card-iframe"
3270
3274
  );
3271
- n && (n.classList.remove("choco-widget-payment-sheet--open"), n.style.display = "none", n.setAttribute("aria-hidden", "true")), o && (o.src = "about:blank"), e.addCardActionUrl = null, e.isAddCardViewOpen = !1, gn(e);
3275
+ t && (t.classList.remove("choco-widget-payment-sheet--open"), t.style.display = "none", t.setAttribute("aria-hidden", "true")), o && (o.src = "about:blank"), e.addCardActionUrl = null, e.isAddCardViewOpen = !1, gn(e);
3272
3276
  }
3273
3277
  function fn(e) {
3274
- e._boundAddCardMessage = (n) => {
3278
+ e._boundAddCardMessage = (t) => {
3275
3279
  var o;
3276
- e.isAddCardViewOpen && (o = n.data) != null && o.message && n.origin === "https://rahmetapp.kz" && ie(e);
3280
+ e.isAddCardViewOpen && (o = t.data) != null && o.message && t.origin === "https://rahmetapp.kz" && te(e);
3277
3281
  }, window.addEventListener("message", e._boundAddCardMessage);
3278
3282
  }
3279
3283
  function gn(e) {
3280
3284
  e._boundAddCardMessage && (window.removeEventListener("message", e._boundAddCardMessage), e._boundAddCardMessage = null);
3281
3285
  }
3282
- function pn(e, n) {
3283
- var c;
3284
- e._pendingDeleteMethod = n;
3285
- const o = (c = e.container) == null ? void 0 : c.querySelector('[data-sheet="payment"]');
3286
+ function pn(e, t) {
3287
+ var a;
3288
+ e._pendingDeleteMethod = t;
3289
+ const o = (a = e.container) == null ? void 0 : a.querySelector('[data-sheet="payment"]');
3286
3290
  if (!o) return;
3287
3291
  o.classList.add("choco-widget-payment-sheet--delete-confirm");
3288
- const s = o.querySelector(".choco-widget-sheet-title"), i = o.querySelector('[data-action="edit-sheet"]'), u = o.querySelector('[data-action="previous-sheet"]');
3289
- s && (s.textContent = e.t("confirmDeleteCard")), i && (i.style.display = "none"), u && (u.style.display = "none");
3292
+ const i = o.querySelector(".choco-widget-sheet-title"), s = o.querySelector('[data-action="edit-sheet"]'), u = o.querySelector('[data-action="previous-sheet"]');
3293
+ i && (i.textContent = e.t("confirmDeleteCard")), s && (s.style.display = "none"), u && (u.style.display = "none");
3290
3294
  }
3291
3295
  function ve(e) {
3292
3296
  var o;
3293
3297
  e._pendingDeleteMethod = null, Ne(e, !1);
3294
- const n = (o = e.container) == null ? void 0 : o.querySelector('[data-sheet="payment"]');
3295
- n == null || n.classList.remove("choco-widget-payment-sheet--delete-confirm"), Ae(e);
3298
+ const t = (o = e.container) == null ? void 0 : o.querySelector('[data-sheet="payment"]');
3299
+ t == null || t.classList.remove("choco-widget-payment-sheet--delete-confirm"), ue(e);
3296
3300
  }
3297
- function Ne(e, n) {
3298
- var u, c, d;
3301
+ function Ne(e, t) {
3302
+ var u, a, d;
3299
3303
  const o = (u = e.container) == null ? void 0 : u.querySelector(
3300
3304
  ".choco-widget-sheet-delete-confirm-actions"
3301
- ), s = (c = e.container) == null ? void 0 : c.querySelector(
3305
+ ), i = (a = e.container) == null ? void 0 : a.querySelector(
3302
3306
  '[data-action="confirm-delete-cancel"]'
3303
- ), i = (d = e.container) == null ? void 0 : d.querySelector(
3307
+ ), s = (d = e.container) == null ? void 0 : d.querySelector(
3304
3308
  '[data-action="confirm-delete-submit"]'
3305
3309
  );
3306
- o == null || o.classList.toggle("choco-widget-sheet-delete-confirm-actions--loading", n), s && (s.disabled = n), i && (i.disabled = n, i.classList.toggle("choco-widget-delete-confirm-btn--loading", n));
3310
+ o == null || o.classList.toggle("choco-widget-sheet-delete-confirm-actions--loading", t), i && (i.disabled = t), s && (s.disabled = t, s.classList.toggle("choco-widget-delete-confirm-btn--loading", t));
3307
3311
  }
3308
- async function Cn(e, n) {
3309
- var s, i;
3310
- const o = n == null ? void 0 : n.cardId;
3311
- if (!(!o || (n == null ? void 0 : n.type) !== "card"))
3312
+ async function Cn(e, t) {
3313
+ var i, s;
3314
+ const o = t == null ? void 0 : t.cardId;
3315
+ if (!(!o || (t == null ? void 0 : t.type) !== "card"))
3312
3316
  try {
3313
- await Nt(e.apiUrl, e._getApiConfig(), o), e.checkoutContext = await Oe(
3317
+ await Dt(e.apiUrl, e._getApiConfig(), o), e.checkoutContext = await Oe(
3314
3318
  e.apiUrl,
3315
3319
  e._getApiConfig()
3316
- ), ((s = e.selectedPaymentMethod) == null ? void 0 : s.type) === "card" && ((i = e.selectedPaymentMethod) == null ? void 0 : i.cardId) === o && (e.selectedPaymentMethod = Le(
3320
+ ), ((i = e.selectedPaymentMethod) == null ? void 0 : i.type) === "card" && ((s = e.selectedPaymentMethod) == null ? void 0 : s.cardId) === o && (e.selectedPaymentMethod = Le(
3317
3321
  e.checkoutContext.data,
3318
3322
  e._getKaspiOptions()
3319
- ), e._emitPaymentMethodSelected(), ut(e)), ce(e), e.config.onSuccess({ message: e.t("cardDeleted") }), e.config.onCardDeleted && e.config.onCardDeleted({ cardId: o });
3323
+ ), e._emitPaymentMethodSelected(), lt(e)), Ae(e), e.config.onSuccess({ message: e.t("cardDeleted") }), e.config.onCardDeleted && e.config.onCardDeleted({ cardId: o });
3320
3324
  } catch (u) {
3321
3325
  e.config.onError({
3322
3326
  attributes: { message: (u == null ? void 0 : u.message) || e.t("paymentError") }
3323
3327
  });
3324
3328
  }
3325
3329
  }
3326
- function ht(e, n) {
3330
+ function ft(e, t) {
3327
3331
  if (!e._isInteractionBlocked()) {
3328
- if (e.selectedPaymentMethod = n, e._emitPaymentMethodSelected(), n.type === "new_card") {
3329
- e._emitUserEvent("one_click_pay_method_resolved", { payment_method: n.type }), W(e), e.handlePayment();
3332
+ if (e.selectedPaymentMethod = t, e._emitPaymentMethodSelected(), t.type === "new_card") {
3333
+ e._emitUserEvent("one_click_pay_method_resolved", { payment_method: t.type }), V(e), e.handlePayment();
3330
3334
  return;
3331
3335
  }
3332
3336
  e._emitUserEvent("one_click_pay_method_resolved", {
3333
3337
  payment_method: e._getPaymentMethodForUserEvent()
3334
- }), ce(e), W(e), ut(e);
3338
+ }), Ae(e), V(e), lt(e);
3335
3339
  }
3336
3340
  }
3337
- function et(e, n) {
3338
- var s;
3339
- const o = n.type || ((s = n.data) == null ? void 0 : s.type);
3341
+ function et(e, t) {
3342
+ var i;
3343
+ const o = t.type || ((i = t.data) == null ? void 0 : i.type);
3340
3344
  if (!o) {
3341
- console.warn("Unknown event format:", n);
3345
+ console.warn("Unknown event format:", t);
3342
3346
  return;
3343
3347
  }
3344
3348
  switch (o) {
3345
3349
  case "order.paid":
3346
- e._orderStatusResolved = !0, $(e), gt(e, n);
3350
+ e._orderStatusResolved = !0, $(e), pt(e, t);
3347
3351
  break;
3348
3352
  case "order.failed":
3349
- e._orderStatusResolved = !0, $(e), pt(e, n);
3353
+ e._orderStatusResolved = !0, $(e), Ct(e, t);
3350
3354
  break;
3351
3355
  case "order.action_required":
3352
- yn(e, n);
3356
+ yn(e, t);
3353
3357
  break;
3354
3358
  default:
3355
3359
  console.warn("Unknown event type:", o);
@@ -3358,38 +3362,38 @@ function et(e, n) {
3358
3362
  function $(e) {
3359
3363
  e._orderStatusPollingId && (clearInterval(e._orderStatusPollingId), e._orderStatusPollingId = null);
3360
3364
  }
3361
- function ue(e, n) {
3365
+ function ce(e, t) {
3362
3366
  $(e), e._orderStatusResolved = !1;
3363
- const o = 6e3, s = 5;
3364
- let i = 0;
3367
+ const o = 6e3, i = 5;
3368
+ let s = 0;
3365
3369
  const u = async () => {
3366
3370
  if (!e._orderStatusResolved) {
3367
- if (i >= s) {
3371
+ if (s >= i) {
3368
3372
  $(e), j(e), e.config.onError({
3369
3373
  attributes: { message: e.t("errorNoServerResponseRetry") }
3370
3374
  });
3371
3375
  return;
3372
3376
  }
3373
- i += 1;
3377
+ s += 1;
3374
3378
  try {
3375
- const { data: c } = await Xt(
3379
+ const { data: a } = await Ut(
3376
3380
  e.apiUrl,
3377
3381
  e._getApiConfig(),
3378
- String(n)
3379
- ), d = c == null ? void 0 : c.status, g = (c == null ? void 0 : c.payload) || {};
3382
+ String(t)
3383
+ ), d = a == null ? void 0 : a.status, g = (a == null ? void 0 : a.payload) || {};
3380
3384
  if (d === "success") {
3381
- e._orderStatusResolved = !0, $(e), gt(e, {
3382
- id: String(g.id || n),
3385
+ e._orderStatusResolved = !0, $(e), pt(e, {
3386
+ id: String(g.id || t),
3383
3387
  attributes: { amount: g.amount, paid_at: g.paid_at || "" }
3384
3388
  });
3385
3389
  return;
3386
3390
  }
3387
- d === "fail" && (e._orderStatusResolved = !0, $(e), pt(e, {
3388
- id: String(g.id || n),
3391
+ d === "fail" && (e._orderStatusResolved = !0, $(e), Ct(e, {
3392
+ id: String(g.id || t),
3389
3393
  attributes: { message: g.message || e.t("paymentError") }
3390
3394
  }));
3391
- } catch (c) {
3392
- console.warn("[Polling] checkOrderStatus error:", c);
3395
+ } catch (a) {
3396
+ console.warn("[Polling] checkOrderStatus error:", a);
3393
3397
  }
3394
3398
  }
3395
3399
  };
@@ -3398,142 +3402,142 @@ function ue(e, n) {
3398
3402
  function Xe() {
3399
3403
  return typeof document > "u" ? !1 : document.hidden || document.visibilityState === "hidden";
3400
3404
  }
3401
- function ft(e, n) {
3402
- j(e), e.config.onSuccess(n);
3405
+ function gt(e, t) {
3406
+ j(e), e.config.onSuccess(t);
3403
3407
  }
3404
3408
  function Te(e) {
3405
3409
  if (!e._pendingSuccessPayload || Xe()) return;
3406
- const n = e._pendingSuccessPayload;
3407
- e._pendingSuccessPayload = null, ft(e, n);
3410
+ const t = e._pendingSuccessPayload;
3411
+ e._pendingSuccessPayload = null, gt(e, t);
3408
3412
  }
3409
- function gt(e, n) {
3410
- var i, u;
3413
+ function pt(e, t) {
3414
+ var s, u;
3411
3415
  e.isAddCardViewOpen && ae(e);
3412
- const o = n.attributes || ((i = n.data) == null ? void 0 : i.attributes) || {}, s = { id: n.id || ((u = n.data) == null ? void 0 : u.id), attributes: o };
3416
+ const o = t.attributes || ((s = t.data) == null ? void 0 : s.attributes) || {}, i = { id: t.id || ((u = t.data) == null ? void 0 : u.id), attributes: o };
3413
3417
  if (Xe()) {
3414
- e._pendingSuccessPayload = s;
3418
+ e._pendingSuccessPayload = i;
3415
3419
  return;
3416
3420
  }
3417
- ft(e, s);
3421
+ gt(e, i);
3418
3422
  }
3419
- function pt(e, n) {
3420
- var s, i;
3423
+ function Ct(e, t) {
3424
+ var i, s;
3421
3425
  e.isAddCardViewOpen && ae(e), j(e);
3422
- const o = n.attributes || ((s = n.data) == null ? void 0 : s.attributes) || {};
3423
- e.config.onError({ id: n.id || ((i = n.data) == null ? void 0 : i.id), attributes: o });
3426
+ const o = t.attributes || ((i = t.data) == null ? void 0 : i.attributes) || {};
3427
+ e.config.onError({ id: t.id || ((s = t.data) == null ? void 0 : s.id), attributes: o });
3424
3428
  }
3425
- function yn(e, n) {
3426
- var u, c, d;
3427
- const o = n.attributes || ((u = n.data) == null ? void 0 : u.attributes) || {}, s = o.action_link || o.action_url, i = o.action_url_type || o.action_type || "redirect";
3428
- if (!s) {
3429
+ function yn(e, t) {
3430
+ var u, a, d;
3431
+ const o = t.attributes || ((u = t.data) == null ? void 0 : u.attributes) || {}, i = o.action_link || o.action_url, s = o.action_url_type || o.action_type || "redirect";
3432
+ if (!i) {
3429
3433
  console.error(e.t("errorActionUrlMissing")), e.waitingForNewCardAction && (e.waitingForNewCardAction = !1, j(e), e.config.onError({ attributes: { message: e.t("errorNoServerResponse") } }));
3430
3434
  return;
3431
3435
  }
3432
- if (e.waitingForNewCardAction && (e.waitingForNewCardAction = !1, e._clearNewCardActionTimeout()), i === "inner") {
3433
- e.addCardActionUrl = s, j(e), e._showAddCardView();
3436
+ if (e.waitingForNewCardAction && (e.waitingForNewCardAction = !1, e._clearNewCardActionTimeout()), s === "inner") {
3437
+ e.addCardActionUrl = i, j(e), e._showAddCardView();
3434
3438
  return;
3435
3439
  }
3436
- if (((c = e.selectedPaymentMethod) == null ? void 0 : c.type) === "kaspi_pay") {
3437
- const g = n.id || ((d = n.data) == null ? void 0 : d.id);
3438
- if (g && !e._orderStatusResolved && !e._orderStatusPollingId && ue(e, String(g)), typeof e.config.onKaspiLink == "function") {
3440
+ if (((a = e.selectedPaymentMethod) == null ? void 0 : a.type) === "kaspi_pay") {
3441
+ const g = t.id || ((d = t.data) == null ? void 0 : d.id);
3442
+ if (g && !e._orderStatusResolved && !e._orderStatusPollingId && ce(e, String(g)), typeof e.config.onKaspiLink == "function") {
3439
3443
  e.config.onKaspiLink({
3440
- action_link: s,
3441
- action_url: s,
3442
- action_type: i,
3443
- event: n
3444
+ action_link: i,
3445
+ action_url: i,
3446
+ action_type: s,
3447
+ event: t
3444
3448
  });
3445
3449
  return;
3446
3450
  }
3447
3451
  }
3448
- window.location.href = s;
3452
+ window.location.href = i;
3449
3453
  }
3450
3454
  async function mn(e) {
3451
- var o, s, i, u;
3455
+ var o, i, s, u;
3452
3456
  if (!e.selectedPaymentMethod) {
3453
3457
  e.config.onError({
3454
3458
  attributes: { message: e.t("errorPaymentMethodNotSelected") }
3455
3459
  });
3456
3460
  return;
3457
3461
  }
3458
- const { checkoutOptions: n } = e._getPaymentBreakdown();
3462
+ const { checkoutOptions: t } = e._getPaymentBreakdown();
3459
3463
  if (e._isBalanceFullyCoveringAmount()) {
3460
- ie(e);
3464
+ te(e);
3461
3465
  try {
3462
- const c = await Ge(
3466
+ const a = await Ge(
3463
3467
  e.apiUrl,
3464
3468
  e._getApiConfig(),
3465
3469
  e.deviceId,
3466
3470
  e.selectedPaymentMethod,
3467
- n
3471
+ t
3468
3472
  );
3469
3473
  await tt(e);
3470
- const d = (c == null ? void 0 : c.id) ?? ((o = c == null ? void 0 : c.data) == null ? void 0 : o.id);
3471
- return d && ue(e, String(d)), c;
3472
- } catch (c) {
3474
+ const d = (a == null ? void 0 : a.id) ?? ((o = a == null ? void 0 : a.data) == null ? void 0 : o.id);
3475
+ return d && ce(e, String(d)), a;
3476
+ } catch (a) {
3473
3477
  throw j(e), e.config.onError({
3474
- attributes: { message: e._resolveErrorMessage(c) }
3475
- }), c;
3478
+ attributes: { message: e._resolveErrorMessage(a) }
3479
+ }), a;
3476
3480
  }
3477
3481
  }
3478
3482
  if (e.selectedPaymentMethod.type === "new_card") {
3479
- await bn(e, n);
3483
+ await bn(e, t);
3480
3484
  return;
3481
3485
  }
3482
3486
  if (e.selectedPaymentMethod.type === "apple_pay") {
3483
- await En(e, n);
3487
+ await En(e, t);
3484
3488
  return;
3485
3489
  }
3486
3490
  if (e.selectedPaymentMethod.type === "google_pay") {
3487
- await vn(e, n);
3491
+ await vn(e, t);
3488
3492
  return;
3489
3493
  }
3490
- ie(e);
3494
+ te(e);
3491
3495
  try {
3492
- const c = await Ge(
3496
+ const a = await Ge(
3493
3497
  e.apiUrl,
3494
3498
  e._getApiConfig(),
3495
3499
  e.deviceId,
3496
3500
  e.selectedPaymentMethod,
3497
- n
3501
+ t
3498
3502
  );
3499
3503
  await tt(e);
3500
- const d = (c == null ? void 0 : c.id) ?? ((s = c == null ? void 0 : c.data) == null ? void 0 : s.id);
3501
- if (d && ue(e, String(d)), ((i = e.selectedPaymentMethod) == null ? void 0 : i.type) === "kaspi_pay") {
3502
- const g = (c == null ? void 0 : c.attributes) || ((u = c == null ? void 0 : c.data) == null ? void 0 : u.attributes) || {}, C = g.action_link || g.action_url, S = g.action_url_type || g.action_type || "redirect";
3504
+ const d = (a == null ? void 0 : a.id) ?? ((i = a == null ? void 0 : a.data) == null ? void 0 : i.id);
3505
+ if (d && ce(e, String(d)), ((s = e.selectedPaymentMethod) == null ? void 0 : s.type) === "kaspi_pay") {
3506
+ const g = (a == null ? void 0 : a.attributes) || ((u = a == null ? void 0 : a.data) == null ? void 0 : u.attributes) || {}, C = g.action_link || g.action_url, S = g.action_url_type || g.action_type || "redirect";
3503
3507
  if (C)
3504
3508
  return typeof e.config.onKaspiLink == "function" ? (e.config.onKaspiLink({
3505
3509
  action_link: C,
3506
3510
  action_url: C,
3507
3511
  action_type: S,
3508
- event: c
3509
- }), c) : (window.location.href = C, c);
3512
+ event: a
3513
+ }), a) : (window.location.href = C, a);
3510
3514
  }
3511
- return c;
3512
- } catch (c) {
3513
- throw j(e), e.config.onError({ message: e._resolveErrorMessage(c) }), c;
3515
+ return a;
3516
+ } catch (a) {
3517
+ throw j(e), e.config.onError({ message: e._resolveErrorMessage(a) }), a;
3514
3518
  }
3515
3519
  }
3516
3520
  async function tt(e) {
3517
- var n, o;
3518
- if (!(((n = e.selectedPaymentMethod) == null ? void 0 : n.type) !== "card" || !((o = e.selectedPaymentMethod) != null && o.cardId)))
3521
+ var t, o;
3522
+ if (!(((t = e.selectedPaymentMethod) == null ? void 0 : t.type) !== "card" || !((o = e.selectedPaymentMethod) != null && o.cardId)))
3519
3523
  try {
3520
- await Dt(
3524
+ await Xt(
3521
3525
  e.apiUrl,
3522
3526
  e._getApiConfig(),
3523
3527
  e.selectedPaymentMethod.cardId
3524
3528
  );
3525
- } catch (s) {
3526
- console.warn("Failed to mark selected card as default:", s);
3529
+ } catch (i) {
3530
+ console.warn("Failed to mark selected card as default:", i);
3527
3531
  }
3528
3532
  }
3529
- async function bn(e, n) {
3530
- ie(e), e.waitingForNewCardAction = !0, e._setNewCardActionTimeout();
3533
+ async function bn(e, t) {
3534
+ te(e), e.waitingForNewCardAction = !0, e._setNewCardActionTimeout();
3531
3535
  try {
3532
- await Ut(
3536
+ await Ht(
3533
3537
  e.apiUrl,
3534
3538
  e._getApiConfig(),
3535
3539
  e.deviceId,
3536
- n
3540
+ t
3537
3541
  );
3538
3542
  } catch (o) {
3539
3543
  e.waitingForNewCardAction = !1, e._clearNewCardActionTimeout(), j(e), e.config.onError({
@@ -3541,21 +3545,21 @@ async function bn(e, n) {
3541
3545
  }), console.error("New card payment error:", o);
3542
3546
  }
3543
3547
  }
3544
- let oe = null;
3545
- async function En(e, n) {
3548
+ let se = null;
3549
+ async function En(e, t) {
3546
3550
  const o = window.ApplePaySession;
3547
3551
  if (!o || !o.canMakePayments()) {
3548
3552
  e.config.onError({ attributes: { message: e.t("errorApplePayUnsupported") } });
3549
3553
  return;
3550
3554
  }
3551
- if (oe) {
3555
+ if (se) {
3552
3556
  try {
3553
- oe.abort();
3557
+ se.abort();
3554
3558
  } catch {
3555
3559
  }
3556
- oe = null;
3560
+ se = null;
3557
3561
  }
3558
- const s = {
3562
+ const i = {
3559
3563
  countryCode: e.config.currency === "GEL" ? "GE" : "KZ",
3560
3564
  currencyCode: e.config.currency,
3561
3565
  supportedNetworks: ["visa", "masterCard"],
@@ -3565,82 +3569,85 @@ async function En(e, n) {
3565
3569
  amount: String(e._getPayableAmount()),
3566
3570
  type: "final"
3567
3571
  }
3568
- }, i = new o(3, s);
3569
- oe = i, i.onvalidatemerchant = async (u) => {
3570
- var c, d;
3572
+ }, s = new o(3, i);
3573
+ se = s, s.onvalidatemerchant = async (u) => {
3574
+ var a, d;
3571
3575
  try {
3572
- const g = await Ht(
3576
+ const g = await xt(
3573
3577
  e.apiUrl,
3574
3578
  e._getApiConfig(),
3575
3579
  u.validationURL
3576
- ), C = ((d = (c = g == null ? void 0 : g.data) == null ? void 0 : c.attributes) == null ? void 0 : d.session) || g, S = JSON.parse(atob(C));
3577
- i.completeMerchantValidation(S);
3580
+ ), C = ((d = (a = g == null ? void 0 : g.data) == null ? void 0 : a.attributes) == null ? void 0 : d.session) || g, S = JSON.parse(atob(C));
3581
+ s.completeMerchantValidation(S);
3578
3582
  } catch (g) {
3579
- console.error("Apple Pay session error:", g), i.abort(), e.config.onError({ attributes: { message: e.t("errorApplePayInit") } });
3583
+ console.error("Apple Pay session error:", g), s.abort(), e.config.onError({ attributes: { message: e.t("errorApplePayInit") } });
3580
3584
  }
3581
- }, i.onpaymentauthorized = async (u) => {
3582
- var c;
3585
+ }, s.onpaymentauthorized = async (u) => {
3586
+ var a;
3583
3587
  try {
3584
- if (ie(e), typeof e.config.onBeforeCheckout == "function") {
3588
+ if (te(e), typeof e.config.onBeforeCheckout == "function") {
3585
3589
  const C = await e.config.onBeforeCheckout();
3586
3590
  C && typeof C == "object" && Object.assign(e.config, C);
3587
3591
  }
3588
- const d = await xt(
3592
+ const d = await Ft(
3589
3593
  e.apiUrl,
3590
3594
  e._getApiConfig(),
3591
3595
  e.deviceId,
3592
3596
  u.payment,
3593
- n
3597
+ t
3594
3598
  );
3595
- i.completePayment(o.STATUS_SUCCESS), oe = null;
3596
- const g = (d == null ? void 0 : d.id) ?? ((c = d == null ? void 0 : d.data) == null ? void 0 : c.id);
3597
- g && ue(e, String(g));
3599
+ s.completePayment(o.STATUS_SUCCESS), se = null;
3600
+ const g = (d == null ? void 0 : d.id) ?? ((a = d == null ? void 0 : d.data) == null ? void 0 : a.id);
3601
+ g && ce(e, String(g));
3598
3602
  } catch (d) {
3599
- console.error("Apple Pay payment error:", d), i.completePayment(o.STATUS_FAILURE), j(e), e.config.onError({
3603
+ console.error("Apple Pay payment error:", d), s.completePayment(o.STATUS_FAILURE), j(e), e.config.onError({
3600
3604
  attributes: {
3601
3605
  message: e._resolveErrorMessage(d, "errorApplePayPayment")
3602
3606
  }
3603
3607
  });
3604
3608
  }
3605
- }, i.oncancel = () => {
3606
- oe = null, e.config.onCancel();
3607
- }, i.begin();
3609
+ }, s.oncancel = () => {
3610
+ se = null, e.config.onCancel();
3611
+ }, s.begin();
3608
3612
  }
3609
- async function vn(e, n) {
3613
+ async function vn(e, t) {
3610
3614
  var P, k, w, L, O, F;
3611
- try {
3612
- await e._loadGooglePaySdk();
3613
- } catch (M) {
3614
- console.error("Google Pay SDK load error:", M), e.config.onError({ attributes: { message: e.t("errorGooglePayUnsupported") } });
3615
- return;
3616
- }
3617
- const o = window.google;
3618
- if (!(o != null && o.payments)) {
3619
- e.config.onError({ attributes: { message: e.t("errorGooglePayUnsupported") } });
3620
- return;
3621
- }
3622
- const s = (P = e.checkoutContext) == null ? void 0 : P.data, i = ((w = (k = s == null ? void 0 : s.payment_methods) == null ? void 0 : k.data) == null ? void 0 : w.attributes) || {}, u = i.google_pay_settings || {};
3615
+ const o = (P = e.checkoutContext) == null ? void 0 : P.data, i = ((w = (k = o == null ? void 0 : o.payment_methods) == null ? void 0 : k.data) == null ? void 0 : w.attributes) || {}, s = i.google_pay_settings || {};
3623
3616
  if (!(i.payment_method_google_pay === "enabled" || i.payment_method_google_pay === !0)) {
3624
3617
  e.config.onError({ attributes: { message: e.t("errorGooglePayUnsupported") } });
3625
3618
  return;
3626
3619
  }
3627
- const d = u == null ? void 0 : u.gateway, g = u == null ? void 0 : u.merchant_id;
3628
- if (!d || !g) {
3620
+ const a = s == null ? void 0 : s.gateway, d = s == null ? void 0 : s.merchant_id;
3621
+ if (!a || !d) {
3629
3622
  e.config.onError({
3630
3623
  attributes: { message: e.t("errorGooglePaySettingsUnavailable") }
3631
3624
  });
3632
3625
  return;
3633
3626
  }
3634
- const C = e.config.environment === "production", S = (u == null ? void 0 : u.merchant_name) || "Choco", T = u == null ? void 0 : u.google_merchant_id;
3635
- if (C && !T) {
3627
+ const g = e.config.environment === "production", C = (s == null ? void 0 : s.merchant_name) || "Choco", S = s == null ? void 0 : s.google_merchant_id;
3628
+ if (g && !S) {
3636
3629
  e.config.onError({
3637
3630
  attributes: { message: e.t("errorGooglePaySettingsUnavailable") }
3638
3631
  });
3639
3632
  return;
3640
3633
  }
3641
- const v = Number(e._getCheckoutAmount()).toFixed(2), Q = new o.payments.api.PaymentsClient({
3642
- environment: C ? "PRODUCTION" : "TEST"
3643
- }), _ = [
3634
+ if (e.config.isNativeAndroid) {
3635
+ await Bn(e, t, { gateway: a, gatewayMerchantId: d });
3636
+ return;
3637
+ }
3638
+ const T = Number(e._getCheckoutAmount()).toFixed(2);
3639
+ try {
3640
+ await e._loadGooglePaySdk();
3641
+ } catch (M) {
3642
+ console.error("Google Pay SDK load error:", M), e.config.onError({ attributes: { message: e.t("errorGooglePayUnsupported") } });
3643
+ return;
3644
+ }
3645
+ const E = window.google;
3646
+ if (!(E != null && E.payments)) {
3647
+ e.config.onError({ attributes: { message: e.t("errorGooglePayUnsupported") } });
3648
+ return;
3649
+ }
3650
+ const Q = [
3644
3651
  {
3645
3652
  type: "CARD",
3646
3653
  parameters: {
@@ -3650,44 +3657,45 @@ async function vn(e, n) {
3650
3657
  },
3651
3658
  tokenizationSpecification: {
3652
3659
  type: "PAYMENT_GATEWAY",
3653
- parameters: { gateway: d, gatewayMerchantId: g }
3660
+ parameters: { gateway: a, gatewayMerchantId: d }
3654
3661
  }
3655
3662
  }
3656
- ], m = {
3663
+ ], _ = {
3657
3664
  apiVersion: 2,
3658
3665
  apiVersionMinor: 0,
3659
- allowedPaymentMethods: _,
3666
+ allowedPaymentMethods: Q,
3660
3667
  transactionInfo: {
3661
3668
  totalPriceStatus: "FINAL",
3662
3669
  totalPriceLabel: "Итого",
3663
- totalPrice: v,
3670
+ totalPrice: T,
3664
3671
  currencyCode: e.config.currency,
3665
3672
  countryCode: e.config.currency === "GEL" ? "GE" : "KZ"
3666
3673
  },
3667
- merchantInfo: C ? { merchantId: T, merchantName: S } : { merchantName: S }
3668
- };
3669
- console.log("paymentDataRequest", m);
3674
+ merchantInfo: g ? { merchantId: S, merchantName: C } : { merchantName: C }
3675
+ }, m = new E.payments.api.PaymentsClient({
3676
+ environment: g ? "PRODUCTION" : "TEST"
3677
+ });
3670
3678
  try {
3671
- const M = await Q.isReadyToPay({
3679
+ const M = await m.isReadyToPay({
3672
3680
  apiVersion: 2,
3673
3681
  apiVersionMinor: 0,
3674
- allowedPaymentMethods: _
3682
+ allowedPaymentMethods: Q
3675
3683
  });
3676
3684
  if (!(M != null && M.result)) {
3677
3685
  e.config.onError({ attributes: { message: e.t("errorGooglePayUnsupported") } });
3678
3686
  return;
3679
3687
  }
3680
- ie(e);
3681
- const J = await Q.loadPaymentData(m), x = (O = (L = J == null ? void 0 : J.paymentMethodData) == null ? void 0 : L.tokenizationData) == null ? void 0 : O.token;
3688
+ te(e);
3689
+ const J = await m.loadPaymentData(_), x = (O = (L = J == null ? void 0 : J.paymentMethodData) == null ? void 0 : L.tokenizationData) == null ? void 0 : O.token;
3682
3690
  if (!x) throw new Error(e.t("errorGooglePayPayment"));
3683
- const q = JSON.parse(x), N = await Ft(
3691
+ const q = JSON.parse(x), N = await at(
3684
3692
  e.apiUrl,
3685
3693
  e._getApiConfig(),
3686
3694
  e.deviceId,
3687
3695
  q,
3688
- n
3696
+ t
3689
3697
  ), b = (N == null ? void 0 : N.id) ?? ((F = N == null ? void 0 : N.data) == null ? void 0 : F.id);
3690
- b && ue(e, String(b));
3698
+ b && ce(e, String(b));
3691
3699
  } catch (M) {
3692
3700
  j(e), M.statusCode === "CANCELED" ? e.config.onCancel() : (e.config.onError({
3693
3701
  attributes: {
@@ -3696,99 +3704,127 @@ async function vn(e, n) {
3696
3704
  }), console.error("Google Pay error:", M));
3697
3705
  }
3698
3706
  }
3699
- function Bn(e) {
3700
- var u, c, d, g, C, S, T, v, Q, _;
3701
- const n = e.container;
3702
- (u = n.querySelector('[data-action="pay"]')) == null || u.addEventListener("click", () => e.handlePayment()), (c = n.querySelector('[data-action="change-method"]')) == null || c.addEventListener("click", () => dt(e)), n.querySelectorAll('[data-action="close"]').forEach((m) => m.addEventListener("click", () => e.close())), (d = n.querySelector('[data-action="close-sheet"]')) == null || d.addEventListener("click", () => {
3703
- e._pendingDeleteMethod ? ve(e) : W(e);
3704
- }), (g = n.querySelector('[data-action="edit-sheet"]')) == null || g.addEventListener("click", () => {
3705
- e.isPaymentSheetEditMode = !0, ce(e), Ae(e);
3706
- }), (C = n.querySelector('[data-action="previous-sheet"]')) == null || C.addEventListener("click", () => {
3707
- e.isPaymentSheetEditMode = !1, ce(e), Ae(e);
3708
- }), (S = n.querySelector('[data-action="close-add-card"]')) == null || S.addEventListener("click", () => ae(e)), (T = n.querySelector('[data-action="confirm-delete-cancel"]')) == null || T.addEventListener("click", () => ve(e)), (v = n.querySelector('[data-action="confirm-delete-submit"]')) == null || v.addEventListener("click", () => {
3707
+ async function Bn(e, t, o) {
3708
+ var i;
3709
+ if (!e.config.onPayWithGooglePay) {
3710
+ e.config.onError({ attributes: { message: e.t("errorGooglePayUnsupported") } });
3711
+ return;
3712
+ }
3713
+ te(e);
3714
+ try {
3715
+ const s = await e.config.onPayWithGooglePay({
3716
+ amount: Number(e._getCheckoutAmount()),
3717
+ gateway: o.gateway,
3718
+ gatewayMerchantId: o.gatewayMerchantId
3719
+ }), u = JSON.parse(s), a = await at(
3720
+ e.apiUrl,
3721
+ e._getApiConfig(),
3722
+ e.deviceId,
3723
+ u,
3724
+ t
3725
+ ), d = (a == null ? void 0 : a.id) ?? ((i = a == null ? void 0 : a.data) == null ? void 0 : i.id);
3726
+ d && ce(e, String(d));
3727
+ } catch (s) {
3728
+ j(e), s.statusCode === "CANCELED" ? e.config.onCancel() : (e.config.onError({
3729
+ attributes: {
3730
+ message: e._resolveErrorMessage(s, "errorGooglePayPayment")
3731
+ }
3732
+ }), console.error("Google Pay native error:", s));
3733
+ }
3734
+ }
3735
+ function In(e) {
3736
+ var u, a, d, g, C, S, T, E, Q, _;
3737
+ const t = e.container;
3738
+ (u = t.querySelector('[data-action="pay"]')) == null || u.addEventListener("click", () => e.handlePayment()), (a = t.querySelector('[data-action="change-method"]')) == null || a.addEventListener("click", () => ht(e)), t.querySelectorAll('[data-action="close"]').forEach((m) => m.addEventListener("click", () => e.close())), (d = t.querySelector('[data-action="close-sheet"]')) == null || d.addEventListener("click", () => {
3739
+ e._pendingDeleteMethod ? ve(e) : V(e);
3740
+ }), (g = t.querySelector('[data-action="edit-sheet"]')) == null || g.addEventListener("click", () => {
3741
+ e.isPaymentSheetEditMode = !0, Ae(e), ue(e);
3742
+ }), (C = t.querySelector('[data-action="previous-sheet"]')) == null || C.addEventListener("click", () => {
3743
+ e.isPaymentSheetEditMode = !1, Ae(e), ue(e);
3744
+ }), (S = t.querySelector('[data-action="close-add-card"]')) == null || S.addEventListener("click", () => ae(e)), (T = t.querySelector('[data-action="confirm-delete-cancel"]')) == null || T.addEventListener("click", () => ve(e)), (E = t.querySelector('[data-action="confirm-delete-submit"]')) == null || E.addEventListener("click", () => {
3709
3745
  if (e._pendingDeleteMethod) {
3710
3746
  const m = e._pendingDeleteMethod;
3711
- Ne(e, !0), Cn(e, m).then(() => W(e)).finally(() => Ne(e, !1));
3747
+ Ne(e, !0), Cn(e, m).then(() => V(e)).finally(() => Ne(e, !1));
3712
3748
  }
3713
- }), n.querySelectorAll(".choco-widget-method-item").forEach((m) => {
3749
+ }), t.querySelectorAll(".choco-widget-method-item").forEach((m) => {
3714
3750
  m.addEventListener("click", (P) => {
3715
3751
  const k = JSON.parse(
3716
3752
  P.currentTarget.getAttribute("data-method") || "{}"
3717
3753
  );
3718
- ht(e, k);
3754
+ ft(e, k);
3719
3755
  });
3720
3756
  });
3721
- const o = n.querySelector('[data-sheet="payment"]');
3757
+ const o = t.querySelector('[data-sheet="payment"]');
3722
3758
  o && (o.addEventListener("click", (m) => {
3723
- m.target === o && W(e);
3724
- }), Qn(e, o));
3725
- const s = n.querySelector('[data-action="toggle-balance"]');
3726
- s && ((Q = s.querySelector("input[type='checkbox']")) == null || Q.addEventListener("change", (m) => {
3759
+ m.target === o && V(e);
3760
+ }), Sn(e, o));
3761
+ const i = t.querySelector('[data-action="toggle-balance"]');
3762
+ i && ((Q = i.querySelector("input[type='checkbox']")) == null || Q.addEventListener("change", (m) => {
3727
3763
  e.useBalance = m.target.checked, e._updatePayButtonAmount();
3728
3764
  }));
3729
- const i = n.querySelector('[data-action="toggle-bonuses"]');
3730
- i && ((_ = i.querySelector("input[type='checkbox']")) == null || _.addEventListener("change", (m) => {
3765
+ const s = t.querySelector('[data-action="toggle-bonuses"]');
3766
+ s && ((_ = s.querySelector("input[type='checkbox']")) == null || _.addEventListener("change", (m) => {
3731
3767
  e.useBonuses = m.target.checked, e.config.onAppliedBonus(e.useBonuses), e._updatePayButtonAmount();
3732
- })), document.removeEventListener("keydown", e._boundKeyDown), document.addEventListener("keydown", e._boundKeyDown), lt(e);
3768
+ })), document.removeEventListener("keydown", e._boundKeyDown), document.addEventListener("keydown", e._boundKeyDown), dt(e);
3733
3769
  }
3734
- function In(e, n) {
3735
- var o, s;
3736
- e.isOpen && (n.key === "Escape" && (n.preventDefault(), e._pendingDeleteMethod ? ve(e) : e.isAddCardViewOpen ? ae(e) : e.isPaymentSheetOpen ? W(e) : e.close()), n.key === "Enter" && ((s = (o = n.target) == null ? void 0 : o.dataset) == null ? void 0 : s.action) === "pay" && (n.preventDefault(), e.handlePayment()));
3770
+ function Qn(e, t) {
3771
+ var o, i;
3772
+ e.isOpen && (t.key === "Escape" && (t.preventDefault(), e._pendingDeleteMethod ? ve(e) : e.isAddCardViewOpen ? ae(e) : e.isPaymentSheetOpen ? V(e) : e.close()), t.key === "Enter" && ((i = (o = t.target) == null ? void 0 : o.dataset) == null ? void 0 : i.action) === "pay" && (t.preventDefault(), e.handlePayment()));
3737
3773
  }
3738
- function Qn(e, n) {
3739
- const o = n.querySelector('[data-action="sheet-drag-handle"]'), s = n.querySelector(".choco-widget-sheet-content");
3740
- if (!o || !s) return;
3741
- const i = 80;
3742
- let u = 0, c = 0;
3774
+ function Sn(e, t) {
3775
+ const o = t.querySelector('[data-action="sheet-drag-handle"]'), i = t.querySelector(".choco-widget-sheet-content");
3776
+ if (!o || !i) return;
3777
+ const s = 80;
3778
+ let u = 0, a = 0;
3743
3779
  const d = (C) => {
3744
- c = C.clientY;
3745
- const S = Math.max(0, c - u);
3746
- s.style.transform = `translateY(${S}px)`;
3780
+ a = C.clientY;
3781
+ const S = Math.max(0, a - u);
3782
+ i.style.transform = `translateY(${S}px)`;
3747
3783
  }, g = (C) => {
3748
3784
  o.releasePointerCapture(C.pointerId), o.removeEventListener("pointermove", d), o.removeEventListener("pointerup", g), o.removeEventListener("pointercancel", g);
3749
- const S = Math.max(0, c - u);
3750
- if (s.classList.remove("choco-widget-sheet-content--dragging"), S >= i) {
3751
- s.style.transform = "translateY(100%)";
3785
+ const S = Math.max(0, a - u);
3786
+ if (i.classList.remove("choco-widget-sheet-content--dragging"), S >= s) {
3787
+ i.style.transform = "translateY(100%)";
3752
3788
  const T = () => {
3753
- s.removeEventListener("transitionend", T), s.style.transform = "", W(e);
3789
+ i.removeEventListener("transitionend", T), i.style.transform = "", V(e);
3754
3790
  };
3755
- s.addEventListener("transitionend", T);
3791
+ i.addEventListener("transitionend", T);
3756
3792
  } else
3757
- s.style.transform = "";
3793
+ i.style.transform = "";
3758
3794
  };
3759
3795
  o.addEventListener("pointerdown", (C) => {
3760
- !e.isPaymentSheetOpen || C.button !== 0 || (C.preventDefault(), u = C.clientY, c = C.clientY, s.classList.add("choco-widget-sheet-content--dragging"), o.setPointerCapture(C.pointerId), o.addEventListener("pointermove", d), o.addEventListener("pointerup", g), o.addEventListener("pointercancel", g));
3796
+ !e.isPaymentSheetOpen || C.button !== 0 || (C.preventDefault(), u = C.clientY, a = C.clientY, i.classList.add("choco-widget-sheet-content--dragging"), o.setPointerCapture(C.pointerId), o.addEventListener("pointermove", d), o.addEventListener("pointerup", g), o.addEventListener("pointercancel", g));
3761
3797
  });
3762
3798
  }
3763
- class se {
3799
+ class ie {
3764
3800
  // ─── Статические методы / logout ─────────────────────────────────────────────
3765
- static _getAuthStorageValue(n) {
3766
- return it(n);
3801
+ static _getAuthStorageValue(t) {
3802
+ return it(t);
3767
3803
  }
3768
- static _setAuthStorageValue(n, o) {
3769
- Re(n, o);
3804
+ static _setAuthStorageValue(t, o) {
3805
+ Re(t, o);
3770
3806
  }
3771
- static _removeAuthStorageValue(n) {
3772
- be(n);
3807
+ static _removeAuthStorageValue(t) {
3808
+ be(t);
3773
3809
  }
3774
3810
  static async logout() {
3775
3811
  Ze();
3776
3812
  }
3777
3813
  // ─── Конструктор ──────────────────────────────────────────────────────────────
3778
- constructor(n) {
3779
- this.config = Jt(n), this.accessToken = null, this.deviceId = nt(), this.apiUrl = bt(this.config.environment), this.translations = yt, this.checkoutContext = null, this.centrifuge = null, this.selectedPaymentMethod = null, this.container = null, this.isOpen = !1, this.isPaymentSheetOpen = !1, this.isPaymentSheetEditMode = !1, this.loading = !1, this.disabled = !1, this.paymentMethodDisabled = !1, this.useBalance = !1, this.useBonuses = !1, this.addCardActionUrl = null, this.isAddCardViewOpen = !1, this.waitingForNewCardAction = !1, this.newCardActionRequiredTimeoutId = null, this._googlePayScriptPromise = null, this._googlePayButtonRenderVersion = 0, this._orderStatusPollingId = null, this._orderStatusResolved = !1, this._pendingDeleteMethod = null, this._pendingSuccessPayload = null, this._lifecycleListenersAttached = !1, this._boundAddCardMessage = null, this._boundKeyDown = (o) => In(this, o), this._boundVisibilityChange = () => this._onVisibilityChange(), this._boundWindowFocus = () => this._onWindowFocus(), this._boundPageShow = () => this._onPageShow();
3814
+ constructor(t) {
3815
+ this.config = Jt(t), this.accessToken = null, this.deviceId = nt(), this.apiUrl = Et(this.config.environment), this.translations = mt, this.checkoutContext = null, this.centrifuge = null, this.selectedPaymentMethod = null, this.container = null, this.isOpen = !1, this.isPaymentSheetOpen = !1, this.isPaymentSheetEditMode = !1, this.loading = !1, this.disabled = !1, this.paymentMethodDisabled = !1, this.useBalance = !1, this.useBonuses = !1, this.addCardActionUrl = null, this.isAddCardViewOpen = !1, this.waitingForNewCardAction = !1, this.newCardActionRequiredTimeoutId = null, this._googlePayScriptPromise = null, this._googlePayButtonRenderVersion = 0, this._orderStatusPollingId = null, this._orderStatusResolved = !1, this._pendingDeleteMethod = null, this._pendingSuccessPayload = null, this._lifecycleListenersAttached = !1, this._boundAddCardMessage = null, this._boundKeyDown = (o) => Qn(this, o), this._boundVisibilityChange = () => this._onVisibilityChange(), this._boundWindowFocus = () => this._onWindowFocus(), this._boundPageShow = () => this._onPageShow();
3780
3816
  }
3781
3817
  // ─── Локализация ──────────────────────────────────────────────────────────────
3782
- t(n, o = {}) {
3818
+ t(t, o = {}) {
3783
3819
  var u;
3784
- const s = this.config.locale || "ru", i = ((u = this.translations[s]) == null ? void 0 : u[n]) || this.translations.ru[n];
3785
- return typeof i != "string" ? n : i.replace(
3820
+ const i = this.config.locale || "ru", s = ((u = this.translations[i]) == null ? void 0 : u[t]) || this.translations.ru[t];
3821
+ return typeof s != "string" ? t : s.replace(
3786
3822
  /{(\w+)}/g,
3787
- (c, d) => Object.prototype.hasOwnProperty.call(o, d) ? String(o[d]) : c
3823
+ (a, d) => Object.prototype.hasOwnProperty.call(o, d) ? String(o[d]) : a
3788
3824
  );
3789
3825
  }
3790
- _resolveErrorMessage(n, o = "paymentError") {
3791
- return (n == null ? void 0 : n.message) || this.t(o);
3826
+ _resolveErrorMessage(t, o = "paymentError") {
3827
+ return (t == null ? void 0 : t.message) || this.t(o);
3792
3828
  }
3793
3829
  // ─── Вспомогательные геттеры ─────────────────────────────────────────────────
3794
3830
  _getApiConfig() {
@@ -3798,27 +3834,27 @@ class se {
3798
3834
  return this.disabled || this.loading;
3799
3835
  }
3800
3836
  _getBalanceAmount() {
3801
- var i, u, c, d;
3802
- const n = (d = (c = (u = (i = this.checkoutContext) == null ? void 0 : i.data) == null ? void 0 : u.balance) == null ? void 0 : c.data) == null ? void 0 : d.money, o = this.config.currency || "KZT", s = Number(n == null ? void 0 : n[o]);
3803
- return Number.isFinite(s) && s > 0 ? s : 0;
3837
+ var s, u, a, d;
3838
+ const t = (d = (a = (u = (s = this.checkoutContext) == null ? void 0 : s.data) == null ? void 0 : u.balance) == null ? void 0 : a.data) == null ? void 0 : d.money, o = this.config.currency || "KZT", i = Number(t == null ? void 0 : t[o]);
3839
+ return Number.isFinite(i) && i > 0 ? i : 0;
3804
3840
  }
3805
3841
  _getBonusesAmount() {
3806
3842
  var o;
3807
- const n = Number((o = this.config.bonuses) == null ? void 0 : o.amount);
3808
- return Number.isFinite(n) && n > 0 ? n : 0;
3843
+ const t = Number((o = this.config.bonuses) == null ? void 0 : o.amount);
3844
+ return Number.isFinite(t) && t > 0 ? t : 0;
3809
3845
  }
3810
3846
  _getBonusesPercent() {
3811
3847
  var o;
3812
- const n = Number((o = this.config.bonuses) == null ? void 0 : o.percent);
3813
- return !Number.isFinite(n) || n <= 0 ? 0 : n >= 100 ? 100 : n;
3848
+ const t = Number((o = this.config.bonuses) == null ? void 0 : o.percent);
3849
+ return !Number.isFinite(t) || t <= 0 ? 0 : t >= 100 ? 100 : t;
3814
3850
  }
3815
3851
  _getAvailableBonus() {
3816
3852
  var o;
3817
- const n = Number((o = this.config.bonuses) == null ? void 0 : o.availableBonus);
3818
- return Number.isFinite(n) && n > 0 ? n : 0;
3853
+ const t = Number((o = this.config.bonuses) == null ? void 0 : o.availableBonus);
3854
+ return Number.isFinite(t) && t > 0 ? t : 0;
3819
3855
  }
3820
3856
  _getPaymentBreakdown() {
3821
- const n = this.config.amount, o = this._getBalanceAmount(), s = this.useBalance ? Math.min(o, n) : 0, i = n - s, u = this.useBalance && s >= n, c = this.useBonuses ? this._getAvailableBonus() : 0, d = Math.max(i - c, 0), g = this.useBalance ? n : d, C = this.useBalance && !u;
3857
+ const t = this.config.amount, o = this._getBalanceAmount(), i = this.useBalance ? Math.min(o, t) : 0, s = t - i, u = this.useBalance && i >= t, a = this.useBonuses ? this._getAvailableBonus() : 0, d = Math.max(s - a, 0), g = this.useBalance ? t : d, C = this.useBalance && !u;
3822
3858
  return {
3823
3859
  payableAmount: d,
3824
3860
  checkoutOptions: {
@@ -3838,25 +3874,26 @@ class se {
3838
3874
  return this._getPaymentBreakdown().checkoutOptions.checkoutAmount ?? this.config.amount;
3839
3875
  }
3840
3876
  _getPaymentMethodForUserEvent() {
3841
- var n;
3842
- return this._isBalanceFullyCoveringAmount() ? "balance" : ((n = this.selectedPaymentMethod) == null ? void 0 : n.type) ?? null;
3877
+ var t;
3878
+ return this._isBalanceFullyCoveringAmount() ? "balance" : ((t = this.selectedPaymentMethod) == null ? void 0 : t.type) ?? null;
3843
3879
  }
3844
3880
  _getKaspiOptions() {
3845
3881
  return {
3846
3882
  onlyKaspiAvailable: this.config.onlyKaspiAvailable,
3847
- disableKaspi: this.config.disableKaspi
3883
+ disableKaspi: this.config.disableKaspi,
3884
+ disableGooglePay: this.config.disableGooglePay
3848
3885
  };
3849
3886
  }
3850
3887
  // ─── Эмиттеры ────────────────────────────────────────────────────────────────
3851
- _emitUserEvent(n, o = {}) {
3852
- typeof this.config.onUserEvent == "function" && this.config.onUserEvent({ eventName: n, eventProperties: o });
3888
+ _emitUserEvent(t, o = {}) {
3889
+ typeof this.config.onUserEvent == "function" && this.config.onUserEvent({ eventName: t, eventProperties: o });
3853
3890
  }
3854
- _emitPaymentMethodSelected(n = this.selectedPaymentMethod) {
3855
- typeof this.config.onPaymentMethodSelected == "function" && this.config.onPaymentMethodSelected(n || null);
3891
+ _emitPaymentMethodSelected(t = this.selectedPaymentMethod) {
3892
+ typeof this.config.onPaymentMethodSelected == "function" && this.config.onPaymentMethodSelected(t || null);
3856
3893
  }
3857
3894
  // ─── Делегаторы в модули (вызываются из domUI/events через widget.method()) ──
3858
3895
  _attachEventListeners() {
3859
- Bn(this);
3896
+ In(this);
3860
3897
  }
3861
3898
  _updatePayButtonAmount() {
3862
3899
  pe(this);
@@ -3869,7 +3906,7 @@ class se {
3869
3906
  }
3870
3907
  // ─── Таймауты новой карты ─────────────────────────────────────────────────────
3871
3908
  _setNewCardActionTimeout() {
3872
- this._clearNewCardActionTimeout(), this.newCardActionRequiredTimeoutId = window.setTimeout(() => {
3909
+ this._clearNewCardActionTimeout(), this.newCardActionRequiredTimeoutId = setTimeout(() => {
3873
3910
  this.waitingForNewCardAction && (this.waitingForNewCardAction = !1, j(this), this.config.onError({
3874
3911
  attributes: { message: this.t("errorNoServerResponseRetry") }
3875
3912
  })), this.newCardActionRequiredTimeoutId = null;
@@ -3879,41 +3916,41 @@ class se {
3879
3916
  this.newCardActionRequiredTimeoutId && (window.clearTimeout(this.newCardActionRequiredTimeoutId), this.newCardActionRequiredTimeoutId = null);
3880
3917
  }
3881
3918
  // ─── Хранение токенов ────────────────────────────────────────────────────────
3882
- _saveTokensToStorage(n, o) {
3883
- Me(n, o);
3919
+ _saveTokensToStorage(t, o) {
3920
+ Me(t, o);
3884
3921
  }
3885
3922
  _clearAuthStorage() {
3886
3923
  Ze();
3887
3924
  }
3888
- _getAuthStorageValue(n) {
3889
- return se._getAuthStorageValue(n);
3925
+ _getAuthStorageValue(t) {
3926
+ return ie._getAuthStorageValue(t);
3890
3927
  }
3891
- _setAuthStorageValue(n, o) {
3892
- se._setAuthStorageValue(n, o);
3928
+ _setAuthStorageValue(t, o) {
3929
+ ie._setAuthStorageValue(t, o);
3893
3930
  }
3894
- _removeAuthStorageValue(n) {
3895
- se._removeAuthStorageValue(n);
3931
+ _removeAuthStorageValue(t) {
3932
+ ie._removeAuthStorageValue(t);
3896
3933
  }
3897
3934
  // ─── Google Pay SDK (используется из domUI + paymentFlow) ────────────────────
3898
3935
  _loadGooglePaySdk() {
3899
- var n, o;
3900
- return typeof window > "u" || typeof document > "u" ? Promise.reject(new Error("Google Pay SDK requires browser environment")) : (o = (n = window.google) == null ? void 0 : n.payments) != null && o.api ? Promise.resolve() : this._googlePayScriptPromise ? this._googlePayScriptPromise : (this._googlePayScriptPromise = new Promise((s, i) => {
3936
+ var t, o;
3937
+ return typeof window > "u" || typeof document > "u" ? Promise.reject(new Error("Google Pay SDK requires browser environment")) : (o = (t = window.google) == null ? void 0 : t.payments) != null && o.api ? Promise.resolve() : this._googlePayScriptPromise ? this._googlePayScriptPromise : (this._googlePayScriptPromise = new Promise((i, s) => {
3901
3938
  const u = document.querySelector(
3902
3939
  'script[data-choco-google-pay-sdk="true"]'
3903
3940
  );
3904
3941
  if (u) {
3905
- u.addEventListener("load", () => s(), { once: !0 }), u.addEventListener(
3942
+ u.addEventListener("load", () => i(), { once: !0 }), u.addEventListener(
3906
3943
  "error",
3907
- () => i(new Error("Failed to load Google Pay SDK")),
3944
+ () => s(new Error("Failed to load Google Pay SDK")),
3908
3945
  { once: !0 }
3909
3946
  );
3910
3947
  return;
3911
3948
  }
3912
- const c = document.createElement("script");
3913
- c.src = "https://pay.google.com/gp/p/js/pay.js", c.async = !0, c.defer = !0, c.setAttribute("data-choco-google-pay-sdk", "true"), c.onload = () => s(), c.onerror = () => i(new Error("Failed to load Google Pay SDK")), document.head.appendChild(c);
3949
+ const a = document.createElement("script");
3950
+ a.src = "https://pay.google.com/gp/p/js/pay.js", a.async = !0, a.defer = !0, a.setAttribute("data-choco-google-pay-sdk", "true"), a.onload = () => i(), a.onerror = () => s(new Error("Failed to load Google Pay SDK")), document.head.appendChild(a);
3914
3951
  }).finally(() => {
3915
- var s, i;
3916
- (i = (s = window.google) == null ? void 0 : s.payments) != null && i.api || (this._googlePayScriptPromise = null);
3952
+ var i, s;
3953
+ (s = (i = window.google) == null ? void 0 : i.payments) != null && s.api || (this._googlePayScriptPromise = null);
3917
3954
  }), this._googlePayScriptPromise);
3918
3955
  }
3919
3956
  // ─── Lifecycle listeners ──────────────────────────────────────────────────────
@@ -3942,14 +3979,14 @@ class se {
3942
3979
  this.apiUrl,
3943
3980
  this._getApiConfig()
3944
3981
  );
3945
- } catch (n) {
3946
- if (n.status === 401)
3982
+ } catch (t) {
3983
+ if (t.status === 401)
3947
3984
  this._removeAuthStorageValue("webPayToken"), await this._obtainTokenByRefreshOrTrackId(), this.checkoutContext = await Oe(
3948
3985
  this.apiUrl,
3949
3986
  this._getApiConfig()
3950
3987
  );
3951
3988
  else
3952
- throw n;
3989
+ throw t;
3953
3990
  }
3954
3991
  }
3955
3992
  // ─── Рендер ───────────────────────────────────────────────────────────────────
@@ -3961,7 +3998,7 @@ class se {
3961
3998
  }
3962
3999
  // ─── Публичный API ────────────────────────────────────────────────────────────
3963
4000
  async init() {
3964
- var n, o;
4001
+ var t, o;
3965
4002
  try {
3966
4003
  if (this._prerender(), this._attachLifecycleListeners(), !this.config.clientId)
3967
4004
  return this.config.onError({ attributes: { message: this.t("errorMissingTrackClient") } }), !1;
@@ -3970,35 +4007,35 @@ class se {
3970
4007
  this.accessToken || await this._obtainTokenByRefreshOrTrackId();
3971
4008
  try {
3972
4009
  await this._fetchCheckoutContextWithRetry();
3973
- } catch (i) {
3974
- const u = i;
4010
+ } catch (s) {
4011
+ const u = s;
3975
4012
  return this.config.onError({ attributes: { message: u.message } }), !1;
3976
4013
  }
3977
- const s = We(
3978
- (o = (n = this.checkoutContext) == null ? void 0 : n.data) == null ? void 0 : o.socket_connections,
3979
- (i) => et(this, i)
4014
+ const i = Ve(
4015
+ (o = (t = this.checkoutContext) == null ? void 0 : t.data) == null ? void 0 : o.socket_connections,
4016
+ (s) => et(this, s)
3980
4017
  );
3981
- return s && (this.centrifuge = s.centrifuge), this.selectedPaymentMethod = Le(
4018
+ return i && (this.centrifuge = i.centrifuge), this.selectedPaymentMethod = Le(
3982
4019
  this.checkoutContext.data,
3983
4020
  this._getKaspiOptions()
3984
4021
  ), this._emitPaymentMethodSelected(), this._render(), !0;
3985
- } catch (s) {
3986
- return console.error(`${this.t("errorWidgetInit")}:`, s), this.config.onError({ attributes: { message: s.message } }), !1;
4022
+ } catch (i) {
4023
+ return console.error(`${this.t("errorWidgetInit")}:`, i), this.config.onError({ attributes: { message: i.message } }), !1;
3987
4024
  }
3988
4025
  }
3989
4026
  close() {
3990
4027
  this.config.onCancel();
3991
4028
  }
3992
4029
  destroy() {
3993
- const n = document.getElementById("choco-one-click-widget");
3994
- n && (n.style.display = "none"), this._clearNewCardActionTimeout(), $(this), this._pendingSuccessPayload = null, this._detachLifecycleListeners(), this.isAddCardViewOpen && ae(this), this.centrifuge && (this.centrifuge.disconnect(), this.centrifuge = null), document.removeEventListener("keydown", this._boundKeyDown), this.container && (this.container.classList.remove("choco-one-click-widget--visible"), setTimeout(() => {
4030
+ const t = document.getElementById("choco-one-click-widget");
4031
+ t && (t.style.display = "none"), this._clearNewCardActionTimeout(), $(this), this._pendingSuccessPayload = null, this._detachLifecycleListeners(), this.isAddCardViewOpen && ae(this), this.centrifuge && (this.centrifuge.disconnect(), this.centrifuge = null), document.removeEventListener("keydown", this._boundKeyDown), this.container && (this.container.classList.remove("choco-one-click-widget--visible"), setTimeout(() => {
3995
4032
  var o;
3996
4033
  (o = this.container) == null || o.remove(), this.container = null;
3997
4034
  }, 300)), this.isOpen = !1, this.isPaymentSheetOpen = !1, this.isAddCardViewOpen = !1, this.selectedPaymentMethod = null;
3998
4035
  }
3999
4036
  getAvailablePaymentMethods() {
4000
- var n;
4001
- return (n = this.checkoutContext) != null && n.data ? Lt(
4037
+ var t;
4038
+ return (t = this.checkoutContext) != null && t.data ? Rt(
4002
4039
  this.checkoutContext.data,
4003
4040
  (o) => this.t(o),
4004
4041
  this._getKaspiOptions()
@@ -4010,8 +4047,8 @@ class se {
4010
4047
  async pay() {
4011
4048
  try {
4012
4049
  await this.createOrder();
4013
- } catch (n) {
4014
- console.error(`${this.t("errorPaymentProcess")}:`, n);
4050
+ } catch (t) {
4051
+ console.error(`${this.t("errorPaymentProcess")}:`, t);
4015
4052
  }
4016
4053
  }
4017
4054
  async handlePayment() {
@@ -4025,102 +4062,102 @@ class se {
4025
4062
  return;
4026
4063
  }
4027
4064
  await this.pay();
4028
- } catch (n) {
4029
- console.error(`${this.t("errorPaymentProcess")}:`, n);
4065
+ } catch (t) {
4066
+ console.error(`${this.t("errorPaymentProcess")}:`, t);
4030
4067
  }
4031
4068
  }
4032
4069
  }
4033
4070
  openPaymentSheet() {
4034
- dt(this);
4071
+ ht(this);
4035
4072
  }
4036
4073
  closePaymentSheet() {
4037
- W(this);
4074
+ V(this);
4038
4075
  }
4039
- async updateAmount(n) {
4040
- if (typeof n != "number" || !Number.isFinite(n) || n < 0)
4076
+ async updateAmount(t) {
4077
+ if (typeof t != "number" || !Number.isFinite(t) || t < 0)
4041
4078
  throw new Error("amount must be a non-negative number");
4042
- this.config.amount = n, pe(this);
4079
+ this.config.amount = t, pe(this);
4043
4080
  }
4044
- async updateAvailableBonus(n) {
4045
- if (typeof n != "number" || !Number.isFinite(n) || n < 0)
4081
+ async updateAvailableBonus(t) {
4082
+ if (typeof t != "number" || !Number.isFinite(t) || t < 0)
4046
4083
  throw new Error("availableBonus must be a non-negative number");
4047
- this.config.bonuses && (this.config.bonuses.availableBonus = n), pe(this);
4084
+ this.config.bonuses && (this.config.bonuses.availableBonus = t), pe(this);
4048
4085
  }
4049
- async updateLocale(n) {
4050
- if (typeof n != "string" || !this.translations[n])
4051
- throw new Error(`Unsupported locale: ${n}`);
4052
- if (this.config.locale = n, !this.container) return;
4053
- const o = this.isPaymentSheetOpen, s = this.isAddCardViewOpen;
4086
+ async updateLocale(t) {
4087
+ if (typeof t != "string" || !this.translations[t])
4088
+ throw new Error(`Unsupported locale: ${t}`);
4089
+ if (this.config.locale = t, !this.container) return;
4090
+ const o = this.isPaymentSheetOpen, i = this.isAddCardViewOpen;
4054
4091
  if (this._render(), ee(this), o) {
4055
- const i = this.container.querySelector('[data-sheet="payment"]');
4056
- i && (i.classList.add("choco-widget-payment-sheet--open"), this.isPaymentSheetOpen = !0);
4092
+ const s = this.container.querySelector('[data-sheet="payment"]');
4093
+ s && (s.classList.add("choco-widget-payment-sheet--open"), this.isPaymentSheetOpen = !0);
4057
4094
  }
4058
- s && $e(this);
4095
+ i && $e(this);
4059
4096
  }
4060
- async setLoading(n) {
4061
- this.loading = !!n, ee(this);
4097
+ async setLoading(t) {
4098
+ this.loading = !!t, ee(this);
4062
4099
  }
4063
- async setDisabled(n) {
4064
- this.disabled = !!n, ee(this);
4100
+ async setDisabled(t) {
4101
+ this.disabled = !!t, ee(this);
4065
4102
  }
4066
- async setPreorderId(n) {
4067
- this.config.preorderId = n;
4103
+ async setPreorderId(t) {
4104
+ this.config.preorderId = t;
4068
4105
  }
4069
- async setMerchantOrderId(n) {
4070
- this.config.merchantOrderId = n;
4106
+ async setMerchantOrderId(t) {
4107
+ this.config.merchantOrderId = t;
4071
4108
  }
4072
4109
  async logout() {
4073
- await se.logout(), this.accessToken = null;
4110
+ await ie.logout(), this.accessToken = null;
4074
4111
  }
4075
- async updateTrackId(n) {
4076
- var o, s;
4077
- if (this.config.trackId = n, !this.config.clientId)
4112
+ async updateTrackId(t) {
4113
+ var o, i;
4114
+ if (this.config.trackId = t, !this.config.clientId)
4078
4115
  return this.config.onError({ attributes: { message: this.t("errorMissingTrackClient") } }), !1;
4079
4116
  try {
4080
4117
  this._prerender(), await this._obtainTokenByRefreshOrTrackId();
4081
4118
  try {
4082
4119
  await this._fetchCheckoutContextWithRetry();
4083
4120
  } catch (u) {
4084
- const c = u;
4085
- return this.config.onError({ attributes: { message: c.message } }), !1;
4121
+ const a = u;
4122
+ return this.config.onError({ attributes: { message: a.message } }), !1;
4086
4123
  }
4087
4124
  this.centrifuge && (this.centrifuge.disconnect(), this.centrifuge = null);
4088
- const i = We(
4089
- (s = (o = this.checkoutContext) == null ? void 0 : o.data) == null ? void 0 : s.socket_connections,
4125
+ const s = Ve(
4126
+ (i = (o = this.checkoutContext) == null ? void 0 : o.data) == null ? void 0 : i.socket_connections,
4090
4127
  (u) => et(this, u)
4091
4128
  );
4092
- return i && (this.centrifuge = i.centrifuge), this.selectedPaymentMethod = Le(
4129
+ return s && (this.centrifuge = s.centrifuge), this.selectedPaymentMethod = Le(
4093
4130
  this.checkoutContext.data,
4094
4131
  this._getKaspiOptions()
4095
4132
  ), this._emitPaymentMethodSelected(), this.paymentMethodDisabled = !1, this._render(), !0;
4096
- } catch (i) {
4097
- return console.error(`${this.t("errorWidgetInit")}:`, i), this.config.onError({ attributes: { message: i.message } }), !1;
4133
+ } catch (s) {
4134
+ return console.error(`${this.t("errorWidgetInit")}:`, s), this.config.onError({ attributes: { message: s.message } }), !1;
4098
4135
  }
4099
4136
  }
4100
- async onConfirmPay(n) {
4101
- if (typeof n != "function") throw new Error("onConfirmPay callback must be a function");
4102
- this.config.onConfirmPay = n;
4137
+ async onConfirmPay(t) {
4138
+ if (typeof t != "function") throw new Error("onConfirmPay callback must be a function");
4139
+ this.config.onConfirmPay = t;
4103
4140
  }
4104
- async onPaymentMethodSelected(n) {
4105
- if (typeof n != "function")
4141
+ async onPaymentMethodSelected(t) {
4142
+ if (typeof t != "function")
4106
4143
  throw new Error("onPaymentMethodSelected callback must be a function");
4107
- this.config.onPaymentMethodSelected = n, this._emitPaymentMethodSelected();
4144
+ this.config.onPaymentMethodSelected = t, this._emitPaymentMethodSelected();
4108
4145
  }
4109
- async onKaspiLink(n) {
4110
- if (typeof n != "function") throw new Error("onKaspiLink callback must be a function");
4111
- this.config.onKaspiLink = n;
4146
+ async onKaspiLink(t) {
4147
+ if (typeof t != "function") throw new Error("onKaspiLink callback must be a function");
4148
+ this.config.onKaspiLink = t;
4112
4149
  }
4113
- async onUserEvent(n) {
4114
- if (typeof n != "function") throw new Error("onUserEvent callback must be a function");
4115
- this.config.onUserEvent = n;
4150
+ async onUserEvent(t) {
4151
+ if (typeof t != "function") throw new Error("onUserEvent callback must be a function");
4152
+ this.config.onUserEvent = t;
4116
4153
  }
4117
- async onAppliedBonus(n) {
4118
- if (typeof n != "function")
4154
+ async onAppliedBonus(t) {
4155
+ if (typeof t != "function")
4119
4156
  throw new Error("onAppliedBonus callback must be a function");
4120
- this.config.onAppliedBonus = n;
4157
+ this.config.onAppliedBonus = t;
4121
4158
  }
4122
4159
  }
4123
- typeof window < "u" && (window.ChocoOneClickWidget = se);
4160
+ typeof window < "u" && (window.ChocoOneClickWidget = ie);
4124
4161
  export {
4125
- se as default
4162
+ ie as default
4126
4163
  };