@mindbowser_inc/ui-feedback-plugin 0.3.2 → 0.4.1

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.
@@ -1,4 +1,38 @@
1
- import { _ as mr, a as We } from "./tslib.es6-BNkLP3y-.mjs";
1
+ function We(t, e) {
2
+ var r = {};
3
+ for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && e.indexOf(s) < 0 && (r[s] = t[s]);
4
+ if (t != null && typeof Object.getOwnPropertySymbols == "function")
5
+ for (var n = 0, s = Object.getOwnPropertySymbols(t); n < s.length; n++)
6
+ e.indexOf(s[n]) < 0 && Object.prototype.propertyIsEnumerable.call(t, s[n]) && (r[s[n]] = t[s[n]]);
7
+ return r;
8
+ }
9
+ function mr(t, e, r, s) {
10
+ function n(i) {
11
+ return i instanceof r ? i : new r(function(a) {
12
+ a(i);
13
+ });
14
+ }
15
+ return new (r || (r = Promise))(function(i, a) {
16
+ function o(u) {
17
+ try {
18
+ c(s.next(u));
19
+ } catch (h) {
20
+ a(h);
21
+ }
22
+ }
23
+ function l(u) {
24
+ try {
25
+ c(s.throw(u));
26
+ } catch (h) {
27
+ a(h);
28
+ }
29
+ }
30
+ function c(u) {
31
+ u.done ? i(u.value) : n(u.value).then(o, l);
32
+ }
33
+ c((s = s.apply(t, e || [])).next());
34
+ });
35
+ }
2
36
  const wr = (t) => t ? (...e) => t(...e) : (...e) => fetch(...e);
