@backmatter/studio 0.0.5 → 0.0.7

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.
Files changed (48) hide show
  1. package/dist/chunks/{EmbedPublishPage-hx1xoAhI.js → EmbedPublishPage-88VsmOhi.js} +13 -13
  2. package/dist/chunks/{UiKitPage-BOunq6mr.js → UiKitPage-X4hkFL2d.js} +9 -9
  3. package/dist/chunks/{WorkspaceRoutes-CTFTWu3L.js → WorkspaceRoutes-DXzdWqN3.js} +20334 -18542
  4. package/dist/chunks/{dashboard-upmiawx5.js → dashboard-DCHRI0WD.js} +422 -400
  5. package/dist/chunks/{index-CBvevwfT.js → index-BS0-Bvbk.js} +2 -2
  6. package/dist/chunks/{status-bar-action-DiXhfcj3.js → status-bar-action-wj1KZ51m.js} +6925 -6567
  7. package/dist/dashboard.js +2 -2
  8. package/dist/index.js +18 -18
  9. package/dist/site-widget.js +788 -234
  10. package/dist/studio.css +454 -66
  11. package/package.json +3 -2
  12. package/src/App.tsx +2 -0
  13. package/src/WorkspaceRoutes.tsx +4 -0
  14. package/src/api.ts +104 -0
  15. package/src/chat/ChatMessage.tsx +10 -3
  16. package/src/chat/ChatPanel.tsx +1 -1
  17. package/src/chat/Composer.tsx +18 -18
  18. package/src/chat/chat-helpers.ts +58 -1
  19. package/src/chrome/AppSidebar.tsx +31 -156
  20. package/src/chrome/CommandPalette.tsx +211 -74
  21. package/src/chrome/ContentExplorerSidebar.tsx +1174 -0
  22. package/src/chrome/UserMenu.tsx +18 -3
  23. package/src/chrome/WorkspaceNavContext.tsx +1 -0
  24. package/src/chrome/command-palette-icons.tsx +152 -0
  25. package/src/chrome/content-path-tree.ts +95 -0
  26. package/src/chrome/content-repo-path.ts +52 -0
  27. package/src/chrome/explorer-icons.tsx +89 -0
  28. package/src/chrome/folder-create-context.ts +147 -0
  29. package/src/chrome/icons.tsx +13 -0
  30. package/src/pages/BlockSettingsDialog.tsx +4 -0
  31. package/src/pages/CliAuthorizePage.tsx +43 -0
  32. package/src/pages/DocEditorPage.tsx +33 -4
  33. package/src/pages/MediaFieldInput.tsx +139 -0
  34. package/src/pages/MediaGalleryPage.tsx +752 -0
  35. package/src/pages/MediaLightbox.tsx +460 -0
  36. package/src/pages/SettingsLayout.tsx +7 -1
  37. package/src/pages/SettingsUsagePage.tsx +187 -0
  38. package/src/pages/TypeDocsPage.tsx +2 -210
  39. package/src/pages/WorkspaceLayout.tsx +6 -1
  40. package/src/pages/media-grid.ts +190 -0
  41. package/src/pages/preview-url.ts +13 -2
  42. package/src/preview-frame.tsx +78 -0
  43. package/src/replica/useReplica.ts +9 -0
  44. package/src/site-bar.tsx +769 -0
  45. package/src/site-widget.tsx +33 -162
  46. package/src/ui/ConfirmDialog.tsx +1 -1
  47. package/src/workspace/permissions.ts +9 -0
  48. package/src/workspace-path.ts +13 -0
@@ -1,19 +1,19 @@
1
1
  var Qe = Object.defineProperty;
