@backmatter/studio 0.0.6 → 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.
- package/dist/chunks/{EmbedPublishPage-DazYJLaD.js → EmbedPublishPage-88VsmOhi.js} +1 -1
- package/dist/chunks/{UiKitPage-DyVyBp0I.js → UiKitPage-X4hkFL2d.js} +3 -3
- package/dist/chunks/{WorkspaceRoutes-CPvkgvxe.js → WorkspaceRoutes-DXzdWqN3.js} +20287 -18407
- package/dist/chunks/{dashboard-6aSS8oyj.js → dashboard-DCHRI0WD.js} +465 -443
- package/dist/chunks/{index-DgTNL4t3.js → index-BS0-Bvbk.js} +2 -2
- package/dist/chunks/{status-bar-action-RNBujSgk.js → status-bar-action-wj1KZ51m.js} +5512 -5382
- package/dist/dashboard.js +2 -2
- package/dist/index.js +4 -4
- package/dist/site-widget.js +2 -2
- package/dist/studio.css +450 -62
- package/package.json +3 -2
- package/src/App.tsx +2 -0
- package/src/WorkspaceRoutes.tsx +2 -0
- package/src/api.ts +80 -0
- package/src/chat/ChatMessage.tsx +10 -3
- package/src/chat/Composer.tsx +18 -18
- package/src/chat/chat-helpers.ts +58 -1
- package/src/chrome/AppSidebar.tsx +31 -156
- package/src/chrome/CommandPalette.tsx +211 -74
- package/src/chrome/ContentExplorerSidebar.tsx +1174 -0
- package/src/chrome/UserMenu.tsx +18 -3
- package/src/chrome/WorkspaceNavContext.tsx +1 -0
- package/src/chrome/command-palette-icons.tsx +152 -0
- package/src/chrome/content-path-tree.ts +95 -0
- package/src/chrome/content-repo-path.ts +52 -0
- package/src/chrome/explorer-icons.tsx +89 -0
- package/src/chrome/folder-create-context.ts +147 -0
- package/src/pages/BlockSettingsDialog.tsx +4 -0
- package/src/pages/CliAuthorizePage.tsx +43 -0
- package/src/pages/DocEditorPage.tsx +33 -4
- package/src/pages/MediaFieldInput.tsx +139 -0
- package/src/pages/MediaGalleryPage.tsx +752 -0
- package/src/pages/MediaLightbox.tsx +460 -0
- package/src/pages/SettingsUsagePage.tsx +19 -0
- package/src/pages/TypeDocsPage.tsx +2 -210
- package/src/pages/WorkspaceLayout.tsx +6 -1
- package/src/pages/media-grid.ts +190 -0
- package/src/pages/preview-url.ts +13 -2
- package/src/replica/useReplica.ts +9 -0
- package/src/ui/ConfirmDialog.tsx +1 -1
- package/src/workspace/permissions.ts +9 -0
- 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
|
|
5
|
-
import { useRef as et, useCallback as tt, useSyncExternalStore as nt, useState as
|
|
6
|
-
import { Y as st, Z as
|
|
7
|
-
import { T as
|
|
8
|
-
const
|
|
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 ?
|
|
11
|
-
},
|
|
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] ??
|
|
13
|
+
return W()[t] ?? re[t];
|
|
14
14
|
},
|
|
15
15
|
has(e, t) {
|
|
16
|
-
return t in W() || t in
|
|
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
|
-
|
|
33
|
-
var
|
|
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
|
|
38
|
+
const qt = 47;
|
|
39
39
|
function He(e) {
|
|
40
40
|
let t = e.length;
|
|
41
|
-
for (; t > 0 && e.charCodeAt(t - 1) ===
|
|
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
|
|
44
|
+
function zt(e) {
|
|
45
45
|
try {
|
|
46
46
|
return (He(new URL(e).pathname) || "/") !== "/";
|
|
47
47
|
} catch {
|
|
48
|
-
throw new
|
|
48
|
+
throw new se(`Invalid base URL: ${e}. Please provide a valid base URL.`);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function Bt(e) {
|
|
52
52
|
try {
|
|
53
53
|
const t = new URL(e);
|
|
54
|
-
if (t.protocol !== "http:" && t.protocol !== "https:") throw new
|
|
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
|
|
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
|
|
60
|
-
if (
|
|
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
|
|
65
|
-
if (e) return
|
|
64
|
+
function Ft(e, t, n, r, s) {
|
|
65
|
+
if (e) return le(e, t);
|
|
66
66
|
{
|
|
67
|
-
const i =
|
|
68
|
-
if (i) return
|
|
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
|
|
70
|
+
if (typeof window < "u" && window.location) return le(window.location.origin, t);
|
|
71
71
|
}
|
|
72
|
-
const
|
|
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
|
-
},
|
|
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,32 +82,32 @@ const zt = {
|
|
|
82
82
|
nan: NaN,
|
|
83
83
|
infinity: Number.POSITIVE_INFINITY,
|
|
84
84
|
"-infinity": Number.NEGATIVE_INFINITY
|
|
85
|
-
},
|
|
86
|
-
function
|
|
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
|
|
90
|
-
const t =
|
|
89
|
+
function $t(e) {
|
|
90
|
+
const t = Ht.exec(e);
|
|
91
91
|
if (!t) return null;
|
|
92
|
-
const [, n, r, s, i, l, d,
|
|
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
|
|
97
|
+
return Wt(p) ? p : null;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
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
|
|
104
|
-
if (!
|
|
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(
|
|
108
|
+
if (Object.entries(Mt).some(([o, u]) => {
|
|
109
109
|
const c = u.test(l);
|
|
110
|
-
return c && r && console.warn(`[better-json] Detected potential prototype pollution attempt using ${
|
|
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");
|
|
112
112
|
try {
|
|
113
113
|
return JSON.parse(l, (u, c) => {
|
|
@@ -116,64 +116,64 @@ function $t(e, t = {}) {
|
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
if (i && typeof c == "string") {
|
|
119
|
-
const m =
|
|
119
|
+
const m = $t(c);
|
|
120
120
|
if (m) return m;
|
|
121
121
|
}
|
|
122
122
|
return s ? s(u, c) : c;
|
|
123
123
|
});
|
|
124
|
-
} catch (
|
|
125
|
-
if (n) throw
|
|
124
|
+
} catch (o) {
|
|
125
|
+
if (n) throw o;
|
|
126
126
|
return e;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
return
|
|
129
|
+
function Vt(e, t = { strict: !0 }) {
|
|
130
|
+
return Gt(e, t);
|
|
131
131
|
}
|
|
132
|
-
const
|
|
132
|
+
const Jt = [
|
|
133
133
|
"javascript:",
|
|
134
134
|
"data:",
|
|
135
135
|
"vbscript:"
|
|
136
136
|
];
|
|
137
|
-
function
|
|
137
|
+
function Kt(e) {
|
|
138
138
|
let t;
|
|
139
139
|
try {
|
|
140
140
|
t = new URL(e);
|
|
141
141
|
} catch {
|
|
142
142
|
return !0;
|
|
143
143
|
}
|
|
144
|
-
return !
|
|
144
|
+
return !Jt.includes(t.protocol);
|
|
145
145
|
}
|
|
146
|
-
const
|
|
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) &&
|
|
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
|
|
159
|
-
const
|
|
160
|
-
let
|
|
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 (; $ <
|
|
163
|
-
t = $, $ +=
|
|
162
|
+
for (; $ < A.length; ) {
|
|
163
|
+
t = $, $ += me;
|
|
164
164
|
try {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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 (
|
|
174
|
+
if (A.length = $ = 0, e) throw e;
|
|
175
175
|
};
|
|
176
|
-
const
|
|
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 <
|
|
188
|
-
|
|
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
|
-
|
|
195
|
-
let i = !
|
|
194
|
+
Yt.epoch++;
|
|
195
|
+
let i = !A.length && !0;
|
|
196
196
|
for (let l of t)
|
|
197
|
-
|
|
197
|
+
A.push(
|
|
198
198
|
l,
|
|
199
199
|
n,
|
|
200
200
|
r,
|
|
201
201
|
s
|
|
202
202
|
);
|
|
203
|
-
i &&
|
|
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
|
-
},
|
|
221
|
-
let We = (e, t, n, r) => (e.events = e.events || {}, e.events[n +
|
|
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 +
|
|
229
|
-
}),
|
|
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
|
|
250
|
+
let nn = (e, t) => We(e, (r) => {
|
|
251
251
|
let s = t(r);
|
|
252
|
-
s && e.events[
|
|
253
|
-
},
|
|
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[
|
|
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[
|
|
262
|
-
e.events[
|
|
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 =
|
|
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
|
|
279
|
-
function
|
|
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 (
|
|
284
|
-
let [, t, n] = e.match(
|
|
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
|
|
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
|
|
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 (
|
|
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
|
|
321
|
-
return
|
|
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
|
|
326
|
-
var
|
|
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");
|
|
@@ -357,11 +357,11 @@ var on = class {
|
|
|
357
357
|
};
|
|
358
358
|
}
|
|
359
359
|
};
|
|
360
|
-
function
|
|
361
|
-
return globalThis[
|
|
360
|
+
function ue(e = "better-auth.message") {
|
|
361
|
+
return globalThis[ce] || (globalThis[ce] = new ln(e)), globalThis[ce];
|
|
362
362
|
}
|
|
363
|
-
const
|
|
364
|
-
var
|
|
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
|
|
388
|
-
return globalThis[
|
|
387
|
+
function Te() {
|
|
388
|
+
return globalThis[de] || (globalThis[de] = new cn()), globalThis[de];
|
|
389
389
|
}
|
|
390
|
-
const
|
|
391
|
-
var
|
|
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,72 +410,72 @@ var cn = class {
|
|
|
410
410
|
};
|
|
411
411
|
}
|
|
412
412
|
};
|
|
413
|
-
function
|
|
414
|
-
return globalThis[
|
|
413
|
+
function he() {
|
|
414
|
+
return globalThis[fe] || (globalThis[fe] = new un()), globalThis[fe];
|
|
415
415
|
}
|
|
416
|
-
const
|
|
417
|
-
function
|
|
418
|
-
var
|
|
419
|
-
const { fetchSession: t, shouldPollSession: n = () => !0, sessionSignal: r, options: s = {} } = e, i = ((
|
|
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 ||
|
|
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
|
-
|
|
429
|
+
o.lastSessionRequest = pe(), t();
|
|
430
430
|
return;
|
|
431
431
|
}
|
|
432
432
|
if ((f == null ? void 0 : f.event) === "visibilitychange") {
|
|
433
|
-
if (
|
|
434
|
-
|
|
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
|
-
|
|
440
|
+
ue().post({
|
|
441
441
|
event: "session",
|
|
442
442
|
data: { trigger: f },
|
|
443
443
|
clientId: Math.random().toString(36).substring(7)
|
|
444
444
|
});
|
|
445
445
|
}, p = () => {
|
|
446
|
-
i && i > 0 && (
|
|
446
|
+
i && i > 0 && (o.pollInterval = setInterval(() => {
|
|
447
447
|
n() && c({ event: "poll" });
|
|
448
448
|
}, i * 1e3));
|
|
449
449
|
}, g = () => {
|
|
450
|
-
|
|
450
|
+
o.unsubscribeBroadcast = ue().subscribe(() => {
|
|
451
451
|
c({ event: "storage" });
|
|
452
452
|
});
|
|
453
453
|
}, y = () => {
|
|
454
|
-
l && (
|
|
454
|
+
l && (o.unsubscribeFocus = Te().subscribe(() => {
|
|
455
455
|
c({ event: "visibilitychange" });
|
|
456
456
|
}));
|
|
457
457
|
}, v = () => {
|
|
458
|
-
|
|
458
|
+
o.unsubscribeOnline = he().subscribe((f) => {
|
|
459
459
|
f && c({ event: "visibilitychange" });
|
|
460
460
|
});
|
|
461
461
|
}, x = () => {
|
|
462
|
-
|
|
462
|
+
o.unsubscribeSignal = r.listen(() => {
|
|
463
463
|
t();
|
|
464
464
|
});
|
|
465
465
|
};
|
|
466
466
|
return {
|
|
467
467
|
init: () => {
|
|
468
|
-
|
|
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);
|
|
472
472
|
},
|
|
473
473
|
triggerRefetch: c,
|
|
474
474
|
broadcastSessionUpdate: m
|
|
475
475
|
};
|
|
476
476
|
}
|
|
477
|
-
const
|
|
478
|
-
function
|
|
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,33 +485,33 @@ function pn(e, t) {
|
|
|
485
485
|
isPending: !1
|
|
486
486
|
});
|
|
487
487
|
}
|
|
488
|
-
function
|
|
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
|
|
494
|
+
function mn(e) {
|
|
495
495
|
return !e || e.session === null && e.user === null ? null : e;
|
|
496
496
|
}
|
|
497
|
-
function
|
|
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
|
|
501
|
-
const n = /* @__PURE__ */
|
|
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__ */
|
|
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
|
-
|
|
514
|
-
const
|
|
513
|
+
on(d, xn);
|
|
514
|
+
const o = async (g, y) => {
|
|
515
515
|
const v = d.value;
|
|
516
516
|
if (d.set({
|
|
517
517
|
...v,
|
|
@@ -527,41 +527,41 @@ function xn(e, t) {
|
|
|
527
527
|
signal: g
|
|
528
528
|
});
|
|
529
529
|
if (g.aborted) return "aborted";
|
|
530
|
-
let { data:
|
|
531
|
-
if (
|
|
532
|
-
const
|
|
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:
|
|
537
|
+
({ data: k, error: E } = Pe(R));
|
|
538
538
|
} catch {
|
|
539
539
|
if (g.aborted) return "aborted";
|
|
540
|
-
|
|
540
|
+
O = "stale";
|
|
541
541
|
}
|
|
542
|
-
if (
|
|
543
|
-
const
|
|
542
|
+
if (E) {
|
|
543
|
+
const R = d.value, j = (E == null ? void 0 : E.status) === 401;
|
|
544
544
|
return d.set({
|
|
545
|
-
data:
|
|
546
|
-
error:
|
|
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 =
|
|
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
|
|
562
|
+
const k = d.value;
|
|
563
563
|
return d.set({
|
|
564
|
-
data:
|
|
564
|
+
data: k.data,
|
|
565
565
|
error: x,
|
|
566
566
|
isPending: !1,
|
|
567
567
|
isRefetching: !1,
|
|
@@ -571,17 +571,17 @@ 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() +
|
|
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 = {
|
|
578
578
|
cancel: () => y.abort(),
|
|
579
|
-
promise: Promise.resolve().then(() => y.signal.aborted ? "aborted" :
|
|
579
|
+
promise: Promise.resolve().then(() => y.signal.aborted ? "aborted" : o(y.signal, g)),
|
|
580
580
|
revision: i
|
|
581
581
|
};
|
|
582
582
|
r = v;
|
|
583
|
-
const x = (
|
|
584
|
-
r === v && (r = void 0,
|
|
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
|
|
592
|
+
return nn(d, () => {
|
|
593
593
|
let g;
|
|
594
|
-
|
|
594
|
+
hn() || (g = setTimeout(() => {
|
|
595
595
|
m();
|
|
596
596
|
}, 0));
|
|
597
|
-
const y =
|
|
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
|
|
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
|
|
619
|
-
if (!
|
|
620
|
-
return
|
|
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]] :
|
|
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,29 +632,29 @@ function me(e, t, n = ".", r) {
|
|
|
632
632
|
}
|
|
633
633
|
return s;
|
|
634
634
|
}
|
|
635
|
-
function
|
|
635
|
+
function vn(e) {
|
|
636
636
|
return (...t) => (
|
|
637
637
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
638
|
-
t.reduce((n, r) =>
|
|
638
|
+
t.reduce((n, r) => xe(n, r, "", e), {})
|
|
639
639
|
);
|
|
640
640
|
}
|
|
641
|
-
const
|
|
642
|
-
var
|
|
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
|
-
|
|
645
|
-
if (
|
|
646
|
-
for (var n of
|
|
647
|
-
Rn.call(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
|
-
},
|
|
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
|
-
},
|
|
655
|
+
}, On = async (e, t) => {
|
|
656
656
|
var n, r, s, i, l, d;
|
|
657
|
-
let
|
|
657
|
+
let o = t || {};
|
|
658
658
|
const u = {
|
|
659
659
|
onRequest: [t == null ? void 0 : t.onRequest],
|
|
660
660
|
onResponse: [t == null ? void 0 : t.onResponse],
|
|
@@ -665,22 +665,22 @@ var bn = Object.defineProperty, wn = Object.defineProperties, Sn = Object.getOwn
|
|
|
665
665
|
if (!t || !(t != null && t.plugins))
|
|
666
666
|
return {
|
|
667
667
|
url: e,
|
|
668
|
-
options:
|
|
668
|
+
options: o,
|
|
669
669
|
hooks: u
|
|
670
670
|
};
|
|
671
671
|
for (const c of (t == null ? void 0 : t.plugins) || []) {
|
|
672
672
|
if (c.init) {
|
|
673
673
|
const m = await ((n = c.init) == null ? void 0 : n.call(c, e.toString(), t));
|
|
674
|
-
|
|
674
|
+
o = m.options || o, e = m.url;
|
|
675
675
|
}
|
|
676
676
|
u.onRequest.push((r = c.hooks) == null ? void 0 : r.onRequest), u.onResponse.push((s = c.hooks) == null ? void 0 : s.onResponse), u.onSuccess.push((i = c.hooks) == null ? void 0 : i.onSuccess), u.onError.push((l = c.hooks) == null ? void 0 : l.onError), u.onRetry.push((d = c.hooks) == null ? void 0 : d.onRetry);
|
|
677
677
|
}
|
|
678
678
|
return {
|
|
679
679
|
url: e,
|
|
680
|
-
options:
|
|
680
|
+
options: o,
|
|
681
681
|
hooks: u
|
|
682
682
|
};
|
|
683
|
-
},
|
|
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
|
-
},
|
|
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
|
|
711
|
+
function Pn(e) {
|
|
712
712
|
if (typeof e == "number")
|
|
713
|
-
return new
|
|
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
|
|
720
|
+
return new Ae(e);
|
|
721
721
|
case "exponential":
|
|
722
|
-
return new
|
|
722
|
+
return new Tn(e);
|
|
723
723
|
default:
|
|
724
724
|
throw new Error("Invalid retry strategy");
|
|
725
725
|
}
|
|
726
726
|
}
|
|
727
|
-
var
|
|
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
|
-
},
|
|
755
|
-
function
|
|
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,7 +762,7 @@ function Un(e) {
|
|
|
762
762
|
if (!t)
|
|
763
763
|
return "json";
|
|
764
764
|
const r = t.split(";").shift() || "";
|
|
765
|
-
return
|
|
765
|
+
return Un.test(r) ? "json" : n.has(r) || r.startsWith("text/") ? "text" : "blob";
|
|
766
766
|
}
|
|
767
767
|
function jn(e) {
|
|
768
768
|
try {
|
|
@@ -811,26 +811,26 @@ function Je(...e) {
|
|
|
811
811
|
}
|
|
812
812
|
return t;
|
|
813
813
|
}
|
|
814
|
-
async function
|
|
815
|
-
const t = new Headers(Je(e == null ? void 0 : e.headers, await
|
|
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 =
|
|
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
|
|
822
|
+
function In(e) {
|
|
823
823
|
return Ve(e) ? "application/json" : null;
|
|
824
824
|
}
|
|
825
|
-
function
|
|
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
|
|
829
|
+
function zn(e, t) {
|
|
830
830
|
const { body: n } = e;
|
|
831
|
-
return n ? !Ve(n) || typeof n == "string" ? n :
|
|
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
|
|
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
|
|
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
|
|
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,25 +857,25 @@ 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
|
|
860
|
+
throw new Mn(n.issues);
|
|
861
861
|
return n.value;
|
|
862
862
|
}
|
|
863
|
-
var Xe = ["get", "post", "put", "patch", "delete"],
|
|
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",
|
|
867
867
|
async init(t, n) {
|
|
868
868
|
var r, s, i, l;
|
|
869
869
|
const d = ((s = (r = e.plugins) == null ? void 0 : r.find(
|
|
870
|
-
(
|
|
870
|
+
(o) => {
|
|
871
871
|
var u;
|
|
872
|
-
return (u =
|
|
872
|
+
return (u = o.schema) != null && u.config ? t.startsWith(o.schema.config.baseURL || "") || t.startsWith(o.schema.config.prefix || "") : !1;
|
|
873
873
|
}
|
|
874
874
|
)) == null ? void 0 : s.schema) || e.schema;
|
|
875
875
|
if (d) {
|
|
876
|
-
let
|
|
877
|
-
(i = d.config) != null && i.prefix &&
|
|
878
|
-
const u = d.schema[
|
|
876
|
+
let o = t;
|
|
877
|
+
(i = d.config) != null && i.prefix && o.startsWith(d.config.prefix) && (o = o.replace(d.config.prefix, ""), d.config.baseURL && (t = t.replace(d.config.prefix, d.config.baseURL))), (l = d.config) != null && l.baseURL && o.startsWith(d.config.baseURL) && (o = o.replace(d.config.baseURL, "")), o.startsWith("/") && o.charAt(1) === "@" && (o = o.substring(1));
|
|
878
|
+
const u = d.schema[o];
|
|
879
879
|
if (u) {
|
|
880
880
|
let c = n == null ? void 0 : n.headers;
|
|
881
881
|
if (u.headers && !(n != null && n.disableValidation)) {
|
|
@@ -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 =
|
|
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 =
|
|
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
|
-
}),
|
|
920
|
+
}), Hn = (e) => {
|
|
921
921
|
async function t(n, r) {
|
|
922
|
-
const s =
|
|
922
|
+
const s = N(U(U({}, e), r), {
|
|
923
923
|
headers: Je(e == null ? void 0 : e.headers, r == null ? void 0 : r.headers),
|
|
924
|
-
plugins: [...(e == null ? void 0 : e.plugins) || [],
|
|
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
|
|
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
|
|
940
|
+
return await ye(n, s);
|
|
941
941
|
}
|
|
942
942
|
return t;
|
|
943
|
-
},
|
|
944
|
-
function
|
|
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 (
|
|
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
|
|
952
|
+
function Gn(e, t) {
|
|
953
953
|
const { baseURL: n, params: r, query: s } = t || {
|
|
954
954
|
query: {},
|
|
955
955
|
params: {},
|
|
@@ -962,7 +962,7 @@ function $n(e, t) {
|
|
|
962
962
|
}
|
|
963
963
|
i.endsWith("/") || (i += "/");
|
|
964
964
|
let [l, d] = e.replace(i, "").split("?");
|
|
965
|
-
const
|
|
965
|
+
const o = new URLSearchParams(d);
|
|
966
966
|
for (const [p, g] of Object.entries(s || {})) {
|
|
967
967
|
if (g == null) continue;
|
|
968
968
|
let y;
|
|
@@ -970,11 +970,11 @@ function $n(e, t) {
|
|
|
970
970
|
y = g;
|
|
971
971
|
else if (Array.isArray(g)) {
|
|
972
972
|
for (const v of g)
|
|
973
|
-
|
|
973
|
+
o.append(p, v);
|
|
974
974
|
continue;
|
|
975
975
|
} else
|
|
976
976
|
y = JSON.stringify(g);
|
|
977
|
-
|
|
977
|
+
o.set(p, y);
|
|
978
978
|
}
|
|
979
979
|
const u = /* @__PURE__ */ new Map();
|
|
980
980
|
if (r)
|
|
@@ -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) =>
|
|
991
|
-
let c =
|
|
990
|
+
l = l.split("/").map((p) => $n(p, u)).join("/"), l = l.replace(/^\/+/, "");
|
|
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
|
|
995
|
-
var n, r, s, i, l, d,
|
|
994
|
+
var ye = async (e, t) => {
|
|
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
|
|
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:
|
|
1003
|
-
body:
|
|
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 } =
|
|
1013
|
+
const { clearTimeout: T } = Fn(p, y);
|
|
1014
1014
|
let f = await g(b.url, b);
|
|
1015
1015
|
T();
|
|
1016
|
-
const
|
|
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(
|
|
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,7 +1030,7 @@ var xe = async (e, t) => {
|
|
|
1030
1030
|
data: "",
|
|
1031
1031
|
error: null
|
|
1032
1032
|
};
|
|
1033
|
-
const h =
|
|
1033
|
+
const h = An(f), L = {
|
|
1034
1034
|
data: null,
|
|
1035
1035
|
response: f,
|
|
1036
1036
|
request: b
|
|
@@ -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(
|
|
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
|
|
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:
|
|
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(
|
|
1067
|
-
response: (
|
|
1066
|
+
P && await P(N(U({}, X), {
|
|
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 =
|
|
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(
|
|
1073
|
+
I && await I(R);
|
|
1074
1074
|
const L = P.getDelay(h);
|
|
1075
|
-
return await new Promise((I) => setTimeout(I, L)), await
|
|
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
|
|
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:
|
|
1088
|
+
error: N(U({}, M), {
|
|
1089
1089
|
status: f.status,
|
|
1090
1090
|
statusText: f.statusText
|
|
1091
1091
|
})
|
|
1092
1092
|
};
|
|
1093
1093
|
};
|
|
1094
|
-
const
|
|
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;
|
|
@@ -1106,39 +1106,39 @@ const Gn = (e) => {
|
|
|
1106
1106
|
} catch {
|
|
1107
1107
|
}
|
|
1108
1108
|
}
|
|
1109
|
-
},
|
|
1110
|
-
var
|
|
1111
|
-
const n = "credentials" in Request.prototype, r =
|
|
1109
|
+
}, Jn = (e, t) => {
|
|
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: {
|
|
1115
|
-
onSuccess: (
|
|
1115
|
+
onSuccess: (j = e == null ? void 0 : e.fetchOptions) == null ? void 0 : j.onSuccess,
|
|
1116
1116
|
onError: (C = e == null ? void 0 : e.fetchOptions) == null ? void 0 : C.onError,
|
|
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:
|
|
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 ?
|
|
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 ? [] : [
|
|
1132
|
+
...e != null && e.disableDefaultFetchPlugins ? [] : [Xt],
|
|
1133
1133
|
...s
|
|
1134
1134
|
]
|
|
1135
|
-
}), { $sessionSignal: p, session: g, broadcastSessionUpdate: y } =
|
|
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,
|
|
1139
|
-
},
|
|
1140
|
-
let
|
|
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
|
|
1159
|
-
h.getAtoms && Object.assign(
|
|
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
|
-
|
|
1162
|
+
O[h].set(!O[h].get());
|
|
1163
1163
|
},
|
|
1164
1164
|
listen: (h, L) => {
|
|
1165
|
-
|
|
1165
|
+
O[h].subscribe(L);
|
|
1166
1166
|
},
|
|
1167
|
-
atoms:
|
|
1167
|
+
atoms: O
|
|
1168
1168
|
};
|
|
1169
|
-
for (const h of
|
|
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:
|
|
1175
|
-
pluginsAtoms:
|
|
1174
|
+
pluginsActions: E,
|
|
1175
|
+
pluginsAtoms: O,
|
|
1176
1176
|
pluginPathMethods: b,
|
|
1177
1177
|
atomListeners: T,
|
|
1178
1178
|
hydrateSession: x,
|
|
@@ -1181,66 +1181,66 @@ const Gn = (e) => {
|
|
|
1181
1181
|
$store: f
|
|
1182
1182
|
};
|
|
1183
1183
|
};
|
|
1184
|
-
function
|
|
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
|
|
1187
|
+
function Xn(e) {
|
|
1188
1188
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
1189
1189
|
}
|
|
1190
|
-
const
|
|
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
|
|
1192
|
+
return e.replace(Qn, "").match(Yn) ?? [];
|
|
1193
|
+
}
|
|
1194
|
+
function er(e) {
|
|
1195
|
+
return Zn(e).map((t) => t.toLowerCase()).join("-");
|
|
1196
1196
|
}
|
|
1197
|
-
function
|
|
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
|
|
1201
|
+
function nr(e, t, n, r, s) {
|
|
1202
1202
|
function i(l = []) {
|
|
1203
1203
|
return new Proxy(function() {
|
|
1204
1204
|
}, {
|
|
1205
|
-
get(d,
|
|
1206
|
-
if (typeof
|
|
1207
|
-
const u = [...l,
|
|
1205
|
+
get(d, o) {
|
|
1206
|
+
if (typeof o != "string" || o === "then" || o === "catch" || o === "finally") return;
|
|
1207
|
+
const u = [...l, o];
|
|
1208
1208
|
let c = e;
|
|
1209
1209
|
for (const m of u) if (c && typeof c == "object" && m in c) c = c[m];
|
|
1210
1210
|
else {
|
|
1211
1211
|
c = void 0;
|
|
1212
1212
|
break;
|
|
1213
1213
|
}
|
|
1214
|
-
return typeof c == "function" ||
|
|
1214
|
+
return typeof c == "function" || Kn(c) ? c : i(u);
|
|
1215
1215
|
},
|
|
1216
|
-
apply: async (d,
|
|
1217
|
-
const c = "/" + l.map(
|
|
1216
|
+
apply: async (d, o, u) => {
|
|
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
|
-
},
|
|
1220
|
+
}, k = tr(c, n, m);
|
|
1221
1221
|
return await t(c, {
|
|
1222
1222
|
...x,
|
|
1223
|
-
body:
|
|
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:
|
|
1229
|
-
async onSuccess(
|
|
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,
|
|
1232
|
-
const
|
|
1233
|
-
if (!
|
|
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
|
|
1236
|
-
const
|
|
1237
|
-
if (!
|
|
1238
|
-
if (b.has(
|
|
1239
|
-
b.add(
|
|
1240
|
-
const C =
|
|
1235
|
+
for (const R of O) {
|
|
1236
|
+
const j = r[R.signal];
|
|
1237
|
+
if (!j) return;
|
|
1238
|
+
if (b.has(R.signal)) continue;
|
|
1239
|
+
b.add(R.signal);
|
|
1240
|
+
const C = j.get();
|
|
1241
1241
|
setTimeout(() => {
|
|
1242
|
-
|
|
1243
|
-
}, 10), (f =
|
|
1242
|
+
j.set(!C);
|
|
1243
|
+
}, 10), (f = R.callback) == null || f.call(R, c);
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
1246
|
});
|
|
@@ -1249,54 +1249,54 @@ function tr(e, t, n, r, s) {
|
|
|
1249
1249
|
}
|
|
1250
1250
|
return i();
|
|
1251
1251
|
}
|
|
1252
|
-
function
|
|
1252
|
+
function rr(e, t = {}) {
|
|
1253
1253
|
const n = et(e.get()), { keys: r, deps: s = [e, r] } = t, i = tt((d) => {
|
|
1254
|
-
const
|
|
1254
|
+
const o = (u) => {
|
|
1255
1255
|
n.current !== u && (n.current = u, d());
|
|
1256
1256
|
};
|
|
1257
|
-
return
|
|
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) {
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1262
|
+
return `use${Xn(e)}`;
|
|
1263
|
+
}
|
|
1264
|
+
function ir(e) {
|
|
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[sr(u)] = () => rr(c);
|
|
1267
|
+
return nr({
|
|
1268
1268
|
...n,
|
|
1269
|
-
...
|
|
1269
|
+
...o,
|
|
1270
1270
|
hydrateSession: s,
|
|
1271
1271
|
$fetch: i,
|
|
1272
1272
|
$store: l
|
|
1273
1273
|
}, i, t, r, d);
|
|
1274
1274
|
}
|
|
1275
|
-
var
|
|
1276
|
-
const ar =
|
|
1275
|
+
var or = "1.7.3";
|
|
1276
|
+
const ar = or, lr = () => ({
|
|
1277
1277
|
id: "magic-link",
|
|
1278
1278
|
version: ar,
|
|
1279
1279
|
$InferServerPlugin: {}
|
|
1280
1280
|
});
|
|
1281
|
-
let
|
|
1282
|
-
function
|
|
1283
|
-
return
|
|
1281
|
+
let Ce = null;
|
|
1282
|
+
function F() {
|
|
1283
|
+
return Ce ?? (Ce = ir({
|
|
1284
1284
|
baseURL: st(),
|
|
1285
|
-
plugins: [
|
|
1286
|
-
})),
|
|
1285
|
+
plugins: [lr()]
|
|
1286
|
+
})), Ce;
|
|
1287
1287
|
}
|
|
1288
|
-
function
|
|
1289
|
-
const [e] =
|
|
1290
|
-
|
|
1291
|
-
it().then((f) =>
|
|
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
|
+
it().then((f) => o(f.github)).catch(() => o(!1));
|
|
1292
1292
|
}, []);
|
|
1293
|
-
const
|
|
1294
|
-
async function
|
|
1293
|
+
const E = window.location.href;
|
|
1294
|
+
async function O() {
|
|
1295
1295
|
l(!0), n(null);
|
|
1296
1296
|
try {
|
|
1297
|
-
await
|
|
1297
|
+
await F().signIn.social({
|
|
1298
1298
|
provider: "github",
|
|
1299
|
-
callbackURL:
|
|
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
|
|
1307
|
+
const f = await F().signIn.magicLink({
|
|
1308
1308
|
email: c,
|
|
1309
|
-
callbackURL:
|
|
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,34 +1316,34 @@ function lr() {
|
|
|
1316
1316
|
}
|
|
1317
1317
|
async function T(f) {
|
|
1318
1318
|
f.preventDefault(), l(!0), n(null);
|
|
1319
|
-
const
|
|
1319
|
+
const R = x === "signup" ? await F().signUp.email({
|
|
1320
1320
|
email: c,
|
|
1321
1321
|
password: p,
|
|
1322
1322
|
name: y,
|
|
1323
|
-
callbackURL:
|
|
1324
|
-
}) : await
|
|
1323
|
+
callbackURL: E
|
|
1324
|
+
}) : await F().signIn.email({
|
|
1325
1325
|
email: c,
|
|
1326
1326
|
password: p,
|
|
1327
|
-
callbackURL:
|
|
1327
|
+
callbackURL: E
|
|
1328
1328
|
});
|
|
1329
|
-
if (
|
|
1330
|
-
n(
|
|
1329
|
+
if (R.error) {
|
|
1330
|
+
n(R.error.message ?? "Sign-in failed"), l(!1);
|
|
1331
1331
|
return;
|
|
1332
1332
|
}
|
|
1333
|
-
window.location.assign(
|
|
1333
|
+
window.location.assign(E);
|
|
1334
1334
|
}
|
|
1335
|
-
return /* @__PURE__ */
|
|
1336
|
-
/* @__PURE__ */
|
|
1337
|
-
/* @__PURE__ */
|
|
1338
|
-
/* @__PURE__ */
|
|
1339
|
-
/* @__PURE__ */
|
|
1340
|
-
/* @__PURE__ */
|
|
1341
|
-
/* @__PURE__ */
|
|
1342
|
-
t ? /* @__PURE__ */
|
|
1343
|
-
r ? /* @__PURE__ */
|
|
1344
|
-
/* @__PURE__ */
|
|
1345
|
-
x === "signup" ? /* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */
|
|
1335
|
+
return /* @__PURE__ */ _("main", { ...at(lt, dr.main), children: [
|
|
1336
|
+
/* @__PURE__ */ a("div", { className: "x10l6tqk x10a8y8t x47corl x87ps6o xlxt4rd", "aria-hidden": !0 }),
|
|
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
|
+
/* @__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(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
|
+
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
|
+
/* @__PURE__ */ a("input", { required: !0, type: "email", value: c, onChange: (f) => m(f.target.value), placeholder: "Email", autoComplete: "email", readOnly: !!u, ...{
|
|
1347
1347
|
0: {
|
|
1348
1348
|
className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x17ia0ru x1l3a84d"
|
|
1349
1349
|
},
|
|
@@ -1351,8 +1351,8 @@ function lr() {
|
|
|
1351
1351
|
className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x1l3a84d x10jjolp"
|
|
1352
1352
|
}
|
|
1353
1353
|
}[!!u << 0] }),
|
|
1354
|
-
/* @__PURE__ */
|
|
1355
|
-
/* @__PURE__ */
|
|
1354
|
+
/* @__PURE__ */ a("input", { required: !0, type: "password", value: p, onChange: (f) => g(f.target.value), placeholder: "Password", autoComplete: x === "signup" ? "new-password" : "current-password", className: "x9f619 xh8yej3 x1gg8mnh x173sf5p xmkeg23 x1y0btm7 x198m1os x4pepcl xf6xdpg x17ia0ru x1l3a84d" }),
|
|
1355
|
+
/* @__PURE__ */ a("button", { type: "submit", disabled: i, ...{
|
|
1356
1356
|
0: {
|
|
1357
1357
|
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k x3smv4v x161b3w3 xc342km x1e6avla xj4hn0o x1wt99x4 x1l3a84d xk50ysn x1u7k74 xggy1nq xr1c510 xx6bhzk xwji4o3 xq3txz7 xd3so5o x12w9bfk xb93eig"
|
|
1358
1358
|
},
|
|
@@ -1361,7 +1361,7 @@ function lr() {
|
|
|
1361
1361
|
}
|
|
1362
1362
|
}[!!i << 0], children: x === "signup" ? "Create account" : "Sign in" })
|
|
1363
1363
|
] }),
|
|
1364
|
-
/* @__PURE__ */
|
|
1364
|
+
/* @__PURE__ */ a("button", { type: "button", disabled: i || !c, onClick: () => void b(), ...{
|
|
1365
1365
|
0: {
|
|
1366
1366
|
className: "x3nfvp2 x9f619 xh8yej3 x1gg8mnh x6s0dn4 xl56j7k xc342km x1e6avla xjbqb8w x1n0nidx x1vrk1b5 x1ypdohk"
|
|
1367
1367
|
},
|
|
@@ -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__ */
|
|
1373
|
-
/* @__PURE__ */
|
|
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__ */
|
|
1381
|
+
/* @__PURE__ */ a(ot, { size: 18 }),
|
|
1382
1382
|
"Continue with GitHub"
|
|
1383
1383
|
] })
|
|
1384
1384
|
] })
|
|
1385
1385
|
] })
|
|
1386
1386
|
] });
|
|
1387
1387
|
}
|
|
1388
|
-
function
|
|
1389
|
-
return /* @__PURE__ */
|
|
1390
|
-
/* @__PURE__ */
|
|
1391
|
-
/* @__PURE__ */
|
|
1392
|
-
/* @__PURE__ */
|
|
1388
|
+
function ur() {
|
|
1389
|
+
return /* @__PURE__ */ _("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", "aria-hidden": !0, children: [
|
|
1390
|
+
/* @__PURE__ */ a("circle", { cx: "24", cy: "24", r: "18.25", stroke: "currentColor", strokeWidth: "1.25", opacity: "0.28" }),
|
|
1391
|
+
/* @__PURE__ */ a("circle", { cx: "24", cy: "24", r: "11.25", stroke: "currentColor", strokeWidth: "1.25", opacity: "0.55" }),
|
|
1392
|
+
/* @__PURE__ */ a("circle", { cx: "24", cy: "24", r: "4", fill: "currentColor" })
|
|
1393
1393
|
] });
|
|
1394
1394
|
}
|
|
1395
|
-
const
|
|
1395
|
+
const dr = {
|
|
1396
1396
|
main: {
|
|
1397
1397
|
kVAEAm: "x1n2onr6",
|
|
1398
1398
|
k1xSpc: "x78zum5",
|
|
@@ -1409,44 +1409,44 @@ const ur = {
|
|
|
1409
1409
|
$$css: !0
|
|
1410
1410
|
}
|
|
1411
1411
|
};
|
|
1412
|
-
function
|
|
1412
|
+
function fr() {
|
|
1413
1413
|
var s;
|
|
1414
|
-
const { userId: e } =
|
|
1415
|
-
return r === "/workspaces" && n &&
|
|
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
|
|
1417
|
+
function hr({
|
|
1418
1418
|
to: e,
|
|
1419
1419
|
title: t,
|
|
1420
1420
|
meta: n,
|
|
1421
1421
|
trailing: r
|
|
1422
1422
|
}) {
|
|
1423
|
-
return /* @__PURE__ */
|
|
1424
|
-
/* @__PURE__ */
|
|
1425
|
-
/* @__PURE__ */
|
|
1426
|
-
n ? /* @__PURE__ */
|
|
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
|
+
/* @__PURE__ */ a("span", { className: "x17tv04q xk50ysn", children: t }),
|
|
1426
|
+
n ? /* @__PURE__ */ a("span", { className: "x1vrk1b5 x111yfic", children: n }) : null
|
|
1427
1427
|
] }),
|
|
1428
|
-
r ? /* @__PURE__ */
|
|
1428
|
+
r ? /* @__PURE__ */ a("span", { className: "x2lah0s x1vrk1b5 x111yfic", children: r }) : null
|
|
1429
1429
|
] });
|
|
1430
1430
|
}
|
|
1431
|
-
function
|
|
1431
|
+
function pr({
|
|
1432
1432
|
children: e
|
|
1433
1433
|
}) {
|
|
1434
|
-
return /* @__PURE__ */
|
|
1434
|
+
return /* @__PURE__ */ a("div", { className: "x78zum5 xdt5ytf xmkeg23 x1y0btm7 x1j0qoeq x13oidi x1hb2obb xb3r6kr", children: e });
|
|
1435
1435
|
}
|
|
1436
|
-
function
|
|
1436
|
+
function gr() {
|
|
1437
1437
|
var t;
|
|
1438
1438
|
const e = ((t = Me().control) == null ? void 0 : t.workspaces) ?? [];
|
|
1439
|
-
return /* @__PURE__ */
|
|
1440
|
-
/* @__PURE__ */
|
|
1439
|
+
return /* @__PURE__ */ _(ae, { centered: !0, children: [
|
|
1440
|
+
/* @__PURE__ */ a(
|
|
1441
1441
|
V,
|
|
1442
1442
|
{
|
|
1443
1443
|
title: "Workspaces",
|
|
1444
1444
|
description: "Each workspace is a site and a team.",
|
|
1445
|
-
action: /* @__PURE__ */
|
|
1445
|
+
action: /* @__PURE__ */ a(qe, { to: "/workspaces/new", children: "New workspace" })
|
|
1446
1446
|
}
|
|
1447
1447
|
),
|
|
1448
|
-
e.length === 0 ? /* @__PURE__ */
|
|
1449
|
-
|
|
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
1451
|
to: ut(n.slug),
|
|
1452
1452
|
title: n.name,
|
|
@@ -1456,10 +1456,10 @@ function pr() {
|
|
|
1456
1456
|
)) })
|
|
1457
1457
|
] });
|
|
1458
1458
|
}
|
|
1459
|
-
function
|
|
1460
|
-
const e =
|
|
1461
|
-
async function d(
|
|
1462
|
-
|
|
1459
|
+
function mr() {
|
|
1460
|
+
const e = ze(), [t, n] = w(""), [r, s] = w(null), [i, l] = w(!1);
|
|
1461
|
+
async function d(o) {
|
|
1462
|
+
o.preventDefault(), l(!0), s(null);
|
|
1463
1463
|
try {
|
|
1464
1464
|
const { workspace: u } = await dt(t), c = B.getState().control;
|
|
1465
1465
|
c && B.applyControl({
|
|
@@ -1480,30 +1480,30 @@ function gr() {
|
|
|
1480
1480
|
l(!1);
|
|
1481
1481
|
}
|
|
1482
1482
|
}
|
|
1483
|
-
return /* @__PURE__ */
|
|
1484
|
-
/* @__PURE__ */
|
|
1483
|
+
return /* @__PURE__ */ _(ae, { children: [
|
|
1484
|
+
/* @__PURE__ */ a(
|
|
1485
1485
|
V,
|
|
1486
1486
|
{
|
|
1487
|
-
kicker: /* @__PURE__ */
|
|
1487
|
+
kicker: /* @__PURE__ */ a(St, { to: "/workspaces", children: "← Workspaces" }),
|
|
1488
1488
|
title: "Create workspace"
|
|
1489
1489
|
}
|
|
1490
1490
|
),
|
|
1491
|
-
/* @__PURE__ */
|
|
1492
|
-
/* @__PURE__ */
|
|
1493
|
-
|
|
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,
|
|
1497
|
-
onChange: (
|
|
1497
|
+
onChange: (o) => n(o.target.value),
|
|
1498
1498
|
placeholder: "Docs site"
|
|
1499
1499
|
}
|
|
1500
1500
|
) }),
|
|
1501
|
-
r ? /* @__PURE__ */
|
|
1502
|
-
/* @__PURE__ */
|
|
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
|
|
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,9 +1519,9 @@ function mr(e, t) {
|
|
|
1519
1519
|
return t;
|
|
1520
1520
|
}
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1523
|
-
const [e] =
|
|
1524
|
-
|
|
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;
|
|
@@ -1533,60 +1533,60 @@ function xr() {
|
|
|
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
|
|
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(
|
|
1542
|
+
i(xr(g, y));
|
|
1543
1543
|
}), () => {
|
|
1544
1544
|
m = !0;
|
|
1545
1545
|
};
|
|
1546
1546
|
}, [t, n]);
|
|
1547
1547
|
async function c() {
|
|
1548
|
-
await
|
|
1549
|
-
}),
|
|
1548
|
+
await F().signOut().catch(() => {
|
|
1549
|
+
}), ne(), B.wipe(), window.location.assign(window.location.href);
|
|
1550
1550
|
}
|
|
1551
|
-
return /* @__PURE__ */
|
|
1552
|
-
/* @__PURE__ */
|
|
1553
|
-
|
|
1554
|
-
/* @__PURE__ */
|
|
1555
|
-
/* @__PURE__ */
|
|
1556
|
-
/* @__PURE__ */
|
|
1557
|
-
] }) : s ? /* @__PURE__ */
|
|
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
|
|
1561
|
-
const { email: e, userId: t } =
|
|
1562
|
-
|
|
1563
|
-
|
|
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
|
|
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__ */
|
|
1577
|
-
/* @__PURE__ */
|
|
1576
|
+
return /* @__PURE__ */ _(ae, { children: [
|
|
1577
|
+
/* @__PURE__ */ a(
|
|
1578
1578
|
V,
|
|
1579
1579
|
{
|
|
1580
1580
|
title: "User settings",
|
|
1581
1581
|
description: "Your account on this Backmatter instance."
|
|
1582
1582
|
}
|
|
1583
1583
|
),
|
|
1584
|
-
/* @__PURE__ */
|
|
1585
|
-
/* @__PURE__ */
|
|
1586
|
-
/* @__PURE__ */
|
|
1587
|
-
/* @__PURE__ */
|
|
1588
|
-
/* @__PURE__ */
|
|
1589
|
-
|
|
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__ */
|
|
1599
|
-
|
|
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,12 +1604,12 @@ function yr() {
|
|
|
1604
1604
|
spellCheck: !1
|
|
1605
1605
|
}
|
|
1606
1606
|
) }),
|
|
1607
|
-
l ? /* @__PURE__ */
|
|
1608
|
-
s ? /* @__PURE__ */
|
|
1609
|
-
/* @__PURE__ */
|
|
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__ */
|
|
1612
|
-
/* @__PURE__ */
|
|
1611
|
+
/* @__PURE__ */ _("div", { children: [
|
|
1612
|
+
/* @__PURE__ */ a(
|
|
1613
1613
|
V,
|
|
1614
1614
|
{
|
|
1615
1615
|
title: "Connectors",
|
|
@@ -1617,18 +1617,39 @@ function yr() {
|
|
|
1617
1617
|
compact: !0
|
|
1618
1618
|
}
|
|
1619
1619
|
),
|
|
1620
|
-
/* @__PURE__ */
|
|
1620
|
+
/* @__PURE__ */ a(Et, { scope: "user", canEdit: !0 })
|
|
1621
1621
|
] })
|
|
1622
1622
|
] })
|
|
1623
1623
|
] });
|
|
1624
1624
|
}
|
|
1625
|
-
function
|
|
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] =
|
|
1649
|
+
const [t, n] = w({
|
|
1629
1650
|
kind: "working"
|
|
1630
1651
|
});
|
|
1631
|
-
return
|
|
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
|
|
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
|
|
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(
|
|
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__ */
|
|
1672
|
-
/* @__PURE__ */
|
|
1673
|
-
/* @__PURE__ */
|
|
1674
|
-
] }) : /* @__PURE__ */
|
|
1675
|
-
/* @__PURE__ */
|
|
1676
|
-
/* @__PURE__ */
|
|
1677
|
-
/* @__PURE__ */
|
|
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 }),
|
|
1698
|
+
/* @__PURE__ */ a(qe, { to: "/", variant: "secondary", children: "Back to the dashboard" })
|
|
1678
1699
|
] }) }) });
|
|
1679
1700
|
}
|
|
1680
|
-
const
|
|
1701
|
+
const Z = Be() ? rt(() => import("./UiKitPage-X4hkFL2d.js").then((e) => ({
|
|
1681
1702
|
default: e.UiKitPage
|
|
1682
1703
|
}))) : null;
|
|
1683
|
-
function
|
|
1704
|
+
function Sr(e) {
|
|
1684
1705
|
return Be() && e.replace(/\/$/, "") === "/__ui";
|
|
1685
1706
|
}
|
|
1686
|
-
function
|
|
1687
|
-
return /* @__PURE__ */
|
|
1707
|
+
function Pr() {
|
|
1708
|
+
return /* @__PURE__ */ a(Tt, { children: /* @__PURE__ */ a(mt, { children: /* @__PURE__ */ a(kr, {}) }) });
|
|
1688
1709
|
}
|
|
1689
|
-
function
|
|
1690
|
-
const e =
|
|
1691
|
-
const r =
|
|
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
|
|
1697
|
-
|
|
1717
|
+
return K(() => {
|
|
1718
|
+
be().then((r) => {
|
|
1698
1719
|
if (!(r != null && r.user)) {
|
|
1699
|
-
|
|
1720
|
+
ne(), B.wipe(), n(null);
|
|
1700
1721
|
return;
|
|
1701
1722
|
}
|
|
1702
|
-
if (
|
|
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 =
|
|
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
|
-
|
|
1733
|
+
ne(), B.wipe(), n(null);
|
|
1713
1734
|
});
|
|
1714
|
-
}, []),
|
|
1715
|
-
|
|
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__ */
|
|
1721
|
-
/* @__PURE__ */
|
|
1722
|
-
/* @__PURE__ */
|
|
1723
|
-
/* @__PURE__ */
|
|
1724
|
-
/* @__PURE__ */
|
|
1725
|
-
/* @__PURE__ */
|
|
1726
|
-
/* @__PURE__ */
|
|
1727
|
-
Ct
|
|
1728
|
-
|
|
1729
|
-
/* @__PURE__ */
|
|
1730
|
-
|
|
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,
|
|
1751
|
+
/* @__PURE__ */ a(q, { path: "*", element: /* @__PURE__ */ a(Ie, { to: "/", replace: !0 }) })
|
|
1752
|
+
] }) }) }) }) : /* @__PURE__ */ a(cr, {});
|
|
1731
1753
|
}
|
|
1732
1754
|
export {
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1755
|
+
Pr as A,
|
|
1756
|
+
pr as L,
|
|
1757
|
+
hr as a,
|
|
1758
|
+
Sr as i
|
|
1737
1759
|
};
|