3
37
  class ht extends Error {
4
38
  constructor(e, r = "FunctionsError", s) {
@@ -22,7 +56,7 @@ class ft extends ht {
22
56
  super("Relay Error invoking the Edge Function", "FunctionsRelayError", e);
23
57
  }
24
58
  }
25
- class gt extends ht {
59
+ class pt extends ht {
26
60
  constructor(e) {
27
61
  super("Edge Function returned a non-2xx status code", "FunctionsHttpError", e);
28
62
  }
@@ -205,20 +239,20 @@ class br {
205
239
  const { headers: o, method: l, body: c, signal: u, timeout: h } = s;
206
240
  let d = {}, { region: f } = s;
207
241
  f || (f = this.region);
208
- const g = new URL(`${this.url}/${r}`);
209
- f && f !== "any" && (d["x-region"] = f, g.searchParams.set("forceFunctionRegion", f));
210
- let p;
211
- c && (o && !Object.prototype.hasOwnProperty.call(o, "Content-Type") || !o) ? typeof Blob < "u" && c instanceof Blob || c instanceof ArrayBuffer ? (d["Content-Type"] = "application/octet-stream", p = c) : typeof c == "string" ? (d["Content-Type"] = "text/plain", p = c) : typeof FormData < "u" && c instanceof FormData ? p = c : (d["Content-Type"] = "application/json", p = JSON.stringify(c)) : c && typeof c != "string" && !(typeof Blob < "u" && c instanceof Blob) && !(c instanceof ArrayBuffer) && !(typeof FormData < "u" && c instanceof FormData) ? p = JSON.stringify(c) : p = c;
242
+ const p = new URL(`${this.url}/${r}`);
243
+ f && f !== "any" && (d["x-region"] = f, p.searchParams.set("forceFunctionRegion", f));
244
+ let g;
245
+ c && (o && !Object.prototype.hasOwnProperty.call(o, "Content-Type") || !o) ? typeof Blob < "u" && c instanceof Blob || c instanceof ArrayBuffer ? (d["Content-Type"] = "application/octet-stream", g = c) : typeof c == "string" ? (d["Content-Type"] = "text/plain", g = c) : typeof FormData < "u" && c instanceof FormData ? g = c : (d["Content-Type"] = "application/json", g = JSON.stringify(c)) : c && typeof c != "string" && !(typeof Blob < "u" && c instanceof Blob) && !(c instanceof ArrayBuffer) && !(typeof FormData < "u" && c instanceof FormData) ? g = JSON.stringify(c) : g = c;
212
246
  let _ = u;
213
247
  h && (a = new AbortController(), i = setTimeout(() => a.abort(), h), u ? (_ = a.signal, u.addEventListener("abort", () => a.abort())) : _ = a.signal);
214
- const w = yield this.fetch(g.toString(), {
248
+ const w = yield this.fetch(p.toString(), {
215
249
  method: l || "POST",
216
250
  // headers priority is (high to low):
217
251
  // 1. invoke-level headers
218
252
  // 2. client-level headers
219
253
  // 3. default Content-Type header
220
254
  headers: Object.assign(Object.assign(Object.assign({}, d), this.headers), o),
221
- body: p,
255
+ body: g,
222
256
  signal: _
223
257
  }).catch(($) => {
224
258
  throw new _r($);
@@ -226,14 +260,14 @@ class br {
226
260
  if (b && b === "true")
227
261
  throw new ft(w);
228
262
  if (!w.ok)
229
- throw new gt(w);
263
+ throw new pt(w);
230
264
  let v = ((n = w.headers.get("Content-Type")) !== null && n !== void 0 ? n : "text/plain").split(";")[0].trim(), S;
231
265
  return v === "application/json" ? S = yield w.json() : v === "application/octet-stream" || v === "application/pdf" ? S = yield w.blob() : v === "text/event-stream" ? S = w : v === "multipart/form-data" ? S = yield w.formData() : S = yield w.text(), { data: S, error: null, response: w };
232
266
  } catch (o) {
233
267
  return {
234
268
  data: null,
235
269
  error: o,
236
- response: o instanceof gt || o instanceof ft ? o.context : void 0
270
+ response: o instanceof pt || o instanceof ft ? o.context : void 0
237
271
  };
238
272
  } finally {
239
273
  i && clearTimeout(i);
@@ -241,7 +275,7 @@ class br {
241
275
  });
242
276
  }
243
277
  }
244
- const Gt = 3, pt = (t) => Math.min(1e3 * 2 ** t, 3e4), kr = [520, 503], zt = [
278
+ const Gt = 3, gt = (t) => Math.min(1e3 * 2 ** t, 3e4), kr = [520, 503], zt = [
245
279
  "GET",
246
280
  "HEAD",
247
281
  "OPTIONS"
@@ -453,7 +487,7 @@ var Er = class {
453
487
  } catch (h) {
454
488
  if ((h == null ? void 0 : h.name) === "AbortError" || (h == null ? void 0 : h.code) === "ABORT_ERR" || !zt.includes(r.method)) throw h;
455
489
  if (r.retryEnabled && a < Gt) {
456
- const d = pt(a);
490
+ const d = gt(a);
457
491
  a++, await vt(d, r.signal);
458
492
  continue;
459
493
  }
@@ -461,7 +495,7 @@ var Er = class {
461
495
  }
462
496
  if (Sr(r.method, u.status, a, r.retryEnabled)) {
463
497
  var o, l;
464
- const h = (o = (l = u.headers) === null || l === void 0 ? void 0 : l.get("Retry-After")) !== null && o !== void 0 ? o : null, d = h !== null ? Math.max(0, parseInt(h, 10) || 0) * 1e3 : pt(a);
498
+ const h = (o = (l = u.headers) === null || l === void 0 ? void 0 : l.get("Retry-After")) !== null && o !== void 0 ? o : null, d = h !== null ? Math.max(0, parseInt(h, 10) || 0) * 1e3 : gt(a);
465
499
  await u.text(), a++, await vt(d, r.signal);
466
500
  continue;
467
501
  }
@@ -473,11 +507,11 @@ var Er = class {
473
507
  let l = "", c = "", u = "";
474
508
  const h = a == null ? void 0 : a.cause;
475
509
  if (h) {
476
- var d, f, g, p;
510
+ var d, f, p, g;
477
511
  const b = (d = h == null ? void 0 : h.message) !== null && d !== void 0 ? d : "", v = (f = h == null ? void 0 : h.code) !== null && f !== void 0 ? f : "";
478
- l = `${(g = a == null ? void 0 : a.name) !== null && g !== void 0 ? g : "FetchError"}: ${a == null ? void 0 : a.message}`, l += `
512
+ l = `${(p = a == null ? void 0 : a.name) !== null && p !== void 0 ? p : "FetchError"}: ${a == null ? void 0 : a.message}`, l += `
479
513
 
480
- Caused by: ${(p = h == null ? void 0 : h.name) !== null && p !== void 0 ? p : "Error"}: ${b}`, v && (l += ` (${v})`), h != null && h.stack && (l += `
514
+ Caused by: ${(g = h == null ? void 0 : h.name) !== null && g !== void 0 ? g : "Error"}: ${b}`, v && (l += ` (${v})`), h != null && h.stack && (l += `
481
515
  ${h.stack}`);
482
516
  } else {
483
517
  var _;
@@ -4863,11 +4897,11 @@ var Pr = class Yt {
4863
4897
  if (f) {
4864
4898
  if (f.aborted)
4865
4899
  return clearTimeout(d), l(c, u);
4866
- const g = () => {
4900
+ const p = () => {
4867
4901
  clearTimeout(d), h.abort();
4868
4902
  };
4869
- return f.addEventListener("abort", g, { once: !0 }), l(c, Re(Re({}, u), {}, { signal: h.signal })).finally(() => {
4870
- clearTimeout(d), f.removeEventListener("abort", g);
4903
+ return f.addEventListener("abort", p, { once: !0 }), l(c, Re(Re({}, u), {}, { signal: h.signal })).finally(() => {
4904
+ clearTimeout(d), f.removeEventListener("abort", p);
4871
4905
  });
4872
4906
  }
4873
4907
  return l(c, Re(Re({}, u), {}, { signal: h.signal })).finally(() => clearTimeout(d));
@@ -5079,8 +5113,8 @@ var Pr = class Yt {
5079
5113
  const l = new URL(`${this.url}/rpc/${e}`);
5080
5114
  let c;
5081
5115
  const u = (f) => f !== null && typeof f == "object" && (!Array.isArray(f) || f.some(u)), h = s && Object.values(r).some(u);
5082
- h ? (o = "POST", c = r) : s || n ? (o = s ? "HEAD" : "GET", Object.entries(r).filter(([f, g]) => g !== void 0).map(([f, g]) => [f, Array.isArray(g) ? `{${g.join(",")}}` : `${g}`]).forEach(([f, g]) => {
5083
- l.searchParams.append(f, g);
5116
+ h ? (o = "POST", c = r) : s || n ? (o = s ? "HEAD" : "GET", Object.entries(r).filter(([f, p]) => p !== void 0).map(([f, p]) => [f, Array.isArray(p) ? `{${p.join(",")}}` : `${p}`]).forEach(([f, p]) => {
5117
+ l.searchParams.append(f, p);
5084
5118
  })) : (o = "POST", c = r);
5085
5119
  const d = new Headers(this.headers);
5086
5120
  return h ? d.set("Prefer", i ? `count=${i},return=minimal` : "return=minimal") : i && d.set("Prefer", `count=${i}`), new ie({
@@ -5248,8 +5282,8 @@ class Dr {
5248
5282
  if (h.length > 255)
5249
5283
  throw new Error(`metadata length ${h.length} exceeds maximum of 255`);
5250
5284
  const d = this.USER_BROADCAST_PUSH_META_LENGTH + l.length + o.length + a.length + c.length + h.length, f = new ArrayBuffer(this.HEADER_LENGTH + d);
5251
- let g = new DataView(f), p = 0;
5252
- g.setUint8(p++, this.KINDS.userBroadcastPush), g.setUint8(p++, l.length), g.setUint8(p++, o.length), g.setUint8(p++, a.length), g.setUint8(p++, c.length), g.setUint8(p++, h.length), g.setUint8(p++, r), Array.from(l, (w) => g.setUint8(p++, w.charCodeAt(0))), Array.from(o, (w) => g.setUint8(p++, w.charCodeAt(0))), Array.from(a, (w) => g.setUint8(p++, w.charCodeAt(0))), Array.from(c, (w) => g.setUint8(p++, w.charCodeAt(0))), Array.from(h, (w) => g.setUint8(p++, w.charCodeAt(0)));
5285
+ let p = new DataView(f), g = 0;
5286
+ p.setUint8(g++, this.KINDS.userBroadcastPush), p.setUint8(g++, l.length), p.setUint8(g++, o.length), p.setUint8(g++, a.length), p.setUint8(g++, c.length), p.setUint8(g++, h.length), p.setUint8(g++, r), Array.from(l, (w) => p.setUint8(g++, w.charCodeAt(0))), Array.from(o, (w) => p.setUint8(g++, w.charCodeAt(0))), Array.from(a, (w) => p.setUint8(g++, w.charCodeAt(0))), Array.from(c, (w) => p.setUint8(g++, w.charCodeAt(0))), Array.from(h, (w) => p.setUint8(g++, w.charCodeAt(0)));
5253
5287
  var _ = new Uint8Array(f.byteLength + s.byteLength);
5254
5288
  return _.set(new Uint8Array(f), 0), _.set(new Uint8Array(s), f.byteLength), _.buffer;
5255
5289
  }
@@ -5280,12 +5314,12 @@ class Dr {
5280
5314
  l = l + i;
5281
5315
  const h = s.decode(e.slice(l, l + a));
5282
5316
  l = l + a;
5283
- const d = e.slice(l, e.byteLength), f = o === this.JSON_ENCODING ? JSON.parse(s.decode(d)) : d, g = {
5317
+ const d = e.slice(l, e.byteLength), f = o === this.JSON_ENCODING ? JSON.parse(s.decode(d)) : d, p = {
5284
5318
  type: this.BROADCAST_EVENT,
5285
5319
  event: u,
5286
5320
  payload: f
5287
5321
  };
5288
- return a > 0 && (g.meta = JSON.parse(h)), { join_ref: null, ref: null, topic: c, event: this.BROADCAST_EVENT, payload: g };
5322
+ return a > 0 && (p.meta = JSON.parse(h)), { join_ref: null, ref: null, topic: c, event: this.BROADCAST_EVENT, payload: p };
5289
5323
  }
5290
5324
  _isArrayBuffer(e) {
5291
5325
  var r;
@@ -5387,7 +5421,7 @@ const _t = (t, e, r = {}) => {
5387
5421
  const e = new URL(t);
5388
5422
  return e.protocol = e.protocol.replace(/^ws/i, "http"), e.pathname = e.pathname.replace(/\/+$/, "").replace(/\/socket\/websocket$/i, "").replace(/\/socket$/i, "").replace(/\/websocket$/i, ""), e.pathname === "" || e.pathname === "/" ? e.pathname = "/api/broadcast" : e.pathname = e.pathname + "/api/broadcast", e.href;
5389
5423
  };
5390
- var pe = (t) => typeof t == "function" ? (
5424
+ var ge = (t) => typeof t == "function" ? (
5391
5425
  /** @type {() => T} */
5392
5426
  t
5393
5427
  ) : function() {
@@ -5527,7 +5561,7 @@ var pe = (t) => typeof t == "function" ? (
5527
5561
  * @param {Socket} socket
5528
5562
  */
5529
5563
  constructor(t, e, r) {
5530
- this.state = I.closed, this.topic = t, this.params = pe(e || {}), this.socket = r, this.bindings = [], this.bindingRef = 0, this.timeout = this.socket.timeout, this.joinedOnce = !1, this.joinPush = new Oe(this, V.join, this.params, this.timeout), this.pushBuffer = [], this.stateChangeRefs = [], this.rejoinTimer = new tr(() => {
5564
+ this.state = I.closed, this.topic = t, this.params = ge(e || {}), this.socket = r, this.bindings = [], this.bindingRef = 0, this.timeout = this.socket.timeout, this.joinedOnce = !1, this.joinPush = new Oe(this, V.join, this.params, this.timeout), this.pushBuffer = [], this.stateChangeRefs = [], this.rejoinTimer = new tr(() => {
5531
5565
  this.socket.isConnected() && this.rejoin();
5532
5566
  }, this.socket.rejoinAfterMs), this.stateChangeRefs.push(this.socket.onError(() => this.rejoinTimer.reset())), this.stateChangeRefs.push(
5533
5567
  this.socket.onOpen(() => {
@@ -5542,7 +5576,7 @@ var pe = (t) => typeof t == "function" ? (
5542
5576
  }), this.onError((s) => {
5543
5577
  this.socket.hasLogger() && this.socket.log("channel", `error ${this.topic}`, s), this.isJoining() && this.joinPush.reset(), this.state = I.errored, this.socket.isConnected() && this.rejoinTimer.scheduleTimeout();
5544
5578
  }), this.joinPush.receive("timeout", () => {
5545
- this.socket.hasLogger() && this.socket.log("channel", `timeout ${this.topic}`, this.joinPush.timeout), new Oe(this, V.leave, pe({}), this.timeout).send(), this.state = I.errored, this.joinPush.reset(), this.socket.isConnected() && this.rejoinTimer.scheduleTimeout();
5579
+ this.socket.hasLogger() && this.socket.log("channel", `timeout ${this.topic}`, this.joinPush.timeout), new Oe(this, V.leave, ge({}), this.timeout).send(), this.state = I.errored, this.joinPush.reset(), this.socket.isConnected() && this.rejoinTimer.scheduleTimeout();
5546
5580
  }), this.on(V.reply, (s, n) => {
5547
5581
  this.trigger(this.replyEventName(n), s);
5548
5582
  });
@@ -5672,7 +5706,7 @@ var pe = (t) => typeof t == "function" ? (
5672
5706
  this.rejoinTimer.reset(), this.joinPush.cancelTimeout(), this.state = I.leaving;
5673
5707
  let e = () => {
5674
5708
  this.socket.hasLogger() && this.socket.log("channel", `leave ${this.topic}`), this.trigger(V.close, "leave");
5675
- }, r = new Oe(this, V.leave, pe({}), t);
5709
+ }, r = new Oe(this, V.leave, ge({}), t);
5676
5710
  return r.receive("ok", () => e()).receive("timeout", () => e()), r.send(), this.canPush() || r.trigger("ok", {}), r;
5677
5711
  }
5678
5712
  /**
@@ -5983,8 +6017,8 @@ var pe = (t) => typeof t == "function" ? (
5983
6017
  }), this.map(r, (l, c) => {
5984
6018
  let u = i[l];
5985
6019
  if (u) {
5986
- let h = c.metas.map((p) => p.phx_ref), d = u.metas.map((p) => p.phx_ref), f = c.metas.filter((p) => d.indexOf(p.phx_ref) < 0), g = u.metas.filter((p) => h.indexOf(p.phx_ref) < 0);
5987
- f.length > 0 && (a[l] = c, a[l].metas = f), g.length > 0 && (o[l] = this.clone(u), o[l].metas = g);
6020
+ let h = c.metas.map((g) => g.phx_ref), d = u.metas.map((g) => g.phx_ref), f = c.metas.filter((g) => d.indexOf(g.phx_ref) < 0), p = u.metas.filter((g) => h.indexOf(g.phx_ref) < 0);
6021
+ f.length > 0 && (a[l] = c, a[l].metas = f), p.length > 0 && (o[l] = this.clone(u), o[l].metas = p);
5988
6022
  } else
5989
6023
  a[l] = c;
5990
6024
  }), this.syncDiff(i, { joins: a, leaves: o }, s, n);
@@ -6168,7 +6202,7 @@ var pe = (t) => typeof t == "function" ? (
6168
6202
  })), this.heartbeatIntervalMs = e.heartbeatIntervalMs || 3e4, this.autoSendHeartbeat = e.autoSendHeartbeat ?? !0, this.heartbeatCallback = e.heartbeatCallback ?? (() => {
6169
6203
  }), this.rejoinAfterMs = (n) => e.rejoinAfterMs ? e.rejoinAfterMs(n) : [1e3, 2e3, 5e3][n - 1] || 1e4, this.reconnectAfterMs = (n) => e.reconnectAfterMs ? e.reconnectAfterMs(n) : [10, 50, 100, 150, 200, 250, 500, 1e3, 2e3][n - 1] || 5e3, this.logger = e.logger || null, !this.logger && e.debug && (this.logger = (n, i, a) => {
6170
6204
  console.log(`${n}: ${i}`, a);
6171
- }), this.longpollerTimeout = e.longpollerTimeout || 2e4, this.params = pe(e.params || {}), this.endPoint = `${t}/${st.websocket}`, this.vsn = e.vsn || Vr, this.heartbeatTimeoutTimer = null, this.heartbeatTimer = null, this.heartbeatSentAt = null, this.pendingHeartbeatRef = null, this.reconnectTimer = new tr(() => {
6205
+ }), this.longpollerTimeout = e.longpollerTimeout || 2e4, this.params = ge(e.params || {}), this.endPoint = `${t}/${st.websocket}`, this.vsn = e.vsn || Vr, this.heartbeatTimeoutTimer = null, this.heartbeatTimer = null, this.heartbeatSentAt = null, this.pendingHeartbeatRef = null, this.reconnectTimer = new tr(() => {
6172
6206
  if (this.pageHidden) {
6173
6207
  this.log("Not reconnecting as page is hidden!"), this.teardown();
6174
6208
  return;
@@ -6234,7 +6268,7 @@ var pe = (t) => typeof t == "function" ? (
6234
6268
  * `new Socket("/socket", {params: {user_id: userToken}})`.
6235
6269
  */
6236
6270
  connect(t) {
6237
- t && (console && console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"), this.params = pe(t)), !(this.conn && !this.disconnecting) && (this.longPollFallbackMs && this.transport !== te ? this.connectWithFallback(te, this.longPollFallbackMs) : this.transportConnect());
6271
+ t && (console && console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"), this.params = ge(t)), !(this.conn && !this.disconnecting) && (this.longPollFallbackMs && this.transport !== te ? this.connectWithFallback(te, this.longPollFallbackMs) : this.transportConnect());
6238
6272
  }
6239
6273
  /**
6240
6274
  * Logs the message. Override `this.logger` for specialized logging. noops by default
@@ -6809,7 +6843,7 @@ var J;
6809
6843
  (function(t) {
6810
6844
  t.SUBSCRIBED = "SUBSCRIBED", t.TIMED_OUT = "TIMED_OUT", t.CLOSED = "CLOSED", t.CHANNEL_ERROR = "CHANNEL_ERROR";
6811
6845
  })(J || (J = {}));
6812
- const wi = z;
6846
+ const mi = z;
6813
6847
  class ve {
6814
6848
  get state() {
6815
6849
  return this.channelAdapter.state;
@@ -6907,8 +6941,8 @@ class ve {
6907
6941
  this._updatePostgresBindings(f, e);
6908
6942
  }).receive("error", (f) => {
6909
6943
  this.state = z.errored;
6910
- const g = Object.values(f).join(", ") || "error";
6911
- e == null || e(J.CHANNEL_ERROR, new Error(g, { cause: f }));
6944
+ const p = Object.values(f).join(", ") || "error";
6945
+ e == null || e(J.CHANNEL_ERROR, new Error(p, { cause: f }));
6912
6946
  }).receive("timeout", () => {
6913
6947
  e == null || e(J.TIMED_OUT);
6914
6948
  });
@@ -7333,8 +7367,8 @@ class ve {
7333
7367
  return !0;
7334
7368
  if (["broadcast", "presence", "postgres_changes"].includes(h))
7335
7369
  if ("id" in d) {
7336
- const f = d.id, g = (i = d.filter) === null || i === void 0 ? void 0 : i.event;
7337
- return f && ((a = r.ids) === null || a === void 0 ? void 0 : a.includes(f)) && (g === "*" || (g == null ? void 0 : g.toLocaleLowerCase()) === ((o = r.data) === null || o === void 0 ? void 0 : o.type.toLocaleLowerCase()));
7370
+ const f = d.id, p = (i = d.filter) === null || i === void 0 ? void 0 : i.event;
7371
+ return f && ((a = r.ids) === null || a === void 0 ? void 0 : a.includes(f)) && (p === "*" || (p == null ? void 0 : p.toLocaleLowerCase()) === ((o = r.data) === null || o === void 0 ? void 0 : o.type.toLocaleLowerCase()));
7338
7372
  } else {
7339
7373
  const f = (c = (l = d == null ? void 0 : d.filter) === null || l === void 0 ? void 0 : l.event) === null || c === void 0 ? void 0 : c.toLocaleLowerCase();
7340
7374
  return f === "*" || f === ((u = r == null ? void 0 : r.event) === null || u === void 0 ? void 0 : u.toLocaleLowerCase());
@@ -7971,26 +8005,26 @@ Option 2: Install and provide the "ws" package:
7971
8005
  _initializeOptions(e) {
7972
8006
  var r, s, n, i, a, o, l, c, u, h, d, f;
7973
8007
  this.worker = (r = e == null ? void 0 : e.worker) !== null && r !== void 0 ? r : !1, this.accessToken = (s = e == null ? void 0 : e.accessToken) !== null && s !== void 0 ? s : null;
7974
- const g = {};
7975
- g.timeout = (n = e == null ? void 0 : e.timeout) !== null && n !== void 0 ? n : Ur, g.heartbeatIntervalMs = (i = e == null ? void 0 : e.heartbeatIntervalMs) !== null && i !== void 0 ? i : Et.HEARTBEAT_INTERVAL, this._disconnectOnEmptyChannelsAfterMs = (a = e == null ? void 0 : e.disconnectOnEmptyChannelsAfterMs) !== null && a !== void 0 ? a : 2 * ((o = e == null ? void 0 : e.heartbeatIntervalMs) !== null && o !== void 0 ? o : Et.HEARTBEAT_INTERVAL), g.transport = (l = e == null ? void 0 : e.transport) !== null && l !== void 0 ? l : jr.getWebSocketConstructor(), g.params = e == null ? void 0 : e.params, g.logger = e == null ? void 0 : e.logger, g.heartbeatCallback = this._wrapHeartbeatCallback(e == null ? void 0 : e.heartbeatCallback), g.sessionStorage = (c = e == null ? void 0 : e.sessionStorage) !== null && c !== void 0 ? c : us(), g.reconnectAfterMs = (u = e == null ? void 0 : e.reconnectAfterMs) !== null && u !== void 0 ? u : (b) => os[b - 1] || ls;
7976
- let p, _;
8008
+ const p = {};
8009
+ p.timeout = (n = e == null ? void 0 : e.timeout) !== null && n !== void 0 ? n : Ur, p.heartbeatIntervalMs = (i = e == null ? void 0 : e.heartbeatIntervalMs) !== null && i !== void 0 ? i : Et.HEARTBEAT_INTERVAL, this._disconnectOnEmptyChannelsAfterMs = (a = e == null ? void 0 : e.disconnectOnEmptyChannelsAfterMs) !== null && a !== void 0 ? a : 2 * ((o = e == null ? void 0 : e.heartbeatIntervalMs) !== null && o !== void 0 ? o : Et.HEARTBEAT_INTERVAL), p.transport = (l = e == null ? void 0 : e.transport) !== null && l !== void 0 ? l : jr.getWebSocketConstructor(), p.params = e == null ? void 0 : e.params, p.logger = e == null ? void 0 : e.logger, p.heartbeatCallback = this._wrapHeartbeatCallback(e == null ? void 0 : e.heartbeatCallback), p.sessionStorage = (c = e == null ? void 0 : e.sessionStorage) !== null && c !== void 0 ? c : us(), p.reconnectAfterMs = (u = e == null ? void 0 : e.reconnectAfterMs) !== null && u !== void 0 ? u : (b) => os[b - 1] || ls;
8010
+ let g, _;
7977
8011
  const w = (h = e == null ? void 0 : e.vsn) !== null && h !== void 0 ? h : Nr;
7978
8012
  switch (w) {
7979
8013
  case xr:
7980
- p = (b, v) => v(JSON.stringify(b)), _ = (b, v) => v(JSON.parse(b));
8014
+ g = (b, v) => v(JSON.stringify(b)), _ = (b, v) => v(JSON.parse(b));
7981
8015
  break;
7982
8016
  case Xt:
7983
- p = this.serializer.encode.bind(this.serializer), _ = this.serializer.decode.bind(this.serializer);
8017
+ g = this.serializer.encode.bind(this.serializer), _ = this.serializer.decode.bind(this.serializer);
7984
8018
  break;
7985
8019
  default:
7986
- throw new Error(`Unsupported serializer version: ${g.vsn}`);
8020
+ throw new Error(`Unsupported serializer version: ${p.vsn}`);
7987
8021
  }
7988
- if (g.vsn = w, g.encode = (d = e == null ? void 0 : e.encode) !== null && d !== void 0 ? d : p, g.decode = (f = e == null ? void 0 : e.decode) !== null && f !== void 0 ? f : _, g.beforeReconnect = this._reconnectAuth.bind(this), (e != null && e.logLevel || e != null && e.log_level) && (this.logLevel = e.logLevel || e.log_level, g.params = Object.assign(Object.assign({}, g.params), { log_level: this.logLevel })), this.worker) {
8022
+ if (p.vsn = w, p.encode = (d = e == null ? void 0 : e.encode) !== null && d !== void 0 ? d : g, p.decode = (f = e == null ? void 0 : e.decode) !== null && f !== void 0 ? f : _, p.beforeReconnect = this._reconnectAuth.bind(this), (e != null && e.logLevel || e != null && e.log_level) && (this.logLevel = e.logLevel || e.log_level, p.params = Object.assign(Object.assign({}, p.params), { log_level: this.logLevel })), this.worker) {
7989
8023
  if (typeof window < "u" && !window.Worker)
7990
8024
  throw new Error("Web Worker is not supported");
7991
- this.workerUrl = e == null ? void 0 : e.workerUrl, g.autoSendHeartbeat = !this.worker;
8025
+ this.workerUrl = e == null ? void 0 : e.workerUrl, p.autoSendHeartbeat = !this.worker;
7992
8026
  }
7993
- return g;
8027
+ return p;
7994
8028
  }
7995
8029
  /** @internal */
7996
8030
  async _reconnectAuth() {
@@ -8028,10 +8062,10 @@ function fs(t, e, r) {
8028
8062
  i !== void 0 && s.searchParams.set(n, i);
8029
8063
  return s.toString();
8030
8064
  }
8031
- async function gs(t) {
8065
+ async function ps(t) {
8032
8066
  return !t || t.type === "none" ? {} : t.type === "bearer" ? { Authorization: `Bearer ${t.token}` } : t.type === "header" ? { [t.name]: t.value } : t.type === "custom" ? await t.getHeaders() : {};
8033
8067
  }
8034
- function ps(t) {
8068
+ function gs(t) {
8035
8069
  const e = t.fetchImpl ?? globalThis.fetch;
8036
8070
  return {
8037
8071
  async request({
@@ -8041,7 +8075,7 @@ function ps(t) {
8041
8075
  body: i,
8042
8076
  headers: a
8043
8077
  }) {
8044
- const o = fs(t.baseUrl, s, n), l = await gs(t.auth), c = await e(o, {
8078
+ const o = fs(t.baseUrl, s, n), l = await ps(t.auth), c = await e(o, {
8045
8079
  method: r,
8046
8080
  headers: {
8047
8081
  ...i ? { "Content-Type": "application/json" } : {},
@@ -8051,13 +8085,13 @@ function ps(t) {
8051
8085
  body: i ? JSON.stringify(i) : void 0
8052
8086
  }), u = await c.text(), h = (c.headers.get("content-type") || "").includes("application/json"), d = h && u ? JSON.parse(u) : u;
8053
8087
  if (!c.ok) {
8054
- const f = h ? d : void 0, g = f == null ? void 0 : f.error;
8088
+ const f = h ? d : void 0, p = f == null ? void 0 : f.error;
8055
8089
  throw new we(
8056
- (g == null ? void 0 : g.message) ?? `Request failed with status ${c.status}`,
8090
+ (p == null ? void 0 : p.message) ?? `Request failed with status ${c.status}`,
8057
8091
  {
8058
8092
  status: c.status,
8059
- icebergType: g == null ? void 0 : g.type,
8060
- icebergCode: g == null ? void 0 : g.code,
8093
+ icebergType: p == null ? void 0 : p.type,
8094
+ icebergCode: p == null ? void 0 : p.code,
8061
8095
  details: f
8062
8096
  }
8063
8097
  );
@@ -8211,7 +8245,7 @@ var vs = class {
8211
8245
  let e = "v1";
8212
8246
  t.catalogName && (e += `/${t.catalogName}`);
8213
8247
  const r = t.baseUrl.endsWith("/") ? t.baseUrl : `${t.baseUrl}/`;
8214
- this.client = ps({
8248
+ this.client = gs({
8215
8249
  baseUrl: r,
8216
8250
  auth: t.auth,
8217
8251
  fetchImpl: t.fetch
@@ -11046,7 +11080,7 @@ class Zs extends F {
11046
11080
  super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.", "AuthPKCECodeVerifierMissingError", 400, "pkce_code_verifier_not_found");
11047
11081
  }
11048
11082
  }
11049
- function _i(t) {
11083
+ function wi(t) {
11050
11084
  return y(t) && t.name === "AuthPKCECodeVerifierMissingError";
11051
11085
  }
11052
11086
  class ct extends F {
@@ -11073,7 +11107,7 @@ class jt extends F {
11073
11107
  return Object.assign(Object.assign({}, super.toJSON()), { reasons: this.reasons });
11074
11108
  }
11075
11109
  }
11076
- function bi(t) {
11110
+ function _i(t) {
11077
11111
  return y(t) && t.name === "AuthWeakPasswordError";
11078
11112
  }
11079
11113
  class De extends F {
@@ -11306,7 +11340,7 @@ function dn(t, e) {
11306
11340
  function fn(t) {
11307
11341
  return ("0" + t.toString(16)).substr(-2);
11308
11342
  }
11309
- function gn() {
11343
+ function pn() {
11310
11344
  const e = new Uint32Array(56);
11311
11345
  if (typeof crypto > "u") {
11312
11346
  const r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~", s = r.length;
@@ -11317,18 +11351,18 @@ function gn() {
11317
11351
  }
11318
11352
  return crypto.getRandomValues(e), Array.from(e, fn).join("");
11319
11353
  }
11320
- async function pn(t) {
11354
+ async function gn(t) {
11321
11355
  const r = new TextEncoder().encode(t), s = await crypto.subtle.digest("SHA-256", r), n = new Uint8Array(s);
11322
11356
  return Array.from(n).map((i) => String.fromCharCode(i)).join("");
11323
11357
  }
11324
11358
  async function yn(t) {
11325
11359
  if (!(typeof crypto < "u" && typeof crypto.subtle < "u" && typeof TextEncoder < "u"))
11326
11360
  return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."), t;
11327
- const r = await pn(t);
11361
+ const r = await gn(t);
11328
11362
  return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
11329
11363
  }
11330
11364
  async function Q(t, e, r = !1) {
11331
- const s = gn();
11365
+ const s = pn();
11332
11366
  let n = s;
11333
11367
  r && (n += "/recovery"), await oe(t, `${e}-code-verifier`, n);
11334
11368
  const i = await yn(s);
@@ -11960,9 +11994,9 @@ class hr {
11960
11994
  if (u.error)
11961
11995
  throw u.error;
11962
11996
  const h = await u.json(), d = (a = u.headers.get("x-total-count")) !== null && a !== void 0 ? a : 0, f = (l = (o = u.headers.get("link")) === null || o === void 0 ? void 0 : o.split(",")) !== null && l !== void 0 ? l : [];
11963
- return f.length > 0 && (f.forEach((g) => {
11964
- const p = parseInt(g.split(";")[0].split("=")[1].substring(0, 1)), _ = JSON.parse(g.split(";")[1].split("=")[1]);
11965
- c[`${_}Page`] = p;
11997
+ return f.length > 0 && (f.forEach((p) => {
11998
+ const g = parseInt(p.split(";")[0].split("=")[1].substring(0, 1)), _ = JSON.parse(p.split(";")[1].split("=")[1]);
11999
+ c[`${_}Page`] = g;
11966
12000
  }), c.total = parseInt(d)), { data: Object.assign(Object.assign({}, h), c), error: null };
11967
12001
  } catch (c) {
11968
12002
  if (y(c))
@@ -12298,9 +12332,9 @@ class hr {
12298
12332
  if (u.error)
12299
12333
  throw u.error;
12300
12334
  const h = await u.json(), d = (a = u.headers.get("x-total-count")) !== null && a !== void 0 ? a : 0, f = (l = (o = u.headers.get("link")) === null || o === void 0 ? void 0 : o.split(",")) !== null && l !== void 0 ? l : [];
12301
- return f.length > 0 && (f.forEach((g) => {
12302
- const p = parseInt(g.split(";")[0].split("=")[1].substring(0, 1)), _ = JSON.parse(g.split(";")[1].split("=")[1]);
12303
- c[`${_}Page`] = p;
12335
+ return f.length > 0 && (f.forEach((p) => {
12336
+ const g = parseInt(p.split(";")[0].split("=")[1].substring(0, 1)), _ = JSON.parse(p.split(";")[1].split("=")[1]);
12337
+ c[`${_}Page`] = g;
12304
12338
  }), c.total = parseInt(d)), { data: Object.assign(Object.assign({}, h), c), error: null };
12305
12339
  } catch (c) {
12306
12340
  if (y(c))
@@ -12564,7 +12598,7 @@ class qt extends Se {
12564
12598
  }
12565
12599
  class Cn extends Se {
12566
12600
  }
12567
- async function ki(t, e, r) {
12601
+ async function bi(t, e, r) {
12568
12602
  q.debug && console.log("@supabase/gotrue-js: navigatorLock: acquire lock", t, e);
12569
12603
  const s = new globalThis.AbortController();
12570
12604
  let n;
@@ -12622,7 +12656,7 @@ async function ki(t, e, r) {
12622
12656
  }
12623
12657
  }
12624
12658
  const Ht = {};
12625
- async function Si(t, e, r) {
12659
+ async function ki(t, e, r) {
12626
12660
  var s;
12627
12661
  const n = (s = Ht[t]) !== null && s !== void 0 ? s : Promise.resolve(), i = (async () => {
12628
12662
  try {
@@ -12703,11 +12737,11 @@ function $n(t) {
12703
12737
  `))
12704
12738
  throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`);
12705
12739
  }
12706
- const f = dr(t.address), g = u ? `${u}://${s}` : s, p = t.statement ? `${t.statement}
12707
- ` : "", _ = `${g} wants you to sign in with your Ethereum account:
12740
+ const f = dr(t.address), p = u ? `${u}://${s}` : s, g = t.statement ? `${t.statement}
12741
+ ` : "", _ = `${p} wants you to sign in with your Ethereum account:
12708
12742
  ${f}
12709
12743
 
12710
- ${p}`;
12744
+ ${g}`;
12711
12745
  let w = `URI: ${h}
12712
12746
  Version: ${d}
12713
12747
  Chain ID: ${r}${a ? `
@@ -13019,7 +13053,7 @@ function He() {
13019
13053
  var t, e;
13020
13054
  return !!(j() && "PublicKeyCredential" in window && window.PublicKeyCredential && "credentials" in navigator && typeof ((t = navigator == null ? void 0 : navigator.credentials) === null || t === void 0 ? void 0 : t.create) == "function" && typeof ((e = navigator == null ? void 0 : navigator.credentials) === null || e === void 0 ? void 0 : e.get) == "function");
13021
13055
  }
13022
- async function gr(t) {
13056
+ async function pr(t) {
13023
13057
  try {
13024
13058
  const e = await navigator.credentials.create(
13025
13059
  /** we assert the type here until typescript types are updated */
@@ -13042,7 +13076,7 @@ async function gr(t) {
13042
13076
  };
13043
13077
  }
13044
13078
  }
13045
- async function pr(t) {
13079
+ async function gr(t) {
13046
13080
  try {
13047
13081
  const e = await navigator.credentials.get(
13048
13082
  /** we assert the type here until typescript types are updated */
@@ -13153,15 +13187,15 @@ class Hn {
13153
13187
  if (h)
13154
13188
  u.name = `${u.id}:${h}`;
13155
13189
  else {
13156
- const f = (await this.client.getUser()).data.user, g = ((a = f == null ? void 0 : f.user_metadata) === null || a === void 0 ? void 0 : a.name) || (f == null ? void 0 : f.email) || (f == null ? void 0 : f.id) || "User";
13157
- u.name = `${u.id}:${g}`;
13190
+ const f = (await this.client.getUser()).data.user, p = ((a = f == null ? void 0 : f.user_metadata) === null || a === void 0 ? void 0 : a.name) || (f == null ? void 0 : f.email) || (f == null ? void 0 : f.id) || "User";
13191
+ u.name = `${u.id}:${p}`;
13158
13192
  }
13159
13193
  }
13160
13194
  u.displayName || (u.displayName = u.name);
13161
13195
  }
13162
13196
  switch (o.webauthn.type) {
13163
13197
  case "create": {
13164
- const u = Bn(o.webauthn.credential_options.publicKey, i == null ? void 0 : i.create), { data: h, error: d } = await gr({
13198
+ const u = Bn(o.webauthn.credential_options.publicKey, i == null ? void 0 : i.create), { data: h, error: d } = await pr({
13165
13199
  publicKey: u,
13166
13200
  signal: c
13167
13201
  });
@@ -13178,7 +13212,7 @@ class Hn {
13178
13212
  } : { data: null, error: d };
13179
13213
  }
13180
13214
  case "request": {
13181
- const u = qn(o.webauthn.credential_options.publicKey, i == null ? void 0 : i.request), { data: h, error: d } = await pr(Object.assign(Object.assign({}, o.webauthn.credential_options), { publicKey: u, signal: c }));
13215
+ const u = qn(o.webauthn.credential_options.publicKey, i == null ? void 0 : i.request), { data: h, error: d } = await gr(Object.assign(Object.assign({}, o.webauthn.credential_options), { publicKey: u, signal: c }));
13182
13216
  return h ? {
13183
13217
  data: {
13184
13218
  factorId: e,
@@ -13798,8 +13832,8 @@ class Ee {
13798
13832
  let i;
13799
13833
  if ("email" in e) {
13800
13834
  const { email: u, password: h, options: d } = e;
13801
- let f = null, g = null;
13802
- this.flowType === "pkce" && ([f, g] = await Q(this.storage, this.storageKey)), i = await m(this.fetch, "POST", `${this.url}/signup`, {
13835
+ let f = null, p = null;
13836
+ this.flowType === "pkce" && ([f, p] = await Q(this.storage, this.storageKey)), i = await m(this.fetch, "POST", `${this.url}/signup`, {
13803
13837
  headers: this.headers,
13804
13838
  redirectTo: d == null ? void 0 : d.emailRedirectTo,
13805
13839
  body: {
@@ -13808,7 +13842,7 @@ class Ee {
13808
13842
  data: (r = d == null ? void 0 : d.data) !== null && r !== void 0 ? r : {},
13809
13843
  gotrue_meta_security: { captcha_token: d == null ? void 0 : d.captchaToken },
13810
13844
  code_challenge: f,
13811
- code_challenge_method: g
13845
+ code_challenge_method: p
13812
13846
  },
13813
13847
  xform: N
13814
13848
  });
@@ -14376,11 +14410,11 @@ class Ee {
14376
14410
  }
14377
14411
  async signInWithEthereum(e) {
14378
14412
  var r, s, n, i, a, o, l, c, u, h, d;
14379
- let f, g;
14413
+ let f, p;
14380
14414
  if ("message" in e)
14381
- f = e.message, g = e.signature;
14415
+ f = e.message, p = e.signature;
14382
14416
  else {
14383
- const { chain: p, wallet: _, statement: w, options: b } = e;
14417
+ const { chain: g, wallet: _, statement: w, options: b } = e;
14384
14418
  let v;
14385
14419
  if (j())
14386
14420
  if (typeof _ == "object")
@@ -14426,39 +14460,39 @@ class Ee {
14426
14460
  requestId: (c = b == null ? void 0 : b.signInWithEthereum) === null || c === void 0 ? void 0 : c.requestId,
14427
14461
  resources: (u = b == null ? void 0 : b.signInWithEthereum) === null || u === void 0 ? void 0 : u.resources
14428
14462
  };
14429
- f = $n(vr), g = await v.request({
14463
+ f = $n(vr), p = await v.request({
14430
14464
  method: "personal_sign",
14431
14465
  params: [In(f), T]
14432
14466
  });
14433
14467
  }
14434
14468
  try {
14435
- const { data: p, error: _ } = await m(this.fetch, "POST", `${this.url}/token?grant_type=web3`, {
14469
+ const { data: g, error: _ } = await m(this.fetch, "POST", `${this.url}/token?grant_type=web3`, {
14436
14470
  headers: this.headers,
14437
14471
  body: Object.assign({
14438
14472
  chain: "ethereum",
14439
14473
  message: f,
14440
- signature: g
14474
+ signature: p
14441
14475
  }, !((h = e.options) === null || h === void 0) && h.captchaToken ? { gotrue_meta_security: { captcha_token: (d = e.options) === null || d === void 0 ? void 0 : d.captchaToken } } : null),
14442
14476
  xform: N
14443
14477
  });
14444
14478
  if (_)
14445
14479
  throw _;
14446
- if (!p || !p.session || !p.user) {
14480
+ if (!g || !g.session || !g.user) {
14447
14481
  const w = new se();
14448
14482
  return this._returnResult({ data: { user: null, session: null }, error: w });
14449
14483
  }
14450
- return p.session && (await this._saveSession(p.session), await this._notifyAllSubscribers("SIGNED_IN", p.session)), this._returnResult({ data: Object.assign({}, p), error: _ });
14451
- } catch (p) {
14452
- if (y(p))
14453
- return this._returnResult({ data: { user: null, session: null }, error: p });
14454
- throw p;
14484
+ return g.session && (await this._saveSession(g.session), await this._notifyAllSubscribers("SIGNED_IN", g.session)), this._returnResult({ data: Object.assign({}, g), error: _ });
14485
+ } catch (g) {
14486
+ if (y(g))
14487
+ return this._returnResult({ data: { user: null, session: null }, error: g });
14488
+ throw g;
14455
14489
  }
14456
14490
  }
14457
14491
  async signInWithSolana(e) {
14458
14492
  var r, s, n, i, a, o, l, c, u, h, d, f;
14459
- let g, p;
14493
+ let p, g;
14460
14494
  if ("message" in e)
14461
- g = e.message, p = e.signature;
14495
+ p = e.message, g = e.signature;
14462
14496
  else {
14463
14497
  const { chain: _, wallet: w, statement: b, options: v } = e;
14464
14498
  let S;
@@ -14493,13 +14527,13 @@ class Ee {
14493
14527
  else
14494
14528
  throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");
14495
14529
  if ("signedMessage" in P && "signature" in P && (typeof P.signedMessage == "string" || P.signedMessage instanceof Uint8Array) && P.signature instanceof Uint8Array)
14496
- g = typeof P.signedMessage == "string" ? P.signedMessage : new TextDecoder().decode(P.signedMessage), p = P.signature;
14530
+ p = typeof P.signedMessage == "string" ? P.signedMessage : new TextDecoder().decode(P.signedMessage), g = P.signature;
14497
14531
  else
14498
14532
  throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields");
14499
14533
  } else {
14500
14534
  if (!("signMessage" in S) || typeof S.signMessage != "function" || !("publicKey" in S) || typeof S != "object" || !S.publicKey || !("toBase58" in S.publicKey) || typeof S.publicKey.toBase58 != "function")
14501
14535
  throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");
14502
- g = [
14536
+ p = [
14503
14537
  `${$.host} wants you to sign in with your Solana account:`,
14504
14538
  S.publicKey.toBase58(),
14505
14539
  ...b ? ["", b, ""] : [""],
@@ -14517,16 +14551,16 @@ class Ee {
14517
14551
  ] : []
14518
14552
  ].join(`
14519
14553
  `);
14520
- const T = await S.signMessage(new TextEncoder().encode(g), "utf8");
14554
+ const T = await S.signMessage(new TextEncoder().encode(p), "utf8");
14521
14555
  if (!T || !(T instanceof Uint8Array))
14522
14556
  throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");
14523
- p = T;
14557
+ g = T;
14524
14558
  }
14525
14559
  }
14526
14560
  try {
14527
14561
  const { data: _, error: w } = await m(this.fetch, "POST", `${this.url}/token?grant_type=web3`, {
14528
14562
  headers: this.headers,
14529
- body: Object.assign({ chain: "solana", message: g, signature: ee(p) }, !((d = e.options) === null || d === void 0) && d.captchaToken ? { gotrue_meta_security: { captcha_token: (f = e.options) === null || f === void 0 ? void 0 : f.captchaToken } } : null),
14563
+ body: Object.assign({ chain: "solana", message: p, signature: ee(g) }, !((d = e.options) === null || d === void 0) && d.captchaToken ? { gotrue_meta_security: { captcha_token: (f = e.options) === null || f === void 0 ? void 0 : f.captchaToken } } : null),
14530
14564
  xform: N
14531
14565
  });
14532
14566
  if (w)
@@ -15954,10 +15988,10 @@ class Ee {
15954
15988
  const h = Math.round(Date.now() / 1e3), d = parseInt(l);
15955
15989
  let f = h + d;
15956
15990
  c && (f = parseInt(c));
15957
- const g = f - h;
15958
- g * 1e3 <= G && console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${g}s, should have been closer to ${d}s`);
15959
- const p = f - d;
15960
- h - p >= 120 ? console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale", p, f, h) : h - p < 0 && console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew", p, f, h);
15991
+ const p = f - h;
15992
+ p * 1e3 <= G && console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${d}s`);
15993
+ const g = f - d;
15994
+ h - g >= 120 ? console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale", g, f, h) : h - g < 0 && console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew", g, f, h);
15961
15995
  const { data: _, error: w } = await this._getUser(a);
15962
15996
  if (w)
15963
15997
  throw w;
@@ -17139,15 +17173,15 @@ class Ee {
17139
17173
  if (e)
17140
17174
  try {
17141
17175
  const { payload: f } = xe(e);
17142
- let g = null;
17143
- f.aal && (g = f.aal);
17144
- let p = g;
17176
+ let p = null;
17177
+ f.aal && (p = f.aal);
17178
+ let g = p;
17145
17179
  const { data: { user: _ }, error: w } = await this.getUser(e);
17146
17180
  if (w)
17147
17181
  return this._returnResult({ data: null, error: w });
17148
- ((s = (r = _ == null ? void 0 : _.factors) === null || r === void 0 ? void 0 : r.filter((S) => S.status === "verified")) !== null && s !== void 0 ? s : []).length > 0 && (p = "aal2");
17182
+ ((s = (r = _ == null ? void 0 : _.factors) === null || r === void 0 ? void 0 : r.filter((S) => S.status === "verified")) !== null && s !== void 0 ? s : []).length > 0 && (g = "aal2");
17149
17183
  const v = f.amr || [];
17150
- return { data: { currentLevel: g, nextLevel: p, currentAuthenticationMethods: v }, error: null };
17184
+ return { data: { currentLevel: p, nextLevel: g, currentAuthenticationMethods: v }, error: null };
17151
17185
  } catch (f) {
17152
17186
  if (y(f))
17153
17187
  return this._returnResult({ data: null, error: f });
@@ -17369,9 +17403,9 @@ class Ee {
17369
17403
  try {
17370
17404
  let s = e;
17371
17405
  if (!s) {
17372
- const { data: f, error: g } = await this.getSession();
17373
- if (g || !f.session)
17374
- return this._returnResult({ data: null, error: g });
17406
+ const { data: f, error: p } = await this.getSession();
17407
+ if (p || !f.session)
17408
+ return this._returnResult({ data: null, error: p });
17375
17409
  s = f.session.access_token;
17376
17410
  }
17377
17411
  const { header: n, payload: i, signature: a, raw: { header: o, payload: l } } = xe(s);
@@ -17439,7 +17473,7 @@ class Ee {
17439
17473
  });
17440
17474
  if (a || !i)
17441
17475
  return this._returnResult({ data: null, error: a });
17442
- const o = Ft(i.options), l = (n = (s = e == null ? void 0 : e.options) === null || s === void 0 ? void 0 : s.signal) !== null && n !== void 0 ? n : ut.createNewAbortSignal(), { data: c, error: u } = await pr({
17476
+ const o = Ft(i.options), l = (n = (s = e == null ? void 0 : e.options) === null || s === void 0 ? void 0 : s.signal) !== null && n !== void 0 ? n : ut.createNewAbortSignal(), { data: c, error: u } = await gr({
17443
17477
  publicKey: o,
17444
17478
  signal: l
17445
17479
  });
@@ -17481,7 +17515,7 @@ class Ee {
17481
17515
  const { data: n, error: i } = await this._startPasskeyRegistration();
17482
17516
  if (i || !n)
17483
17517
  return this._returnResult({ data: null, error: i });
17484
- const a = Mt(n.options), o = (s = (r = e == null ? void 0 : e.options) === null || r === void 0 ? void 0 : r.signal) !== null && s !== void 0 ? s : ut.createNewAbortSignal(), { data: l, error: c } = await gr({
17518
+ const a = Mt(n.options), o = (s = (r = e == null ? void 0 : e.options) === null || r === void 0 ? void 0 : r.signal) !== null && s !== void 0 ? s : ut.createNewAbortSignal(), { data: l, error: c } = await pr({
17485
17519
  publicKey: a,
17486
17520
  signal: o
17487
17521
  });
@@ -17676,18 +17710,18 @@ class Ee {
17676
17710
  }
17677
17711
  }
17678
17712
  Ee.nextInstanceID = {};
17679
- const Ei = hr, Fn = Ee, Wn = "2.108.2";
17680
- let ge = "", Fe;
17713
+ const Si = hr, Fn = Ee, Wn = "2.108.2";
17714
+ let pe = "", Fe;
17681
17715
  if (typeof Deno < "u") {
17682
17716
  var Xe;
17683
- ge = "deno", Fe = (Xe = Deno.version) === null || Xe === void 0 ? void 0 : Xe.deno;
17684
- } else if (typeof document < "u") ge = "web";
17685
- else if (typeof navigator < "u" && navigator.product === "ReactNative") ge = "react-native";
17717
+ pe = "deno", Fe = (Xe = Deno.version) === null || Xe === void 0 ? void 0 : Xe.deno;
17718
+ } else if (typeof document < "u") pe = "web";
17719
+ else if (typeof navigator < "u" && navigator.product === "ReactNative") pe = "react-native";
17686
17720
  else {
17687
17721
  var Qe;
17688
- ge = "node", Fe = typeof process < "u" ? (Qe = process.version) === null || Qe === void 0 ? void 0 : Qe.replace(/^v/, "") : void 0;
17722
+ pe = "node", Fe = typeof process < "u" ? (Qe = process.version) === null || Qe === void 0 ? void 0 : Qe.replace(/^v/, "") : void 0;
17689
17723
  }
17690
- const yr = [`runtime=${ge}`];
17724
+ const yr = [`runtime=${pe}`];
17691
17725
  Fe && yr.push(`runtime-version=${Fe}`);
17692
17726
  const Kn = { "X-Client-Info": `supabase-js/${Wn}; ${yr.join("; ")}` }, Vn = { headers: Kn }, Jn = { schema: "public" }, Gn = {
17693
17727
  autoRefreshToken: !0,
@@ -17863,12 +17897,12 @@ const li = (t) => t ? (...e) => t(...e) : (...e) => fetch(...e), ci = () => Head
17863
17897
  return async (u, h) => {
17864
17898
  var d;
17865
17899
  const f = (d = await r()) !== null && d !== void 0 ? d : t;
17866
- let g = new a(h == null ? void 0 : h.headers);
17867
- if (g.has("apikey") || g.set("apikey", t), g.has("Authorization") || g.set("Authorization", `Bearer ${f}`), c) {
17868
- const p = await hi(u, c, l);
17869
- p && (p.traceparent && !g.has("traceparent") && g.set("traceparent", p.traceparent), p.tracestate && !g.has("tracestate") && g.set("tracestate", p.tracestate), p.baggage && !g.has("baggage") && g.set("baggage", p.baggage));
17900
+ let p = new a(h == null ? void 0 : h.headers);
17901
+ if (p.has("apikey") || p.set("apikey", t), p.has("Authorization") || p.set("Authorization", `Bearer ${f}`), c) {
17902
+ const g = await hi(u, c, l);
17903
+ g && (g.traceparent && !p.has("traceparent") && p.set("traceparent", g.traceparent), g.tracestate && !p.has("tracestate") && p.set("tracestate", g.tracestate), g.baggage && !p.has("baggage") && p.set("baggage", g.baggage));
17870
17904
  }
17871
- return i(u, A(A({}, h), {}, { headers: g }));
17905
+ return i(u, A(A({}, h), {}, { headers: p }));
17872
17906
  };
17873
17907
  };
17874
17908
  async function hi(t, e, r) {
@@ -17889,12 +17923,12 @@ function di(t) {
17889
17923
  }
17890
17924
  function fi(t, e) {
17891
17925
  var r, s, n, i, a, o;
17892
- const { db: l, auth: c, realtime: u, global: h } = t, { db: d, auth: f, realtime: g, global: p } = e, _ = Jt(t.tracePropagation), w = Jt(e.tracePropagation), b = {
17926
+ const { db: l, auth: c, realtime: u, global: h } = t, { db: d, auth: f, realtime: p, global: g } = e, _ = Jt(t.tracePropagation), w = Jt(e.tracePropagation), b = {
17893
17927
  db: A(A({}, d), l),
17894
17928
  auth: A(A({}, f), c),
17895
- realtime: A(A({}, g), u),
17929
+ realtime: A(A({}, p), u),
17896
17930
  storage: {},
17897
- global: A(A(A({}, p), h), {}, { headers: A(A({}, (r = p == null ? void 0 : p.headers) !== null && r !== void 0 ? r : {}), (s = h == null ? void 0 : h.headers) !== null && s !== void 0 ? s : {}) }),
17931
+ global: A(A(A({}, g), h), {}, { headers: A(A({}, (r = g == null ? void 0 : g.headers) !== null && r !== void 0 ? r : {}), (s = h == null ? void 0 : h.headers) !== null && s !== void 0 ? s : {}) }),
17898
17932
  tracePropagation: {
17899
17933
  enabled: (n = (i = _ == null ? void 0 : _.enabled) !== null && i !== void 0 ? i : w == null ? void 0 : w.enabled) !== null && n !== void 0 ? n : !1,
17900
17934
  respectSamplingDecision: (a = (o = _ == null ? void 0 : _.respectSamplingDecision) !== null && o !== void 0 ? o : w == null ? void 0 : w.respectSamplingDecision) !== null && a !== void 0 ? a : !0
@@ -17903,7 +17937,7 @@ function fi(t, e) {
17903
17937
  };
17904
17938
  return t.accessToken ? b.accessToken = t.accessToken : delete b.accessToken, b;
17905
17939
  }
17906
- function gi(t) {
17940
+ function pi(t) {
17907
17941
  const e = t == null ? void 0 : t.trim();
17908
17942
  if (!e) throw new Error("supabaseUrl is required.");
17909
17943
  if (!e.match(/^https?:\/\//i)) throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");
@@ -17913,7 +17947,7 @@ function gi(t) {
17913
17947
  throw Error("Invalid supabaseUrl: Provided URL is malformed.");
17914
17948
  }
17915
17949
  }
17916
- var pi = class extends Fn {
17950
+ var gi = class extends Fn {
17917
17951
  constructor(t) {
17918
17952
  super(t);
17919
17953
  }
@@ -18132,7 +18166,7 @@ var pi = class extends Fn {
18132
18166
  constructor(t, e, r) {
18133
18167
  var s, n;
18134
18168
  this.supabaseUrl = t, this.supabaseKey = e;
18135
- const i = gi(t);
18169
+ const i = pi(t);
18136
18170
  if (!e) throw new Error("supabaseKey is required.");
18137
18171
  this.realtimeUrl = new URL("realtime/v1", i), this.realtimeUrl.protocol = this.realtimeUrl.protocol.replace("http", "ws"), this.authUrl = new URL("auth/v1", i), this.storageUrl = new URL("storage/v1", i), this.functionsUrl = new URL("functions/v1", i);
18138
18172
  const a = `sb-${i.hostname.split(".")[0]}-auth-token`, o = {
@@ -18284,14 +18318,14 @@ var pi = class extends Fn {
18284
18318
  const { data: s } = await t.auth.getSession();
18285
18319
  return (e = (r = s.session) === null || r === void 0 ? void 0 : r.access_token) !== null && e !== void 0 ? e : t.supabaseKey;
18286
18320
  }
18287
- _initSupabaseAuthClient({ autoRefreshToken: t, persistSession: e, detectSessionInUrl: r, storage: s, userStorage: n, storageKey: i, flowType: a, lock: o, debug: l, throwOnError: c, experimental: u, lockAcquireTimeout: h, skipAutoInitialize: d }, f, g) {
18288
- const p = {
18321
+ _initSupabaseAuthClient({ autoRefreshToken: t, persistSession: e, detectSessionInUrl: r, storage: s, userStorage: n, storageKey: i, flowType: a, lock: o, debug: l, throwOnError: c, experimental: u, lockAcquireTimeout: h, skipAutoInitialize: d }, f, p) {
18322
+ const g = {
18289
18323
  Authorization: `Bearer ${this.supabaseKey}`,
18290
18324
  apikey: `${this.supabaseKey}`
18291
18325
  };
18292
- return new pi({
18326
+ return new gi({
18293
18327
  url: this.authUrl.href,
18294
- headers: A(A({}, p), f),
18328
+ headers: A(A({}, g), f),
18295
18329
  storageKey: i,
18296
18330
  autoRefreshToken: t,
18297
18331
  persistSession: e,
@@ -18303,7 +18337,7 @@ var pi = class extends Fn {
18303
18337
  debug: l,
18304
18338
  throwOnError: c,
18305
18339
  experimental: u,
18306
- fetch: g,
18340
+ fetch: p,
18307
18341
  lockAcquireTimeout: h,
18308
18342
  skipAutoInitialize: d,
18309
18343
  hasCustomAuthorizationHeader: Object.keys(this.headers).some((_) => _.toLowerCase() === "authorization")
@@ -18321,7 +18355,7 @@ var pi = class extends Fn {
18321
18355
  (t === "TOKEN_REFRESHED" || t === "SIGNED_IN") && this.changedAccessToken !== r ? (this.changedAccessToken = r, this.realtime.setAuth(r)) : t === "SIGNED_OUT" && (this.realtime.setAuth(), e == "STORAGE" && this.auth.signOut(), this.changedAccessToken = void 0);
18322
18356
  }
18323
18357
  };
18324
- const Ti = (t, e, r) => new yi(t, e, r);
18358
+ const Ei = (t, e, r) => new yi(t, e, r);
18325
18359
  function vi() {
18326
18360
  if (typeof window < "u") return !1;
18327
18361
  const t = globalThis.process;
@@ -18333,7 +18367,7 @@ function vi() {
18333
18367
  }
18334
18368
  vi() && console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");
18335
18369
  export {
18336
- Ei as AuthAdminApi,
18370
+ Si as AuthAdminApi,
18337
18371
  Ys as AuthApiError,
18338
18372
  Fn as AuthClient,
18339
18373
  ke as AuthError,
@@ -18352,13 +18386,13 @@ export {
18352
18386
  et as FunctionRegion,
18353
18387
  ht as FunctionsError,
18354
18388
  _r as FunctionsFetchError,
18355
- gt as FunctionsHttpError,
18389
+ pt as FunctionsHttpError,
18356
18390
  ft as FunctionsRelayError,
18357
18391
  hr as GoTrueAdminApi,
18358
18392
  Ee as GoTrueClient,
18359
18393
  qt as NavigatorLockAcquireTimeoutError,
18360
18394
  yt as PostgrestError,
18361
- wi as REALTIME_CHANNEL_STATES,
18395
+ mi as REALTIME_CHANNEL_STATES,
18362
18396
  le as REALTIME_LISTEN_TYPES,
18363
18397
  St as REALTIME_POSTGRES_CHANGES_LISTEN_EVENT,
18364
18398
  kt as REALTIME_PRESENCE_LISTEN_EVENTS,
@@ -18370,17 +18404,17 @@ export {
18370
18404
  it as StorageApiError,
18371
18405
  yi as SupabaseClient,
18372
18406
  jr as WebSocketFactory,
18373
- Ti as createClient,
18407
+ Ei as createClient,
18374
18408
  Xs as isAuthApiError,
18375
18409
  y as isAuthError,
18376
18410
  Qs as isAuthImplicitGrantRedirectError,
18377
- _i as isAuthPKCECodeVerifierMissingError,
18411
+ wi as isAuthPKCECodeVerifierMissingError,
18378
18412
  en as isAuthRefreshDiscardedError,
18379
18413
  Ct as isAuthRetryableFetchError,
18380
18414
  je as isAuthSessionMissingError,
18381
- bi as isAuthWeakPasswordError,
18415
+ _i as isAuthWeakPasswordError,
18382
18416
  q as lockInternals,
18383
- ki as navigatorLock,
18384
- Si as processLock
18417
+ bi as navigatorLock,
18418
+ ki as processLock
18385
18419
  };
18386
- //# sourceMappingURL=index-D6dCjvzy.mjs.map
18420
+ //# sourceMappingURL=index-BcqBbswO.mjs.map