2
2
  var Ze = (e, t, n) => t in e ? Qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var D = (e, t, n) => Ze(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { jsxs as E, jsx as a, Fragment as be } from "react/jsx-runtime";
5
- import { useRef as et, useCallback as tt, useSyncExternalStore as nt, useState as R, useEffect as V, Suspense as we, lazy as rt } from "react";
6
- import { M as st, O as Ce, Q as it, p as ot, U as at, N as Ie, V as lt, A as qe, W as ct, X as Fe, B as ye, Y as ut, Z as dt, K as ve, n as ft, _ as ht, F as pt, $ as Be, J as gt, a0 as mt, R as xt, L as q } from "./status-bar-action-DiXhfcj3.js";
7
- import { T as O, G as yt, j as ze, k as Me, l as De, m as vt, n as bt, o as oe, c as J, B as wt, S as se, F as Z, I as ee, r as B, p as te, P as St, M as kt, q as Rt, t as Et, v as _t, f as Ot, x as Tt, y as Pt, g as Lt, R as Ut, h as Nt, i as jt, L as At, w as Ct } from "./WorkspaceRoutes-CTFTWu3L.js";
8
- const ne = /* @__PURE__ */ Object.create(null), W = (e) => {
4
+ import { jsxs as _, jsx as a, Fragment as we } from "react/jsx-runtime";
5
+ import { useRef as et, useCallback as tt, useSyncExternalStore as nt, useState as w, useEffect as K, lazy as rt, Suspense as Se } from "react";
6
+ import { Y as st, Z as ve, _ as it, $ as ot, p as at, a0 as lt, X as Ie, a1 as ct, j as qe, a2 as ut, a3 as ze, B as oe, a4 as dt, a5 as ft, U as be, a6 as ht, f as pt, u as gt, a7 as Be, M as mt, R as xt, a8 as yt, V as vt, W as q } from "./status-bar-action-wj1KZ51m.js";
7
+ import { T as S, j as Fe, k as Me, l as De, m as bt, n as wt, o as ae, c as V, B as St, S as J, F as ee, I as te, r as B, p as ne, P as kt, M as Et, q as Rt, t as _t, v as Ot, f as Tt, x as Pt, y as Lt, g as Ut, R as At, h as jt, i as Nt, L as Ct, w as It } from "./WorkspaceRoutes-DXzdWqN3.js";
8
+ const re = /* @__PURE__ */ Object.create(null), W = (e) => {
9
9
  var t, n;
10
- return ((t = globalThis.process) == null ? void 0 : t.env) || ((n = globalThis.Deno) == null ? void 0 : n.env.toObject()) || globalThis.__env__ || (e ? ne : globalThis);
11
- }, F = new Proxy(ne, {
10
+ return ((t = globalThis.process) == null ? void 0 : t.env) || ((n = globalThis.Deno) == null ? void 0 : n.env.toObject()) || globalThis.__env__ || (e ? re : globalThis);
11
+ }, z = new Proxy(re, {
12
12
  get(e, t) {
13
- return W()[t] ?? ne[t];
13
+ return W()[t] ?? re[t];
14
14
  },
15
15
  has(e, t) {
16
- return t in W() || t in ne;
16
+ return t in W() || t in re;
17
17
  },
18
18
  set(e, t, n) {
19
19
  const r = W(!0);
@@ -29,52 +29,52 @@ const ne = /* @__PURE__ */ Object.create(null), W = (e) => {
29
29
  return Object.keys(e);
30
30
  }
31
31
  });
32
- F.NODE_ENV;
33
- var re = class extends Error {
32
+ z.NODE_ENV;
33
+ var se = class extends Error {
34
34
  constructor(e, t) {
35
35
  super(e, t), this.name = "BetterAuthError", this.message = e, this.stack = "";
36
36
  }
37
37
  };
38
- const It = 47;
38
+ const qt = 47;
39
39
  function He(e) {
40
40
  let t = e.length;
41
- for (; t > 0 && e.charCodeAt(t - 1) === It; ) t--;
41
+ for (; t > 0 && e.charCodeAt(t - 1) === qt; ) t--;
42
42
  return t === e.length ? e : e.slice(0, t);
43
43
  }
44
- function qt(e) {
44
+ function zt(e) {
45
45
  try {
46
46
  return (He(new URL(e).pathname) || "/") !== "/";
47
47
  } catch {
48
- throw new re(`Invalid base URL: ${e}. Please provide a valid base URL.`);
48
+ throw new se(`Invalid base URL: ${e}. Please provide a valid base URL.`);
49
49
  }
50
50
  }
51
- function Ft(e) {
51
+ function Bt(e) {
52
52
  try {
53
53
  const t = new URL(e);
54
- if (t.protocol !== "http:" && t.protocol !== "https:") throw new re(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`);
54
+ if (t.protocol !== "http:" && t.protocol !== "https:") throw new se(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`);
55
55
  } catch (t) {
56
- throw t instanceof re ? t : new re(`Invalid base URL: ${e}. Please provide a valid base URL.`, { cause: t });
56
+ throw t instanceof se ? t : new se(`Invalid base URL: ${e}. Please provide a valid base URL.`, { cause: t });
57
57
  }
58
58
  }
59
- function ae(e, t = "/api/auth") {
60
- if (Ft(e), qt(e)) return e;
59
+ function le(e, t = "/api/auth") {
60
+ if (Bt(e), zt(e)) return e;
61
61
  const n = He(e);
62
62
  return !t || t === "/" ? n : (t = t.startsWith("/") ? t : `/${t}`, `${n}${t}`);
63
63
  }
64
- function Bt(e, t, n, r, s) {
65
- if (e) return ae(e, t);
64
+ function Ft(e, t, n, r, s) {
65
+ if (e) return le(e, t);
66
66
  {
67
- const i = F.BETTER_AUTH_URL || F.NEXT_PUBLIC_BETTER_AUTH_URL || F.PUBLIC_BETTER_AUTH_URL || F.NUXT_PUBLIC_BETTER_AUTH_URL || F.NUXT_PUBLIC_AUTH_URL || (F.BASE_URL !== "/" ? F.BASE_URL : void 0);
68
- if (i) return ae(i, t);
67
+ const i = z.BETTER_AUTH_URL || z.NEXT_PUBLIC_BETTER_AUTH_URL || z.PUBLIC_BETTER_AUTH_URL || z.NUXT_PUBLIC_BETTER_AUTH_URL || z.NUXT_PUBLIC_AUTH_URL || (z.BASE_URL !== "/" ? z.BASE_URL : void 0);
68
+ if (i) return le(i, t);
69
69
  }
70
- if (typeof window < "u" && window.location) return ae(window.location.origin, t);
70
+ if (typeof window < "u" && window.location) return le(window.location.origin, t);
71
71
  }
72
- const zt = {
72
+ const Mt = {
73
73
  proto: /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
74
74
  constructor: /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
75
75
  protoShort: /"__proto__"\s*:/,
76
76
  constructorShort: /"constructor"\s*:/
77
- }, Mt = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/, Se = {
77
+ }, Dt = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/, ke = {
78
78
  true: !0,
79
79
  false: !1,
80
80
  null: null,
@@ -82,30 +82,30 @@ const zt = {
82
82
  nan: NaN,
83
83
  infinity: Number.POSITIVE_INFINITY,
84
84
  "-infinity": Number.NEGATIVE_INFINITY
85
- }, Dt = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;
86
- function Ht(e) {
85
+ }, Ht = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;
86
+ function Wt(e) {
87
87
  return e instanceof Date && !isNaN(e.getTime());
88
88
  }
89
- function Wt(e) {
90
- const t = Dt.exec(e);
89
+ function $t(e) {
90
+ const t = Ht.exec(e);
91
91
  if (!t) return null;
92
92
  const [, n, r, s, i, l, d, o, u, c, m] = t, p = new Date(Date.UTC(parseInt(n, 10), parseInt(r, 10) - 1, parseInt(s, 10), parseInt(i, 10), parseInt(l, 10), parseInt(d, 10), o ? parseInt(o.padEnd(3, "0"), 10) : 0));
93
93
  if (u) {
94
94
  const g = (parseInt(c, 10) * 60 + parseInt(m, 10)) * (u === "+" ? -1 : 1);
95
95
  p.setUTCMinutes(p.getUTCMinutes() + g);
96
96
  }
97
- return Ht(p) ? p : null;
97
+ return Wt(p) ? p : null;
98
98
  }
99
- function $t(e, t = {}) {
99
+ function Gt(e, t = {}) {
100
100
  const { strict: n = !1, warnings: r = !1, reviver: s, parseDates: i = !0 } = t;
101
101
  if (typeof e != "string") return e;
102
102
  const l = e.trim(), d = l.toLowerCase();
103
- if (d.length <= 9 && d in Se) return Se[d];
104
- if (!Mt.test(l)) {
103
+ if (d.length <= 9 && d in ke) return ke[d];
104
+ if (!Dt.test(l)) {
105
105
  if (n) throw new SyntaxError("[better-json] Invalid JSON");
106
106
  return e;
107
107
  }
108
- if (Object.entries(zt).some(([o, u]) => {
108
+ if (Object.entries(Mt).some(([o, u]) => {
109
109
  const c = u.test(l);
110
110
  return c && r && console.warn(`[better-json] Detected potential prototype pollution attempt using ${o} pattern`), c;
111
111
  }) && n) throw new Error("[better-json] Potential prototype pollution attempt detected");
@@ -116,7 +116,7 @@ function $t(e, t = {}) {
116
116
  return;
117
117
  }
118
118
  if (i && typeof c == "string") {
119
- const m = Wt(c);
119
+ const m = $t(c);
120
120
  if (m) return m;
121
121
  }
122
122
  return s ? s(u, c) : c;
@@ -126,15 +126,15 @@ function $t(e, t = {}) {
126
126
  return e;
127
127
  }
128
128
  }
129
- function Gt(e, t = { strict: !0 }) {
130
- return $t(e, t);
129
+ function Vt(e, t = { strict: !0 }) {
130
+ return Gt(e, t);
131
131
  }
132
132
  const Jt = [
133
133
  "javascript:",
134
134
  "data:",
135
135
  "vbscript:"
136
136
  ];
137
- function Vt(e) {
137
+ function Kt(e) {
138
138
  let t;
139
139
  try {
140
140
  t = new URL(e);
@@ -143,37 +143,37 @@ function Vt(e) {
143
143
  }
144
144
  return !Jt.includes(t.protocol);
145
145
  }
146
- const Kt = {
146
+ const Xt = {
147
147
  id: "redirect",
148
148
  name: "Redirect",
149
149
  hooks: { onSuccess(e) {
150
150
  var t, n;
151
- if ((t = e.data) != null && t.url && ((n = e.data) != null && n.redirect) && Vt(e.data.url) && typeof window < "u" && window.location && window.location)
151
+ if ((t = e.data) != null && t.url && ((n = e.data) != null && n.redirect) && Kt(e.data.url) && typeof window < "u" && window.location && window.location)
152
152
  try {
153
153
  window.location.href = e.data.url;
154
154
  } catch {
155
155
  }
156
156
  } }
157
157
  };
158
- let N = [], $ = 0;
159
- const ge = 4, Xt = globalThis.nanostoresGlobal || (globalThis.nanostoresGlobal = { epoch: 0 });
160
- let Yt = () => {
158
+ let A = [], $ = 0;
159
+ const me = 4, Yt = globalThis.nanostoresGlobal || (globalThis.nanostoresGlobal = { epoch: 0 });
160
+ let Qt = () => {
161
161
  let e, t;
162
- for (; $ < N.length; ) {
163
- t = $, $ += ge;
162
+ for (; $ < A.length; ) {
163
+ t = $, $ += me;
164
164
  try {
165
- N[t](
166
- N[t + 1].value,
167
- N[t + 2],
168
- N[t + 3]
165
+ A[t](
166
+ A[t + 1].value,
167
+ A[t + 2],
168
+ A[t + 3]
169
169
  );
170
170
  } catch (n) {
171
171
  e = n;
172
172
  }
173
173
  }
174
- if (N.length = $ = 0, e) throw e;
174
+ if (A.length = $ = 0, e) throw e;
175
175
  };
176
- const ke = /* @__NO_SIDE_EFFECTS__ */ (e) => {
176
+ const Ee = /* @__NO_SIDE_EFFECTS__ */ (e) => {
177
177
  let t = [], n = {
178
178
  eq: Object.is,
179
179
  get() {
@@ -184,23 +184,23 @@ const ke = /* @__NO_SIDE_EFFECTS__ */ (e) => {
184
184
  lc: 0,
185
185
  listen(r) {
186
186
  return n.lc = t.push(r), () => {
187
- for (let i = $; i < N.length; )
188
- N[i] === r ? N.splice(i, ge) : i += ge;
187
+ for (let i = $; i < A.length; )
188
+ A[i] === r ? A.splice(i, me) : i += me;
189
189
  let s = t.indexOf(r);
190
190
  ~s && (t.splice(s, 1), --n.lc || n.off());
191
191
  };
192
192
  },
193
193
  notify(r, s) {
194
- Xt.epoch++;
195
- let i = !N.length && !0;
194
+ Yt.epoch++;
195
+ let i = !A.length && !0;
196
196
  for (let l of t)
197
- N.push(
197
+ A.push(
198
198
  l,
199
199
  n,
200
200
  r,
201
201
  s
202
202
  );
203
- i && Yt();
203
+ i && Qt();
204
204
  },
205
205
  /* It will be called on last listener unsubscribing.
206
206
  We will redefine it in onMount and onStop. */
@@ -217,16 +217,16 @@ const ke = /* @__NO_SIDE_EFFECTS__ */ (e) => {
217
217
  value: e
218
218
  };
219
219
  return n;
220
- }, Qt = 2, Zt = 5, X = 6, Y = 10;
221
- let We = (e, t, n, r) => (e.events = e.events || {}, e.events[n + Y] || (e.events[n + Y] = r((s) => {
220
+ }, Zt = 2, en = 5, Y = 6, Q = 10;
221
+ let We = (e, t, n, r) => (e.events = e.events || {}, e.events[n + Q] || (e.events[n + Q] = r((s) => {
222
222
  e.events[n].reduceRight((i, l) => (l(i), i), {
223
223
  shared: {},
224
224
  ...s
225
225
  });
226
226
  })), e.events[n] = e.events[n] || [], e.events[n].push(t), () => {
227
227
  let s = e.events[n], i = s.indexOf(t);
228
- ~i && (s.splice(i, 1), s.length || (e.events[n + Y](), delete e.events[n + Y]));
229
- }), en = (e, t) => We(e, t, Qt, (n) => {
228
+ ~i && (s.splice(i, 1), s.length || (e.events[n + Q](), delete e.events[n + Q]));
229
+ }), tn = (e, t) => We(e, t, Zt, (n) => {
230
230
  let r = e.set, s = e.setKey;
231
231
  return e.setKey && (e.setKey = (i, l) => {
232
232
  let d;
@@ -247,19 +247,19 @@ let We = (e, t, n, r) => (e.events = e.events || {}, e.events[n + Y] || (e.event
247
247
  };
248
248
  });
249
249
  const $e = 1e3;
250
- let tn = (e, t) => We(e, (r) => {
250
+ let nn = (e, t) => We(e, (r) => {
251
251
  let s = t(r);
252
- s && e.events[X].push(s);
253
- }, Zt, (r) => {
252
+ s && e.events[Y].push(s);
253
+ }, en, (r) => {
254
254
  let s = e.listen;
255
255
  e.listen = (...l) => (!e.lc && !e.active && (e.active = !0, r()), s(...l));
256
256
  let i = e.off;
257
- return e.events[X] = [], e.off = () => {
257
+ return e.events[Y] = [], e.off = () => {
258
258
  i(), setTimeout(() => {
259
259
  if (e.active && !e.lc) {
260
260
  e.active = !1;
261
- for (let l of e.events[X]) l();
262
- e.events[X] = [];
261
+ for (let l of e.events[Y]) l();
262
+ e.events[Y] = [];
263
263
  }
264
264
  }, $e);
265
265
  }, () => {
@@ -267,7 +267,7 @@ let tn = (e, t) => We(e, (r) => {
267
267
  };
268
268
  });
269
269
  function Re(e, t) {
270
- let n = nn(t), r = e;
270
+ let n = rn(t), r = e;
271
271
  for (let s of n) {
272
272
  if (r == null)
273
273
  return;
@@ -275,18 +275,18 @@ function Re(e, t) {
275
275
  }
276
276
  return r;
277
277
  }
278
- const Ee = /(.*)\[(\d+)\]/;
279
- function nn(e) {
278
+ const _e = /(.*)\[(\d+)\]/;
279
+ function rn(e) {
280
280
  return e.split(".").flatMap((t) => Ge(t));
281
281
  }
282
282
  function Ge(e) {
283
- if (Ee.test(e)) {
284
- let [, t, n] = e.match(Ee);
283
+ if (_e.test(e)) {
284
+ let [, t, n] = e.match(_e);
285
285
  return [...Ge(t), n];
286
286
  }
287
287
  return [e];
288
288
  }
289
- function rn(e, t, n) {
289
+ function sn(e, t, n) {
290
290
  let r = new Set(t);
291
291
  return e.listen((s, i, l) => {
292
292
  (l === void 0 ? t.some(
@@ -297,7 +297,7 @@ function rn(e, t, n) {
297
297
  ) : r.has(l) || r.has(l.split(/\.|\[/)[0])) && n(s, i, l);
298
298
  });
299
299
  }
300
- function _e(e) {
300
+ function Oe(e) {
301
301
  if (typeof e != "object" || e === null) return !1;
302
302
  const t = Object.getPrototypeOf(e);
303
303
  return t === Object.prototype || t === null;
@@ -309,7 +309,7 @@ function ie(e, t) {
309
309
  for (let n = 0; n < e.length; n++) if (!ie(e[n], t[n])) return !1;
310
310
  return !0;
311
311
  }
312
- if (_e(e) && _e(t)) {
312
+ if (Oe(e) && Oe(t)) {
313
313
  const n = Object.keys(e), r = Object.keys(t);
314
314
  if (n.length !== r.length) return !1;
315
315
  for (const s of n) if (!(s in t) || !ie(e[s], t[s])) return !1;
@@ -317,13 +317,13 @@ function ie(e, t) {
317
317
  }
318
318
  return !1;
319
319
  }
320
- function sn(e, t) {
321
- return en(e, ({ newValue: n, abort: r }) => {
320
+ function on(e, t) {
321
+ return tn(e, ({ newValue: n, abort: r }) => {
322
322
  t(e.value, n) && r();
323
323
  });
324
324
  }
325
- const le = Symbol.for("better-auth:broadcast-channel"), on = () => Math.floor(Date.now() / 1e3);
326
- var an = class {
325
+ const ce = Symbol.for("better-auth:broadcast-channel"), an = () => Math.floor(Date.now() / 1e3);
326
+ var ln = class {
327
327
  constructor(e = "better-auth.message") {
328
328
  D(this, "listeners", /* @__PURE__ */ new Set());
329
329
  D(this, "name");
@@ -339,7 +339,7 @@ var an = class {
339
339
  try {
340
340
  localStorage.setItem(this.name, JSON.stringify({
341
341
  ...e,
342
- timestamp: on()
342
+ timestamp: an()
343
343
  }));
344
344
  } catch {
345
345
  }
@@ -357,11 +357,11 @@ var an = class {
357
357
  };
358
358
  }
359
359
  };
360
- function ce(e = "better-auth.message") {
361
- return globalThis[le] || (globalThis[le] = new an(e)), globalThis[le];
360
+ function ue(e = "better-auth.message") {
361
+ return globalThis[ce] || (globalThis[ce] = new ln(e)), globalThis[ce];
362
362
  }
363
- const ue = Symbol.for("better-auth:focus-manager");
364
- var ln = class {
363
+ const de = Symbol.for("better-auth:focus-manager");
364
+ var cn = class {
365
365
  constructor() {
366
366
  D(this, "listeners", /* @__PURE__ */ new Set());
367
367
  }
@@ -384,11 +384,11 @@ var ln = class {
384
384
  };
385
385
  }
386
386
  };
387
- function Oe() {
388
- return globalThis[ue] || (globalThis[ue] = new ln()), globalThis[ue];
387
+ function Te() {
388
+ return globalThis[de] || (globalThis[de] = new cn()), globalThis[de];
389
389
  }
390
- const de = Symbol.for("better-auth:online-manager");
391
- var cn = class {
390
+ const fe = Symbol.for("better-auth:online-manager");
391
+ var un = class {
392
392
  constructor() {
393
393
  D(this, "listeners", /* @__PURE__ */ new Set());
394
394
  D(this, "isOnline", typeof navigator < "u" ? navigator.onLine : !0);
@@ -410,34 +410,34 @@ var cn = class {
410
410
  };
411
411
  }
412
412
  };
413
- function fe() {
414
- return globalThis[de] || (globalThis[de] = new cn()), globalThis[de];
413
+ function he() {
414
+ return globalThis[fe] || (globalThis[fe] = new un()), globalThis[fe];
415
415
  }
416
- const he = () => Math.floor(Date.now() / 1e3), un = 5;
417
- function dn(e) {
418
- var _, b, T;
419
- const { fetchSession: t, shouldPollSession: n = () => !0, sessionSignal: r, options: s = {} } = e, i = ((_ = s.sessionOptions) == null ? void 0 : _.refetchInterval) ?? 0, l = ((b = s.sessionOptions) == null ? void 0 : b.refetchOnWindowFocus) ?? !0, d = ((T = s.sessionOptions) == null ? void 0 : T.refetchWhenOffline) ?? !1, o = {
416
+ const pe = () => Math.floor(Date.now() / 1e3), dn = 5;
417
+ function fn(e) {
418
+ var O, b, T;
419
+ const { fetchSession: t, shouldPollSession: n = () => !0, sessionSignal: r, options: s = {} } = e, i = ((O = s.sessionOptions) == null ? void 0 : O.refetchInterval) ?? 0, l = ((b = s.sessionOptions) == null ? void 0 : b.refetchOnWindowFocus) ?? !0, d = ((T = s.sessionOptions) == null ? void 0 : T.refetchWhenOffline) ?? !1, o = {
420
420
  isInitialized: !1,
421
421
  lastSessionRequest: 0
422
- }, u = () => d || fe().isOnline, c = (f) => {
422
+ }, u = () => d || he().isOnline, c = (f) => {
423
423
  if (u()) {
424
424
  if ((f == null ? void 0 : f.event) === "storage") {
425
425
  t();
426
426
  return;
427
427
  }
428
428
  if ((f == null ? void 0 : f.event) === "poll") {
429
- o.lastSessionRequest = he(), t();
429
+ o.lastSessionRequest = pe(), t();
430
430
  return;
431
431
  }
432
432
  if ((f == null ? void 0 : f.event) === "visibilitychange") {
433
- if (he() - o.lastSessionRequest < un) return;
434
- o.lastSessionRequest = he(), t();
433
+ if (pe() - o.lastSessionRequest < dn) return;
434
+ o.lastSessionRequest = pe(), t();
435
435
  return;
436
436
  }
437
437
  t();
438
438
  }
439
439
  }, m = (f) => {
440
- ce().post({
440
+ ue().post({
441
441
  event: "session",
442
442
  data: { trigger: f },
443
443
  clientId: Math.random().toString(36).substring(7)
@@ -447,15 +447,15 @@ function dn(e) {
447
447
  n() && c({ event: "poll" });
448
448
  }, i * 1e3));
449
449
  }, g = () => {
450
- o.unsubscribeBroadcast = ce().subscribe(() => {
450
+ o.unsubscribeBroadcast = ue().subscribe(() => {
451
451
  c({ event: "storage" });
452
452
  });
453
453
  }, y = () => {
454
- l && (o.unsubscribeFocus = Oe().subscribe(() => {
454
+ l && (o.unsubscribeFocus = Te().subscribe(() => {
455
455
  c({ event: "visibilitychange" });
456
456
  }));
457
457
  }, v = () => {
458
- o.unsubscribeOnline = fe().subscribe((f) => {
458
+ o.unsubscribeOnline = he().subscribe((f) => {
459
459
  f && c({ event: "visibilitychange" });
460
460
  });
461
461
  }, x = () => {
@@ -465,7 +465,7 @@ function dn(e) {
465
465
  };
466
466
  return {
467
467
  init: () => {
468
- o.isInitialized || (o.isInitialized = !0, p(), g(), y(), v(), x(), o.cleanupBroadcastSetup = ce().setup(), o.cleanupFocusSetup = Oe().setup(), o.cleanupOnlineSetup = fe().setup());
468
+ o.isInitialized || (o.isInitialized = !0, p(), g(), y(), v(), x(), o.cleanupBroadcastSetup = ue().setup(), o.cleanupFocusSetup = Te().setup(), o.cleanupOnlineSetup = he().setup());
469
469
  },
470
470
  cleanup: () => {
471
471
  o.isInitialized && (o.pollInterval && (clearInterval(o.pollInterval), o.pollInterval = void 0), o.unsubscribeBroadcast && (o.unsubscribeBroadcast(), o.unsubscribeBroadcast = void 0), o.unsubscribeFocus && (o.unsubscribeFocus(), o.unsubscribeFocus = void 0), o.unsubscribeOnline && (o.unsubscribeOnline(), o.unsubscribeOnline = void 0), o.unsubscribeSignal && (o.unsubscribeSignal(), o.unsubscribeSignal = void 0), o.cleanupBroadcastSetup && (o.cleanupBroadcastSetup(), o.cleanupBroadcastSetup = void 0), o.cleanupFocusSetup && (o.cleanupFocusSetup(), o.cleanupFocusSetup = void 0), o.cleanupOnlineSetup && (o.cleanupOnlineSetup(), o.cleanupOnlineSetup = void 0), o.isInitialized = !1, o.lastSessionRequest = 0);
@@ -474,8 +474,8 @@ function dn(e) {
474
474
  broadcastSessionUpdate: m
475
475
  };
476
476
  }
477
- const fn = () => typeof window > "u", hn = $e;
478
- function pn(e, t) {
477
+ const hn = () => typeof window > "u", pn = $e;
478
+ function gn(e, t) {
479
479
  if (typeof window > "u") return;
480
480
  const n = e.get();
481
481
  n.data !== null || t === null || e.set({
@@ -485,32 +485,32 @@ function pn(e, t) {
485
485
  isPending: !1
486
486
  });
487
487
  }
488
- function Te(e) {
488
+ function Pe(e) {
489
489
  return typeof e == "object" && e !== null && "data" in e && "error" in e ? e : {
490
490
  data: e,
491
491
  error: null
492
492
  };
493
493
  }
494
- function gn(e) {
494
+ function mn(e) {
495
495
  return !e || e.session === null && e.user === null ? null : e;
496
496
  }
497
- function mn(e, t) {
497
+ function xn(e, t) {
498
498
  return ie(e.data, t.data) && e.error === t.error && e.isPending === t.isPending && e.isRefetching === t.isRefetching && e.refetch === t.refetch;
499
499
  }
500
- function xn(e, t) {
501
- const n = /* @__PURE__ */ ke(!1);
500
+ function yn(e, t) {
501
+ const n = /* @__PURE__ */ Ee(!1);
502
502
  let r, s = 0, i = 0;
503
503
  n.listen(() => {
504
504
  i++, s = 0;
505
505
  });
506
- const l = (g) => c(g), d = /* @__PURE__ */ ke({
506
+ const l = (g) => c(g), d = /* @__PURE__ */ Ee({
507
507
  data: null,
508
508
  error: null,
509
509
  isPending: !0,
510
510
  isRefetching: !1,
511
511
  refetch: l
512
512
  });
513
- sn(d, mn);
513
+ on(d, xn);
514
514
  const o = async (g, y) => {
515
515
  const v = d.value;
516
516
  if (d.set({
@@ -527,41 +527,41 @@ function xn(e, t) {
527
527
  signal: g
528
528
  });
529
529
  if (g.aborted) return "aborted";
530
- let { data: w, error: S } = Te(x), _ = "fresh";
531
- if (w != null && w.needsRefresh) try {
532
- const k = await e("/get-session", {
530
+ let { data: k, error: E } = Pe(x), O = "fresh";
531
+ if (k != null && k.needsRefresh) try {
532
+ const R = await e("/get-session", {
533
533
  method: "POST",
534
534
  signal: g
535
535
  });
536
536
  if (g.aborted) return "aborted";
537
- ({ data: w, error: S } = Te(k));
537
+ ({ data: k, error: E } = Pe(R));
538
538
  } catch {
539
539
  if (g.aborted) return "aborted";
540
- _ = "stale";
540
+ O = "stale";
541
541
  }
542
- if (S) {
543
- const k = d.value, j = (S == null ? void 0 : S.status) === 401;
542
+ if (E) {
543
+ const R = d.value, j = (E == null ? void 0 : E.status) === 401;
544
544
  return d.set({
545
- data: j ? null : k.data,
546
- error: S,
545
+ data: j ? null : R.data,
546
+ error: E,
547
547
  isPending: !1,
548
548
  isRefetching: !1,
549
549
  refetch: l
550
550
  }), "failed";
551
551
  }
552
- const b = gn(w), T = d.value, f = T.data != null && b != null && ie(T.data, b) ? T.data : b;
552
+ const b = mn(k), T = d.value, f = T.data != null && b != null && ie(T.data, b) ? T.data : b;
553
553
  return d.set({
554
554
  data: f,
555
555
  error: null,
556
556
  isPending: !1,
557
557
  isRefetching: !1,
558
558
  refetch: l
559
- }), _;
559
+ }), O;
560
560
  } catch (x) {
561
561
  if (g.aborted) return "aborted";
562
- const w = d.value;
562
+ const k = d.value;
563
563
  return d.set({
564
- data: w.data,
564
+ data: k.data,
565
565
  error: x,
566
566
  isPending: !1,
567
567
  isRefetching: !1,
@@ -571,7 +571,7 @@ function xn(e, t) {
571
571
  }, u = () => {
572
572
  var v, x;
573
573
  const g = (x = (v = d.value.data) == null ? void 0 : v.session) == null ? void 0 : x.expiresAt, y = g instanceof Date ? g.getTime() : Number.POSITIVE_INFINITY;
574
- return Math.min(Date.now() + hn, y);
574
+ return Math.min(Date.now() + pn, y);
575
575
  }, c = (g) => {
576
576
  s = 0, r == null || r.cancel();
577
577
  const y = new AbortController(), v = {
@@ -580,8 +580,8 @@ function xn(e, t) {
580
580
  revision: i
581
581
  };
582
582
  r = v;
583
- const x = (w) => {
584
- r === v && (r = void 0, w === "fresh" && v.revision === i && (s = u()));
583
+ const x = (k) => {
584
+ r === v && (r = void 0, k === "fresh" && v.revision === i && (s = u()));
585
585
  };
586
586
  return v.promise.then(x, () => x("failed")), v.promise.then(() => {
587
587
  });
@@ -589,12 +589,12 @@ function xn(e, t) {
589
589
  }) : Date.now() < s ? Promise.resolve() : c();
590
590
  let p = () => {
591
591
  };
592
- return tn(d, () => {
592
+ return nn(d, () => {
593
593
  let g;
594
- fn() || (g = setTimeout(() => {
594
+ hn() || (g = setTimeout(() => {
595
595
  m();
596
596
  }, 0));
597
- const y = dn({
597
+ const y = fn({
598
598
  fetchSession: c,
599
599
  shouldPollSession: () => d.value.data != null,
600
600
  sessionSignal: n,
@@ -609,21 +609,21 @@ function xn(e, t) {
609
609
  broadcastSessionUpdate: (g) => p(g)
610
610
  };
611
611
  }
612
- function pe(e) {
612
+ function ge(e) {
613
613
  if (e === null || typeof e != "object")
614
614
  return !1;
615
615
  const t = Object.getPrototypeOf(e);
616
616
  return t !== null && t !== Object.prototype && Object.getPrototypeOf(t) !== null || Symbol.iterator in e ? !1 : Symbol.toStringTag in e ? Object.prototype.toString.call(e) === "[object Module]" : !0;
617
617
  }
618
- function me(e, t, n = ".", r) {
619
- if (!pe(t))
620
- return me(e, {}, n, r);
618
+ function xe(e, t, n = ".", r) {
619
+ if (!ge(t))
620
+ return xe(e, {}, n, r);
621
621
  const s = { ...t };
622
622
  for (const i of Object.keys(e)) {
623
623
  if (i === "__proto__" || i === "constructor")
624
624
  continue;
625
625
  const l = e[i];
626
- l != null && (r && r(s, i, l, n) || (Array.isArray(l) && Array.isArray(s[i]) ? s[i] = [...l, ...s[i]] : pe(l) && pe(s[i]) ? s[i] = me(
626
+ l != null && (r && r(s, i, l, n) || (Array.isArray(l) && Array.isArray(s[i]) ? s[i] = [...l, ...s[i]] : ge(l) && ge(s[i]) ? s[i] = xe(
627
627
  l,
628
628
  s[i],
629
629
  (n ? `${n}.` : "") + i.toString(),
@@ -632,27 +632,27 @@ function me(e, t, n = ".", r) {
632
632
  }
633
633
  return s;
634
634
  }
635
- function yn(e) {
635
+ function vn(e) {
636
636
  return (...t) => (
637
637
  // eslint-disable-next-line unicorn/no-array-reduce
638
- t.reduce((n, r) => me(n, r, "", e), {})
638
+ t.reduce((n, r) => xe(n, r, "", e), {})
639
639
  );
640
640
  }
641
- const vn = yn();
642
- var bn = Object.defineProperty, wn = Object.defineProperties, Sn = Object.getOwnPropertyDescriptors, Pe = Object.getOwnPropertySymbols, kn = Object.prototype.hasOwnProperty, Rn = Object.prototype.propertyIsEnumerable, Le = (e, t, n) => t in e ? bn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, U = (e, t) => {
641
+ const bn = vn();
642
+ var wn = Object.defineProperty, Sn = Object.defineProperties, kn = Object.getOwnPropertyDescriptors, Le = Object.getOwnPropertySymbols, En = Object.prototype.hasOwnProperty, Rn = Object.prototype.propertyIsEnumerable, Ue = (e, t, n) => t in e ? wn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, U = (e, t) => {
643
643
  for (var n in t || (t = {}))
644
- kn.call(t, n) && Le(e, n, t[n]);
645
- if (Pe)
646
- for (var n of Pe(t))
647
- Rn.call(t, n) && Le(e, n, t[n]);
644
+ En.call(t, n) && Ue(e, n, t[n]);
645
+ if (Le)
646
+ for (var n of Le(t))
647
+ Rn.call(t, n) && Ue(e, n, t[n]);
648
648
  return e;
649
- }, A = (e, t) => wn(e, Sn(t)), En = class extends Error {
649
+ }, N = (e, t) => Sn(e, kn(t)), _n = class extends Error {
650
650
  constructor(e, t, n) {
651
651
  super(t || e.toString(), {
652
652
  cause: n
653
653
  }), this.status = e, this.statusText = t, this.error = n, Error.captureStackTrace(this, this.constructor);
654
654
  }
655
- }, _n = async (e, t) => {
655
+ }, On = async (e, t) => {
656
656
  var n, r, s, i, l, d;
657
657
  let o = t || {};
658
658
  const u = {
@@ -680,7 +680,7 @@ var bn = Object.defineProperty, wn = Object.defineProperties, Sn = Object.getOwn
680
680
  options: o,
681
681
  hooks: u
682
682
  };
683
- }, Ue = class {
683
+ }, Ae = class {
684
684
  constructor(e) {
685
685
  this.options = e;
686
686
  }
@@ -692,7 +692,7 @@ var bn = Object.defineProperty, wn = Object.defineProperties, Sn = Object.getOwn
692
692
  getDelay() {
693
693
  return this.options.delay;
694
694
  }
695
- }, On = class {
695
+ }, Tn = class {
696
696
  constructor(e) {
697
697
  this.options = e;
698
698
  }
@@ -708,23 +708,23 @@ var bn = Object.defineProperty, wn = Object.defineProperties, Sn = Object.getOwn
708
708
  );
709
709
  }
710
710
  };
711
- function Tn(e) {
711
+ function Pn(e) {
712
712
  if (typeof e == "number")
713
- return new Ue({
713
+ return new Ae({
714
714
  type: "linear",
715
715
  attempts: e,
716
716
  delay: 1e3
717
717
  });
718
718
  switch (e.type) {
719
719
  case "linear":
720
- return new Ue(e);
720
+ return new Ae(e);
721
721
  case "exponential":
722
- return new On(e);
722
+ return new Tn(e);
723
723
  default:
724
724
  throw new Error("Invalid retry strategy");
725
725
  }
726
726
  }
727
- var Pn = async (e) => {
727
+ var Ln = async (e) => {
728
728
  const t = {}, n = async (r) => typeof r == "function" ? await r() : r;
729
729
  if (e != null && e.auth) {
730
730
  if (e.auth.type === "Bearer") {
@@ -751,8 +751,8 @@ var Pn = async (e) => {
751
751
  }
752
752
  }
753
753
  return t;
754
- }, Ln = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
755
- function Un(e) {
754
+ }, Un = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;
755
+ function An(e) {
756
756
  const t = e.headers.get("content-type"), n = /* @__PURE__ */ new Set([
757
757
  "image/svg",
758
758
  "application/xml",
@@ -762,41 +762,41 @@ function Un(e) {
762
762
  if (!t)
763
763
  return "json";
764
764
  const r = t.split(";").shift() || "";
765
- return Ln.test(r) ? "json" : n.has(r) || r.startsWith("text/") ? "text" : "blob";
765
+ return Un.test(r) ? "json" : n.has(r) || r.startsWith("text/") ? "text" : "blob";
766
766
  }
767
- function Nn(e) {
767
+ function jn(e) {
768
768
  try {
769
769
  return JSON.parse(e), !0;
770
770
  } catch {
771
771
  return !1;
772
772
  }
773
773
  }
774
- function Je(e) {
774
+ function Ve(e) {
775
775
  if (e === void 0)
776
776
  return !1;
777
777
  const t = typeof e;
778
778
  return t === "string" || t === "number" || t === "boolean" || t === null ? !0 : t !== "object" ? !1 : Array.isArray(e) ? !0 : e.buffer ? !1 : e.constructor && e.constructor.name === "Object" || typeof e.toJSON == "function";
779
779
  }
780
- function Ne(e) {
780
+ function je(e) {
781
781
  try {
782
782
  return JSON.parse(e);
783
783
  } catch {
784
784
  return e;
785
785
  }
786
786
  }
787
- function je(e) {
787
+ function Ne(e) {
788
788
  return typeof e == "function";
789
789
  }
790
- function jn(e) {
790
+ function Nn(e) {
791
791
  if (e != null && e.customFetchImpl)
792
792
  return e.customFetchImpl;
793
- if (typeof globalThis < "u" && je(globalThis.fetch))
793
+ if (typeof globalThis < "u" && Ne(globalThis.fetch))
794
794
  return globalThis.fetch;
795
- if (typeof window < "u" && je(window.fetch))
795
+ if (typeof window < "u" && Ne(window.fetch))
796
796
  return window.fetch;
797
797
  throw new Error("No fetch implementation found");
798
798
  }
799
- function Ve(...e) {
799
+ function Je(...e) {
800
800
  const t = {};
801
801
  for (const n of e)
802
802
  if (n)
@@ -811,26 +811,26 @@ function Ve(...e) {
811
811
  }
812
812
  return t;
813
813
  }
814
- async function An(e) {
815
- const t = new Headers(Ve(e == null ? void 0 : e.headers, await Pn(e)));
814
+ async function Cn(e) {
815
+ const t = new Headers(Je(e == null ? void 0 : e.headers, await Ln(e)));
816
816
  if (!t.has("content-type")) {
817
- const n = Cn(e == null ? void 0 : e.body);
817
+ const n = In(e == null ? void 0 : e.body);
818
818
  n && t.set("content-type", n);
819
819
  }
820
820
  return t;
821
821
  }
822
- function Cn(e) {
823
- return Je(e) ? "application/json" : null;
824
- }
825
822
  function In(e) {
823
+ return Ve(e) ? "application/json" : null;
824
+ }
825
+ function qn(e) {
826
826
  const t = e.get("content-type");
827
827
  return t ? t.split(";")[0].trim().toLowerCase() : null;
828
828
  }
829
- function qn(e, t) {
829
+ function zn(e, t) {
830
830
  const { body: n } = e;
831
- return n ? !Je(n) || typeof n == "string" ? n : In(t) === "application/x-www-form-urlencoded" ? new URLSearchParams(n).toString() : JSON.stringify(n) : null;
831
+ return n ? !Ve(n) || typeof n == "string" ? n : qn(t) === "application/x-www-form-urlencoded" ? new URLSearchParams(n).toString() : JSON.stringify(n) : null;
832
832
  }
833
- function Fn(e, t) {
833
+ function Bn(e, t) {
834
834
  var n;
835
835
  if (t != null && t.method)
836
836
  return t.method.toUpperCase();
@@ -840,7 +840,7 @@ function Fn(e, t) {
840
840
  }
841
841
  return t != null && t.body ? "POST" : "GET";
842
842
  }
843
- function Bn(e, t) {
843
+ function Fn(e, t) {
844
844
  let n;
845
845
  return !(e != null && e.signal) && (e != null && e.timeout) && (n = setTimeout(() => t == null ? void 0 : t.abort(), e == null ? void 0 : e.timeout)), {
846
846
  abortTimeout: n,
@@ -849,7 +849,7 @@ function Bn(e, t) {
849
849
  }
850
850
  };
851
851
  }
852
- var zn = class Ke extends Error {
852
+ var Mn = class Ke extends Error {
853
853
  constructor(t, n) {
854
854
  super(n || JSON.stringify(t, null, 2)), this.issues = t, Object.setPrototypeOf(this, Ke.prototype);
855
855
  }
@@ -857,10 +857,10 @@ var zn = class Ke extends Error {
857
857
  async function G(e, t) {
858
858
  const n = await e["~standard"].validate(t);
859
859
  if (n.issues)
860
- throw new zn(n.issues);
860
+ throw new Mn(n.issues);
861
861
  return n.value;
862
862
  }
863
- var Xe = ["get", "post", "put", "patch", "delete"], Mn = (e) => ({
863
+ var Xe = ["get", "post", "put", "patch", "delete"], Dn = (e) => ({
864
864
  id: "apply-schema",
865
865
  name: "Apply Schema",
866
866
  version: "1.0.0",
@@ -897,12 +897,12 @@ var Xe = ["get", "post", "put", "patch", "delete"], Mn = (e) => ({
897
897
  y[v.toLowerCase()] = x;
898
898
  c = y;
899
899
  }
900
- let m = A(U({}, n), {
900
+ let m = N(U({}, n), {
901
901
  method: u.method,
902
902
  output: u.output,
903
903
  headers: c
904
904
  });
905
- return n != null && n.disableValidation || (m = A(U({}, m), {
905
+ return n != null && n.disableValidation || (m = N(U({}, m), {
906
906
  body: u.input ? await G(u.input, n == null ? void 0 : n.body) : n == null ? void 0 : n.body,
907
907
  params: u.params ? await G(u.params, n == null ? void 0 : n.params) : n == null ? void 0 : n.params,
908
908
  query: u.query ? await G(u.query, n == null ? void 0 : n.query) : n == null ? void 0 : n.query
@@ -917,15 +917,15 @@ var Xe = ["get", "post", "put", "patch", "delete"], Mn = (e) => ({
917
917
  options: n
918
918
  };
919
919
  }
920
- }), Dn = (e) => {
920
+ }), Hn = (e) => {
921
921
  async function t(n, r) {
922
- const s = A(U(U({}, e), r), {
923
- headers: Ve(e == null ? void 0 : e.headers, r == null ? void 0 : r.headers),
924
- plugins: [...(e == null ? void 0 : e.plugins) || [], Mn(e || {}), ...(r == null ? void 0 : r.plugins) || []]
922
+ const s = N(U(U({}, e), r), {
923
+ headers: Je(e == null ? void 0 : e.headers, r == null ? void 0 : r.headers),
924
+ plugins: [...(e == null ? void 0 : e.plugins) || [], Dn(e || {}), ...(r == null ? void 0 : r.plugins) || []]
925
925
  });
926
926
  if (e != null && e.catchAllError)
927
927
  try {
928
- return await xe(n, s);
928
+ return await ye(n, s);
929
929
  } catch (i) {
930
930
  return {
931
931
  data: null,
@@ -937,19 +937,19 @@ var Xe = ["get", "post", "put", "patch", "delete"], Mn = (e) => ({
937
937
  }
938
938
  };
939
939
  }
940
- return await xe(n, s);
940
+ return await ye(n, s);
941
941
  }
942
942
  return t;
943
- }, Hn = (e) => e === "." || e === "..";
944
- function Wn(e, t) {
943
+ }, Wn = (e) => e === "." || e === "..";
944
+ function $n(e, t) {
945
945
  let n = e;
946
946
  for (const [r, s] of t)
947
947
  n = n.replace(r, s);
948
- if (Hn(n))
948
+ if (Wn(n))
949
949
  throw new TypeError("Path parameters cannot be reserved path segments");
950
950
  return encodeURIComponent(n);
951
951
  }
952
- function $n(e, t) {
952
+ function Gn(e, t) {
953
953
  const { baseURL: n, params: r, query: s } = t || {
954
954
  query: {},
955
955
  params: {},
@@ -987,21 +987,21 @@ function $n(e, t) {
987
987
  } else
988
988
  for (const [p, g] of Object.entries(r))
989
989
  u.set(`:${p}`, String(g));
990
- l = l.split("/").map((p) => Wn(p, u)).join("/"), l = l.replace(/^\/+/, "");
990
+ l = l.split("/").map((p) => $n(p, u)).join("/"), l = l.replace(/^\/+/, "");
991
991
  let c = o.toString();
992
992
  return c = c.length > 0 ? `?${c}`.replace(/\+/g, "%20") : "", i.startsWith("http") ? new URL(`${l}${c}`, i) : `${i}${l}${c}`;
993
993
  }
994
- var xe = async (e, t) => {
994
+ var ye = async (e, t) => {
995
995
  var n, r, s, i, l, d, o, u;
996
996
  const {
997
997
  hooks: c,
998
998
  url: m,
999
999
  options: p
1000
- } = await _n(e, t), g = jn(p), y = new AbortController(), v = (n = p.signal) != null ? n : y.signal, x = $n(m, p), w = await An(p), S = qn(p, w), _ = Fn(m, p), b = A(U({}, p), {
1000
+ } = await On(e, t), g = Nn(p), y = new AbortController(), v = (n = p.signal) != null ? n : y.signal, x = Gn(m, p), k = await Cn(p), E = zn(p, k), O = Bn(m, p), b = N(U({}, p), {
1001
1001
  url: x,
1002
- headers: w,
1003
- body: S,
1004
- method: _,
1002
+ headers: k,
1003
+ body: E,
1004
+ method: O,
1005
1005
  signal: v
1006
1006
  });
1007
1007
  for (const P of c.onRequest)
@@ -1010,16 +1010,16 @@ var xe = async (e, t) => {
1010
1010
  typeof h == "object" && h !== null && Object.assign(b, h);
1011
1011
  }
1012
1012
  ("pipeTo" in b && typeof b.pipeTo == "function" || typeof ((r = t == null ? void 0 : t.body) == null ? void 0 : r.pipe) == "function") && ("duplex" in b || (b.duplex = "half"));
1013
- const { clearTimeout: T } = Bn(p, y);
1013
+ const { clearTimeout: T } = Fn(p, y);
1014
1014
  let f = await g(b.url, b);
1015
1015
  T();
1016
- const k = {
1016
+ const R = {
1017
1017
  response: f,
1018
1018
  request: b
1019
1019
  };
1020
1020
  for (const P of c.onResponse)
1021
1021
  if (P) {
1022
- const h = await P(A(U({}, k), {
1022
+ const h = await P(N(U({}, R), {
1023
1023
  response: (s = t == null ? void 0 : t.hookOptions) != null && s.cloneResponse ? f.clone() : f
1024
1024
  }));
1025
1025
  h instanceof Response ? f = h : typeof h == "object" && h !== null && (f = h.response);
@@ -1030,13 +1030,13 @@ var xe = async (e, t) => {
1030
1030
  data: "",
1031
1031
  error: null
1032
1032
  };
1033
- const h = Un(f), L = {
1033
+ const h = An(f), L = {
1034
1034
  data: null,
1035
1035
  response: f,
1036
1036
  request: b
1037
1037
  };
1038
1038
  if (h === "json" || h === "text") {
1039
- const I = await f.text(), Ye = (i = b.jsonParser) != null ? i : Ne;
1039
+ const I = await f.text(), Ye = (i = b.jsonParser) != null ? i : je;
1040
1040
  L.data = await Ye(I);
1041
1041
  } else
1042
1042
  L.data = await f[h]();
@@ -1045,7 +1045,7 @@ var xe = async (e, t) => {
1045
1045
  L.data
1046
1046
  ));
1047
1047
  for (const I of c.onSuccess)
1048
- I && await I(A(U({}, L), {
1048
+ I && await I(N(U({}, L), {
1049
1049
  response: (l = t == null ? void 0 : t.hookOptions) != null && l.cloneResponse ? f.clone() : f
1050
1050
  }));
1051
1051
  return t != null && t.throw ? L.data : {
@@ -1053,45 +1053,45 @@ var xe = async (e, t) => {
1053
1053
  error: null
1054
1054
  };
1055
1055
  }
1056
- const j = (d = t == null ? void 0 : t.jsonParser) != null ? d : Ne, C = await f.text(), H = Nn(C), M = H ? await j(C) : null, K = {
1056
+ const j = (d = t == null ? void 0 : t.jsonParser) != null ? d : je, C = await f.text(), H = jn(C), M = H ? await j(C) : null, X = {
1057
1057
  response: f,
1058
1058
  responseText: C,
1059
1059
  request: b,
1060
- error: A(U({}, M), {
1060
+ error: N(U({}, M), {
1061
1061
  status: f.status,
1062
1062
  statusText: f.statusText
1063
1063
  })
1064
1064
  };
1065
1065
  for (const P of c.onError)
1066
- P && await P(A(U({}, K), {
1066
+ P && await P(N(U({}, X), {
1067
1067
  response: (o = t == null ? void 0 : t.hookOptions) != null && o.cloneResponse ? f.clone() : f
1068
1068
  }));
1069
1069
  if (t != null && t.retry) {
1070
- const P = Tn(t.retry), h = (u = t.retryAttempt) != null ? u : 0;
1070
+ const P = Pn(t.retry), h = (u = t.retryAttempt) != null ? u : 0;
1071
1071
  if (await P.shouldAttemptRetry(h, f)) {
1072
1072
  for (const I of c.onRetry)
1073
- I && await I(k);
1073
+ I && await I(R);
1074
1074
  const L = P.getDelay(h);
1075
- return await new Promise((I) => setTimeout(I, L)), await xe(e, A(U({}, t), {
1075
+ return await new Promise((I) => setTimeout(I, L)), await ye(e, N(U({}, t), {
1076
1076
  retryAttempt: h + 1
1077
1077
  }));
1078
1078
  }
1079
1079
  }
1080
1080
  if (t != null && t.throw)
1081
- throw new En(
1081
+ throw new _n(
1082
1082
  f.status,
1083
1083
  f.statusText,
1084
1084
  H ? M : C
1085
1085
  );
1086
1086
  return {
1087
1087
  data: null,
1088
- error: A(U({}, M), {
1088
+ error: N(U({}, M), {
1089
1089
  status: f.status,
1090
1090
  statusText: f.statusText
1091
1091
  })
1092
1092
  };
1093
1093
  };
1094
- const Gn = (e) => {
1094
+ const Vn = (e) => {
1095
1095
  if (typeof process > "u") return;
1096
1096
  const t = e ?? "/api/auth";
1097
1097
  if (process.env.NEXT_PUBLIC_AUTH_URL) return process.env.NEXT_PUBLIC_AUTH_URL;
@@ -1107,8 +1107,8 @@ const Gn = (e) => {
1107
1107
  }
1108
1108
  }
1109
1109
  }, Jn = (e, t) => {
1110
- var k, j, C, H, M, K, P;
1111
- const n = "credentials" in Request.prototype, r = Bt(e == null ? void 0 : e.baseURL, e == null ? void 0 : e.basePath) ?? Gn(e == null ? void 0 : e.basePath) ?? "/api/auth", s = ((k = e == null ? void 0 : e.plugins) == null ? void 0 : k.flatMap((h) => h.fetchPlugins).filter((h) => h !== void 0)) || [], i = {
1110
+ var R, j, C, H, M, X, P;
1111
+ const n = "credentials" in Request.prototype, r = Ft(e == null ? void 0 : e.baseURL, e == null ? void 0 : e.basePath) ?? Vn(e == null ? void 0 : e.basePath) ?? "/api/auth", s = ((R = e == null ? void 0 : e.plugins) == null ? void 0 : R.flatMap((h) => h.fetchPlugins).filter((h) => h !== void 0)) || [], i = {
1112
1112
  id: "lifecycle-hooks",
1113
1113
  name: "lifecycle-hooks",
1114
1114
  hooks: {
@@ -1117,28 +1117,28 @@ const Gn = (e) => {
1117
1117
  onRequest: (H = e == null ? void 0 : e.fetchOptions) == null ? void 0 : H.onRequest,
1118
1118
  onResponse: (M = e == null ? void 0 : e.fetchOptions) == null ? void 0 : M.onResponse
1119
1119
  }
1120
- }, { onSuccess: l, onError: d, onRequest: o, onResponse: u, ...c } = (e == null ? void 0 : e.fetchOptions) || {}, m = Dn({
1120
+ }, { onSuccess: l, onError: d, onRequest: o, onResponse: u, ...c } = (e == null ? void 0 : e.fetchOptions) || {}, m = Hn({
1121
1121
  baseURL: r,
1122
1122
  ...n ? { credentials: "include" } : {},
1123
1123
  method: "GET",
1124
1124
  jsonParser(h) {
1125
- return h ? Gt(h, { strict: !1 }) : null;
1125
+ return h ? Vt(h, { strict: !1 }) : null;
1126
1126
  },
1127
1127
  customFetchImpl: fetch,
1128
1128
  ...c,
1129
1129
  plugins: [
1130
1130
  i,
1131
1131
  ...c.plugins || [],
1132
- ...e != null && e.disableDefaultFetchPlugins ? [] : [Kt],
1132
+ ...e != null && e.disableDefaultFetchPlugins ? [] : [Xt],
1133
1133
  ...s
1134
1134
  ]
1135
- }), { $sessionSignal: p, session: g, broadcastSessionUpdate: y } = xn(m, e);
1135
+ }), { $sessionSignal: p, session: g, broadcastSessionUpdate: y } = yn(m, e);
1136
1136
  let v = !1;
1137
1137
  const x = (h) => {
1138
- v || h === null || (v = !0, pn(g, h));
1139
- }, w = (e == null ? void 0 : e.plugins) || [];
1140
- let S = {};
1141
- const _ = {
1138
+ v || h === null || (v = !0, gn(g, h));
1139
+ }, k = (e == null ? void 0 : e.plugins) || [];
1140
+ let E = {};
1141
+ const O = {
1142
1142
  $sessionSignal: p,
1143
1143
  session: g
1144
1144
  }, b = {
@@ -1155,24 +1155,24 @@ const Gn = (e) => {
1155
1155
  h === "/sign-out" ? y("signout") : (h === "/update-user" || h === "/update-session") && y("updateUser");
1156
1156
  }
1157
1157
  }];
1158
- for (const h of w)
1159
- h.getAtoms && Object.assign(_, (K = h.getAtoms) == null ? void 0 : K.call(h, m)), h.pathMethods && Object.assign(b, h.pathMethods), h.atomListeners && T.push(...h.atomListeners);
1158
+ for (const h of k)
1159
+ h.getAtoms && Object.assign(O, (X = h.getAtoms) == null ? void 0 : X.call(h, m)), h.pathMethods && Object.assign(b, h.pathMethods), h.atomListeners && T.push(...h.atomListeners);
1160
1160
  const f = {
1161
1161
  notify: (h) => {
1162
- _[h].set(!_[h].get());
1162
+ O[h].set(!O[h].get());
1163
1163
  },
1164
1164
  listen: (h, L) => {
1165
- _[h].subscribe(L);
1165
+ O[h].subscribe(L);
1166
1166
  },
1167
- atoms: _
1167
+ atoms: O
1168
1168
  };
1169
- for (const h of w) h.getActions && (S = vn(((P = h.getActions) == null ? void 0 : P.call(h, m, f, e)) ?? {}, S));
1169
+ for (const h of k) h.getActions && (E = bn(((P = h.getActions) == null ? void 0 : P.call(h, m, f, e)) ?? {}, E));
1170
1170
  return {
1171
1171
  get baseURL() {
1172
1172
  return r;
1173
1173
  },
1174
- pluginsActions: S,
1175
- pluginsAtoms: _,
1174
+ pluginsActions: E,
1175
+ pluginsAtoms: O,
1176
1176
  pluginPathMethods: b,
1177
1177
  atomListeners: T,
1178
1178
  hydrateSession: x,
@@ -1181,24 +1181,24 @@ const Gn = (e) => {
1181
1181
  $store: f
1182
1182
  };
1183
1183
  };
1184
- function Vn(e) {
1184
+ function Kn(e) {
1185
1185
  return typeof e == "object" && e !== null && "get" in e && typeof e.get == "function" && "lc" in e && typeof e.lc == "number";
1186
1186
  }
1187
- function Kn(e) {
1187
+ function Xn(e) {
1188
1188
  return e.charAt(0).toUpperCase() + e.slice(1);
1189
1189
  }
1190
- const Xn = new RegExp("[\\p{Ll}\\d]+|\\p{Lu}+(?!\\p{Ll})|\\p{Lu}[\\p{Ll}\\d]+|\\p{Lo}+", "gu"), Yn = /['\u2019]/g;
1191
- function Qn(e) {
1192
- return e.replace(Yn, "").match(Xn) ?? [];
1193
- }
1190
+ const Yn = new RegExp("[\\p{Ll}\\d]+|\\p{Lu}+(?!\\p{Ll})|\\p{Lu}[\\p{Ll}\\d]+|\\p{Lo}+", "gu"), Qn = /['\u2019]/g;
1194
1191
  function Zn(e) {
1195
- return Qn(e).map((t) => t.toLowerCase()).join("-");
1192
+ return e.replace(Qn, "").match(Yn) ?? [];
1196
1193
  }
1197
- function er(e, t, n) {
1194
+ function er(e) {
1195
+ return Zn(e).map((t) => t.toLowerCase()).join("-");
1196
+ }
1197
+ function tr(e, t, n) {
1198
1198
  const r = t[e], { fetchOptions: s, query: i, ...l } = n || {};
1199
1199
  return r || (s != null && s.method ? s.method : l && Object.keys(l).length > 0 ? "POST" : "GET");
1200
1200
  }
1201
- function tr(e, t, n, r, s) {
1201
+ function nr(e, t, n, r, s) {
1202
1202
  function i(l = []) {
1203
1203
  return new Proxy(function() {
1204
1204
  }, {
@@ -1211,36 +1211,36 @@ function tr(e, t, n, r, s) {
1211
1211
  c = void 0;
1212
1212
  break;
1213
1213
  }
1214
- return typeof c == "function" || Vn(c) ? c : i(u);
1214
+ return typeof c == "function" || Kn(c) ? c : i(u);
1215
1215
  },
1216
1216
  apply: async (d, o, u) => {
1217
- const c = "/" + l.map(Zn).join("/"), m = u[0] || {}, p = u[1] || {}, { query: g, fetchOptions: y, ...v } = m, x = {
1217
+ const c = "/" + l.map(er).join("/"), m = u[0] || {}, p = u[1] || {}, { query: g, fetchOptions: y, ...v } = m, x = {
1218
1218
  ...p,
1219
1219
  ...y
1220
- }, w = er(c, n, m);
1220
+ }, k = tr(c, n, m);
1221
1221
  return await t(c, {
1222
1222
  ...x,
1223
- body: w === "GET" ? void 0 : {
1223
+ body: k === "GET" ? void 0 : {
1224
1224
  ...v,
1225
1225
  ...(x == null ? void 0 : x.body) || {}
1226
1226
  },
1227
1227
  query: g || (x == null ? void 0 : x.query),
1228
- method: w,
1229
- async onSuccess(S) {
1228
+ method: k,
1229
+ async onSuccess(E) {
1230
1230
  var T, f;
1231
- if (await ((T = x == null ? void 0 : x.onSuccess) == null ? void 0 : T.call(x, S)), !s || x.disableSignal) return;
1232
- const _ = s.filter((k) => k.matcher(c));
1233
- if (!_.length) return;
1231
+ if (await ((T = x == null ? void 0 : x.onSuccess) == null ? void 0 : T.call(x, E)), !s || x.disableSignal) return;
1232
+ const O = s.filter((R) => R.matcher(c));
1233
+ if (!O.length) return;
1234
1234
  const b = /* @__PURE__ */ new Set();
1235
- for (const k of _) {
1236
- const j = r[k.signal];
1235
+ for (const R of O) {
1236
+ const j = r[R.signal];
1237
1237
  if (!j) return;
1238
- if (b.has(k.signal)) continue;
1239
- b.add(k.signal);
1238
+ if (b.has(R.signal)) continue;
1239
+ b.add(R.signal);
1240
1240
  const C = j.get();
1241
1241
  setTimeout(() => {
1242
1242
  j.set(!C);
1243
- }, 10), (f = k.callback) == null || f.call(k, c);
1243
+ }, 10), (f = R.callback) == null || f.call(R, c);
1244
1244
  }
1245
1245
  }
1246
1246
  });
@@ -1249,22 +1249,22 @@ function tr(e, t, n, r, s) {
1249
1249
  }
1250
1250
  return i();
1251
1251
  }
1252
- function nr(e, t = {}) {
1252
+ function rr(e, t = {}) {
1253
1253
  const n = et(e.get()), { keys: r, deps: s = [e, r] } = t, i = tt((d) => {
1254
1254
  const o = (u) => {
1255
1255
  n.current !== u && (n.current = u, d());
1256
1256
  };
1257
- return o(e.value), r != null && r.length ? rn(e, r, o) : e.listen(o);
1257
+ return o(e.value), r != null && r.length ? sn(e, r, o) : e.listen(o);
1258
1258
  }, s), l = () => n.current;
1259
1259
  return nt(i, l, l);
1260
1260
  }
1261
- function rr(e) {
1262
- return `use${Kn(e)}`;
1263
- }
1264
1261
  function sr(e) {
1262
+ return `use${Xn(e)}`;
1263
+ }
1264
+ function ir(e) {
1265
1265
  const { pluginPathMethods: t, pluginsActions: n, pluginsAtoms: r, hydrateSession: s, $fetch: i, $store: l, atomListeners: d } = Jn(e), o = {};
1266
- for (const [u, c] of Object.entries(r)) o[rr(u)] = () => nr(c);
1267
- return tr({
1266
+ for (const [u, c] of Object.entries(r)) o[sr(u)] = () => rr(c);
1267
+ return nr({
1268
1268
  ...n,
1269
1269
  ...o,
1270
1270
  hydrateSession: s,
@@ -1272,31 +1272,31 @@ function sr(e) {
1272
1272
  $store: l
1273
1273
  }, i, t, r, d);
1274
1274
  }
1275
- var ir = "1.7.3";
1276
- const or = ir, ar = () => ({
1275
+ var or = "1.7.3";
1276
+ const ar = or, lr = () => ({
1277
1277
  id: "magic-link",
1278
- version: or,
1278
+ version: ar,
1279
1279
  $InferServerPlugin: {}
1280
1280
  });
1281
- let Ae = null;
1282
- function z() {
1283
- return Ae ?? (Ae = sr({
1281
+ let Ce = null;
1282
+ function F() {
1283
+ return Ce ?? (Ce = ir({
1284
1284
  baseURL: st(),
1285
- plugins: [ar()]
1286
- })), Ae;
1285
+ plugins: [lr()]
1286
+ })), Ce;
1287
1287
  }
1288
- function lr() {
1289
- const [e] = Ce(), [t, n] = R(null), [r, s] = R(null), [i, l] = R(!1), [d, o] = R(null), u = e.get("token") ? e.get("email") ?? "" : "", [c, m] = R(u || (e.get("email") ?? "")), [p, g] = R(""), [y, v] = R(""), [x, w] = R("signin");
1290
- V(() => {
1288
+ function cr() {
1289
+ const [e] = ve(), [t, n] = w(null), [r, s] = w(null), [i, l] = w(!1), [d, o] = w(null), u = e.get("token") ? e.get("email") ?? "" : "", [c, m] = w(u || (e.get("email") ?? "")), [p, g] = w(""), [y, v] = w(""), [x, k] = w("signin");
1290
+ K(() => {
1291
1291
  it().then((f) => o(f.github)).catch(() => o(!1));
1292
1292
  }, []);
1293
- const S = window.location.href;
1294
- async function _() {
1293
+ const E = window.location.href;
1294
+ async function O() {
1295
1295
  l(!0), n(null);
1296
1296
  try {
1297
- await z().signIn.social({
1297
+ await F().signIn.social({
1298
1298
  provider: "github",
1299
- callbackURL: S
1299
+ callbackURL: E
1300
1300
  });
1301
1301
  } catch (f) {
1302
1302
  n(f instanceof Error ? f.message : "GitHub sign-in failed"), l(!1);
@@ -1304,9 +1304,9 @@ function lr() {
1304
1304
  }
1305
1305
  async function b() {
1306
1306
  l(!0), n(null), s(null);
1307
- const f = await z().signIn.magicLink({
1307
+ const f = await F().signIn.magicLink({
1308
1308
  email: c,
1309
- callbackURL: S
1309
+ callbackURL: E
1310
1310
  });
1311
1311
  if (l(!1), f.error) {
1312
1312
  n(f.error.message ?? "Could not send the magic link");
@@ -1316,32 +1316,32 @@ function lr() {
1316
1316
  }
1317
1317
  async function T(f) {
1318
1318
  f.preventDefault(), l(!0), n(null);
1319
- const k = x === "signup" ? await z().signUp.email({
1319
+ const R = x === "signup" ? await F().signUp.email({
1320
1320
  email: c,
1321
1321
  password: p,
1322
1322
  name: y,
1323
- callbackURL: S
1324
- }) : await z().signIn.email({
1323
+ callbackURL: E
1324
+ }) : await F().signIn.email({
1325
1325
  email: c,
1326
1326
  password: p,
1327
- callbackURL: S
1327
+ callbackURL: E
1328
1328
  });
1329
- if (k.error) {
1330
- n(k.error.message ?? "Sign-in failed"), l(!1);
1329
+ if (R.error) {
1330
+ n(R.error.message ?? "Sign-in failed"), l(!1);
1331
1331
  return;
1332
1332
  }
1333
- window.location.assign(S);
1333
+ window.location.assign(E);
1334
1334
  }
1335
- return /* @__PURE__ */ E("main", { ...ot(at, ur.main), children: [
1335
+ return /* @__PURE__ */ _("main", { ...at(lt, dr.main), children: [
1336
1336
  /* @__PURE__ */ a("div", { className: "x10l6tqk x10a8y8t x47corl x87ps6o xlxt4rd", "aria-hidden": !0 }),
1337
- /* @__PURE__ */ E("div", { className: "x1n2onr6 x78zum5 xh8yej3 xxc7z9f xdt5ytf x6s0dn4 x2b8uid", children: [
1338
- /* @__PURE__ */ a("div", { className: "xrvj5dj x1ku5rj1 x1useyqa xsdox4t x1y5o9j5 x1n0nidx", children: /* @__PURE__ */ a(cr, {}) }),
1337
+ /* @__PURE__ */ _("div", { className: "x1n2onr6 x78zum5 xh8yej3 xxc7z9f xdt5ytf x6s0dn4 x2b8uid", children: [
1338
+ /* @__PURE__ */ a("div", { className: "xrvj5dj x1ku5rj1 x1useyqa xsdox4t x1y5o9j5 x1n0nidx", children: /* @__PURE__ */ a(ur, {}) }),
1339
1339
  /* @__PURE__ */ a("h1", { className: "x1ghz6dp xqjzbou xneq65o x1s688f x1b4dsll x1u7k74 x1w2vvpw", children: u ? "Join this workspace" : "Welcome back" }),
1340
- /* @__PURE__ */ a("div", { className: "x1g7u8ds", children: /* @__PURE__ */ a(O, { tone: "muted", children: u ? `Sign in as ${u}. A password or GitHub stays on this page. A magic link sends one more email.` : "Sign in with email or GitHub." }) }),
1341
- /* @__PURE__ */ E("div", { className: "x78zum5 xh8yej3 x1tfhste xdt5ytf x6s0dn4 x11cgr9k", children: [
1342
- t ? /* @__PURE__ */ a(O, { tone: "danger", children: t }) : null,
1343
- r ? /* @__PURE__ */ a(O, { tone: "muted", children: r }) : null,
1344
- /* @__PURE__ */ E("form", { onSubmit: (f) => void T(f), className: "x78zum5 xh8yej3 xdt5ytf x1ndbd79", children: [
1340
+ /* @__PURE__ */ a("div", { className: "x1g7u8ds", children: /* @__PURE__ */ a(S, { tone: "muted", children: u ? `Sign in as ${u}. A password or GitHub stays on this page. A magic link sends one more email.` : "Sign in with email or GitHub." }) }),
1341
+ /* @__PURE__ */ _("div", { className: "x78zum5 xh8yej3 x1tfhste xdt5ytf x6s0dn4 x11cgr9k", children: [
1342
+ t ? /* @__PURE__ */ a(S, { tone: "danger", children: t }) : null,
1343
+ r ? /* @__PURE__ */ a(S, { tone: "muted", children: r }) : null,
1344
+ /* @__PURE__ */ _("form", { onSubmit: (f) => void T(f), className: "x78zum5 xh8yej3 xdt5ytf x1ndbd79", children: [
1345
1345
  x === "signup" ? /* @__PURE__ */ a("input", { required: !0, value: y, onChange: (f) => v(f.target.value), placeholder: "Name", autoComplete: "name", className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x17ia0ru x1l3a84d" }) : null,
1346
1346
  /* @__PURE__ */ a("input", { required: !0, type: "email", value: c, onChange: (f) => m(f.target.value), placeholder: "Email", autoComplete: "email", readOnly: !!u, ...{
1347
1347
  0: {
@@ -1369,8 +1369,8 @@ function lr() {
1369
1369
  className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k xc342km x1e6avla xjbqb8w x1n0nidx x1vrk1b5 xwq05k6 x1h6gzvc x47corl"
1370
1370
  }
1371
1371
  }[!!(i || !c) << 0], children: "Email me a magic link" }),
1372
- /* @__PURE__ */ a("button", { type: "button", disabled: i, onClick: () => w(x === "signup" ? "signin" : "signup"), className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k xc342km x1e6avla xjbqb8w x1n0nidx x1vrk1b5 x1ypdohk", children: x === "signup" ? "I already have an account" : "Create an account" }),
1373
- /* @__PURE__ */ E("button", { type: "button", disabled: i || d !== !0, onClick: () => void _(), ...{
1372
+ /* @__PURE__ */ a("button", { type: "button", disabled: i, onClick: () => k(x === "signup" ? "signin" : "signup"), className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k xc342km x1e6avla xjbqb8w x1n0nidx x1vrk1b5 x1ypdohk", children: x === "signup" ? "I already have an account" : "Create an account" }),
1373
+ /* @__PURE__ */ _("button", { type: "button", disabled: i || d !== !0, onClick: () => void O(), ...{
1374
1374
  0: {
1375
1375
  className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k x3smv4v x161b3w3 xc342km x1e6avla xj4hn0o x1wt99x4 x1l3a84d xk50ysn x1u7k74 xggy1nq xr1c510 xx6bhzk xwji4o3 xq3txz7 xd3so5o x12w9bfk xb93eig"
1376
1376
  },
@@ -1378,21 +1378,21 @@ function lr() {
1378
1378
  className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k x3smv4v x161b3w3 xc342km x1e6avla xj4hn0o x1wt99x4 x1l3a84d xk50ysn x1u7k74 xggy1nq xr1c510 xx6bhzk xwji4o3 xq3txz7 xd3so5o x12w9bfk xb93eig xwq05k6 x1h6gzvc x47corl"
1379
1379
  }
1380
1380
  }[!!(i || d !== !0) << 0], children: [
1381
- /* @__PURE__ */ a(yt, { size: 18 }),
1381
+ /* @__PURE__ */ a(ot, { size: 18 }),
1382
1382
  "Continue with GitHub"
1383
1383
  ] })
1384
1384
  ] })
1385
1385
  ] })
1386
1386
  ] });
1387
1387
  }
1388
- function cr() {
1389
- return /* @__PURE__ */ E("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", "aria-hidden": !0, children: [
1388
+ function ur() {
1389
+ return /* @__PURE__ */ _("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", "aria-hidden": !0, children: [
1390
1390
  /* @__PURE__ */ a("circle", { cx: "24", cy: "24", r: "18.25", stroke: "currentColor", strokeWidth: "1.25", opacity: "0.28" }),
1391
1391
  /* @__PURE__ */ a("circle", { cx: "24", cy: "24", r: "11.25", stroke: "currentColor", strokeWidth: "1.25", opacity: "0.55" }),
1392
1392
  /* @__PURE__ */ a("circle", { cx: "24", cy: "24", r: "4", fill: "currentColor" })
1393
1393
  ] });
1394
1394
  }
1395
- const ur = {
1395
+ const dr = {
1396
1396
  main: {
1397
1397
  kVAEAm: "x1n2onr6",
1398
1398
  k1xSpc: "x78zum5",
@@ -1409,46 +1409,46 @@ const ur = {
1409
1409
  $$css: !0
1410
1410
  }
1411
1411
  };
1412
- function dr() {
1412
+ function fr() {
1413
1413
  var s;
1414
- const { userId: e } = ze(), t = Me(), n = De(e), r = vt(n, ((s = t.control) == null ? void 0 : s.workspaces) ?? []);
1415
- return r === "/workspaces" && n && bt(e), /* @__PURE__ */ a(Ie, { to: r, replace: !0 });
1414
+ const { userId: e } = Fe(), t = Me(), n = De(e), r = bt(n, ((s = t.control) == null ? void 0 : s.workspaces) ?? []);
1415
+ return r === "/workspaces" && n && wt(e), /* @__PURE__ */ a(Ie, { to: r, replace: !0 });
1416
1416
  }
1417
- function fr({
1417
+ function hr({
1418
1418
  to: e,
1419
1419
  title: t,
1420
1420
  meta: n,
1421
1421
  trailing: r
1422
1422
  }) {
1423
- return /* @__PURE__ */ E(lt, { to: e, className: "x78zum5 x6s0dn4 x1qughib x11cgr9k x21xpn4 x173sf5p x15jjofa x1hl2dhg xqjzbou xso031l x1q0q8m5 x4b2zrn x1t1lzn6 x1xcxyqb", children: [
1424
- /* @__PURE__ */ E("span", { className: "x78zum5 xeuugli xdt5ytf x195vfkc", children: [
1423
+ return /* @__PURE__ */ _(ct, { to: e, className: "x78zum5 x6s0dn4 x1qughib x11cgr9k x21xpn4 x173sf5p x15jjofa x1hl2dhg xqjzbou xso031l x1q0q8m5 x4b2zrn x1t1lzn6 x1xcxyqb", children: [
1424
+ /* @__PURE__ */ _("span", { className: "x78zum5 xeuugli xdt5ytf x195vfkc", children: [
1425
1425
  /* @__PURE__ */ a("span", { className: "x17tv04q xk50ysn", children: t }),
1426
1426
  n ? /* @__PURE__ */ a("span", { className: "x1vrk1b5 x111yfic", children: n }) : null
1427
1427
  ] }),
1428
1428
  r ? /* @__PURE__ */ a("span", { className: "x2lah0s x1vrk1b5 x111yfic", children: r }) : null
1429
1429
  ] });
1430
1430
  }
1431
- function hr({
1431
+ function pr({
1432
1432
  children: e
1433
1433
  }) {
1434
1434
  return /* @__PURE__ */ a("div", { className: "x78zum5 xdt5ytf xmkeg23 x1y0btm7 x1j0qoeq x13oidi x1hb2obb xb3r6kr", children: e });
1435
1435
  }
1436
- function pr() {
1436
+ function gr() {
1437
1437
  var t;
1438
1438
  const e = ((t = Me().control) == null ? void 0 : t.workspaces) ?? [];
1439
- return /* @__PURE__ */ E(oe, { centered: !0, children: [
1439
+ return /* @__PURE__ */ _(ae, { centered: !0, children: [
1440
1440
  /* @__PURE__ */ a(
1441
- J,
1441
+ V,
1442
1442
  {
1443
1443
  title: "Workspaces",
1444
1444
  description: "Each workspace is a site and a team.",
1445
1445
  action: /* @__PURE__ */ a(qe, { to: "/workspaces/new", children: "New workspace" })
1446
1446
  }
1447
1447
  ),
1448
- e.length === 0 ? /* @__PURE__ */ a(O, { tone: "muted", children: "No workspaces yet." }) : /* @__PURE__ */ a(hr, { children: e.map((n) => /* @__PURE__ */ a(
1449
- fr,
1448
+ e.length === 0 ? /* @__PURE__ */ a(S, { tone: "muted", children: "No workspaces yet." }) : /* @__PURE__ */ a(pr, { children: e.map((n) => /* @__PURE__ */ a(
1449
+ hr,
1450
1450
  {
1451
- to: ct(n.slug),
1451
+ to: ut(n.slug),
1452
1452
  title: n.name,
1453
1453
  meta: n.role
1454
1454
  },
@@ -1456,12 +1456,12 @@ function pr() {
1456
1456
  )) })
1457
1457
  ] });
1458
1458
  }
1459
- function gr() {
1460
- const e = Fe(), [t, n] = R(""), [r, s] = R(null), [i, l] = R(!1);
1459
+ function mr() {
1460
+ const e = ze(), [t, n] = w(""), [r, s] = w(null), [i, l] = w(!1);
1461
1461
  async function d(o) {
1462
1462
  o.preventDefault(), l(!0), s(null);
1463
1463
  try {
1464
- const { workspace: u } = await ut(t), c = B.getState().control;
1464
+ const { workspace: u } = await dt(t), c = B.getState().control;
1465
1465
  c && B.applyControl({
1466
1466
  ...c,
1467
1467
  workspaces: [
@@ -1480,17 +1480,17 @@ function gr() {
1480
1480
  l(!1);
1481
1481
  }
1482
1482
  }
1483
- return /* @__PURE__ */ E(oe, { children: [
1483
+ return /* @__PURE__ */ _(ae, { children: [
1484
1484
  /* @__PURE__ */ a(
1485
- J,
1485
+ V,
1486
1486
  {
1487
- kicker: /* @__PURE__ */ a(wt, { to: "/workspaces", children: "← Workspaces" }),
1487
+ kicker: /* @__PURE__ */ a(St, { to: "/workspaces", children: "← Workspaces" }),
1488
1488
  title: "Create workspace"
1489
1489
  }
1490
1490
  ),
1491
- /* @__PURE__ */ a("form", { onSubmit: d, children: /* @__PURE__ */ E(se, { children: [
1492
- /* @__PURE__ */ a(Z, { label: "Name", children: /* @__PURE__ */ a(
1493
- ee,
1491
+ /* @__PURE__ */ a("form", { onSubmit: d, children: /* @__PURE__ */ _(J, { children: [
1492
+ /* @__PURE__ */ a(ee, { label: "Name", children: /* @__PURE__ */ a(
1493
+ te,
1494
1494
  {
1495
1495
  required: !0,
1496
1496
  value: t,
@@ -1498,12 +1498,12 @@ function gr() {
1498
1498
  placeholder: "Docs site"
1499
1499
  }
1500
1500
  ) }),
1501
- r ? /* @__PURE__ */ a(O, { tone: "danger", children: r }) : null,
1502
- /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(ye, { type: "submit", disabled: i, children: i ? "Creating…" : "Create workspace" }) })
1501
+ r ? /* @__PURE__ */ a(S, { tone: "danger", children: r }) : null,
1502
+ /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(oe, { type: "submit", disabled: i, children: i ? "Creating…" : "Create workspace" }) })
1503
1503
  ] }) })
1504
1504
  ] });
1505
1505
  }
1506
- function mr(e, t) {
1506
+ function xr(e, t) {
1507
1507
  switch (e) {
1508
1508
  case "invite_expired":
1509
1509
  return "This invite has expired. Ask for a new one.";
@@ -1519,74 +1519,74 @@ function mr(e, t) {
1519
1519
  return t;
1520
1520
  }
1521
1521
  }
1522
- function xr() {
1523
- const [e] = Ce(), t = Fe(), n = e.get("token") ?? "", r = e.get("email") ?? "", [s, i] = R(null), [l, d] = R(null), [o, u] = R(!1);
1524
- V(() => {
1522
+ function yr() {
1523
+ const [e] = ve(), t = ze(), n = e.get("token") ?? "", r = e.get("email") ?? "", [s, i] = w(null), [l, d] = w(null), [o, u] = w(!1);
1524
+ K(() => {
1525
1525
  if (!n) {
1526
1526
  i("This invite link is missing a token.");
1527
1527
  return;
1528
1528
  }
1529
1529
  let m = !1;
1530
- return dt(n).then((p) => {
1530
+ return ft(n).then((p) => {
1531
1531
  m || t(`/${p.slug}`, { replace: !0 });
1532
1532
  }).catch(async (p) => {
1533
1533
  if (m) return;
1534
1534
  const g = p && typeof p == "object" && "code" in p ? p.code : void 0;
1535
1535
  if (g === "invite_email_mismatch" || g === "unauthorized") {
1536
- const v = await ve().catch(() => null);
1536
+ const v = await be().catch(() => null);
1537
1537
  if (m) return;
1538
1538
  d((v == null ? void 0 : v.user.email) ?? null), u(!0);
1539
1539
  return;
1540
1540
  }
1541
1541
  const y = p instanceof Error ? p.message : "Could not accept invite";
1542
- i(mr(g, y));
1542
+ i(xr(g, y));
1543
1543
  }), () => {
1544
1544
  m = !0;
1545
1545
  };
1546
1546
  }, [t, n]);
1547
1547
  async function c() {
1548
- await z().signOut().catch(() => {
1549
- }), te(), B.wipe(), window.location.assign(window.location.href);
1548
+ await F().signOut().catch(() => {
1549
+ }), ne(), B.wipe(), window.location.assign(window.location.href);
1550
1550
  }
1551
- return /* @__PURE__ */ E(oe, { centered: !0, children: [
1552
- /* @__PURE__ */ a(J, { title: "Accept invite" }),
1553
- o ? /* @__PURE__ */ E(se, { children: [
1554
- /* @__PURE__ */ a(O, { children: l ? `You're signed in as ${l}. This invite is for ${r || "someone else"}.` : `Sign in as ${r || "the invited email"} to join.` }),
1555
- /* @__PURE__ */ a(O, { size: "sm", tone: "muted", children: "Password and GitHub stay on the next screen. A magic link sends one more email to that address." }),
1556
- /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(ye, { type: "button", variant: "secondary", onClick: () => void c(), children: r ? `Sign in as ${r}` : "Sign in to continue" }) })
1557
- ] }) : s ? /* @__PURE__ */ a(O, { tone: "danger", children: s }) : /* @__PURE__ */ a(O, { tone: "muted", children: "Joining workspace…" })
1551
+ return /* @__PURE__ */ _(ae, { centered: !0, children: [
1552
+ /* @__PURE__ */ a(V, { title: "Accept invite" }),
1553
+ o ? /* @__PURE__ */ _(J, { children: [
1554
+ /* @__PURE__ */ a(S, { children: l ? `You're signed in as ${l}. This invite is for ${r || "someone else"}.` : `Sign in as ${r || "the invited email"} to join.` }),
1555
+ /* @__PURE__ */ a(S, { size: "sm", tone: "muted", children: "Password and GitHub stay on the next screen. A magic link sends one more email to that address." }),
1556
+ /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(oe, { type: "button", variant: "secondary", onClick: () => void c(), children: r ? `Sign in as ${r}` : "Sign in to continue" }) })
1557
+ ] }) : s ? /* @__PURE__ */ a(S, { tone: "danger", children: s }) : /* @__PURE__ */ a(S, { tone: "muted", children: "Joining workspace…" })
1558
1558
  ] });
1559
1559
  }
1560
- function yr() {
1561
- const { email: e, userId: t } = ze(), [n, r] = R(""), [s, i] = R(null), [l, d] = R(null), [o, u] = R(!1);
1562
- V(() => {
1563
- ve().then((m) => {
1560
+ function vr() {
1561
+ const { email: e, userId: t } = Fe(), [n, r] = w(""), [s, i] = w(null), [l, d] = w(null), [o, u] = w(!1);
1562
+ K(() => {
1563
+ be().then((m) => {
1564
1564
  m != null && m.user.name && r(m.user.name);
1565
1565
  });
1566
1566
  }, []);
1567
1567
  async function c(m) {
1568
1568
  m.preventDefault(), u(!0), d(null), i(null);
1569
- const p = await z().updateUser({ name: n });
1569
+ const p = await F().updateUser({ name: n });
1570
1570
  if (u(!1), p.error) {
1571
1571
  d(p.error.message ?? "Could not save name");
1572
1572
  return;
1573
1573
  }
1574
1574
  i("Name saved. New publishes will use it.");
1575
1575
  }
1576
- return /* @__PURE__ */ E(oe, { children: [
1576
+ return /* @__PURE__ */ _(ae, { children: [
1577
1577
  /* @__PURE__ */ a(
1578
- J,
1578
+ V,
1579
1579
  {
1580
1580
  title: "User settings",
1581
1581
  description: "Your account on this Backmatter instance."
1582
1582
  }
1583
1583
  ),
1584
- /* @__PURE__ */ E(se, { gap: "lg", children: [
1585
- /* @__PURE__ */ a(St, { children: /* @__PURE__ */ a("form", { onSubmit: (m) => void c(m), children: /* @__PURE__ */ E(se, { children: [
1586
- /* @__PURE__ */ a(O, { as: "h2", size: "lg", weight: "medium", children: "Account" }),
1587
- /* @__PURE__ */ a(Z, { label: "Name", children: /* @__PURE__ */ a(ee, { value: n, onChange: (m) => r(m.target.value), autoComplete: "name" }) }),
1588
- /* @__PURE__ */ a(Z, { label: "Email", children: /* @__PURE__ */ a(
1589
- ee,
1584
+ /* @__PURE__ */ _(J, { gap: "lg", children: [
1585
+ /* @__PURE__ */ a(kt, { children: /* @__PURE__ */ a("form", { onSubmit: (m) => void c(m), children: /* @__PURE__ */ _(J, { children: [
1586
+ /* @__PURE__ */ a(S, { as: "h2", size: "lg", weight: "medium", children: "Account" }),
1587
+ /* @__PURE__ */ a(ee, { label: "Name", children: /* @__PURE__ */ a(te, { value: n, onChange: (m) => r(m.target.value), autoComplete: "name" }) }),
1588
+ /* @__PURE__ */ a(ee, { label: "Email", children: /* @__PURE__ */ a(
1589
+ te,
1590
1590
  {
1591
1591
  type: "email",
1592
1592
  value: e,
@@ -1595,8 +1595,8 @@ function yr() {
1595
1595
  spellCheck: !1
1596
1596
  }
1597
1597
  ) }),
1598
- /* @__PURE__ */ a(Z, { label: "User ID", hint: "Stable id for this account.", children: /* @__PURE__ */ a(
1599
- ee,
1598
+ /* @__PURE__ */ a(ee, { label: "User ID", hint: "Stable id for this account.", children: /* @__PURE__ */ a(
1599
+ te,
1600
1600
  {
1601
1601
  value: t,
1602
1602
  readOnly: !0,
@@ -1604,31 +1604,52 @@ function yr() {
1604
1604
  spellCheck: !1
1605
1605
  }
1606
1606
  ) }),
1607
- l ? /* @__PURE__ */ a(O, { tone: "danger", children: l }) : null,
1608
- s ? /* @__PURE__ */ a(O, { tone: "muted", children: s }) : null,
1609
- /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(ye, { type: "submit", disabled: o, children: o ? "Saving…" : "Save name" }) })
1607
+ l ? /* @__PURE__ */ a(S, { tone: "danger", children: l }) : null,
1608
+ s ? /* @__PURE__ */ a(S, { tone: "muted", children: s }) : null,
1609
+ /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(oe, { type: "submit", disabled: o, children: o ? "Saving…" : "Save name" }) })
1610
1610
  ] }) }) }),
1611
- /* @__PURE__ */ E("div", { children: [
1611
+ /* @__PURE__ */ _("div", { children: [
1612
1612
  /* @__PURE__ */ a(
1613
- J,
1613
+ V,
1614
1614
  {
1615
1615
  title: "Connectors",
1616
1616
  description: "Personal MCP servers that follow you across workspaces.",
1617
1617
  compact: !0
1618
1618
  }
1619
1619
  ),
1620
- /* @__PURE__ */ a(kt, { scope: "user", canEdit: !0 })
1620
+ /* @__PURE__ */ a(Et, { scope: "user", canEdit: !0 })
1621
1621
  ] })
1622
1622
  ] })
1623
1623
  ] });
1624
1624
  }
1625
- function vr({
1625
+ function br() {
1626
+ const [e] = ve(), t = e.get("id") ?? "", [n, r] = w("idle"), [s, i] = w(null);
1627
+ return /* @__PURE__ */ _(J, { gap: "lg", children: [
1628
+ /* @__PURE__ */ a(S, { as: "h1", size: "xl", weight: "medium", children: "Allow the CLI" }),
1629
+ /* @__PURE__ */ a(S, { tone: "muted", children: "This connects the Backmatter CLI on your computer to your account." }),
1630
+ n === "done" ? /* @__PURE__ */ a(S, { children: "You can return to the terminal." }) : null,
1631
+ s ? /* @__PURE__ */ a(S, { tone: "danger", children: s }) : null,
1632
+ n === "done" ? null : /* @__PURE__ */ a(
1633
+ oe,
1634
+ {
1635
+ disabled: !t,
1636
+ onClick: () => {
1637
+ i(null), ht(t).then(() => r("done")).catch((l) => {
1638
+ r("error"), i(l instanceof Error ? l.message : "Could not approve");
1639
+ });
1640
+ },
1641
+ children: "Allow"
1642
+ }
1643
+ )
1644
+ ] });
1645
+ }
1646
+ function wr({
1626
1647
  userId: e
1627
1648
  }) {
1628
- const [t, n] = R({
1649
+ const [t, n] = w({
1629
1650
  kind: "working"
1630
1651
  });
1631
- return V(() => {
1652
+ return K(() => {
1632
1653
  const r = Rt(window.location.search);
1633
1654
  if (!r) {
1634
1655
  n({
@@ -1642,7 +1663,7 @@ function vr({
1642
1663
  try {
1643
1664
  const {
1644
1665
  workspace: i
1645
- } = await ft(r.workspaceId), l = Et(r.returnUrl, i.siteUrls);
1666
+ } = await pt(r.workspaceId), l = _t(r.returnUrl, i.siteUrls);
1646
1667
  if (!l) {
1647
1668
  n({
1648
1669
  kind: "error",
@@ -1652,12 +1673,12 @@ function vr({
1652
1673
  }
1653
1674
  const {
1654
1675
  ticket: d
1655
- } = await ht(i.id, {
1676
+ } = await gt(i.id, {
1656
1677
  redirect: l.redirect,
1657
1678
  tree: e
1658
1679
  });
1659
1680
  if (s) return;
1660
- window.location.replace(_t(l.origin, d));
1681
+ window.location.replace(Ot(l.origin, d));
1661
1682
  } catch (i) {
1662
1683
  if (s) return;
1663
1684
  n({
@@ -1668,70 +1689,71 @@ function vr({
1668
1689
  })(), () => {
1669
1690
  s = !0;
1670
1691
  };
1671
- }, [e]), /* @__PURE__ */ a("div", { className: "x1ov3xa9 xrvj5dj x1ku5rj1 x1t7e3gq", children: /* @__PURE__ */ a("div", { className: "x78zum5 xdt5ytf x1ndbd79 x1lr1uin x1t7e3gq x4pepcl x1d0qn7y", children: t.kind === "working" ? /* @__PURE__ */ E(be, { children: [
1672
- /* @__PURE__ */ a(O, { size: "lg", weight: "medium", children: "Opening your site…" }),
1673
- /* @__PURE__ */ a(O, { tone: "muted", children: "Setting up editing on the site and sending you back." })
1674
- ] }) : /* @__PURE__ */ E(be, { children: [
1675
- /* @__PURE__ */ a(O, { size: "lg", weight: "medium", children: "Could not open the site" }),
1676
- /* @__PURE__ */ a(O, { tone: "muted", children: t.message }),
1692
+ }, [e]), /* @__PURE__ */ a("div", { className: "x1ov3xa9 xrvj5dj x1ku5rj1 x1t7e3gq", children: /* @__PURE__ */ a("div", { className: "x78zum5 xdt5ytf x1ndbd79 x1lr1uin x1t7e3gq x4pepcl x1d0qn7y", children: t.kind === "working" ? /* @__PURE__ */ _(we, { children: [
1693
+ /* @__PURE__ */ a(S, { size: "lg", weight: "medium", children: "Opening your site…" }),
1694
+ /* @__PURE__ */ a(S, { tone: "muted", children: "Setting up editing on the site and sending you back." })
1695
+ ] }) : /* @__PURE__ */ _(we, { children: [
1696
+ /* @__PURE__ */ a(S, { size: "lg", weight: "medium", children: "Could not open the site" }),
1697
+ /* @__PURE__ */ a(S, { tone: "muted", children: t.message }),
1677
1698
  /* @__PURE__ */ a(qe, { to: "/", variant: "secondary", children: "Back to the dashboard" })
1678
1699
  ] }) }) });
1679
1700
  }
1680
- const Q = Be() ? rt(() => import("./UiKitPage-BOunq6mr.js").then((e) => ({
1701
+ const Z = Be() ? rt(() => import("./UiKitPage-X4hkFL2d.js").then((e) => ({
1681
1702
  default: e.UiKitPage
1682
1703
  }))) : null;
1683
- function br(e) {
1704
+ function Sr(e) {
1684
1705
  return Be() && e.replace(/\/$/, "") === "/__ui";
1685
1706
  }
1686
- function Or() {
1687
- return /* @__PURE__ */ a(Ot, { children: /* @__PURE__ */ a(pt, { children: /* @__PURE__ */ a(wr, {}) }) });
1707
+ function Pr() {
1708
+ return /* @__PURE__ */ a(Tt, { children: /* @__PURE__ */ a(mt, { children: /* @__PURE__ */ a(kr, {}) }) });
1688
1709
  }
1689
- function wr() {
1690
- const e = gt(), [t, n] = R(() => {
1691
- const r = Tt();
1710
+ function kr() {
1711
+ const e = xt(), [t, n] = w(() => {
1712
+ const r = Pt();
1692
1713
  return r ? {
1693
1714
  user: r
1694
1715
  } : "loading";
1695
1716
  });
1696
- return V(() => {
1697
- ve().then((r) => {
1717
+ return K(() => {
1718
+ be().then((r) => {
1698
1719
  if (!(r != null && r.user)) {
1699
- te(), B.wipe(), n(null);
1720
+ ne(), B.wipe(), n(null);
1700
1721
  return;
1701
1722
  }
1702
- if (Pt(r.user), n({
1723
+ if (Lt(r.user), n({
1703
1724
  user: {
1704
1725
  id: r.user.id,
1705
1726
  email: r.user.email
1706
1727
  }
1707
1728
  }), B.getState().sessionUserId !== r.user.id) {
1708
- const s = mt(window.location.pathname);
1729
+ const s = yt(window.location.pathname);
1709
1730
  B.hydrate(r.user.id, s ?? De(r.user.id));
1710
1731
  }
1711
1732
  }).catch(() => {
1712
- te(), B.wipe(), n(null);
1733
+ ne(), B.wipe(), n(null);
1713
1734
  });
1714
- }, []), Q && br(e.pathname) ? /* @__PURE__ */ a(we, { fallback: /* @__PURE__ */ a("div", { className: "x1y5dg2c", children: /* @__PURE__ */ a(O, { tone: "muted", children: "Loading kit…" }) }), children: /* @__PURE__ */ a(Q, {}) }) : t === "loading" ? /* @__PURE__ */ a(Lt, {}) : t ? e.pathname.replace(/\/$/, "") === "/enter" ? /* @__PURE__ */ a(vr, { userId: t.user.id }) : /* @__PURE__ */ a(Ut, { user: t.user, children: /* @__PURE__ */ a(Nt, { children: /* @__PURE__ */ a(jt, { userId: t.user.id, email: t.user.email, onLogout: () => {
1715
- te(), B.wipe(), z().signOut().then(() => {
1735
+ }, []), Z && Sr(e.pathname) ? /* @__PURE__ */ a(Se, { fallback: /* @__PURE__ */ a("div", { className: "x1y5dg2c", children: /* @__PURE__ */ a(S, { tone: "muted", children: "Loading kit…" }) }), children: /* @__PURE__ */ a(Z, {}) }) : t === "loading" ? /* @__PURE__ */ a(Ut, {}) : t ? e.pathname.replace(/\/$/, "") === "/enter" ? /* @__PURE__ */ a(wr, { userId: t.user.id }) : /* @__PURE__ */ a(At, { user: t.user, children: /* @__PURE__ */ a(jt, { children: /* @__PURE__ */ a(Nt, { userId: t.user.id, email: t.user.email, onLogout: () => {
1736
+ ne(), B.wipe(), F().signOut().then(() => {
1716
1737
  n(null);
1717
1738
  }).catch(() => {
1718
1739
  n(null);
1719
1740
  });
1720
- }, children: /* @__PURE__ */ E(xt, { children: [
1721
- /* @__PURE__ */ a(q, { path: "/", element: /* @__PURE__ */ a(dr, {}) }),
1722
- /* @__PURE__ */ a(q, { path: "/workspaces", element: /* @__PURE__ */ a(pr, {}) }),
1723
- /* @__PURE__ */ a(q, { path: "/workspaces/new", element: /* @__PURE__ */ a(gr, {}) }),
1724
- /* @__PURE__ */ a(q, { path: "/invite", element: /* @__PURE__ */ a(xr, {}) }),
1725
- /* @__PURE__ */ a(q, { path: "/account", element: /* @__PURE__ */ a(yr, {}) }),
1726
- /* @__PURE__ */ a(q, { path: "/workspaces/:workspaceId/*", element: /* @__PURE__ */ a(At, {}) }),
1727
- Ct(),
1728
- Q ? /* @__PURE__ */ a(q, { path: "/__ui", element: /* @__PURE__ */ a(we, { fallback: /* @__PURE__ */ a("div", { className: "x1y5dg2c", children: /* @__PURE__ */ a(O, { tone: "muted", children: "Loading kit…" }) }), children: /* @__PURE__ */ a(Q, {}) }) }) : null,
1741
+ }, children: /* @__PURE__ */ _(vt, { children: [
1742
+ /* @__PURE__ */ a(q, { path: "/", element: /* @__PURE__ */ a(fr, {}) }),
1743
+ /* @__PURE__ */ a(q, { path: "/workspaces", element: /* @__PURE__ */ a(gr, {}) }),
1744
+ /* @__PURE__ */ a(q, { path: "/workspaces/new", element: /* @__PURE__ */ a(mr, {}) }),
1745
+ /* @__PURE__ */ a(q, { path: "/invite", element: /* @__PURE__ */ a(yr, {}) }),
1746
+ /* @__PURE__ */ a(q, { path: "/account", element: /* @__PURE__ */ a(vr, {}) }),
1747
+ /* @__PURE__ */ a(q, { path: "/cli/authorize", element: /* @__PURE__ */ a(br, {}) }),
1748
+ /* @__PURE__ */ a(q, { path: "/workspaces/:workspaceId/*", element: /* @__PURE__ */ a(Ct, {}) }),
1749
+ It(),
1750
+ Z ? /* @__PURE__ */ a(q, { path: "/__ui", element: /* @__PURE__ */ a(Se, { fallback: /* @__PURE__ */ a("div", { className: "x1y5dg2c", children: /* @__PURE__ */ a(S, { tone: "muted", children: "Loading kit…" }) }), children: /* @__PURE__ */ a(Z, {}) }) }) : null,
1729
1751
  /* @__PURE__ */ a(q, { path: "*", element: /* @__PURE__ */ a(Ie, { to: "/", replace: !0 }) })
1730
- ] }) }) }) }) : /* @__PURE__ */ a(lr, {});
1752
+ ] }) }) }) }) : /* @__PURE__ */ a(cr, {});
1731
1753
  }
1732
1754
  export {
1733
- Or as A,
1734
- hr as L,
1735
- fr as a,
1736
- br as i
1755
+ Pr as A,
1756
+ pr as L,
1757
+ hr as a,
1758
+ Sr as i
1737
1759
  };