@shiftengineering/folio 0.1.7 → 0.1.8
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.
|
@@ -50,11 +50,11 @@ var dt = {};
|
|
|
50
50
|
var Zr;
|
|
51
51
|
function Gs() {
|
|
52
52
|
return Zr || (Zr = 1, process.env.NODE_ENV !== "production" && function() {
|
|
53
|
-
var t = qn, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), l = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), m = Symbol.for("react.offscreen"),
|
|
54
|
-
function
|
|
53
|
+
var t = qn, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), l = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), m = Symbol.for("react.offscreen"), R = Symbol.iterator, v = "@@iterator";
|
|
54
|
+
function O(i) {
|
|
55
55
|
if (i === null || typeof i != "object")
|
|
56
56
|
return null;
|
|
57
|
-
var y =
|
|
57
|
+
var y = R && i[R] || i[v];
|
|
58
58
|
return typeof y == "function" ? y : null;
|
|
59
59
|
}
|
|
60
60
|
var A = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
@@ -538,7 +538,7 @@ Check the top-level render call using <` + b + ">.");
|
|
|
538
538
|
else if (Bt(i))
|
|
539
539
|
i._store && (i._store.validated = !0);
|
|
540
540
|
else if (i) {
|
|
541
|
-
var D =
|
|
541
|
+
var D = O(i);
|
|
542
542
|
if (typeof D == "function" && D !== i.entries)
|
|
543
543
|
for (var I = D.call(i), F; !(F = I.next()).done; )
|
|
544
544
|
Bt(F.value) && Wr(F.value, y);
|
|
@@ -952,33 +952,33 @@ function Jt(t) {
|
|
|
952
952
|
function $n(t) {
|
|
953
953
|
let e = !1, r = 0, n = !1, s;
|
|
954
954
|
const a = ur(), u = (v) => {
|
|
955
|
-
var
|
|
956
|
-
n || (p(new Qn(v)), (
|
|
955
|
+
var O;
|
|
956
|
+
n || (p(new Qn(v)), (O = t.abort) == null || O.call(t));
|
|
957
957
|
}, l = () => {
|
|
958
958
|
e = !0;
|
|
959
959
|
}, c = () => {
|
|
960
960
|
e = !1;
|
|
961
961
|
}, d = () => Sr.isFocused() && (t.networkMode === "always" || Nt.isOnline()) && t.canRun(), h = () => Ln(t.networkMode) && t.canRun(), f = (v) => {
|
|
962
|
-
var
|
|
963
|
-
n || (n = !0, (
|
|
962
|
+
var O;
|
|
963
|
+
n || (n = !0, (O = t.onSuccess) == null || O.call(t, v), s == null || s(), a.resolve(v));
|
|
964
964
|
}, p = (v) => {
|
|
965
|
-
var
|
|
966
|
-
n || (n = !0, (
|
|
965
|
+
var O;
|
|
966
|
+
n || (n = !0, (O = t.onError) == null || O.call(t, v), s == null || s(), a.reject(v));
|
|
967
967
|
}, m = () => new Promise((v) => {
|
|
968
|
-
var
|
|
968
|
+
var O;
|
|
969
969
|
s = (A) => {
|
|
970
970
|
(n || d()) && v(A);
|
|
971
|
-
}, (
|
|
971
|
+
}, (O = t.onPause) == null || O.call(t);
|
|
972
972
|
}).then(() => {
|
|
973
973
|
var v;
|
|
974
974
|
s = void 0, n || (v = t.onContinue) == null || v.call(t);
|
|
975
|
-
}),
|
|
975
|
+
}), R = () => {
|
|
976
976
|
if (n)
|
|
977
977
|
return;
|
|
978
978
|
let v;
|
|
979
|
-
const
|
|
979
|
+
const O = r === 0 ? t.initialPromise : void 0;
|
|
980
980
|
try {
|
|
981
|
-
v =
|
|
981
|
+
v = O ?? t.fn();
|
|
982
982
|
} catch (A) {
|
|
983
983
|
v = Promise.reject(A);
|
|
984
984
|
}
|
|
@@ -992,7 +992,7 @@ function $n(t) {
|
|
|
992
992
|
return;
|
|
993
993
|
}
|
|
994
994
|
r++, (X = t.onFail) == null || X.call(t, r, A), Zs(Q).then(() => d() ? void 0 : m()).then(() => {
|
|
995
|
-
e ? p(A) :
|
|
995
|
+
e ? p(A) : R();
|
|
996
996
|
});
|
|
997
997
|
});
|
|
998
998
|
};
|
|
@@ -1003,7 +1003,7 @@ function $n(t) {
|
|
|
1003
1003
|
cancelRetry: l,
|
|
1004
1004
|
continueRetry: c,
|
|
1005
1005
|
canStart: h,
|
|
1006
|
-
start: () => (h() ?
|
|
1006
|
+
start: () => (h() ? R() : m().then(R), a)
|
|
1007
1007
|
};
|
|
1008
1008
|
}
|
|
1009
1009
|
function ii() {
|
|
@@ -1217,7 +1217,7 @@ var L = ii(), ke, Rn, Kn = (Rn = class {
|
|
|
1217
1217
|
this
|
|
1218
1218
|
), g(this, Je, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((d = u.fetchOptions) == null ? void 0 : d.meta)) && P(this, re, le).call(this, { type: "fetch", meta: (h = u.fetchOptions) == null ? void 0 : h.meta });
|
|
1219
1219
|
const l = (f) => {
|
|
1220
|
-
var p, m,
|
|
1220
|
+
var p, m, R, v;
|
|
1221
1221
|
Jt(f) && f.silent || P(this, re, le).call(this, {
|
|
1222
1222
|
type: "error",
|
|
1223
1223
|
error: f
|
|
@@ -1225,8 +1225,8 @@ var L = ii(), ke, Rn, Kn = (Rn = class {
|
|
|
1225
1225
|
p,
|
|
1226
1226
|
f,
|
|
1227
1227
|
this
|
|
1228
|
-
), (v = (
|
|
1229
|
-
|
|
1228
|
+
), (v = (R = o(this, ee).config).onSettled) == null || v.call(
|
|
1229
|
+
R,
|
|
1230
1230
|
this.state.data,
|
|
1231
1231
|
f,
|
|
1232
1232
|
this
|
|
@@ -1237,7 +1237,7 @@ var L = ii(), ke, Rn, Kn = (Rn = class {
|
|
|
1237
1237
|
fn: u.fetchFn,
|
|
1238
1238
|
abort: n.abort.bind(n),
|
|
1239
1239
|
onSuccess: (f) => {
|
|
1240
|
-
var p, m,
|
|
1240
|
+
var p, m, R, v;
|
|
1241
1241
|
if (f === void 0) {
|
|
1242
1242
|
process.env.NODE_ENV !== "production" && console.error(
|
|
1243
1243
|
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
@@ -1246,12 +1246,12 @@ var L = ii(), ke, Rn, Kn = (Rn = class {
|
|
|
1246
1246
|
}
|
|
1247
1247
|
try {
|
|
1248
1248
|
this.setData(f);
|
|
1249
|
-
} catch (
|
|
1250
|
-
l(
|
|
1249
|
+
} catch (O) {
|
|
1250
|
+
l(O);
|
|
1251
1251
|
return;
|
|
1252
1252
|
}
|
|
1253
|
-
(m = (p = o(this, ee).config).onSuccess) == null || m.call(p, f, this), (v = (
|
|
1254
|
-
|
|
1253
|
+
(m = (p = o(this, ee).config).onSuccess) == null || m.call(p, f, this), (v = (R = o(this, ee).config).onSettled) == null || v.call(
|
|
1254
|
+
R,
|
|
1255
1255
|
f,
|
|
1256
1256
|
this.state.error,
|
|
1257
1257
|
this
|
|
@@ -1481,7 +1481,7 @@ var oe, Pn, ui = (Pn = class extends at {
|
|
|
1481
1481
|
this.execute(this.state.variables);
|
|
1482
1482
|
}
|
|
1483
1483
|
async execute(e) {
|
|
1484
|
-
var s, a, u, l, c, d, h, f, p, m,
|
|
1484
|
+
var s, a, u, l, c, d, h, f, p, m, R, v, O, A, C, j, Q, z, X, K;
|
|
1485
1485
|
g(this, Ue, $n({
|
|
1486
1486
|
fn: () => this.options.mutationFn ? this.options.mutationFn(e) : Promise.reject(new Error("No mutationFn found")),
|
|
1487
1487
|
onFail: (q, k) => {
|
|
@@ -1528,11 +1528,11 @@ var oe, Pn, ui = (Pn = class extends at {
|
|
|
1528
1528
|
this.state.variables,
|
|
1529
1529
|
this.state.context,
|
|
1530
1530
|
this
|
|
1531
|
-
)), await ((v = (
|
|
1531
|
+
)), await ((v = (R = this.options).onSettled) == null ? void 0 : v.call(R, q, null, e, this.state.context)), P(this, ue, ge).call(this, { type: "success", data: q }), q;
|
|
1532
1532
|
} catch (q) {
|
|
1533
1533
|
try {
|
|
1534
|
-
throw await ((A = (
|
|
1535
|
-
|
|
1534
|
+
throw await ((A = (O = o(this, W).config).onError) == null ? void 0 : A.call(
|
|
1535
|
+
O,
|
|
1536
1536
|
q,
|
|
1537
1537
|
e,
|
|
1538
1538
|
this.state.context,
|
|
@@ -1741,12 +1741,12 @@ function It(t) {
|
|
|
1741
1741
|
function sn(t) {
|
|
1742
1742
|
return {
|
|
1743
1743
|
onFetch: (e, r) => {
|
|
1744
|
-
var h, f, p, m,
|
|
1745
|
-
const n = e.options, s = (p = (f = (h = e.fetchOptions) == null ? void 0 : h.meta) == null ? void 0 : f.fetchMore) == null ? void 0 : p.direction, a = ((m = e.state.data) == null ? void 0 : m.pages) || [], u = ((
|
|
1744
|
+
var h, f, p, m, R;
|
|
1745
|
+
const n = e.options, s = (p = (f = (h = e.fetchOptions) == null ? void 0 : h.meta) == null ? void 0 : f.fetchMore) == null ? void 0 : p.direction, a = ((m = e.state.data) == null ? void 0 : m.pages) || [], u = ((R = e.state.data) == null ? void 0 : R.pageParams) || [];
|
|
1746
1746
|
let l = { pages: [], pageParams: [] }, c = 0;
|
|
1747
1747
|
const d = async () => {
|
|
1748
1748
|
let v = !1;
|
|
1749
|
-
const
|
|
1749
|
+
const O = (j) => {
|
|
1750
1750
|
Object.defineProperty(j, "signal", {
|
|
1751
1751
|
enumerable: !0,
|
|
1752
1752
|
get: () => (e.signal.aborted ? v = !0 : e.signal.addEventListener("abort", () => {
|
|
@@ -1765,7 +1765,7 @@ function sn(t) {
|
|
|
1765
1765
|
direction: z ? "backward" : "forward",
|
|
1766
1766
|
meta: e.options.meta
|
|
1767
1767
|
};
|
|
1768
|
-
|
|
1768
|
+
O(X);
|
|
1769
1769
|
const K = await A(
|
|
1770
1770
|
X
|
|
1771
1771
|
), { maxPages: q } = e.options, k = z ? ti : ei;
|
|
@@ -1792,8 +1792,8 @@ function sn(t) {
|
|
|
1792
1792
|
return l;
|
|
1793
1793
|
};
|
|
1794
1794
|
e.options.persister ? e.fetchFn = () => {
|
|
1795
|
-
var v,
|
|
1796
|
-
return (
|
|
1795
|
+
var v, O;
|
|
1796
|
+
return (O = (v = e.options).persister) == null ? void 0 : O.call(
|
|
1797
1797
|
v,
|
|
1798
1798
|
d,
|
|
1799
1799
|
{
|
|
@@ -2141,7 +2141,7 @@ var U, we, Ee, Xe, Ze, Re, et, tt, Tn, hi = (Tn = class {
|
|
|
2141
2141
|
...Vn(h.data, e.options)
|
|
2142
2142
|
}), r._optimisticResults === "isRestoring" && (f.fetchStatus = "idle");
|
|
2143
2143
|
}
|
|
2144
|
-
let { error:
|
|
2144
|
+
let { error: R, errorUpdatedAt: v, status: O } = f;
|
|
2145
2145
|
if (r.select && f.data !== void 0)
|
|
2146
2146
|
if (a && f.data === (u == null ? void 0 : u.data) && r.select === o(this, Ct))
|
|
2147
2147
|
m = o(this, nt);
|
|
@@ -2153,7 +2153,7 @@ var U, we, Ee, Xe, Ze, Re, et, tt, Tn, hi = (Tn = class {
|
|
|
2153
2153
|
}
|
|
2154
2154
|
else
|
|
2155
2155
|
m = f.data;
|
|
2156
|
-
if (r.placeholderData !== void 0 && m === void 0 &&
|
|
2156
|
+
if (r.placeholderData !== void 0 && m === void 0 && O === "pending") {
|
|
2157
2157
|
let k;
|
|
2158
2158
|
if (a != null && a.isPlaceholderData && r.placeholderData === (l == null ? void 0 : l.placeholderData))
|
|
2159
2159
|
k = a.data;
|
|
@@ -2166,24 +2166,24 @@ var U, we, Ee, Xe, Ze, Re, et, tt, Tn, hi = (Tn = class {
|
|
|
2166
2166
|
} catch (ye) {
|
|
2167
2167
|
g(this, ce, ye);
|
|
2168
2168
|
}
|
|
2169
|
-
k !== void 0 && (
|
|
2169
|
+
k !== void 0 && (O = "success", m = ar(
|
|
2170
2170
|
a == null ? void 0 : a.data,
|
|
2171
2171
|
k,
|
|
2172
2172
|
r
|
|
2173
2173
|
), p = !0);
|
|
2174
2174
|
}
|
|
2175
|
-
o(this, ce) && (
|
|
2176
|
-
const A = f.fetchStatus === "fetching", C =
|
|
2177
|
-
status:
|
|
2175
|
+
o(this, ce) && (R = o(this, ce), m = o(this, nt), v = Date.now(), O = "error");
|
|
2176
|
+
const A = f.fetchStatus === "fetching", C = O === "pending", j = O === "error", Q = C && A, z = m !== void 0, K = {
|
|
2177
|
+
status: O,
|
|
2178
2178
|
fetchStatus: f.fetchStatus,
|
|
2179
2179
|
isPending: C,
|
|
2180
|
-
isSuccess:
|
|
2180
|
+
isSuccess: O === "success",
|
|
2181
2181
|
isError: j,
|
|
2182
2182
|
isInitialLoading: Q,
|
|
2183
2183
|
isLoading: Q,
|
|
2184
2184
|
data: m,
|
|
2185
2185
|
dataUpdatedAt: f.dataUpdatedAt,
|
|
2186
|
-
error:
|
|
2186
|
+
error: R,
|
|
2187
2187
|
errorUpdatedAt: v,
|
|
2188
2188
|
failureCount: f.fetchFailureCount,
|
|
2189
2189
|
failureReason: f.fetchFailureReason,
|
|
@@ -2434,7 +2434,7 @@ var Ri = (t, e) => {
|
|
|
2434
2434
|
r.clearReset();
|
|
2435
2435
|
});
|
|
2436
2436
|
function xi(t, e, r) {
|
|
2437
|
-
var f, p, m,
|
|
2437
|
+
var f, p, m, R, v;
|
|
2438
2438
|
if (process.env.NODE_ENV !== "production" && (typeof t != "object" || Array.isArray(t)))
|
|
2439
2439
|
throw new Error(
|
|
2440
2440
|
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
@@ -2454,8 +2454,8 @@ function xi(t, e, r) {
|
|
|
2454
2454
|
), d = c.getOptimisticResult(u), h = !s && t.subscribed !== !1;
|
|
2455
2455
|
if ($.useSyncExternalStore(
|
|
2456
2456
|
$.useCallback(
|
|
2457
|
-
(
|
|
2458
|
-
const A = h ? c.subscribe(L.batchCalls(
|
|
2457
|
+
(O) => {
|
|
2458
|
+
const A = h ? c.subscribe(L.batchCalls(O)) : br;
|
|
2459
2459
|
return c.updateResult(), A;
|
|
2460
2460
|
},
|
|
2461
2461
|
[c, h]
|
|
@@ -2474,19 +2474,19 @@ function xi(t, e, r) {
|
|
|
2474
2474
|
suspense: u.suspense
|
|
2475
2475
|
}))
|
|
2476
2476
|
throw d.error;
|
|
2477
|
-
if ((
|
|
2477
|
+
if ((R = (m = n.getDefaultOptions().queries) == null ? void 0 : m._experimental_afterQuery) == null || R.call(
|
|
2478
2478
|
m,
|
|
2479
2479
|
u,
|
|
2480
2480
|
d
|
|
2481
2481
|
), u.experimental_prefetchInRender && !Qe && Ci(d, s)) {
|
|
2482
|
-
const
|
|
2482
|
+
const O = l ? (
|
|
2483
2483
|
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
2484
2484
|
cn(u, c, a)
|
|
2485
2485
|
) : (
|
|
2486
2486
|
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
2487
2487
|
(v = n.getQueryCache().get(u.queryHash)) == null ? void 0 : v.promise
|
|
2488
2488
|
);
|
|
2489
|
-
|
|
2489
|
+
O == null || O.catch(br).finally(() => {
|
|
2490
2490
|
c.updateResult();
|
|
2491
2491
|
});
|
|
2492
2492
|
}
|
|
@@ -2973,12 +2973,12 @@ function pn(t) {
|
|
|
2973
2973
|
f.batch = d;
|
|
2974
2974
|
t.fetch(d.items.map((f) => f.key)).then(async (f) => {
|
|
2975
2975
|
var p;
|
|
2976
|
-
await Promise.all(f.map(async (m,
|
|
2977
|
-
var
|
|
2978
|
-
const v = d.items[
|
|
2976
|
+
await Promise.all(f.map(async (m, R) => {
|
|
2977
|
+
var O, A;
|
|
2978
|
+
const v = d.items[R];
|
|
2979
2979
|
try {
|
|
2980
2980
|
const C = await Promise.resolve(m);
|
|
2981
|
-
(
|
|
2981
|
+
(O = v.resolve) == null || O.call(v, C);
|
|
2982
2982
|
} catch (C) {
|
|
2983
2983
|
(A = v.reject) == null || A.call(v, C);
|
|
2984
2984
|
}
|
|
@@ -3811,25 +3811,25 @@ const ds = (t, e, r, n, s = [], a = [], u = /* @__PURE__ */ new Map()) => {
|
|
|
3811
3811
|
} : m;
|
|
3812
3812
|
}
|
|
3813
3813
|
if (!Qo(t, r)) {
|
|
3814
|
-
const m = bn(t, r),
|
|
3814
|
+
const m = bn(t, r), R = m ? {
|
|
3815
3815
|
transformedValue: m.value,
|
|
3816
3816
|
annotations: [m.type]
|
|
3817
3817
|
} : {
|
|
3818
3818
|
transformedValue: t
|
|
3819
3819
|
};
|
|
3820
|
-
return l || u.set(t,
|
|
3820
|
+
return l || u.set(t, R), R;
|
|
3821
3821
|
}
|
|
3822
3822
|
if (qt(a, t))
|
|
3823
3823
|
return {
|
|
3824
3824
|
transformedValue: null
|
|
3825
3825
|
};
|
|
3826
3826
|
const c = bn(t, r), d = (c == null ? void 0 : c.value) ?? t, h = xe(d) ? [] : {}, f = {};
|
|
3827
|
-
ot(d, (m,
|
|
3828
|
-
if (
|
|
3829
|
-
throw new Error(`Detected property ${
|
|
3830
|
-
const v = ds(m, e, r, n, [...s,
|
|
3831
|
-
h[
|
|
3832
|
-
f[ss(
|
|
3827
|
+
ot(d, (m, R) => {
|
|
3828
|
+
if (R === "__proto__" || R === "constructor" || R === "prototype")
|
|
3829
|
+
throw new Error(`Detected property ${R}. This is a prototype pollution risk, please remove it from your object.`);
|
|
3830
|
+
const v = ds(m, e, r, n, [...s, R], [...a, t], u);
|
|
3831
|
+
h[R] = v.transformedValue, xe(v.annotations) ? f[R] = v.annotations : wt(v.annotations) && ot(v.annotations, (O, A) => {
|
|
3832
|
+
f[ss(R) + "." + A] = O;
|
|
3833
3833
|
});
|
|
3834
3834
|
});
|
|
3835
3835
|
const p = vr(f) ? {
|
|
@@ -3957,8 +3957,8 @@ function Ho(t, e) {
|
|
|
3957
3957
|
]
|
|
3958
3958
|
}), n = async (s, a, u = null) => {
|
|
3959
3959
|
const l = a.map((f) => {
|
|
3960
|
-
const p = f.name.toLowerCase(), m =
|
|
3961
|
-
return { ...f, mimeType:
|
|
3960
|
+
const p = f.name.toLowerCase(), m = p.includes(".") ? p.substring(p.lastIndexOf(".")) : "", R = Js(m);
|
|
3961
|
+
return { ...f, mimeType: R };
|
|
3962
3962
|
}).filter(
|
|
3963
3963
|
(f) => f.mimeType !== null
|
|
3964
3964
|
);
|
|
@@ -4159,8 +4159,8 @@ function Zo({
|
|
|
4159
4159
|
const { host: u, port: l, token: c } = ct(), d = Bo(null), [h, f] = Go();
|
|
4160
4160
|
return Wo(() => {
|
|
4161
4161
|
(() => {
|
|
4162
|
-
const
|
|
4163
|
-
f(
|
|
4162
|
+
const R = `${`${u}:${l}`}?jwt=${encodeURIComponent(c)}`;
|
|
4163
|
+
f(R);
|
|
4164
4164
|
})();
|
|
4165
4165
|
}, [u, l, c]), h ? /* @__PURE__ */ gt.jsx(
|
|
4166
4166
|
"div",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var _r;function vs(){return _r||(_r=1,process.env.NODE_ENV!=="production"&&function(){var t=_,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),
|
|
17
|
+
*/var _r;function vs(){return _r||(_r=1,process.env.NODE_ENV!=="production"&&function(){var t=_,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),O=Symbol.iterator,v="@@iterator";function P(i){if(i===null||typeof i!="object")return null;var y=O&&i[O]||i[v];return typeof y=="function"?y:null}var D=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(i){{for(var y=arguments.length,b=new Array(y>1?y-1:0),E=1;E<y;E++)b[E-1]=arguments[E];U("error",i,b)}}function U(i,y,b){{var E=D.ReactDebugCurrentFrame,k=E.getStackAddendum();k!==""&&(y+="%s",b=b.concat([k]));var j=b.map(function(A){return String(A)});j.unshift("Warning: "+y),Function.prototype.apply.call(console[i],console,j)}}var V=!1,Y=!1,te=!1,z=!1,N=!1,q;q=Symbol.for("react.module.reference");function xe(i){return!!(typeof i=="string"||typeof i=="function"||i===n||i===a||N||i===s||i===d||i===h||z||i===m||V||Y||te||typeof i=="object"&&i!==null&&(i.$$typeof===p||i.$$typeof===f||i.$$typeof===u||i.$$typeof===l||i.$$typeof===c||i.$$typeof===q||i.getModuleId!==void 0))}function Fe(i,y,b){var E=i.displayName;if(E)return E;var k=y.displayName||y.name||"";return k!==""?b+"("+k+")":b}function Ke(i){return i.displayName||"Context"}function Ae(i){if(i==null)return null;if(typeof i.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case n:return"Fragment";case r:return"Portal";case a:return"Profiler";case s:return"StrictMode";case d:return"Suspense";case h:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case l:var y=i;return Ke(y)+".Consumer";case u:var b=i;return Ke(b._context)+".Provider";case c:return Fe(i,i.render,"ForwardRef");case f:var E=i.displayName||null;return E!==null?E:Ae(i.type)||"Memo";case p:{var k=i,j=k._payload,A=k._init;try{return Ae(A(j))}catch{return null}}}return null}var Ve=Object.assign,Ft=0,Wn,Bn,Gn,Yn,Xn,Jn,Zn;function es(){}es.__reactDisabledLog=!0;function Co(){{if(Ft===0){Wn=console.log,Bn=console.info,Gn=console.warn,Yn=console.error,Xn=console.group,Jn=console.groupCollapsed,Zn=console.groupEnd;var i={configurable:!0,enumerable:!0,value:es,writable:!0};Object.defineProperties(console,{info:i,log:i,warn:i,error:i,group:i,groupCollapsed:i,groupEnd:i})}Ft++}}function To(){{if(Ft--,Ft===0){var i={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Ve({},i,{value:Wn}),info:Ve({},i,{value:Bn}),warn:Ve({},i,{value:Gn}),error:Ve({},i,{value:Yn}),group:Ve({},i,{value:Xn}),groupCollapsed:Ve({},i,{value:Jn}),groupEnd:Ve({},i,{value:Zn})})}Ft<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var yr=D.ReactCurrentDispatcher,pr;function Lt(i,y,b){{if(pr===void 0)try{throw Error()}catch(k){var E=k.stack.trim().match(/\n( *(at )?)/);pr=E&&E[1]||""}return`
|
|
18
18
|
`+pr+i}}var mr=!1,Qt;{var xo=typeof WeakMap=="function"?WeakMap:Map;Qt=new xo}function ts(i,y){if(!i||mr)return"";{var b=Qt.get(i);if(b!==void 0)return b}var E;mr=!0;var k=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var j;j=yr.current,yr.current=null,Co();try{if(y){var A=function(){throw Error()};if(Object.defineProperty(A.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(A,[])}catch(ee){E=ee}Reflect.construct(i,[],A)}else{try{A.call()}catch(ee){E=ee}i.call(A.prototype)}}else{try{throw Error()}catch(ee){E=ee}i()}}catch(ee){if(ee&&E&&typeof ee.stack=="string"){for(var S=ee.stack.split(`
|
|
19
19
|
`),X=E.stack.split(`
|
|
20
20
|
`),Q=S.length-1,$=X.length-1;Q>=1&&$>=0&&S[Q]!==X[$];)$--;for(;Q>=1&&$>=0;Q--,$--)if(S[Q]!==X[$]){if(Q!==1||$!==1)do if(Q--,$--,$<0||S[Q]!==X[$]){var se=`
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+i+"`."}return""}}function Ko(i){return""}var fs={};function Vo(i){{var y=ls();if(!y){var b=typeof i=="string"?i:i.displayName||i.name;b&&(y=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+b+">.")}return y}}function hs(i,y){{if(!i._store||i._store.validated||i.key!=null)return;i._store.validated=!0;var b=Vo(y);if(fs[b])return;fs[b]=!0;var E="";i&&i._owner&&i._owner!==br.current&&(E=" It was passed a child from "+Ae(i._owner.type)+"."),ft(i),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',b,E),ft(null)}}function ds(i,y){{if(typeof i!="object")return;if(gr(i))for(var b=0;b<i.length;b++){var E=i[b];wr(E)&&hs(E,y)}else if(wr(i))i._store&&(i._store.validated=!0);else if(i){var k=
|
|
25
|
+
Check the top-level render call using <`+b+">.")}return y}}function hs(i,y){{if(!i._store||i._store.validated||i.key!=null)return;i._store.validated=!0;var b=Vo(y);if(fs[b])return;fs[b]=!0;var E="";i&&i._owner&&i._owner!==br.current&&(E=" It was passed a child from "+Ae(i._owner.type)+"."),ft(i),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',b,E),ft(null)}}function ds(i,y){{if(typeof i!="object")return;if(gr(i))for(var b=0;b<i.length;b++){var E=i[b];wr(E)&&hs(E,y)}else if(wr(i))i._store&&(i._store.validated=!0);else if(i){var k=P(i);if(typeof k=="function"&&k!==i.entries)for(var j=k.call(i),A;!(A=j.next()).done;)wr(A.value)&&hs(A.value,y)}}}function zo(i){{var y=i.type;if(y==null||typeof y=="string")return;var b;if(typeof y=="function")b=y.propTypes;else if(typeof y=="object"&&(y.$$typeof===c||y.$$typeof===f))b=y.propTypes;else return;if(b){var E=Ae(y);Do(b,i.props,"prop",E,i)}else if(y.PropTypes!==void 0&&!vr){vr=!0;var k=Ae(y);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",k||"Unknown")}typeof y.getDefaultProps=="function"&&!y.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ho(i){{for(var y=Object.keys(i.props),b=0;b<y.length;b++){var E=y[b];if(E!=="children"&&E!=="key"){ft(i),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",E),ft(null);break}}i.ref!==null&&(ft(i),x("Invalid attribute `ref` supplied to `React.Fragment`."),ft(null))}}var ys={};function ps(i,y,b,E,k,j){{var A=xe(i);if(!A){var S="";(i===void 0||typeof i=="object"&&i!==null&&Object.keys(i).length===0)&&(S+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var X=Ko();X?S+=X:S+=ls();var Q;i===null?Q="null":gr(i)?Q="array":i!==void 0&&i.$$typeof===e?(Q="<"+(Ae(i.type)||"Unknown")+" />",S=" Did you accidentally export a JSX literal instead of a component?"):Q=typeof i,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Q,S)}var $=$o(i,y,b,k,j);if($==null)return $;if(A){var se=y.children;if(se!==void 0)if(E)if(gr(se)){for(var ht=0;ht<se.length;ht++)ds(se[ht],i);Object.freeze&&Object.freeze(se)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ds(se,i)}if(At.call(y,"key")){var ze=Ae(i),ee=Object.keys(y).filter(function(Jo){return Jo!=="key"}),Er=ee.length>0?"{key: someKey, "+ee.join(": ..., ")+": ...}":"{key: someKey}";if(!ys[ze+Er]){var Xo=ee.length>0?"{"+ee.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,Er,ze,Xo,ze),ys[ze+Er]=!0}}return i===n?Ho($):zo($),$}}function Wo(i,y,b){return ps(i,y,b,!0)}function Bo(i,y,b){return ps(i,y,b,!1)}var Go=Bo,Yo=Wo;pt.Fragment=n,pt.jsx=Go,pt.jsxs=Yo}()),pt}process.env.NODE_ENV==="production"?dt.exports=bs():dt.exports=vs();var mt=dt.exports,Ht=(t=>(t.NOT_CHUNKED="NOT_CHUNKED",t.PROCESSING="PROCESSING",t.CHUNKED="CHUNKED",t.ERROR_CHUNKING="ERROR_CHUNKING",t))(Ht||{}),Wt=(t=>(t.PDF="application/pdf",t.TXT="text/plain",t.CSV="text/csv",t.DIRECTORY="inode/directory",t.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",t))(Wt||{});const gt=4e3*1024*1024,Ir={"application/pdf":{extensions:[".pdf"],maxSize:gt},"text/plain":{extensions:[".txt",".json",".py",".ts",".tsx"],maxSize:gt},"text/csv":{extensions:[".csv"],maxSize:gt},"inode/directory":{extensions:[],maxSize:gt},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{extensions:[".docx"],maxSize:gt}};Object.entries(Ir).reduce((t,[e,r])=>({...t,[e]:r.extensions}),{}),new Set(Object.values(Wt));function ws(t){const e=t.toLowerCase().startsWith(".")?t.toLowerCase():`.${t.toLowerCase()}`;for(const[r,n]of Object.entries(Ir))if(n.extensions.includes(e))return r;return null}var He=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_e=typeof window>"u"||"Deno"in globalThis;function re(){}function Es(t,e){return typeof t=="function"?t(e):t}function Bt(t){return typeof t=="number"&&t>=0&&t!==1/0}function kr(t,e){return Math.max(t+(e||0)-Date.now(),0)}function We(t,e){return typeof t=="function"?t(e):t}function ie(t,e){return typeof t=="function"?t(e):t}function jr(t,e){const{type:r="all",exact:n,fetchStatus:s,predicate:a,queryKey:u,stale:l}=t;if(u){if(n){if(e.queryHash!==Gt(u,e.options))return!1}else if(!bt(e.queryKey,u))return!1}if(r!=="all"){const c=e.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||a&&!a(e))}function qr(t,e){const{exact:r,status:n,predicate:s,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(r){if(Ie(e.options.mutationKey)!==Ie(a))return!1}else if(!bt(e.options.mutationKey,a))return!1}return!(n&&e.state.status!==n||s&&!s(e))}function Gt(t,e){return((e==null?void 0:e.queryKeyHashFn)||Ie)(t)}function Ie(t){return JSON.stringify(t,(e,r)=>Xt(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function bt(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(r=>!bt(t[r],e[r])):!1}function Yt(t,e){if(t===e)return t;const r=Ur(t)&&Ur(e);if(r||Xt(t)&&Xt(e)){const n=r?t:Object.keys(t),s=n.length,a=r?e:Object.keys(e),u=a.length,l=r?[]:{};let c=0;for(let d=0;d<u;d++){const h=r?d:a[d];(!r&&n.includes(h)||r)&&t[h]===void 0&&e[h]===void 0?(l[h]=void 0,c++):(l[h]=Yt(t[h],e[h]),l[h]===t[h]&&t[h]!==void 0&&c++)}return s===u&&c===s?t:l}return e}function _t(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(t[r]!==e[r])return!1;return!0}function Ur(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Xt(t){if(!Mr(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!Mr(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Mr(t){return Object.prototype.toString.call(t)==="[object Object]"}function Os(t){return new Promise(e=>{setTimeout(e,t)})}function Jt(t,e,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(t,e);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Yt(t,e)}catch(n){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`)}return Yt(t,e)}return e}function Ps(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function Rs(t,e,r=0){const n=[e,...t];return r&&n.length>r?n.slice(0,-1):n}var It=Symbol();function Nr(t,e){return process.env.NODE_ENV!=="production"&&t.queryFn===It&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`),!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===It?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Ss=(Dn=class extends He{constructor(){super();w(this,je);w(this,ve);w(this,Je);g(this,Je,e=>{if(!_e&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){o(this,ve)||this.setEventListener(o(this,Je))}onUnsubscribe(){var e;this.hasListeners()||((e=o(this,ve))==null||e.call(this),g(this,ve,void 0))}setEventListener(e){var r;g(this,Je,e),(r=o(this,ve))==null||r.call(this),g(this,ve,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){o(this,je)!==e&&(g(this,je,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof o(this,je)=="boolean"?o(this,je):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},je=new WeakMap,ve=new WeakMap,Je=new WeakMap,Dn),Zt=new Ss,Cs=(_n=class extends He{constructor(){super();w(this,Ze,!0);w(this,we);w(this,et);g(this,et,e=>{if(!_e&&window.addEventListener){const r=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){o(this,we)||this.setEventListener(o(this,et))}onUnsubscribe(){var e;this.hasListeners()||((e=o(this,we))==null||e.call(this),g(this,we,void 0))}setEventListener(e){var r;g(this,et,e),(r=o(this,we))==null||r.call(this),g(this,we,e(this.setOnline.bind(this)))}setOnline(e){o(this,Ze)!==e&&(g(this,Ze,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return o(this,Ze)}},Ze=new WeakMap,we=new WeakMap,et=new WeakMap,_n),kt=new Cs;function er(){let t,e;const r=new Promise((s,a)=>{t=s,e=a});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),t(s)},r.reject=s=>{n({status:"rejected",reason:s}),e(s)},r}function Ts(t){return Math.min(1e3*2**t,3e4)}function Lr(t){return(t??"online")==="online"?kt.isOnline():!0}var Qr=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function tr(t){return t instanceof Qr}function $r(t){let e=!1,r=0,n=!1,s;const a=er(),u=v=>{var O;n||(p(new Qr(v)),(O=t.abort)==null||O.call(t))},l=()=>{e=!0},c=()=>{e=!1},d=()=>Zt.isFocused()&&(t.networkMode==="always"||kt.isOnline())&&t.canRun(),h=()=>Lr(t.networkMode)&&t.canRun(),f=v=>{var O;n||(n=!0,(O=t.onSuccess)==null||O.call(t,v),s==null||s(),a.resolve(v))},p=v=>{var O;n||(n=!0,(O=t.onError)==null||O.call(t,v),s==null||s(),a.reject(v))},m=()=>new Promise(v=>{var O;s=D=>{(n||d())&&v(D)},(O=t.onPause)==null||O.call(t)}).then(()=>{var v;s=void 0,n||(v=t.onContinue)==null||v.call(t)}),P=()=>{if(n)return;let v;const O=r===0?t.initialPromise:void 0;try{v=O??t.fn()}catch(D){v=Promise.reject(D)}Promise.resolve(v).then(f).catch(D=>{var te;if(n)return;const x=t.retry??(_e?0:3),U=t.retryDelay??Ts,V=typeof U=="function"?U(r,D):U,Y=x===!0||typeof x=="number"&&r<x||typeof x=="function"&&x(r,D);if(e||!Y){p(D);return}r++,(te=t.onFail)==null||te.call(t,r,D),Os(V).then(()=>d()?void 0:m()).then(()=>{e?p(D):P()})})};return{promise:a,cancel:u,continue:()=>(s==null||s(),a),cancelRetry:l,continueRetry:c,canStart:h,start:()=>(h()?P():m().then(P),a)}}function xs(){let t=[],e=0,r=l=>{l()},n=l=>{l()},s=l=>setTimeout(l,0);const a=l=>{e?t.push(l):s(()=>{r(l)})},u=()=>{const l=t;t=[],l.length&&s(()=>{n(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||u()}return c},batchCalls:l=>(...c)=>{a(()=>{l(...c)})},schedule:a,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var K=xs(),Kr=(In=class{constructor(){w(this,qe)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Bt(this.gcTime)&&g(this,qe,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(_e?1/0:5*60*1e3))}clearGcTimeout(){o(this,qe)&&(clearTimeout(o(this,qe)),g(this,qe,void 0))}},qe=new WeakMap,In),Fs=(kn=class extends Kr{constructor(e){super();w(this,oe);w(this,tt);w(this,rt);w(this,ne);w(this,Ue);w(this,W);w(this,St);w(this,Me);g(this,Me,!1),g(this,St,e.defaultOptions),this.setOptions(e.options),this.observers=[],g(this,Ue,e.client),g(this,ne,o(this,Ue).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,g(this,tt,As(this.options)),this.state=e.state??o(this,tt),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=o(this,W))==null?void 0:e.promise}setOptions(e){this.options={...o(this,St),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&o(this,ne).remove(this)}setData(e,r){const n=Jt(this.state.data,e,this.options);return R(this,oe,me).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(e,r){R(this,oe,me).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var n,s;const r=(n=o(this,W))==null?void 0:n.promise;return(s=o(this,W))==null||s.cancel(e),r?r.then(re).catch(re):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(o(this,tt))}isActive(){return this.observers.some(e=>ie(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===It||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!kr(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=o(this,W))==null||r.continue()}onOnline(){var r;const e=this.observers.find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=o(this,W))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),o(this,ne).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(o(this,W)&&(o(this,Me)?o(this,W).cancel({revert:!0}):o(this,W).cancelRetry()),this.scheduleGc()),o(this,ne).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||R(this,oe,me).call(this,{type:"invalidate"})}fetch(e,r){var c,d,h;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(o(this,W))return o(this,W).continueRetry(),o(this,W).promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(p=>p.options.queryFn);f&&this.setOptions(f.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(g(this,Me,!0),n.signal)})},a=()=>{const f=Nr(this.options,r),p={client:o(this,Ue),queryKey:this.queryKey,meta:this.meta};return s(p),g(this,Me,!1),this.options.persister?this.options.persister(f,p,this):f(p)},u={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:o(this,Ue),state:this.state,fetchFn:a};s(u),(c=this.options.behavior)==null||c.onFetch(u,this),g(this,rt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=u.fetchOptions)==null?void 0:d.meta))&&R(this,oe,me).call(this,{type:"fetch",meta:(h=u.fetchOptions)==null?void 0:h.meta});const l=f=>{var p,m,P,v;tr(f)&&f.silent||R(this,oe,me).call(this,{type:"error",error:f}),tr(f)||((m=(p=o(this,ne).config).onError)==null||m.call(p,f,this),(v=(P=o(this,ne).config).onSettled)==null||v.call(P,this.state.data,f,this)),this.scheduleGc()};return g(this,W,$r({initialPromise:r==null?void 0:r.initialPromise,fn:u.fetchFn,abort:n.abort.bind(n),onSuccess:f=>{var p,m,P,v;if(f===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(O){l(O);return}(m=(p=o(this,ne).config).onSuccess)==null||m.call(p,f,this),(v=(P=o(this,ne).config).onSettled)==null||v.call(P,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,p)=>{R(this,oe,me).call(this,{type:"failed",failureCount:f,error:p})},onPause:()=>{R(this,oe,me).call(this,{type:"pause"})},onContinue:()=>{R(this,oe,me).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0})),o(this,W).start()}},tt=new WeakMap,rt=new WeakMap,ne=new WeakMap,Ue=new WeakMap,W=new WeakMap,St=new WeakMap,Me=new WeakMap,oe=new WeakSet,me=function(e){const r=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Vr(n.data,this.options),fetchMeta:e.meta??null};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=e.error;return tr(s)&&s.revert&&o(this,rt)?{...o(this,rt),fetchStatus:"idle"}:{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=r(this.state),K.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),o(this,ne).notify({query:this,type:"updated",action:e})})},kn);function Vr(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Lr(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function As(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,n=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Ds=(jn=class extends He{constructor(e={}){super();w(this,ce);this.config=e,g(this,ce,new Map)}build(e,r,n){const s=r.queryKey,a=r.queryHash??Gt(s,r);let u=this.get(a);return u||(u=new Fs({client:e,queryKey:s,queryHash:a,options:e.defaultQueryOptions(r),state:n,defaultOptions:e.getQueryDefaults(s)}),this.add(u)),u}add(e){o(this,ce).has(e.queryHash)||(o(this,ce).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=o(this,ce).get(e.queryHash);r&&(e.destroy(),r===e&&o(this,ce).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){K.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return o(this,ce).get(e)}getAll(){return[...o(this,ce).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(n=>jr(r,n))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(n=>jr(e,n)):r}notify(e){K.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){K.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){K.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ce=new WeakMap,jn),_s=(qn=class extends Kr{constructor(e){super();w(this,fe);w(this,le);w(this,B);w(this,Ne);this.mutationId=e.mutationId,g(this,B,e.mutationCache),g(this,le,[]),this.state=e.state||zr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){o(this,le).includes(e)||(o(this,le).push(e),this.clearGcTimeout(),o(this,B).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){g(this,le,o(this,le).filter(r=>r!==e)),this.scheduleGc(),o(this,B).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){o(this,le).length||(this.state.status==="pending"?this.scheduleGc():o(this,B).remove(this))}continue(){var e;return((e=o(this,Ne))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var s,a,u,l,c,d,h,f,p,m,P,v,O,D,x,U,V,Y,te,z;g(this,Ne,$r({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(N,q)=>{R(this,fe,De).call(this,{type:"failed",failureCount:N,error:q})},onPause:()=>{R(this,fe,De).call(this,{type:"pause"})},onContinue:()=>{R(this,fe,De).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>o(this,B).canRun(this)}));const r=this.state.status==="pending",n=!o(this,Ne).canStart();try{if(!r){R(this,fe,De).call(this,{type:"pending",variables:e,isPaused:n}),await((a=(s=o(this,B).config).onMutate)==null?void 0:a.call(s,e,this));const q=await((l=(u=this.options).onMutate)==null?void 0:l.call(u,e));q!==this.state.context&&R(this,fe,De).call(this,{type:"pending",context:q,variables:e,isPaused:n})}const N=await o(this,Ne).start();return await((d=(c=o(this,B).config).onSuccess)==null?void 0:d.call(c,N,e,this.state.context,this)),await((f=(h=this.options).onSuccess)==null?void 0:f.call(h,N,e,this.state.context)),await((m=(p=o(this,B).config).onSettled)==null?void 0:m.call(p,N,null,this.state.variables,this.state.context,this)),await((v=(P=this.options).onSettled)==null?void 0:v.call(P,N,null,e,this.state.context)),R(this,fe,De).call(this,{type:"success",data:N}),N}catch(N){try{throw await((D=(O=o(this,B).config).onError)==null?void 0:D.call(O,N,e,this.state.context,this)),await((U=(x=this.options).onError)==null?void 0:U.call(x,N,e,this.state.context)),await((Y=(V=o(this,B).config).onSettled)==null?void 0:Y.call(V,void 0,N,this.state.variables,this.state.context,this)),await((z=(te=this.options).onSettled)==null?void 0:z.call(te,void 0,N,e,this.state.context)),N}finally{R(this,fe,De).call(this,{type:"error",error:N})}}finally{o(this,B).runNext(this)}}},le=new WeakMap,B=new WeakMap,Ne=new WeakMap,fe=new WeakSet,De=function(e){const r=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),K.batch(()=>{o(this,le).forEach(n=>{n.onMutationUpdate(e)}),o(this,B).notify({mutation:this,type:"updated",action:e})})},qn);function zr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Is=(Un=class extends He{constructor(e={}){super();w(this,de);w(this,ae);w(this,Ct);this.config=e,g(this,de,new Set),g(this,ae,new Map),g(this,Ct,0)}build(e,r,n){const s=new _s({mutationCache:this,mutationId:++Vt(this,Ct)._,options:e.defaultMutationOptions(r),state:n});return this.add(s),s}add(e){o(this,de).add(e);const r=jt(e);if(typeof r=="string"){const n=o(this,ae).get(r);n?n.push(e):o(this,ae).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(o(this,de).delete(e)){const r=jt(e);if(typeof r=="string"){const n=o(this,ae).get(r);if(n)if(n.length>1){const s=n.indexOf(e);s!==-1&&n.splice(s,1)}else n[0]===e&&o(this,ae).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=jt(e);if(typeof r=="string"){const n=o(this,ae).get(r),s=n==null?void 0:n.find(a=>a.state.status==="pending");return!s||s===e}else return!0}runNext(e){var n;const r=jt(e);if(typeof r=="string"){const s=(n=o(this,ae).get(r))==null?void 0:n.find(a=>a!==e&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){K.batch(()=>{o(this,de).forEach(e=>{this.notify({type:"removed",mutation:e})}),o(this,de).clear(),o(this,ae).clear()})}getAll(){return Array.from(o(this,de))}find(e){const r={exact:!0,...e};return this.getAll().find(n=>qr(r,n))}findAll(e={}){return this.getAll().filter(r=>qr(e,r))}notify(e){K.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return K.batch(()=>Promise.all(e.map(r=>r.continue().catch(re))))}},de=new WeakMap,ae=new WeakMap,Ct=new WeakMap,Un);function jt(t){var e;return(e=t.options.scope)==null?void 0:e.id}function Hr(t){return{onFetch:(e,r)=>{var h,f,p,m,P;const n=e.options,s=(p=(f=(h=e.fetchOptions)==null?void 0:h.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,a=((m=e.state.data)==null?void 0:m.pages)||[],u=((P=e.state.data)==null?void 0:P.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let v=!1;const O=U=>{Object.defineProperty(U,"signal",{enumerable:!0,get:()=>(e.signal.aborted?v=!0:e.signal.addEventListener("abort",()=>{v=!0}),e.signal)})},D=Nr(e.options,e.fetchOptions),x=async(U,V,Y)=>{if(v)return Promise.reject();if(V==null&&U.pages.length)return Promise.resolve(U);const te={client:e.client,queryKey:e.queryKey,pageParam:V,direction:Y?"backward":"forward",meta:e.options.meta};O(te);const z=await D(te),{maxPages:N}=e.options,q=Y?Rs:Ps;return{pages:q(U.pages,z,N),pageParams:q(U.pageParams,V,N)}};if(s&&a.length){const U=s==="backward",V=U?ks:Wr,Y={pages:a,pageParams:u},te=V(n,Y);l=await x(Y,te,U)}else{const U=t??a.length;do{const V=c===0?u[0]??n.initialPageParam:Wr(n,l);if(c>0&&V==null)break;l=await x(l,V),c++}while(c<U)}return l};e.options.persister?e.fetchFn=()=>{var v,O;return(O=(v=e.options).persister)==null?void 0:O.call(v,d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=d}}}function Wr(t,{pages:e,pageParams:r}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,r[n],r):void 0}function ks(t,{pages:e,pageParams:r}){var n;return e.length>0?(n=t.getPreviousPageParam)==null?void 0:n.call(t,e[0],e,r[0],r):void 0}var js=(Mn=class{constructor(t={}){w(this,L);w(this,Ee);w(this,Oe);w(this,nt);w(this,st);w(this,Pe);w(this,it);w(this,ot);g(this,L,t.queryCache||new Ds),g(this,Ee,t.mutationCache||new Is),g(this,Oe,t.defaultOptions||{}),g(this,nt,new Map),g(this,st,new Map),g(this,Pe,0)}mount(){Vt(this,Pe)._++,o(this,Pe)===1&&(g(this,it,Zt.subscribe(async t=>{t&&(await this.resumePausedMutations(),o(this,L).onFocus())})),g(this,ot,kt.subscribe(async t=>{t&&(await this.resumePausedMutations(),o(this,L).onOnline())})))}unmount(){var t,e;Vt(this,Pe)._--,o(this,Pe)===0&&((t=o(this,it))==null||t.call(this),g(this,it,void 0),(e=o(this,ot))==null||e.call(this),g(this,ot,void 0))}isFetching(t){return o(this,L).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return o(this,Ee).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=o(this,L).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=o(this,L).build(this,e),n=r.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(We(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return o(this,L).findAll(t).map(({queryKey:e,state:r})=>{const n=r.data;return[e,n]})}setQueryData(t,e,r){const n=this.defaultQueryOptions({queryKey:t}),s=o(this,L).get(n.queryHash),a=s==null?void 0:s.state.data,u=Es(e,a);if(u!==void 0)return o(this,L).build(this,n).setData(u,{...r,manual:!0})}setQueriesData(t,e,r){return K.batch(()=>o(this,L).findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=o(this,L).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=o(this,L);K.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=o(this,L);return K.batch(()=>(r.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},n=K.batch(()=>o(this,L).findAll(t).map(s=>s.cancel(r)));return Promise.all(n).then(re).catch(re)}invalidateQueries(t,e={}){return K.batch(()=>(o(this,L).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},n=K.batch(()=>o(this,L).findAll(t).filter(s=>!s.isDisabled()).map(s=>{let a=s.fetch(void 0,r);return r.throwOnError||(a=a.catch(re)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(re)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=o(this,L).build(this,e);return r.isStaleByTime(We(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(re).catch(re)}fetchInfiniteQuery(t){return t.behavior=Hr(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(re).catch(re)}ensureInfiniteQueryData(t){return t.behavior=Hr(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return kt.isOnline()?o(this,Ee).resumePausedMutations():Promise.resolve()}getQueryCache(){return o(this,L)}getMutationCache(){return o(this,Ee)}getDefaultOptions(){return o(this,Oe)}setDefaultOptions(t){g(this,Oe,t)}setQueryDefaults(t,e){o(this,nt).set(Ie(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...o(this,nt).values()],r={};return e.forEach(n=>{bt(t,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(t,e){o(this,st).set(Ie(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...o(this,st).values()],r={};return e.forEach(n=>{bt(t,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...o(this,Oe).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Gt(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===It&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...o(this,Oe).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){o(this,L).clear(),o(this,Ee).clear()}},L=new WeakMap,Ee=new WeakMap,Oe=new WeakMap,nt=new WeakMap,st=new WeakMap,Pe=new WeakMap,it=new WeakMap,ot=new WeakMap,Mn),qs=(Nn=class extends He{constructor(e,r){super();w(this,I);w(this,J);w(this,T);w(this,Tt);w(this,G);w(this,Le);w(this,at);w(this,Re);w(this,he);w(this,xt);w(this,ut);w(this,ct);w(this,Qe);w(this,$e);w(this,Se);w(this,lt,new Set);this.options=r,g(this,J,e),g(this,he,null),g(this,Re,er()),this.options.experimental_prefetchInRender||o(this,Re).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(o(this,T).addObserver(this),Br(o(this,T),this.options)?R(this,I,Dt).call(this):this.updateResult(),R(this,I,Cr).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return rr(o(this,T),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return rr(o(this,T),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,R(this,I,Tr).call(this),R(this,I,xr).call(this),o(this,T).removeObserver(this)}setOptions(e,r){const n=this.options,s=o(this,T);if(this.options=o(this,J).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ie(this.options.enabled,o(this,T))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");R(this,I,Fr).call(this),o(this,T).setOptions(this.options),n._defaulted&&!_t(this.options,n)&&o(this,J).getQueryCache().notify({type:"observerOptionsUpdated",query:o(this,T),observer:this});const a=this.hasListeners();a&&Gr(o(this,T),s,this.options,n)&&R(this,I,Dt).call(this),this.updateResult(r),a&&(o(this,T)!==s||ie(this.options.enabled,o(this,T))!==ie(n.enabled,o(this,T))||We(this.options.staleTime,o(this,T))!==We(n.staleTime,o(this,T)))&&R(this,I,Pr).call(this);const u=R(this,I,Rr).call(this);a&&(o(this,T)!==s||ie(this.options.enabled,o(this,T))!==ie(n.enabled,o(this,T))||u!==o(this,Se))&&R(this,I,Sr).call(this,u)}getOptimisticResult(e){const r=o(this,J).getQueryCache().build(o(this,J),e),n=this.createResult(r,e);return Ms(this,n)&&(g(this,G,n),g(this,at,this.options),g(this,Le,o(this,T).state)),n}getCurrentResult(){return o(this,G)}trackResult(e,r){const n={};return Object.keys(e).forEach(s=>{Object.defineProperty(n,s,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(s),r==null||r(s),e[s])})}),n}trackProp(e){o(this,lt).add(e)}getCurrentQuery(){return o(this,T)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=o(this,J).defaultQueryOptions(e),n=o(this,J).getQueryCache().build(o(this,J),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(e){return R(this,I,Dt).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),o(this,G)))}createResult(e,r){var N;const n=o(this,T),s=this.options,a=o(this,G),u=o(this,Le),l=o(this,at),d=e!==n?e.state:o(this,Tt),{state:h}=e;let f={...h},p=!1,m;if(r._optimisticResults){const q=this.hasListeners(),xe=!q&&Br(e,r),Fe=q&&Gr(e,n,r,s);(xe||Fe)&&(f={...f,...Vr(h.data,e.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:P,errorUpdatedAt:v,status:O}=f;if(r.select&&f.data!==void 0)if(a&&f.data===(u==null?void 0:u.data)&&r.select===o(this,xt))m=o(this,ut);else try{g(this,xt,r.select),m=r.select(f.data),m=Jt(a==null?void 0:a.data,m,r),g(this,ut,m),g(this,he,null)}catch(q){g(this,he,q)}else m=f.data;if(r.placeholderData!==void 0&&m===void 0&&O==="pending"){let q;if(a!=null&&a.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData))q=a.data;else if(q=typeof r.placeholderData=="function"?r.placeholderData((N=o(this,ct))==null?void 0:N.state.data,o(this,ct)):r.placeholderData,r.select&&q!==void 0)try{q=r.select(q),g(this,he,null)}catch(xe){g(this,he,xe)}q!==void 0&&(O="success",m=Jt(a==null?void 0:a.data,q,r),p=!0)}o(this,he)&&(P=o(this,he),m=o(this,ut),v=Date.now(),O="error");const D=f.fetchStatus==="fetching",x=O==="pending",U=O==="error",V=x&&D,Y=m!==void 0,z={status:O,fetchStatus:f.fetchStatus,isPending:x,isSuccess:O==="success",isError:U,isInitialLoading:V,isLoading:V,data:m,dataUpdatedAt:f.dataUpdatedAt,error:P,errorUpdatedAt:v,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:D,isRefetching:D&&!x,isLoadingError:U&&!Y,isPaused:f.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:U&&Y,isStale:nr(e,r),refetch:this.refetch,promise:o(this,Re)};if(this.options.experimental_prefetchInRender){const q=Ke=>{z.status==="error"?Ke.reject(z.error):z.data!==void 0&&Ke.resolve(z.data)},xe=()=>{const Ke=g(this,Re,z.promise=er());q(Ke)},Fe=o(this,Re);switch(Fe.status){case"pending":e.queryHash===n.queryHash&&q(Fe);break;case"fulfilled":(z.status==="error"||z.data!==Fe.value)&&xe();break;case"rejected":(z.status!=="error"||z.error!==Fe.reason)&&xe();break}}return z}updateResult(e){const r=o(this,G),n=this.createResult(o(this,T),this.options);if(g(this,Le,o(this,T).state),g(this,at,this.options),o(this,Le).data!==void 0&&g(this,ct,o(this,T)),_t(n,r))return;g(this,G,n);const s={},a=()=>{if(!r)return!0;const{notifyOnChangeProps:u}=this.options,l=typeof u=="function"?u():u;if(l==="all"||!l&&!o(this,lt).size)return!0;const c=new Set(l??o(this,lt));return this.options.throwOnError&&c.add("error"),Object.keys(o(this,G)).some(d=>{const h=d;return o(this,G)[h]!==r[h]&&c.has(h)})};(e==null?void 0:e.listeners)!==!1&&a()&&(s.listeners=!0),R(this,I,gs).call(this,{...s,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&R(this,I,Cr).call(this)}},J=new WeakMap,T=new WeakMap,Tt=new WeakMap,G=new WeakMap,Le=new WeakMap,at=new WeakMap,Re=new WeakMap,he=new WeakMap,xt=new WeakMap,ut=new WeakMap,ct=new WeakMap,Qe=new WeakMap,$e=new WeakMap,Se=new WeakMap,lt=new WeakMap,I=new WeakSet,Dt=function(e){R(this,I,Fr).call(this);let r=o(this,T).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(re)),r},Pr=function(){R(this,I,Tr).call(this);const e=We(this.options.staleTime,o(this,T));if(_e||o(this,G).isStale||!Bt(e))return;const n=kr(o(this,G).dataUpdatedAt,e)+1;g(this,Qe,setTimeout(()=>{o(this,G).isStale||this.updateResult()},n))},Rr=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(o(this,T)):this.options.refetchInterval)??!1},Sr=function(e){R(this,I,xr).call(this),g(this,Se,e),!(_e||ie(this.options.enabled,o(this,T))===!1||!Bt(o(this,Se))||o(this,Se)===0)&&g(this,$e,setInterval(()=>{(this.options.refetchIntervalInBackground||Zt.isFocused())&&R(this,I,Dt).call(this)},o(this,Se)))},Cr=function(){R(this,I,Pr).call(this),R(this,I,Sr).call(this,R(this,I,Rr).call(this))},Tr=function(){o(this,Qe)&&(clearTimeout(o(this,Qe)),g(this,Qe,void 0))},xr=function(){o(this,$e)&&(clearInterval(o(this,$e)),g(this,$e,void 0))},Fr=function(){const e=o(this,J).getQueryCache().build(o(this,J),this.options);if(e===o(this,T))return;const r=o(this,T);g(this,T,e),g(this,Tt,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},gs=function(e){K.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(o(this,G))}),o(this,J).getQueryCache().notify({query:o(this,T),type:"observerResultsUpdated"})})},Nn);function Us(t,e){return ie(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Br(t,e){return Us(t,e)||t.state.data!==void 0&&rr(t,e,e.refetchOnMount)}function rr(t,e,r){if(ie(e.enabled,t)!==!1){const n=typeof r=="function"?r(t):r;return n==="always"||n!==!1&&nr(t,e)}return!1}function Gr(t,e,r,n){return(t!==e||ie(n.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&nr(t,r)}function nr(t,e){return ie(e.enabled,t)!==!1&&t.isStaleByTime(We(e.staleTime,t))}function Ms(t,e){return!_t(t.getCurrentResult(),e)}var Ns=(Ln=class extends He{constructor(e,r){super();w(this,pe);w(this,Ce);w(this,Te);w(this,Z);w(this,ye);g(this,Ce,e),this.setOptions(r),this.bindMethods(),R(this,pe,zt).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var n;const r=this.options;this.options=o(this,Ce).defaultMutationOptions(e),_t(this.options,r)||o(this,Ce).getMutationCache().notify({type:"observerOptionsUpdated",mutation:o(this,Z),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Ie(r.mutationKey)!==Ie(this.options.mutationKey)?this.reset():((n=o(this,Z))==null?void 0:n.state.status)==="pending"&&o(this,Z).setOptions(this.options)}onUnsubscribe(){var e;this.hasListeners()||(e=o(this,Z))==null||e.removeObserver(this)}onMutationUpdate(e){R(this,pe,zt).call(this),R(this,pe,Ar).call(this,e)}getCurrentResult(){return o(this,Te)}reset(){var e;(e=o(this,Z))==null||e.removeObserver(this),g(this,Z,void 0),R(this,pe,zt).call(this),R(this,pe,Ar).call(this)}mutate(e,r){var n;return g(this,ye,r),(n=o(this,Z))==null||n.removeObserver(this),g(this,Z,o(this,Ce).getMutationCache().build(o(this,Ce),this.options)),o(this,Z).addObserver(this),o(this,Z).execute(e)}},Ce=new WeakMap,Te=new WeakMap,Z=new WeakMap,ye=new WeakMap,pe=new WeakSet,zt=function(){var r;const e=((r=o(this,Z))==null?void 0:r.state)??zr();g(this,Te,{...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset})},Ar=function(e){K.batch(()=>{var r,n,s,a,u,l,c,d;if(o(this,ye)&&this.hasListeners()){const h=o(this,Te).variables,f=o(this,Te).context;(e==null?void 0:e.type)==="success"?((n=(r=o(this,ye)).onSuccess)==null||n.call(r,e.data,h,f),(a=(s=o(this,ye)).onSettled)==null||a.call(s,e.data,null,h,f)):(e==null?void 0:e.type)==="error"&&((l=(u=o(this,ye)).onError)==null||l.call(u,e.error,h,f),(d=(c=o(this,ye)).onSettled)==null||d.call(c,void 0,e.error,h,f))}this.listeners.forEach(h=>{h(o(this,Te))})})},Ln),Yr=M.createContext(void 0),vt=t=>{const e=M.useContext(Yr);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},Ls=({client:t,children:e})=>(M.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),mt.jsx(Yr.Provider,{value:t,children:e})),Xr=M.createContext(!1),Qs=()=>M.useContext(Xr);Xr.Provider;function $s(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var Ks=M.createContext($s()),Vs=()=>M.useContext(Ks);function Jr(t,e){return typeof t=="function"?t(...e):!!t}function sr(){}var zs=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},Hs=t=>{M.useEffect(()=>{t.clearReset()},[t])},Ws=({result:t,errorResetBoundary:e,throwOnError:r,query:n,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&(s&&t.data===void 0||Jr(r,[t.error,n])),Bs=t=>{const e=t.staleTime;t.suspense&&(t.staleTime=typeof e=="function"?(...r)=>Math.max(e(...r),1e3):Math.max(e??1e3,1e3),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3)))},Gs=(t,e)=>t.isLoading&&t.isFetching&&!e,Ys=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Zr=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function Xs(t,e,r){var f,p,m,P,v;if(process.env.NODE_ENV!=="production"&&(typeof t!="object"||Array.isArray(t)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=vt(),s=Qs(),a=Vs(),u=n.defaultQueryOptions(t);(p=(f=n.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||p.call(f,u),process.env.NODE_ENV!=="production"&&(u.queryFn||console.error(`[${u.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),u._optimisticResults=s?"isRestoring":"optimistic",Bs(u),zs(u,a),Hs(a);const l=!n.getQueryCache().get(u.queryHash),[c]=M.useState(()=>new e(n,u)),d=c.getOptimisticResult(u),h=!s&&t.subscribed!==!1;if(M.useSyncExternalStore(M.useCallback(O=>{const D=h?c.subscribe(K.batchCalls(O)):sr;return c.updateResult(),D},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),M.useEffect(()=>{c.setOptions(u,{listeners:!1})},[u,c]),Ys(u,d))throw Zr(u,c,a);if(Ws({result:d,errorResetBoundary:a,throwOnError:u.throwOnError,query:n.getQueryCache().get(u.queryHash),suspense:u.suspense}))throw d.error;if((P=(m=n.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||P.call(m,u,d),u.experimental_prefetchInRender&&!_e&&Gs(d,s)){const O=l?Zr(u,c,a):(v=n.getQueryCache().get(u.queryHash))==null?void 0:v.promise;O==null||O.catch(sr).finally(()=>{c.updateResult()})}return u.notifyOnChangeProps?d:c.trackResult(d)}function en(t,e){return Xs(t,qs)}function ir(t,e){const r=vt(),[n]=M.useState(()=>new Ns(r,t));M.useEffect(()=>{n.setOptions(t)},[n,t]);const s=M.useSyncExternalStore(M.useCallback(u=>n.subscribe(K.batchCalls(u)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),a=M.useCallback((u,l)=>{n.mutate(u,l).catch(sr)},[n]);if(s.error&&Jr(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}function Be(t){const e={subscribe(r){let n=null,s=!1,a=!1,u=!1;function l(){if(n===null){u=!0;return}a||(a=!0,typeof n=="function"?n():n&&n.unsubscribe())}return n=t({next(c){var d;s||(d=r.next)==null||d.call(r,c)},error(c){var d;s||(s=!0,(d=r.error)==null||d.call(r,c),l())},complete(){var c;s||(s=!0,(c=r.complete)==null||c.call(r),l())}}),u&&l(),{unsubscribe:l}},pipe(...r){return r.reduce(Js,e)}};return e}function Js(t,e){return e(t)}function Zs(t){const e=new AbortController;return new Promise((n,s)=>{let a=!1;function u(){a||(a=!0,l.unsubscribe())}e.signal.addEventListener("abort",()=>{s(e.signal.reason)});const l=t.subscribe({next(c){a=!0,n(c),u()},error(c){s(c)},complete(){e.abort(),u()}})})}function ei(t){return e=>{let r=0,n=null;const s=[];function a(){n||(n=e.subscribe({next(l){var c;for(const d of s)(c=d.next)==null||c.call(d,l)},error(l){var c;for(const d of s)(c=d.error)==null||c.call(d,l)},complete(){var l;for(const c of s)(l=c.complete)==null||l.call(c)}}))}function u(){if(r===0&&n){const l=n;n=null,l.unsubscribe()}}return Be(l=>(r++,s.push(l),a(),{unsubscribe(){r--,u();const c=s.findIndex(d=>d===l);c>-1&&s.splice(c,1)}}))}}function ti(t){return e=>Be(r=>e.subscribe({next(n){var s;(s=t.next)==null||s.call(t,n),r.next(n)},error(n){var s;(s=t.error)==null||s.call(t,n),r.error(n)},complete(){var n;(n=t.complete)==null||n.call(t),r.complete()}}))}function ri(t){let e=t;const r=[],n=u=>{e!==void 0&&u.next(e),r.push(u)},s=u=>{r.splice(r.indexOf(u),1)},a=Be(u=>(n(u),()=>{s(u)}));return a.next=u=>{if(e!==u){e=u;for(const l of r)l.next(u)}},a.get=()=>e,a}function ni(t){return Be(e=>{function r(s=0,a=t.op){const u=t.links[s];if(!u)throw new Error("No more links to execute - did you forget to add an ending link?");return u({op:a,next(c){return r(s+1,c)}})}return r().subscribe(e)})}const tn=()=>{},rn=t=>{Object.freeze&&Object.freeze(t)};function nn(t,e,r){var n,s;const a=e.join(".");return(n=r)[s=a]??(n[s]=new Proxy(tn,{get(u,l){if(!(typeof l!="string"||l==="then"))return nn(t,[...e,l],r)},apply(u,l,c){const d=e[e.length-1];let h={args:c,path:e};return d==="call"?h={args:c.length>=2?[c[1]]:[],path:e.slice(0,-1)}:d==="apply"&&(h={args:c.length>=2?c[1]:[],path:e.slice(0,-1)}),rn(h.args),rn(h.path),t(h)}})),r[a]}const si=t=>nn(t,[],Object.create(null)),ii=t=>new Proxy(tn,{get(e,r){if(r!=="then")return t(r)}});function wt(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}function oi(t,e){if("error"in t){const n=e.deserialize(t.error);return{ok:!1,error:{...t,error:n}}}return{ok:!0,result:{...t.result,...(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)}}}}class or extends Error{constructor(){super("Unable to transform response from server")}}function ai(t,e){let r;try{r=oi(t,e)}catch{throw new or}if(!r.ok&&(!wt(r.error.error)||typeof r.error.error.code!="number"))throw new or;if(r.ok&&!wt(r.result))throw new or;return r}var sn,on;(sn=Symbol).dispose??(sn.dispose=Symbol()),(on=Symbol).asyncDispose??(on.asyncDispose=Symbol()),typeof window>"u"||"Deno"in window||(($n=(Qn=globalThis.process)==null?void 0:Qn.env)==null?void 0:$n.NODE_ENV)==="test"||(Vn=(Kn=globalThis.process)==null?void 0:Kn.env)!=null&&Vn.JEST_WORKER_ID||(Hn=(zn=globalThis.process)==null?void 0:zn.env)!=null&&Hn.VITEST_WORKER_ID;function qt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ui(t){return t instanceof ge||t instanceof Error&&t.name==="TRPCClientError"}function ci(t){return wt(t)&&wt(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function li(t,e){return typeof t=="string"?t:wt(t)&&typeof t.message=="string"?t.message:e}class ge extends Error{static from(e,r={}){const n=e;return ui(n)?(r.meta&&(n.meta={...n.meta,...r.meta}),n):ci(n)?new ge(n.error.message,{...r,result:n}):new ge(li(n,"Unknown error"),{...r,cause:n})}constructor(e,r){var s,a;const n=r==null?void 0:r.cause;super(e,{cause:n}),qt(this,"cause",void 0),qt(this,"shape",void 0),qt(this,"data",void 0),qt(this,"meta",void 0),this.meta=r==null?void 0:r.meta,this.cause=n,this.shape=(s=r==null?void 0:r.result)==null?void 0:s.error,this.data=(a=r==null?void 0:r.result)==null?void 0:a.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,ge.prototype)}}function ar(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class fi{$request(e){return ni({links:this.links,op:{...e,context:e.context??{},id:++this.requestId}}).pipe(ei())}async requestAsPromise(e){try{const r=this.$request(e);return(await Zs(r)).result.data}catch(r){throw ge.from(r)}}query(e,r,n){return this.requestAsPromise({type:"query",path:e,input:r,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}mutation(e,r,n){return this.requestAsPromise({type:"mutation",path:e,input:r,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}subscription(e,r,n){return this.$request({type:"subscription",path:e,input:r,context:n.context,signal:n.signal}).subscribe({next(a){var u,l,c,d;switch(a.result.type){case"state":{(u=n.onConnectionStateChange)==null||u.call(n,a.result);break}case"started":{(l=n.onStarted)==null||l.call(n,{context:a.context});break}case"stopped":{(c=n.onStopped)==null||c.call(n);break}case"data":case void 0:{(d=n.onData)==null||d.call(n,a.result.data);break}}},error(a){var u;(u=n.onError)==null||u.call(n,a)},complete(){var a;(a=n.onComplete)==null||a.call(n)}})}constructor(e){ar(this,"links",void 0),ar(this,"runtime",void 0),ar(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(r=>r(this.runtime))}}const hi=Symbol.for("trpc_untypedClient"),di={query:"query",mutate:"mutation",subscribe:"subscription"},yi=t=>di[t];function pi(t){const e=si(({path:r,args:n})=>{const s=[...r],a=yi(s.pop()),u=s.join(".");return t[a](u,...n)});return ii(r=>r===hi?t:e[r])}function mi(t){const e=new fi(t);return pi(e)}const an=t=>typeof t=="function";function gi(t){if(t)return t;if(typeof window<"u"&&an(window.fetch))return window.fetch;if(typeof globalThis<"u"&&an(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}const un=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function cn(t){let e=null,r=null;const n=()=>{clearTimeout(r),r=null,e=null};function s(l){var h,f;const c=[[]];let d=0;for(;;){const p=l[d];if(!p)break;const m=c[c.length-1];if(p.aborted){(h=p.reject)==null||h.call(p,new Error("Aborted")),d++;continue}if(t.validate(m.concat(p).map(v=>v.key))){m.push(p),d++;continue}if(m.length===0){(f=p.reject)==null||f.call(p,new Error("Input is too big for a single dispatch")),d++;continue}c.push([])}return c}function a(){const l=s(e);n();for(const c of l){if(!c.length)continue;const d={items:c};for(const f of c)f.batch=d;t.fetch(d.items.map(f=>f.key)).then(async f=>{var p;await Promise.all(f.map(async(m,P)=>{var O,D;const v=d.items[P];try{const x=await Promise.resolve(m);(O=v.resolve)==null||O.call(v,x)}catch(x){(D=v.reject)==null||D.call(v,x)}v.batch=null,v.reject=null,v.resolve=null}));for(const m of d.items)(p=m.reject)==null||p.call(m,new Error("Missing result")),m.batch=null}).catch(f=>{var p;for(const m of d.items)(p=m.reject)==null||p.call(m,f),m.batch=null})}}function u(l){const c={aborted:!1,key:l,batch:null,resolve:un,reject:un},d=new Promise((h,f)=>{c.reject=f,c.resolve=h,e||(e=[]),e.push(c)});return r||(r=setTimeout(a)),d}return{load:u}}function bi(...t){const e=new AbortController,r=t.length;let n=0;const s=()=>{++n===r&&e.abort()};for(const a of t)a!=null&&a.aborted?s():a==null||a.addEventListener("abort",s,{once:!0});return e.signal}function vi(t){const e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:r=>r,deserialize:r=>r},output:{serialize:r=>r,deserialize:r=>r}}}function wi(t){return{url:t.url.toString(),fetch:t.fetch,transformer:vi(t.transformer),methodOverride:t.methodOverride}}function Ei(t){const e={};for(let r=0;r<t.length;r++){const n=t[r];e[r]=n}return e}const Oi={query:"GET",mutation:"POST",subscription:"PATCH"};function ln(t){return"input"in t?t.transformer.input.serialize(t.input):Ei(t.inputs.map(e=>t.transformer.input.serialize(e)))}const fn=t=>{const e=t.url.split("?");let n=e[0].replace(/\/$/,"")+"/"+t.path;const s=[];if(e[1]&&s.push(e[1]),"inputs"in t&&s.push("batch=1"),t.type==="query"||t.type==="subscription"){const a=ln(t);a!==void 0&&t.methodOverride!=="POST"&&s.push(`input=${encodeURIComponent(JSON.stringify(a))}`)}return s.length&&(n+="?"+s.join("&")),n},Pi=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=ln(t);return e!==void 0?JSON.stringify(e):void 0},Ri=t=>xi({...t,contentTypeHeader:"application/json",getUrl:fn,getBody:Pi});class Si extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}}const Ci=t=>{var e;if(t!=null&&t.aborted)throw(e=t.throwIfAborted)==null||e.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new Si};async function Ti(t){Ci(t.signal);const e=t.getUrl(t),r=t.getBody(t),{type:n}=t,s=await(async()=>{const u=await t.headers();return Symbol.iterator in u?Object.fromEntries(u):u})(),a={...t.contentTypeHeader?{"content-type":t.contentTypeHeader}:{},...t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0,...s};return gi(t.fetch)(e,{method:t.methodOverride??Oi[n],signal:t.signal,body:r,headers:a})}async function xi(t){const e={},r=await Ti(t);e.response=r;const n=await r.json();return e.responseJSON=n,{json:n,meta:e}}function Fi(t){const e=wi(t),r=t.maxURLLength??1/0;return()=>{const n=l=>({validate(c){if(r===1/0)return!0;const d=c.map(p=>p.path).join(","),h=c.map(p=>p.input);return fn({...e,type:l,path:d,inputs:h,signal:null}).length<=r},async fetch(c){const d=c.map(v=>v.path).join(","),h=c.map(v=>v.input),f=bi(...c.map(v=>v.signal)),p=await Ri({...e,path:d,inputs:h,type:l,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:c}):t.headers:{}},signal:f});return(Array.isArray(p.json)?p.json:c.map(()=>p.json)).map(v=>({meta:p.meta,json:v}))}}),s=cn(n("query")),a=cn(n("mutation")),u={query:s,mutation:a};return({op:l})=>Be(c=>{/* istanbul ignore if -- @preserve */if(l.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const h=u[l.type].load(l);let f;return h.then(p=>{f=p;const m=ai(p.json,e.transformer.output);if(!m.ok){c.error(ge.from(m.error,{meta:p.meta}));return}c.next({context:p.meta,result:m.result}),c.complete()}).catch(p=>{c.error(ge.from(p,{meta:f==null?void 0:f.meta}))}),()=>{}})}}function Ai(t){return typeof FormData>"u"?!1:t instanceof FormData}const ur={css:{query:["72e3ff","3fb0d8"],mutation:["c5a3fc","904dfc"],subscription:["ff49e1","d83fbe"]},ansi:{regular:{query:["\x1B[30;46m","\x1B[97;46m"],mutation:["\x1B[30;45m","\x1B[97;45m"],subscription:["\x1B[30;42m","\x1B[97;42m"]},bold:{query:["\x1B[1;30;46m","\x1B[1;97;46m"],mutation:["\x1B[1;30;45m","\x1B[1;97;45m"],subscription:["\x1B[1;30;42m","\x1B[1;97;42m"]}}};function Di(t){const{direction:e,type:r,withContext:n,path:s,id:a,input:u}=t,l=[],c=[];if(t.colorMode==="none")l.push(e==="up"?">>":"<<",r,`#${a}`,s);else if(t.colorMode==="ansi"){const[d,h]=ur.ansi.regular[r],[f,p]=ur.ansi.bold[r];l.push(e==="up"?d:h,e==="up"?">>":"<<",r,e==="up"?f:p,`#${a}`,s,"\x1B[0m")}else{const[d,h]=ur.css[r],f=`
|
|
30
|
+
<%s key={someKey} {...props} />`,Er,ze,Xo,ze),ys[ze+Er]=!0}}return i===n?Ho($):zo($),$}}function Wo(i,y,b){return ps(i,y,b,!0)}function Bo(i,y,b){return ps(i,y,b,!1)}var Go=Bo,Yo=Wo;pt.Fragment=n,pt.jsx=Go,pt.jsxs=Yo}()),pt}process.env.NODE_ENV==="production"?dt.exports=bs():dt.exports=vs();var mt=dt.exports,Ht=(t=>(t.NOT_CHUNKED="NOT_CHUNKED",t.PROCESSING="PROCESSING",t.CHUNKED="CHUNKED",t.ERROR_CHUNKING="ERROR_CHUNKING",t))(Ht||{}),Wt=(t=>(t.PDF="application/pdf",t.TXT="text/plain",t.CSV="text/csv",t.DIRECTORY="inode/directory",t.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",t))(Wt||{});const gt=4e3*1024*1024,Ir={"application/pdf":{extensions:[".pdf"],maxSize:gt},"text/plain":{extensions:[".txt",".json",".py",".ts",".tsx"],maxSize:gt},"text/csv":{extensions:[".csv"],maxSize:gt},"inode/directory":{extensions:[],maxSize:gt},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{extensions:[".docx"],maxSize:gt}};Object.entries(Ir).reduce((t,[e,r])=>({...t,[e]:r.extensions}),{}),new Set(Object.values(Wt));function ws(t){const e=t.toLowerCase().startsWith(".")?t.toLowerCase():`.${t.toLowerCase()}`;for(const[r,n]of Object.entries(Ir))if(n.extensions.includes(e))return r;return null}var He=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_e=typeof window>"u"||"Deno"in globalThis;function re(){}function Es(t,e){return typeof t=="function"?t(e):t}function Bt(t){return typeof t=="number"&&t>=0&&t!==1/0}function kr(t,e){return Math.max(t+(e||0)-Date.now(),0)}function We(t,e){return typeof t=="function"?t(e):t}function ie(t,e){return typeof t=="function"?t(e):t}function jr(t,e){const{type:r="all",exact:n,fetchStatus:s,predicate:a,queryKey:u,stale:l}=t;if(u){if(n){if(e.queryHash!==Gt(u,e.options))return!1}else if(!bt(e.queryKey,u))return!1}if(r!=="all"){const c=e.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||a&&!a(e))}function qr(t,e){const{exact:r,status:n,predicate:s,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(r){if(Ie(e.options.mutationKey)!==Ie(a))return!1}else if(!bt(e.options.mutationKey,a))return!1}return!(n&&e.state.status!==n||s&&!s(e))}function Gt(t,e){return((e==null?void 0:e.queryKeyHashFn)||Ie)(t)}function Ie(t){return JSON.stringify(t,(e,r)=>Xt(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function bt(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(r=>!bt(t[r],e[r])):!1}function Yt(t,e){if(t===e)return t;const r=Ur(t)&&Ur(e);if(r||Xt(t)&&Xt(e)){const n=r?t:Object.keys(t),s=n.length,a=r?e:Object.keys(e),u=a.length,l=r?[]:{};let c=0;for(let d=0;d<u;d++){const h=r?d:a[d];(!r&&n.includes(h)||r)&&t[h]===void 0&&e[h]===void 0?(l[h]=void 0,c++):(l[h]=Yt(t[h],e[h]),l[h]===t[h]&&t[h]!==void 0&&c++)}return s===u&&c===s?t:l}return e}function _t(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(t[r]!==e[r])return!1;return!0}function Ur(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Xt(t){if(!Mr(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!Mr(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Mr(t){return Object.prototype.toString.call(t)==="[object Object]"}function Os(t){return new Promise(e=>{setTimeout(e,t)})}function Jt(t,e,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(t,e);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Yt(t,e)}catch(n){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`)}return Yt(t,e)}return e}function Ps(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function Rs(t,e,r=0){const n=[e,...t];return r&&n.length>r?n.slice(0,-1):n}var It=Symbol();function Nr(t,e){return process.env.NODE_ENV!=="production"&&t.queryFn===It&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${t.queryHash}'`),!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===It?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Ss=(Dn=class extends He{constructor(){super();w(this,je);w(this,ve);w(this,Je);g(this,Je,e=>{if(!_e&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){o(this,ve)||this.setEventListener(o(this,Je))}onUnsubscribe(){var e;this.hasListeners()||((e=o(this,ve))==null||e.call(this),g(this,ve,void 0))}setEventListener(e){var r;g(this,Je,e),(r=o(this,ve))==null||r.call(this),g(this,ve,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){o(this,je)!==e&&(g(this,je,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof o(this,je)=="boolean"?o(this,je):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},je=new WeakMap,ve=new WeakMap,Je=new WeakMap,Dn),Zt=new Ss,Cs=(_n=class extends He{constructor(){super();w(this,Ze,!0);w(this,we);w(this,et);g(this,et,e=>{if(!_e&&window.addEventListener){const r=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){o(this,we)||this.setEventListener(o(this,et))}onUnsubscribe(){var e;this.hasListeners()||((e=o(this,we))==null||e.call(this),g(this,we,void 0))}setEventListener(e){var r;g(this,et,e),(r=o(this,we))==null||r.call(this),g(this,we,e(this.setOnline.bind(this)))}setOnline(e){o(this,Ze)!==e&&(g(this,Ze,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return o(this,Ze)}},Ze=new WeakMap,we=new WeakMap,et=new WeakMap,_n),kt=new Cs;function er(){let t,e;const r=new Promise((s,a)=>{t=s,e=a});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),t(s)},r.reject=s=>{n({status:"rejected",reason:s}),e(s)},r}function Ts(t){return Math.min(1e3*2**t,3e4)}function Lr(t){return(t??"online")==="online"?kt.isOnline():!0}var Qr=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function tr(t){return t instanceof Qr}function $r(t){let e=!1,r=0,n=!1,s;const a=er(),u=v=>{var P;n||(p(new Qr(v)),(P=t.abort)==null||P.call(t))},l=()=>{e=!0},c=()=>{e=!1},d=()=>Zt.isFocused()&&(t.networkMode==="always"||kt.isOnline())&&t.canRun(),h=()=>Lr(t.networkMode)&&t.canRun(),f=v=>{var P;n||(n=!0,(P=t.onSuccess)==null||P.call(t,v),s==null||s(),a.resolve(v))},p=v=>{var P;n||(n=!0,(P=t.onError)==null||P.call(t,v),s==null||s(),a.reject(v))},m=()=>new Promise(v=>{var P;s=D=>{(n||d())&&v(D)},(P=t.onPause)==null||P.call(t)}).then(()=>{var v;s=void 0,n||(v=t.onContinue)==null||v.call(t)}),O=()=>{if(n)return;let v;const P=r===0?t.initialPromise:void 0;try{v=P??t.fn()}catch(D){v=Promise.reject(D)}Promise.resolve(v).then(f).catch(D=>{var te;if(n)return;const x=t.retry??(_e?0:3),U=t.retryDelay??Ts,V=typeof U=="function"?U(r,D):U,Y=x===!0||typeof x=="number"&&r<x||typeof x=="function"&&x(r,D);if(e||!Y){p(D);return}r++,(te=t.onFail)==null||te.call(t,r,D),Os(V).then(()=>d()?void 0:m()).then(()=>{e?p(D):O()})})};return{promise:a,cancel:u,continue:()=>(s==null||s(),a),cancelRetry:l,continueRetry:c,canStart:h,start:()=>(h()?O():m().then(O),a)}}function xs(){let t=[],e=0,r=l=>{l()},n=l=>{l()},s=l=>setTimeout(l,0);const a=l=>{e?t.push(l):s(()=>{r(l)})},u=()=>{const l=t;t=[],l.length&&s(()=>{n(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||u()}return c},batchCalls:l=>(...c)=>{a(()=>{l(...c)})},schedule:a,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var K=xs(),Kr=(In=class{constructor(){w(this,qe)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Bt(this.gcTime)&&g(this,qe,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(_e?1/0:5*60*1e3))}clearGcTimeout(){o(this,qe)&&(clearTimeout(o(this,qe)),g(this,qe,void 0))}},qe=new WeakMap,In),Fs=(kn=class extends Kr{constructor(e){super();w(this,oe);w(this,tt);w(this,rt);w(this,ne);w(this,Ue);w(this,W);w(this,St);w(this,Me);g(this,Me,!1),g(this,St,e.defaultOptions),this.setOptions(e.options),this.observers=[],g(this,Ue,e.client),g(this,ne,o(this,Ue).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,g(this,tt,As(this.options)),this.state=e.state??o(this,tt),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=o(this,W))==null?void 0:e.promise}setOptions(e){this.options={...o(this,St),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&o(this,ne).remove(this)}setData(e,r){const n=Jt(this.state.data,e,this.options);return R(this,oe,me).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(e,r){R(this,oe,me).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var n,s;const r=(n=o(this,W))==null?void 0:n.promise;return(s=o(this,W))==null||s.cancel(e),r?r.then(re).catch(re):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(o(this,tt))}isActive(){return this.observers.some(e=>ie(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===It||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!kr(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=o(this,W))==null||r.continue()}onOnline(){var r;const e=this.observers.find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=o(this,W))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),o(this,ne).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(o(this,W)&&(o(this,Me)?o(this,W).cancel({revert:!0}):o(this,W).cancelRetry()),this.scheduleGc()),o(this,ne).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||R(this,oe,me).call(this,{type:"invalidate"})}fetch(e,r){var c,d,h;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(o(this,W))return o(this,W).continueRetry(),o(this,W).promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(p=>p.options.queryFn);f&&this.setOptions(f.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(g(this,Me,!0),n.signal)})},a=()=>{const f=Nr(this.options,r),p={client:o(this,Ue),queryKey:this.queryKey,meta:this.meta};return s(p),g(this,Me,!1),this.options.persister?this.options.persister(f,p,this):f(p)},u={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:o(this,Ue),state:this.state,fetchFn:a};s(u),(c=this.options.behavior)==null||c.onFetch(u,this),g(this,rt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=u.fetchOptions)==null?void 0:d.meta))&&R(this,oe,me).call(this,{type:"fetch",meta:(h=u.fetchOptions)==null?void 0:h.meta});const l=f=>{var p,m,O,v;tr(f)&&f.silent||R(this,oe,me).call(this,{type:"error",error:f}),tr(f)||((m=(p=o(this,ne).config).onError)==null||m.call(p,f,this),(v=(O=o(this,ne).config).onSettled)==null||v.call(O,this.state.data,f,this)),this.scheduleGc()};return g(this,W,$r({initialPromise:r==null?void 0:r.initialPromise,fn:u.fetchFn,abort:n.abort.bind(n),onSuccess:f=>{var p,m,O,v;if(f===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(P){l(P);return}(m=(p=o(this,ne).config).onSuccess)==null||m.call(p,f,this),(v=(O=o(this,ne).config).onSettled)==null||v.call(O,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,p)=>{R(this,oe,me).call(this,{type:"failed",failureCount:f,error:p})},onPause:()=>{R(this,oe,me).call(this,{type:"pause"})},onContinue:()=>{R(this,oe,me).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0})),o(this,W).start()}},tt=new WeakMap,rt=new WeakMap,ne=new WeakMap,Ue=new WeakMap,W=new WeakMap,St=new WeakMap,Me=new WeakMap,oe=new WeakSet,me=function(e){const r=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Vr(n.data,this.options),fetchMeta:e.meta??null};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=e.error;return tr(s)&&s.revert&&o(this,rt)?{...o(this,rt),fetchStatus:"idle"}:{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=r(this.state),K.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),o(this,ne).notify({query:this,type:"updated",action:e})})},kn);function Vr(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Lr(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function As(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,n=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Ds=(jn=class extends He{constructor(e={}){super();w(this,ce);this.config=e,g(this,ce,new Map)}build(e,r,n){const s=r.queryKey,a=r.queryHash??Gt(s,r);let u=this.get(a);return u||(u=new Fs({client:e,queryKey:s,queryHash:a,options:e.defaultQueryOptions(r),state:n,defaultOptions:e.getQueryDefaults(s)}),this.add(u)),u}add(e){o(this,ce).has(e.queryHash)||(o(this,ce).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=o(this,ce).get(e.queryHash);r&&(e.destroy(),r===e&&o(this,ce).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){K.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return o(this,ce).get(e)}getAll(){return[...o(this,ce).values()]}find(e){const r={exact:!0,...e};return this.getAll().find(n=>jr(r,n))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(n=>jr(e,n)):r}notify(e){K.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){K.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){K.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ce=new WeakMap,jn),_s=(qn=class extends Kr{constructor(e){super();w(this,fe);w(this,le);w(this,B);w(this,Ne);this.mutationId=e.mutationId,g(this,B,e.mutationCache),g(this,le,[]),this.state=e.state||zr(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){o(this,le).includes(e)||(o(this,le).push(e),this.clearGcTimeout(),o(this,B).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){g(this,le,o(this,le).filter(r=>r!==e)),this.scheduleGc(),o(this,B).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){o(this,le).length||(this.state.status==="pending"?this.scheduleGc():o(this,B).remove(this))}continue(){var e;return((e=o(this,Ne))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var s,a,u,l,c,d,h,f,p,m,O,v,P,D,x,U,V,Y,te,z;g(this,Ne,$r({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(N,q)=>{R(this,fe,De).call(this,{type:"failed",failureCount:N,error:q})},onPause:()=>{R(this,fe,De).call(this,{type:"pause"})},onContinue:()=>{R(this,fe,De).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>o(this,B).canRun(this)}));const r=this.state.status==="pending",n=!o(this,Ne).canStart();try{if(!r){R(this,fe,De).call(this,{type:"pending",variables:e,isPaused:n}),await((a=(s=o(this,B).config).onMutate)==null?void 0:a.call(s,e,this));const q=await((l=(u=this.options).onMutate)==null?void 0:l.call(u,e));q!==this.state.context&&R(this,fe,De).call(this,{type:"pending",context:q,variables:e,isPaused:n})}const N=await o(this,Ne).start();return await((d=(c=o(this,B).config).onSuccess)==null?void 0:d.call(c,N,e,this.state.context,this)),await((f=(h=this.options).onSuccess)==null?void 0:f.call(h,N,e,this.state.context)),await((m=(p=o(this,B).config).onSettled)==null?void 0:m.call(p,N,null,this.state.variables,this.state.context,this)),await((v=(O=this.options).onSettled)==null?void 0:v.call(O,N,null,e,this.state.context)),R(this,fe,De).call(this,{type:"success",data:N}),N}catch(N){try{throw await((D=(P=o(this,B).config).onError)==null?void 0:D.call(P,N,e,this.state.context,this)),await((U=(x=this.options).onError)==null?void 0:U.call(x,N,e,this.state.context)),await((Y=(V=o(this,B).config).onSettled)==null?void 0:Y.call(V,void 0,N,this.state.variables,this.state.context,this)),await((z=(te=this.options).onSettled)==null?void 0:z.call(te,void 0,N,e,this.state.context)),N}finally{R(this,fe,De).call(this,{type:"error",error:N})}}finally{o(this,B).runNext(this)}}},le=new WeakMap,B=new WeakMap,Ne=new WeakMap,fe=new WeakSet,De=function(e){const r=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=r(this.state),K.batch(()=>{o(this,le).forEach(n=>{n.onMutationUpdate(e)}),o(this,B).notify({mutation:this,type:"updated",action:e})})},qn);function zr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Is=(Un=class extends He{constructor(e={}){super();w(this,de);w(this,ae);w(this,Ct);this.config=e,g(this,de,new Set),g(this,ae,new Map),g(this,Ct,0)}build(e,r,n){const s=new _s({mutationCache:this,mutationId:++Vt(this,Ct)._,options:e.defaultMutationOptions(r),state:n});return this.add(s),s}add(e){o(this,de).add(e);const r=jt(e);if(typeof r=="string"){const n=o(this,ae).get(r);n?n.push(e):o(this,ae).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(o(this,de).delete(e)){const r=jt(e);if(typeof r=="string"){const n=o(this,ae).get(r);if(n)if(n.length>1){const s=n.indexOf(e);s!==-1&&n.splice(s,1)}else n[0]===e&&o(this,ae).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=jt(e);if(typeof r=="string"){const n=o(this,ae).get(r),s=n==null?void 0:n.find(a=>a.state.status==="pending");return!s||s===e}else return!0}runNext(e){var n;const r=jt(e);if(typeof r=="string"){const s=(n=o(this,ae).get(r))==null?void 0:n.find(a=>a!==e&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){K.batch(()=>{o(this,de).forEach(e=>{this.notify({type:"removed",mutation:e})}),o(this,de).clear(),o(this,ae).clear()})}getAll(){return Array.from(o(this,de))}find(e){const r={exact:!0,...e};return this.getAll().find(n=>qr(r,n))}findAll(e={}){return this.getAll().filter(r=>qr(e,r))}notify(e){K.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>r.state.isPaused);return K.batch(()=>Promise.all(e.map(r=>r.continue().catch(re))))}},de=new WeakMap,ae=new WeakMap,Ct=new WeakMap,Un);function jt(t){var e;return(e=t.options.scope)==null?void 0:e.id}function Hr(t){return{onFetch:(e,r)=>{var h,f,p,m,O;const n=e.options,s=(p=(f=(h=e.fetchOptions)==null?void 0:h.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,a=((m=e.state.data)==null?void 0:m.pages)||[],u=((O=e.state.data)==null?void 0:O.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let v=!1;const P=U=>{Object.defineProperty(U,"signal",{enumerable:!0,get:()=>(e.signal.aborted?v=!0:e.signal.addEventListener("abort",()=>{v=!0}),e.signal)})},D=Nr(e.options,e.fetchOptions),x=async(U,V,Y)=>{if(v)return Promise.reject();if(V==null&&U.pages.length)return Promise.resolve(U);const te={client:e.client,queryKey:e.queryKey,pageParam:V,direction:Y?"backward":"forward",meta:e.options.meta};P(te);const z=await D(te),{maxPages:N}=e.options,q=Y?Rs:Ps;return{pages:q(U.pages,z,N),pageParams:q(U.pageParams,V,N)}};if(s&&a.length){const U=s==="backward",V=U?ks:Wr,Y={pages:a,pageParams:u},te=V(n,Y);l=await x(Y,te,U)}else{const U=t??a.length;do{const V=c===0?u[0]??n.initialPageParam:Wr(n,l);if(c>0&&V==null)break;l=await x(l,V),c++}while(c<U)}return l};e.options.persister?e.fetchFn=()=>{var v,P;return(P=(v=e.options).persister)==null?void 0:P.call(v,d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=d}}}function Wr(t,{pages:e,pageParams:r}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,r[n],r):void 0}function ks(t,{pages:e,pageParams:r}){var n;return e.length>0?(n=t.getPreviousPageParam)==null?void 0:n.call(t,e[0],e,r[0],r):void 0}var js=(Mn=class{constructor(t={}){w(this,L);w(this,Ee);w(this,Oe);w(this,nt);w(this,st);w(this,Pe);w(this,it);w(this,ot);g(this,L,t.queryCache||new Ds),g(this,Ee,t.mutationCache||new Is),g(this,Oe,t.defaultOptions||{}),g(this,nt,new Map),g(this,st,new Map),g(this,Pe,0)}mount(){Vt(this,Pe)._++,o(this,Pe)===1&&(g(this,it,Zt.subscribe(async t=>{t&&(await this.resumePausedMutations(),o(this,L).onFocus())})),g(this,ot,kt.subscribe(async t=>{t&&(await this.resumePausedMutations(),o(this,L).onOnline())})))}unmount(){var t,e;Vt(this,Pe)._--,o(this,Pe)===0&&((t=o(this,it))==null||t.call(this),g(this,it,void 0),(e=o(this,ot))==null||e.call(this),g(this,ot,void 0))}isFetching(t){return o(this,L).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return o(this,Ee).findAll({...t,status:"pending"}).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=o(this,L).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=o(this,L).build(this,e),n=r.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(We(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return o(this,L).findAll(t).map(({queryKey:e,state:r})=>{const n=r.data;return[e,n]})}setQueryData(t,e,r){const n=this.defaultQueryOptions({queryKey:t}),s=o(this,L).get(n.queryHash),a=s==null?void 0:s.state.data,u=Es(e,a);if(u!==void 0)return o(this,L).build(this,n).setData(u,{...r,manual:!0})}setQueriesData(t,e,r){return K.batch(()=>o(this,L).findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=o(this,L).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=o(this,L);K.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=o(this,L);return K.batch(()=>(r.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},n=K.batch(()=>o(this,L).findAll(t).map(s=>s.cancel(r)));return Promise.all(n).then(re).catch(re)}invalidateQueries(t,e={}){return K.batch(()=>(o(this,L).findAll(t).forEach(r=>{r.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},n=K.batch(()=>o(this,L).findAll(t).filter(s=>!s.isDisabled()).map(s=>{let a=s.fetch(void 0,r);return r.throwOnError||(a=a.catch(re)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(re)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=o(this,L).build(this,e);return r.isStaleByTime(We(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(re).catch(re)}fetchInfiniteQuery(t){return t.behavior=Hr(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(re).catch(re)}ensureInfiniteQueryData(t){return t.behavior=Hr(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return kt.isOnline()?o(this,Ee).resumePausedMutations():Promise.resolve()}getQueryCache(){return o(this,L)}getMutationCache(){return o(this,Ee)}getDefaultOptions(){return o(this,Oe)}setDefaultOptions(t){g(this,Oe,t)}setQueryDefaults(t,e){o(this,nt).set(Ie(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...o(this,nt).values()],r={};return e.forEach(n=>{bt(t,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(t,e){o(this,st).set(Ie(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...o(this,st).values()],r={};return e.forEach(n=>{bt(t,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...o(this,Oe).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Gt(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===It&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...o(this,Oe).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){o(this,L).clear(),o(this,Ee).clear()}},L=new WeakMap,Ee=new WeakMap,Oe=new WeakMap,nt=new WeakMap,st=new WeakMap,Pe=new WeakMap,it=new WeakMap,ot=new WeakMap,Mn),qs=(Nn=class extends He{constructor(e,r){super();w(this,I);w(this,J);w(this,T);w(this,Tt);w(this,G);w(this,Le);w(this,at);w(this,Re);w(this,he);w(this,xt);w(this,ut);w(this,ct);w(this,Qe);w(this,$e);w(this,Se);w(this,lt,new Set);this.options=r,g(this,J,e),g(this,he,null),g(this,Re,er()),this.options.experimental_prefetchInRender||o(this,Re).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(o(this,T).addObserver(this),Br(o(this,T),this.options)?R(this,I,Dt).call(this):this.updateResult(),R(this,I,Cr).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return rr(o(this,T),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return rr(o(this,T),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,R(this,I,Tr).call(this),R(this,I,xr).call(this),o(this,T).removeObserver(this)}setOptions(e,r){const n=this.options,s=o(this,T);if(this.options=o(this,J).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ie(this.options.enabled,o(this,T))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");R(this,I,Fr).call(this),o(this,T).setOptions(this.options),n._defaulted&&!_t(this.options,n)&&o(this,J).getQueryCache().notify({type:"observerOptionsUpdated",query:o(this,T),observer:this});const a=this.hasListeners();a&&Gr(o(this,T),s,this.options,n)&&R(this,I,Dt).call(this),this.updateResult(r),a&&(o(this,T)!==s||ie(this.options.enabled,o(this,T))!==ie(n.enabled,o(this,T))||We(this.options.staleTime,o(this,T))!==We(n.staleTime,o(this,T)))&&R(this,I,Pr).call(this);const u=R(this,I,Rr).call(this);a&&(o(this,T)!==s||ie(this.options.enabled,o(this,T))!==ie(n.enabled,o(this,T))||u!==o(this,Se))&&R(this,I,Sr).call(this,u)}getOptimisticResult(e){const r=o(this,J).getQueryCache().build(o(this,J),e),n=this.createResult(r,e);return Ms(this,n)&&(g(this,G,n),g(this,at,this.options),g(this,Le,o(this,T).state)),n}getCurrentResult(){return o(this,G)}trackResult(e,r){const n={};return Object.keys(e).forEach(s=>{Object.defineProperty(n,s,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(s),r==null||r(s),e[s])})}),n}trackProp(e){o(this,lt).add(e)}getCurrentQuery(){return o(this,T)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const r=o(this,J).defaultQueryOptions(e),n=o(this,J).getQueryCache().build(o(this,J),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(e){return R(this,I,Dt).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),o(this,G)))}createResult(e,r){var N;const n=o(this,T),s=this.options,a=o(this,G),u=o(this,Le),l=o(this,at),d=e!==n?e.state:o(this,Tt),{state:h}=e;let f={...h},p=!1,m;if(r._optimisticResults){const q=this.hasListeners(),xe=!q&&Br(e,r),Fe=q&&Gr(e,n,r,s);(xe||Fe)&&(f={...f,...Vr(h.data,e.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:O,errorUpdatedAt:v,status:P}=f;if(r.select&&f.data!==void 0)if(a&&f.data===(u==null?void 0:u.data)&&r.select===o(this,xt))m=o(this,ut);else try{g(this,xt,r.select),m=r.select(f.data),m=Jt(a==null?void 0:a.data,m,r),g(this,ut,m),g(this,he,null)}catch(q){g(this,he,q)}else m=f.data;if(r.placeholderData!==void 0&&m===void 0&&P==="pending"){let q;if(a!=null&&a.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData))q=a.data;else if(q=typeof r.placeholderData=="function"?r.placeholderData((N=o(this,ct))==null?void 0:N.state.data,o(this,ct)):r.placeholderData,r.select&&q!==void 0)try{q=r.select(q),g(this,he,null)}catch(xe){g(this,he,xe)}q!==void 0&&(P="success",m=Jt(a==null?void 0:a.data,q,r),p=!0)}o(this,he)&&(O=o(this,he),m=o(this,ut),v=Date.now(),P="error");const D=f.fetchStatus==="fetching",x=P==="pending",U=P==="error",V=x&&D,Y=m!==void 0,z={status:P,fetchStatus:f.fetchStatus,isPending:x,isSuccess:P==="success",isError:U,isInitialLoading:V,isLoading:V,data:m,dataUpdatedAt:f.dataUpdatedAt,error:O,errorUpdatedAt:v,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:D,isRefetching:D&&!x,isLoadingError:U&&!Y,isPaused:f.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:U&&Y,isStale:nr(e,r),refetch:this.refetch,promise:o(this,Re)};if(this.options.experimental_prefetchInRender){const q=Ke=>{z.status==="error"?Ke.reject(z.error):z.data!==void 0&&Ke.resolve(z.data)},xe=()=>{const Ke=g(this,Re,z.promise=er());q(Ke)},Fe=o(this,Re);switch(Fe.status){case"pending":e.queryHash===n.queryHash&&q(Fe);break;case"fulfilled":(z.status==="error"||z.data!==Fe.value)&&xe();break;case"rejected":(z.status!=="error"||z.error!==Fe.reason)&&xe();break}}return z}updateResult(e){const r=o(this,G),n=this.createResult(o(this,T),this.options);if(g(this,Le,o(this,T).state),g(this,at,this.options),o(this,Le).data!==void 0&&g(this,ct,o(this,T)),_t(n,r))return;g(this,G,n);const s={},a=()=>{if(!r)return!0;const{notifyOnChangeProps:u}=this.options,l=typeof u=="function"?u():u;if(l==="all"||!l&&!o(this,lt).size)return!0;const c=new Set(l??o(this,lt));return this.options.throwOnError&&c.add("error"),Object.keys(o(this,G)).some(d=>{const h=d;return o(this,G)[h]!==r[h]&&c.has(h)})};(e==null?void 0:e.listeners)!==!1&&a()&&(s.listeners=!0),R(this,I,gs).call(this,{...s,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&R(this,I,Cr).call(this)}},J=new WeakMap,T=new WeakMap,Tt=new WeakMap,G=new WeakMap,Le=new WeakMap,at=new WeakMap,Re=new WeakMap,he=new WeakMap,xt=new WeakMap,ut=new WeakMap,ct=new WeakMap,Qe=new WeakMap,$e=new WeakMap,Se=new WeakMap,lt=new WeakMap,I=new WeakSet,Dt=function(e){R(this,I,Fr).call(this);let r=o(this,T).fetch(this.options,e);return e!=null&&e.throwOnError||(r=r.catch(re)),r},Pr=function(){R(this,I,Tr).call(this);const e=We(this.options.staleTime,o(this,T));if(_e||o(this,G).isStale||!Bt(e))return;const n=kr(o(this,G).dataUpdatedAt,e)+1;g(this,Qe,setTimeout(()=>{o(this,G).isStale||this.updateResult()},n))},Rr=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(o(this,T)):this.options.refetchInterval)??!1},Sr=function(e){R(this,I,xr).call(this),g(this,Se,e),!(_e||ie(this.options.enabled,o(this,T))===!1||!Bt(o(this,Se))||o(this,Se)===0)&&g(this,$e,setInterval(()=>{(this.options.refetchIntervalInBackground||Zt.isFocused())&&R(this,I,Dt).call(this)},o(this,Se)))},Cr=function(){R(this,I,Pr).call(this),R(this,I,Sr).call(this,R(this,I,Rr).call(this))},Tr=function(){o(this,Qe)&&(clearTimeout(o(this,Qe)),g(this,Qe,void 0))},xr=function(){o(this,$e)&&(clearInterval(o(this,$e)),g(this,$e,void 0))},Fr=function(){const e=o(this,J).getQueryCache().build(o(this,J),this.options);if(e===o(this,T))return;const r=o(this,T);g(this,T,e),g(this,Tt,e.state),this.hasListeners()&&(r==null||r.removeObserver(this),e.addObserver(this))},gs=function(e){K.batch(()=>{e.listeners&&this.listeners.forEach(r=>{r(o(this,G))}),o(this,J).getQueryCache().notify({query:o(this,T),type:"observerResultsUpdated"})})},Nn);function Us(t,e){return ie(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Br(t,e){return Us(t,e)||t.state.data!==void 0&&rr(t,e,e.refetchOnMount)}function rr(t,e,r){if(ie(e.enabled,t)!==!1){const n=typeof r=="function"?r(t):r;return n==="always"||n!==!1&&nr(t,e)}return!1}function Gr(t,e,r,n){return(t!==e||ie(n.enabled,t)===!1)&&(!r.suspense||t.state.status!=="error")&&nr(t,r)}function nr(t,e){return ie(e.enabled,t)!==!1&&t.isStaleByTime(We(e.staleTime,t))}function Ms(t,e){return!_t(t.getCurrentResult(),e)}var Ns=(Ln=class extends He{constructor(e,r){super();w(this,pe);w(this,Ce);w(this,Te);w(this,Z);w(this,ye);g(this,Ce,e),this.setOptions(r),this.bindMethods(),R(this,pe,zt).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var n;const r=this.options;this.options=o(this,Ce).defaultMutationOptions(e),_t(this.options,r)||o(this,Ce).getMutationCache().notify({type:"observerOptionsUpdated",mutation:o(this,Z),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Ie(r.mutationKey)!==Ie(this.options.mutationKey)?this.reset():((n=o(this,Z))==null?void 0:n.state.status)==="pending"&&o(this,Z).setOptions(this.options)}onUnsubscribe(){var e;this.hasListeners()||(e=o(this,Z))==null||e.removeObserver(this)}onMutationUpdate(e){R(this,pe,zt).call(this),R(this,pe,Ar).call(this,e)}getCurrentResult(){return o(this,Te)}reset(){var e;(e=o(this,Z))==null||e.removeObserver(this),g(this,Z,void 0),R(this,pe,zt).call(this),R(this,pe,Ar).call(this)}mutate(e,r){var n;return g(this,ye,r),(n=o(this,Z))==null||n.removeObserver(this),g(this,Z,o(this,Ce).getMutationCache().build(o(this,Ce),this.options)),o(this,Z).addObserver(this),o(this,Z).execute(e)}},Ce=new WeakMap,Te=new WeakMap,Z=new WeakMap,ye=new WeakMap,pe=new WeakSet,zt=function(){var r;const e=((r=o(this,Z))==null?void 0:r.state)??zr();g(this,Te,{...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset})},Ar=function(e){K.batch(()=>{var r,n,s,a,u,l,c,d;if(o(this,ye)&&this.hasListeners()){const h=o(this,Te).variables,f=o(this,Te).context;(e==null?void 0:e.type)==="success"?((n=(r=o(this,ye)).onSuccess)==null||n.call(r,e.data,h,f),(a=(s=o(this,ye)).onSettled)==null||a.call(s,e.data,null,h,f)):(e==null?void 0:e.type)==="error"&&((l=(u=o(this,ye)).onError)==null||l.call(u,e.error,h,f),(d=(c=o(this,ye)).onSettled)==null||d.call(c,void 0,e.error,h,f))}this.listeners.forEach(h=>{h(o(this,Te))})})},Ln),Yr=M.createContext(void 0),vt=t=>{const e=M.useContext(Yr);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},Ls=({client:t,children:e})=>(M.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),mt.jsx(Yr.Provider,{value:t,children:e})),Xr=M.createContext(!1),Qs=()=>M.useContext(Xr);Xr.Provider;function $s(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var Ks=M.createContext($s()),Vs=()=>M.useContext(Ks);function Jr(t,e){return typeof t=="function"?t(...e):!!t}function sr(){}var zs=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},Hs=t=>{M.useEffect(()=>{t.clearReset()},[t])},Ws=({result:t,errorResetBoundary:e,throwOnError:r,query:n,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&(s&&t.data===void 0||Jr(r,[t.error,n])),Bs=t=>{const e=t.staleTime;t.suspense&&(t.staleTime=typeof e=="function"?(...r)=>Math.max(e(...r),1e3):Math.max(e??1e3,1e3),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3)))},Gs=(t,e)=>t.isLoading&&t.isFetching&&!e,Ys=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Zr=(t,e,r)=>e.fetchOptimistic(t).catch(()=>{r.clearReset()});function Xs(t,e,r){var f,p,m,O,v;if(process.env.NODE_ENV!=="production"&&(typeof t!="object"||Array.isArray(t)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=vt(),s=Qs(),a=Vs(),u=n.defaultQueryOptions(t);(p=(f=n.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||p.call(f,u),process.env.NODE_ENV!=="production"&&(u.queryFn||console.error(`[${u.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),u._optimisticResults=s?"isRestoring":"optimistic",Bs(u),zs(u,a),Hs(a);const l=!n.getQueryCache().get(u.queryHash),[c]=M.useState(()=>new e(n,u)),d=c.getOptimisticResult(u),h=!s&&t.subscribed!==!1;if(M.useSyncExternalStore(M.useCallback(P=>{const D=h?c.subscribe(K.batchCalls(P)):sr;return c.updateResult(),D},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),M.useEffect(()=>{c.setOptions(u,{listeners:!1})},[u,c]),Ys(u,d))throw Zr(u,c,a);if(Ws({result:d,errorResetBoundary:a,throwOnError:u.throwOnError,query:n.getQueryCache().get(u.queryHash),suspense:u.suspense}))throw d.error;if((O=(m=n.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||O.call(m,u,d),u.experimental_prefetchInRender&&!_e&&Gs(d,s)){const P=l?Zr(u,c,a):(v=n.getQueryCache().get(u.queryHash))==null?void 0:v.promise;P==null||P.catch(sr).finally(()=>{c.updateResult()})}return u.notifyOnChangeProps?d:c.trackResult(d)}function en(t,e){return Xs(t,qs)}function ir(t,e){const r=vt(),[n]=M.useState(()=>new Ns(r,t));M.useEffect(()=>{n.setOptions(t)},[n,t]);const s=M.useSyncExternalStore(M.useCallback(u=>n.subscribe(K.batchCalls(u)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),a=M.useCallback((u,l)=>{n.mutate(u,l).catch(sr)},[n]);if(s.error&&Jr(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}function Be(t){const e={subscribe(r){let n=null,s=!1,a=!1,u=!1;function l(){if(n===null){u=!0;return}a||(a=!0,typeof n=="function"?n():n&&n.unsubscribe())}return n=t({next(c){var d;s||(d=r.next)==null||d.call(r,c)},error(c){var d;s||(s=!0,(d=r.error)==null||d.call(r,c),l())},complete(){var c;s||(s=!0,(c=r.complete)==null||c.call(r),l())}}),u&&l(),{unsubscribe:l}},pipe(...r){return r.reduce(Js,e)}};return e}function Js(t,e){return e(t)}function Zs(t){const e=new AbortController;return new Promise((n,s)=>{let a=!1;function u(){a||(a=!0,l.unsubscribe())}e.signal.addEventListener("abort",()=>{s(e.signal.reason)});const l=t.subscribe({next(c){a=!0,n(c),u()},error(c){s(c)},complete(){e.abort(),u()}})})}function ei(t){return e=>{let r=0,n=null;const s=[];function a(){n||(n=e.subscribe({next(l){var c;for(const d of s)(c=d.next)==null||c.call(d,l)},error(l){var c;for(const d of s)(c=d.error)==null||c.call(d,l)},complete(){var l;for(const c of s)(l=c.complete)==null||l.call(c)}}))}function u(){if(r===0&&n){const l=n;n=null,l.unsubscribe()}}return Be(l=>(r++,s.push(l),a(),{unsubscribe(){r--,u();const c=s.findIndex(d=>d===l);c>-1&&s.splice(c,1)}}))}}function ti(t){return e=>Be(r=>e.subscribe({next(n){var s;(s=t.next)==null||s.call(t,n),r.next(n)},error(n){var s;(s=t.error)==null||s.call(t,n),r.error(n)},complete(){var n;(n=t.complete)==null||n.call(t),r.complete()}}))}function ri(t){let e=t;const r=[],n=u=>{e!==void 0&&u.next(e),r.push(u)},s=u=>{r.splice(r.indexOf(u),1)},a=Be(u=>(n(u),()=>{s(u)}));return a.next=u=>{if(e!==u){e=u;for(const l of r)l.next(u)}},a.get=()=>e,a}function ni(t){return Be(e=>{function r(s=0,a=t.op){const u=t.links[s];if(!u)throw new Error("No more links to execute - did you forget to add an ending link?");return u({op:a,next(c){return r(s+1,c)}})}return r().subscribe(e)})}const tn=()=>{},rn=t=>{Object.freeze&&Object.freeze(t)};function nn(t,e,r){var n,s;const a=e.join(".");return(n=r)[s=a]??(n[s]=new Proxy(tn,{get(u,l){if(!(typeof l!="string"||l==="then"))return nn(t,[...e,l],r)},apply(u,l,c){const d=e[e.length-1];let h={args:c,path:e};return d==="call"?h={args:c.length>=2?[c[1]]:[],path:e.slice(0,-1)}:d==="apply"&&(h={args:c.length>=2?c[1]:[],path:e.slice(0,-1)}),rn(h.args),rn(h.path),t(h)}})),r[a]}const si=t=>nn(t,[],Object.create(null)),ii=t=>new Proxy(tn,{get(e,r){if(r!=="then")return t(r)}});function wt(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}function oi(t,e){if("error"in t){const n=e.deserialize(t.error);return{ok:!1,error:{...t,error:n}}}return{ok:!0,result:{...t.result,...(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)}}}}class or extends Error{constructor(){super("Unable to transform response from server")}}function ai(t,e){let r;try{r=oi(t,e)}catch{throw new or}if(!r.ok&&(!wt(r.error.error)||typeof r.error.error.code!="number"))throw new or;if(r.ok&&!wt(r.result))throw new or;return r}var sn,on;(sn=Symbol).dispose??(sn.dispose=Symbol()),(on=Symbol).asyncDispose??(on.asyncDispose=Symbol()),typeof window>"u"||"Deno"in window||(($n=(Qn=globalThis.process)==null?void 0:Qn.env)==null?void 0:$n.NODE_ENV)==="test"||(Vn=(Kn=globalThis.process)==null?void 0:Kn.env)!=null&&Vn.JEST_WORKER_ID||(Hn=(zn=globalThis.process)==null?void 0:zn.env)!=null&&Hn.VITEST_WORKER_ID;function qt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ui(t){return t instanceof ge||t instanceof Error&&t.name==="TRPCClientError"}function ci(t){return wt(t)&&wt(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function li(t,e){return typeof t=="string"?t:wt(t)&&typeof t.message=="string"?t.message:e}class ge extends Error{static from(e,r={}){const n=e;return ui(n)?(r.meta&&(n.meta={...n.meta,...r.meta}),n):ci(n)?new ge(n.error.message,{...r,result:n}):new ge(li(n,"Unknown error"),{...r,cause:n})}constructor(e,r){var s,a;const n=r==null?void 0:r.cause;super(e,{cause:n}),qt(this,"cause",void 0),qt(this,"shape",void 0),qt(this,"data",void 0),qt(this,"meta",void 0),this.meta=r==null?void 0:r.meta,this.cause=n,this.shape=(s=r==null?void 0:r.result)==null?void 0:s.error,this.data=(a=r==null?void 0:r.result)==null?void 0:a.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,ge.prototype)}}function ar(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class fi{$request(e){return ni({links:this.links,op:{...e,context:e.context??{},id:++this.requestId}}).pipe(ei())}async requestAsPromise(e){try{const r=this.$request(e);return(await Zs(r)).result.data}catch(r){throw ge.from(r)}}query(e,r,n){return this.requestAsPromise({type:"query",path:e,input:r,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}mutation(e,r,n){return this.requestAsPromise({type:"mutation",path:e,input:r,context:n==null?void 0:n.context,signal:n==null?void 0:n.signal})}subscription(e,r,n){return this.$request({type:"subscription",path:e,input:r,context:n.context,signal:n.signal}).subscribe({next(a){var u,l,c,d;switch(a.result.type){case"state":{(u=n.onConnectionStateChange)==null||u.call(n,a.result);break}case"started":{(l=n.onStarted)==null||l.call(n,{context:a.context});break}case"stopped":{(c=n.onStopped)==null||c.call(n);break}case"data":case void 0:{(d=n.onData)==null||d.call(n,a.result.data);break}}},error(a){var u;(u=n.onError)==null||u.call(n,a)},complete(){var a;(a=n.onComplete)==null||a.call(n)}})}constructor(e){ar(this,"links",void 0),ar(this,"runtime",void 0),ar(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(r=>r(this.runtime))}}const hi=Symbol.for("trpc_untypedClient"),di={query:"query",mutate:"mutation",subscribe:"subscription"},yi=t=>di[t];function pi(t){const e=si(({path:r,args:n})=>{const s=[...r],a=yi(s.pop()),u=s.join(".");return t[a](u,...n)});return ii(r=>r===hi?t:e[r])}function mi(t){const e=new fi(t);return pi(e)}const an=t=>typeof t=="function";function gi(t){if(t)return t;if(typeof window<"u"&&an(window.fetch))return window.fetch;if(typeof globalThis<"u"&&an(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}const un=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function cn(t){let e=null,r=null;const n=()=>{clearTimeout(r),r=null,e=null};function s(l){var h,f;const c=[[]];let d=0;for(;;){const p=l[d];if(!p)break;const m=c[c.length-1];if(p.aborted){(h=p.reject)==null||h.call(p,new Error("Aborted")),d++;continue}if(t.validate(m.concat(p).map(v=>v.key))){m.push(p),d++;continue}if(m.length===0){(f=p.reject)==null||f.call(p,new Error("Input is too big for a single dispatch")),d++;continue}c.push([])}return c}function a(){const l=s(e);n();for(const c of l){if(!c.length)continue;const d={items:c};for(const f of c)f.batch=d;t.fetch(d.items.map(f=>f.key)).then(async f=>{var p;await Promise.all(f.map(async(m,O)=>{var P,D;const v=d.items[O];try{const x=await Promise.resolve(m);(P=v.resolve)==null||P.call(v,x)}catch(x){(D=v.reject)==null||D.call(v,x)}v.batch=null,v.reject=null,v.resolve=null}));for(const m of d.items)(p=m.reject)==null||p.call(m,new Error("Missing result")),m.batch=null}).catch(f=>{var p;for(const m of d.items)(p=m.reject)==null||p.call(m,f),m.batch=null})}}function u(l){const c={aborted:!1,key:l,batch:null,resolve:un,reject:un},d=new Promise((h,f)=>{c.reject=f,c.resolve=h,e||(e=[]),e.push(c)});return r||(r=setTimeout(a)),d}return{load:u}}function bi(...t){const e=new AbortController,r=t.length;let n=0;const s=()=>{++n===r&&e.abort()};for(const a of t)a!=null&&a.aborted?s():a==null||a.addEventListener("abort",s,{once:!0});return e.signal}function vi(t){const e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:r=>r,deserialize:r=>r},output:{serialize:r=>r,deserialize:r=>r}}}function wi(t){return{url:t.url.toString(),fetch:t.fetch,transformer:vi(t.transformer),methodOverride:t.methodOverride}}function Ei(t){const e={};for(let r=0;r<t.length;r++){const n=t[r];e[r]=n}return e}const Oi={query:"GET",mutation:"POST",subscription:"PATCH"};function ln(t){return"input"in t?t.transformer.input.serialize(t.input):Ei(t.inputs.map(e=>t.transformer.input.serialize(e)))}const fn=t=>{const e=t.url.split("?");let n=e[0].replace(/\/$/,"")+"/"+t.path;const s=[];if(e[1]&&s.push(e[1]),"inputs"in t&&s.push("batch=1"),t.type==="query"||t.type==="subscription"){const a=ln(t);a!==void 0&&t.methodOverride!=="POST"&&s.push(`input=${encodeURIComponent(JSON.stringify(a))}`)}return s.length&&(n+="?"+s.join("&")),n},Pi=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=ln(t);return e!==void 0?JSON.stringify(e):void 0},Ri=t=>xi({...t,contentTypeHeader:"application/json",getUrl:fn,getBody:Pi});class Si extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}}const Ci=t=>{var e;if(t!=null&&t.aborted)throw(e=t.throwIfAborted)==null||e.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new Si};async function Ti(t){Ci(t.signal);const e=t.getUrl(t),r=t.getBody(t),{type:n}=t,s=await(async()=>{const u=await t.headers();return Symbol.iterator in u?Object.fromEntries(u):u})(),a={...t.contentTypeHeader?{"content-type":t.contentTypeHeader}:{},...t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0,...s};return gi(t.fetch)(e,{method:t.methodOverride??Oi[n],signal:t.signal,body:r,headers:a})}async function xi(t){const e={},r=await Ti(t);e.response=r;const n=await r.json();return e.responseJSON=n,{json:n,meta:e}}function Fi(t){const e=wi(t),r=t.maxURLLength??1/0;return()=>{const n=l=>({validate(c){if(r===1/0)return!0;const d=c.map(p=>p.path).join(","),h=c.map(p=>p.input);return fn({...e,type:l,path:d,inputs:h,signal:null}).length<=r},async fetch(c){const d=c.map(v=>v.path).join(","),h=c.map(v=>v.input),f=bi(...c.map(v=>v.signal)),p=await Ri({...e,path:d,inputs:h,type:l,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:c}):t.headers:{}},signal:f});return(Array.isArray(p.json)?p.json:c.map(()=>p.json)).map(v=>({meta:p.meta,json:v}))}}),s=cn(n("query")),a=cn(n("mutation")),u={query:s,mutation:a};return({op:l})=>Be(c=>{/* istanbul ignore if -- @preserve */if(l.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const h=u[l.type].load(l);let f;return h.then(p=>{f=p;const m=ai(p.json,e.transformer.output);if(!m.ok){c.error(ge.from(m.error,{meta:p.meta}));return}c.next({context:p.meta,result:m.result}),c.complete()}).catch(p=>{c.error(ge.from(p,{meta:f==null?void 0:f.meta}))}),()=>{}})}}function Ai(t){return typeof FormData>"u"?!1:t instanceof FormData}const ur={css:{query:["72e3ff","3fb0d8"],mutation:["c5a3fc","904dfc"],subscription:["ff49e1","d83fbe"]},ansi:{regular:{query:["\x1B[30;46m","\x1B[97;46m"],mutation:["\x1B[30;45m","\x1B[97;45m"],subscription:["\x1B[30;42m","\x1B[97;42m"]},bold:{query:["\x1B[1;30;46m","\x1B[1;97;46m"],mutation:["\x1B[1;30;45m","\x1B[1;97;45m"],subscription:["\x1B[1;30;42m","\x1B[1;97;42m"]}}};function Di(t){const{direction:e,type:r,withContext:n,path:s,id:a,input:u}=t,l=[],c=[];if(t.colorMode==="none")l.push(e==="up"?">>":"<<",r,`#${a}`,s);else if(t.colorMode==="ansi"){const[d,h]=ur.ansi.regular[r],[f,p]=ur.ansi.bold[r];l.push(e==="up"?d:h,e==="up"?">>":"<<",r,e==="up"?f:p,`#${a}`,s,"\x1B[0m")}else{const[d,h]=ur.css[r],f=`
|
|
31
31
|
background-color: #${e==="up"?d:h};
|
|
32
32
|
color: ${e==="up"?"black":"white"};
|
|
33
33
|
padding: 2px;
|
|
34
|
-
`;l.push("%c",e==="up"?">>":"<<",r,`#${a}`,`%c${s}%c`,"%O"),c.push(f,`${f}; font-weight: bold;`,`${f}; font-weight: normal;`)}return e==="up"?c.push(n?{input:u,context:t.context}:{input:u}):c.push({input:u,result:t.result,elapsedMs:t.elapsedMs,...n&&{context:t.context}}),{parts:l,args:c}}const _i=({c:t=console,colorMode:e="css",withContext:r})=>n=>{const s=n.input,a=Ai(s)?Object.fromEntries(s):s,{parts:u,args:l}=Di({...n,colorMode:e,input:a,withContext:r}),c=n.direction==="down"&&n.result&&(n.result instanceof Error||"error"in n.result.result&&n.result.result.error)?"error":"log";t[c].apply(null,[u.join(" ")].concat(l))};function Ii(t={}){const{enabled:e=()=>!0}=t,r=t.colorMode??(typeof window>"u"?"ansi":"css"),n=t.withContext??r==="css",{logger:s=_i({c:t.console,colorMode:r,withContext:n})}=t;return()=>({op:a,next:u})=>Be(l=>{e({...a,direction:"up"})&&s({...a,direction:"up"});const c=Date.now();function d(h){const f=Date.now()-c;e({...a,direction:"down",result:h})&&s({...a,direction:"down",elapsedMs:f,result:h})}return u(a).pipe(ti({next(h){d(h)},error(h){d(h)}})).subscribe(l)})}const ki=(t,...e)=>typeof t=="function"?t(...e):t;function ji(){let t,e;return{promise:new Promise((n,s)=>{t=n,e=s}),resolve:t,reject:e}}async function qi(t){const e=await ki(t.url);if(!t.connectionParams)return e;const n=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+n}function ke(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ui(t){const{promise:e,resolve:r,reject:n}=ji();return t.addEventListener("open",()=>{t.removeEventListener("error",n),r()}),t.addEventListener("error",n),e}function Mi(t,{intervalMs:e,pongTimeoutMs:r}){let n,s;function a(){n=setTimeout(()=>{t.send("PING"),s=setTimeout(()=>{t.close()},r)},e)}function u(){clearTimeout(n),a()}function l(){clearTimeout(s),u()}t.addEventListener("open",a),t.addEventListener("message",({data:c})=>{clearTimeout(n),a(),c==="PONG"&&l()}),t.addEventListener("close",()=>{clearTimeout(n),clearTimeout(s)})}class Ut{get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){if(this.openPromise)return this.openPromise;this.id=++Ut.connectCount;const e=qi(this.urlOptions).then(r=>new this.WebSocketPonyfill(r));this.openPromise=e.then(Ui),this.ws=await e,this.ws.addEventListener("message",function({data:r}){r==="PING"&&this.send("PONG")}),this.keepAliveOpts.enabled&&Mi(this.ws,this.keepAliveOpts),this.ws.addEventListener("close",()=>{this.ws=null});try{await this.openPromise}finally{this.openPromise=null}}async close(){var e;try{await this.openPromise}finally{(e=this.ws)==null||e.close()}}constructor(e){if(ke(this,"id",++Ut.connectCount),ke(this,"WebSocketPonyfill",void 0),ke(this,"urlOptions",void 0),ke(this,"keepAliveOpts",void 0),ke(this,"wsObservable",ri(null)),ke(this,"openPromise",null),this.WebSocketPonyfill=e.WebSocketPonyfill??WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=e.urlOptions,this.keepAliveOpts=e.keepAlive}}ke(Ut,"connectCount",0);class Ni{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,r){this.keyToValue.set(e,r),this.valueToKey.set(r,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}}class hn{constructor(e){this.generateIdentifier=e,this.kv=new Ni}register(e,r){this.kv.getByValue(e)||(r||(r=this.generateIdentifier(e)),this.kv.set(r,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}}class Li extends hn{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,r){typeof r=="object"?(r.allowProps&&this.classToAllowedProps.set(e,r.allowProps),super.register(e,r.identifier)):super.register(e,r)}getAllowedProps(e){return this.classToAllowedProps.get(e)}}function Qi(t){if("values"in Object)return Object.values(t);const e=[];for(const r in t)t.hasOwnProperty(r)&&e.push(t[r]);return e}function $i(t,e){const r=Qi(t);if("find"in r)return r.find(e);const n=r;for(let s=0;s<n.length;s++){const a=n[s];if(e(a))return a}}function Ge(t,e){Object.entries(t).forEach(([r,n])=>e(n,r))}function Mt(t,e){return t.indexOf(e)!==-1}function dn(t,e){for(let r=0;r<t.length;r++){const n=t[r];if(e(n))return n}}class Ki{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return $i(this.transfomers,r=>r.isApplicable(e))}findByName(e){return this.transfomers[e]}}const Vi=t=>Object.prototype.toString.call(t).slice(8,-1),yn=t=>typeof t>"u",zi=t=>t===null,Et=t=>typeof t!="object"||t===null||t===Object.prototype?!1:Object.getPrototypeOf(t)===null?!0:Object.getPrototypeOf(t)===Object.prototype,cr=t=>Et(t)&&Object.keys(t).length===0,be=t=>Array.isArray(t),Hi=t=>typeof t=="string",Wi=t=>typeof t=="number"&&!isNaN(t),Bi=t=>typeof t=="boolean",Gi=t=>t instanceof RegExp,Ot=t=>t instanceof Map,Pt=t=>t instanceof Set,pn=t=>Vi(t)==="Symbol",Yi=t=>t instanceof Date&&!isNaN(t.valueOf()),Xi=t=>t instanceof Error,mn=t=>typeof t=="number"&&isNaN(t),Ji=t=>Bi(t)||zi(t)||yn(t)||Wi(t)||Hi(t)||pn(t),Zi=t=>typeof t=="bigint",eo=t=>t===1/0||t===-1/0,to=t=>ArrayBuffer.isView(t)&&!(t instanceof DataView),ro=t=>t instanceof URL,gn=t=>t.replace(/\./g,"\\."),lr=t=>t.map(String).map(gn).join("."),Rt=t=>{const e=[];let r="";for(let s=0;s<t.length;s++){let a=t.charAt(s);if(a==="\\"&&t.charAt(s+1)==="."){r+=".",s++;continue}if(a==="."){e.push(r),r="";continue}r+=a}const n=r;return e.push(n),e};function ue(t,e,r,n){return{isApplicable:t,annotation:e,transform:r,untransform:n}}const bn=[ue(yn,"undefined",()=>null,()=>{}),ue(Zi,"bigint",t=>t.toString(),t=>typeof BigInt<"u"?BigInt(t):(console.error("Please add a BigInt polyfill."),t)),ue(Yi,"Date",t=>t.toISOString(),t=>new Date(t)),ue(Xi,"Error",(t,e)=>{const r={name:t.name,message:t.message};return e.allowedErrorProps.forEach(n=>{r[n]=t[n]}),r},(t,e)=>{const r=new Error(t.message);return r.name=t.name,r.stack=t.stack,e.allowedErrorProps.forEach(n=>{r[n]=t[n]}),r}),ue(Gi,"regexp",t=>""+t,t=>{const e=t.slice(1,t.lastIndexOf("/")),r=t.slice(t.lastIndexOf("/")+1);return new RegExp(e,r)}),ue(Pt,"set",t=>[...t.values()],t=>new Set(t)),ue(Ot,"map",t=>[...t.entries()],t=>new Map(t)),ue(t=>mn(t)||eo(t),"number",t=>mn(t)?"NaN":t>0?"Infinity":"-Infinity",Number),ue(t=>t===0&&1/t===-1/0,"number",()=>"-0",Number),ue(ro,"URL",t=>t.toString(),t=>new URL(t))];function Nt(t,e,r,n){return{isApplicable:t,annotation:e,transform:r,untransform:n}}const vn=Nt((t,e)=>pn(t)?!!e.symbolRegistry.getIdentifier(t):!1,(t,e)=>["symbol",e.symbolRegistry.getIdentifier(t)],t=>t.description,(t,e,r)=>{const n=r.symbolRegistry.getValue(e[1]);if(!n)throw new Error("Trying to deserialize unknown symbol");return n}),no=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((t,e)=>(t[e.name]=e,t),{}),wn=Nt(to,t=>["typed-array",t.constructor.name],t=>[...t],(t,e)=>{const r=no[e[1]];if(!r)throw new Error("Trying to deserialize unknown typed array");return new r(t)});function En(t,e){return t!=null&&t.constructor?!!e.classRegistry.getIdentifier(t.constructor):!1}const On=Nt(En,(t,e)=>["class",e.classRegistry.getIdentifier(t.constructor)],(t,e)=>{const r=e.classRegistry.getAllowedProps(t.constructor);if(!r)return{...t};const n={};return r.forEach(s=>{n[s]=t[s]}),n},(t,e,r)=>{const n=r.classRegistry.getValue(e[1]);if(!n)throw new Error(`Trying to deserialize unknown class '${e[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(n.prototype),t)}),Pn=Nt((t,e)=>!!e.customTransformerRegistry.findApplicable(t),(t,e)=>["custom",e.customTransformerRegistry.findApplicable(t).name],(t,e)=>e.customTransformerRegistry.findApplicable(t).serialize(t),(t,e,r)=>{const n=r.customTransformerRegistry.findByName(e[1]);if(!n)throw new Error("Trying to deserialize unknown custom value");return n.deserialize(t)}),so=[On,vn,Pn,wn],Rn=(t,e)=>{const r=dn(so,s=>s.isApplicable(t,e));if(r)return{value:r.transform(t,e),type:r.annotation(t,e)};const n=dn(bn,s=>s.isApplicable(t,e));if(n)return{value:n.transform(t,e),type:n.annotation}},Sn={};bn.forEach(t=>{Sn[t.annotation]=t});const io=(t,e,r)=>{if(be(e))switch(e[0]){case"symbol":return vn.untransform(t,e,r);case"class":return On.untransform(t,e,r);case"custom":return Pn.untransform(t,e,r);case"typed-array":return wn.untransform(t,e,r);default:throw new Error("Unknown transformation: "+e)}else{const n=Sn[e];if(!n)throw new Error("Unknown transformation: "+e);return n.untransform(t,r)}},Ye=(t,e)=>{if(e>t.size)throw new Error("index out of bounds");const r=t.keys();for(;e>0;)r.next(),e--;return r.next().value};function Cn(t){if(Mt(t,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(Mt(t,"prototype"))throw new Error("prototype is not allowed as a property");if(Mt(t,"constructor"))throw new Error("constructor is not allowed as a property")}const oo=(t,e)=>{Cn(e);for(let r=0;r<e.length;r++){const n=e[r];if(Pt(t))t=Ye(t,+n);else if(Ot(t)){const s=+n,a=+e[++r]==0?"key":"value",u=Ye(t,s);switch(a){case"key":t=u;break;case"value":t=t.get(u);break}}else t=t[n]}return t},fr=(t,e,r)=>{if(Cn(e),e.length===0)return r(t);let n=t;for(let a=0;a<e.length-1;a++){const u=e[a];if(be(n)){const l=+u;n=n[l]}else if(Et(n))n=n[u];else if(Pt(n)){const l=+u;n=Ye(n,l)}else if(Ot(n)){if(a===e.length-2)break;const c=+u,d=+e[++a]==0?"key":"value",h=Ye(n,c);switch(d){case"key":n=h;break;case"value":n=n.get(h);break}}}const s=e[e.length-1];if(be(n)?n[+s]=r(n[+s]):Et(n)&&(n[s]=r(n[s])),Pt(n)){const a=Ye(n,+s),u=r(a);a!==u&&(n.delete(a),n.add(u))}if(Ot(n)){const a=+e[e.length-2],u=Ye(n,a);switch(+s==0?"key":"value"){case"key":{const c=r(u);n.set(c,n.get(u)),c!==u&&n.delete(u);break}case"value":{n.set(u,r(n.get(u)));break}}}return t};function hr(t,e,r=[]){if(!t)return;if(!be(t)){Ge(t,(a,u)=>hr(a,e,[...r,...Rt(u)]));return}const[n,s]=t;s&&Ge(s,(a,u)=>{hr(a,e,[...r,...Rt(u)])}),e(n,r)}function ao(t,e,r){return hr(e,(n,s)=>{t=fr(t,s,a=>io(a,n,r))}),t}function uo(t,e){function r(n,s){const a=oo(t,Rt(s));n.map(Rt).forEach(u=>{t=fr(t,u,()=>a)})}if(be(e)){const[n,s]=e;n.forEach(a=>{t=fr(t,Rt(a),()=>t)}),s&&Ge(s,r)}else Ge(e,r);return t}const co=(t,e)=>Et(t)||be(t)||Ot(t)||Pt(t)||En(t,e);function lo(t,e,r){const n=r.get(t);n?n.push(e):r.set(t,[e])}function fo(t,e){const r={};let n;return t.forEach(s=>{if(s.length<=1)return;e||(s=s.map(l=>l.map(String)).sort((l,c)=>l.length-c.length));const[a,...u]=s;a.length===0?n=u.map(lr):r[lr(a)]=u.map(lr)}),n?cr(r)?[n]:[n,r]:cr(r)?void 0:r}const Tn=(t,e,r,n,s=[],a=[],u=new Map)=>{const l=Ji(t);if(!l){lo(t,s,e);const m=u.get(t);if(m)return n?{transformedValue:null}:m}if(!co(t,r)){const m=Rn(t,r),P=m?{transformedValue:m.value,annotations:[m.type]}:{transformedValue:t};return l||u.set(t,P),P}if(Mt(a,t))return{transformedValue:null};const c=Rn(t,r),d=(c==null?void 0:c.value)??t,h=be(d)?[]:{},f={};Ge(d,(m,P)=>{if(P==="__proto__"||P==="constructor"||P==="prototype")throw new Error(`Detected property ${P}. This is a prototype pollution risk, please remove it from your object.`);const v=Tn(m,e,r,n,[...s,P],[...a,t],u);h[P]=v.transformedValue,be(v.annotations)?f[P]=v.annotations:Et(v.annotations)&&Ge(v.annotations,(O,D)=>{f[gn(P)+"."+D]=O})});const p=cr(f)?{transformedValue:h,annotations:c?[c.type]:void 0}:{transformedValue:h,annotations:c?[c.type,f]:f};return l||u.set(t,p),p};function xn(t){return Object.prototype.toString.call(t).slice(8,-1)}function Fn(t){return xn(t)==="Array"}function ho(t){if(xn(t)!=="Object")return!1;const e=Object.getPrototypeOf(t);return!!e&&e.constructor===Object&&e===Object.prototype}function yo(t,e,r,n,s){const a={}.propertyIsEnumerable.call(n,e)?"enumerable":"nonenumerable";a==="enumerable"&&(t[e]=r),s&&a==="nonenumerable"&&Object.defineProperty(t,e,{value:r,enumerable:!1,writable:!0,configurable:!0})}function dr(t,e={}){if(Fn(t))return t.map(s=>dr(s,e));if(!ho(t))return t;const r=Object.getOwnPropertyNames(t),n=Object.getOwnPropertySymbols(t);return[...r,...n].reduce((s,a)=>{if(Fn(e.props)&&!e.props.includes(a))return s;const u=t[a],l=dr(u,e);return yo(s,a,l,t,e.nonenumerable),s},{})}class C{constructor({dedupe:e=!1}={}){this.classRegistry=new Li,this.symbolRegistry=new hn(r=>r.description??""),this.customTransformerRegistry=new Ki,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const r=new Map,n=Tn(e,r,this,this.dedupe),s={json:n.transformedValue};n.annotations&&(s.meta={...s.meta,values:n.annotations});const a=fo(r,this.dedupe);return a&&(s.meta={...s.meta,referentialEqualities:a}),s}deserialize(e){const{json:r,meta:n}=e;let s=dr(r);return n!=null&&n.values&&(s=ao(s,n.values,this)),n!=null&&n.referentialEqualities&&(s=uo(s,n.referentialEqualities)),s}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,r){this.classRegistry.register(e,r)}registerSymbol(e,r){this.symbolRegistry.register(e,r)}registerCustom(e,r){this.customTransformerRegistry.register({name:r,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}}C.defaultInstance=new C,C.serialize=C.defaultInstance.serialize.bind(C.defaultInstance),C.deserialize=C.defaultInstance.deserialize.bind(C.defaultInstance),C.stringify=C.defaultInstance.stringify.bind(C.defaultInstance),C.parse=C.defaultInstance.parse.bind(C.defaultInstance),C.registerClass=C.defaultInstance.registerClass.bind(C.defaultInstance),C.registerSymbol=C.defaultInstance.registerSymbol.bind(C.defaultInstance),C.registerCustom=C.defaultInstance.registerCustom.bind(C.defaultInstance),C.allowErrorProps=C.defaultInstance.allowErrorProps.bind(C.defaultInstance),C.serialize,C.deserialize,C.stringify,C.parse,C.registerClass,C.registerCustom,C.registerSymbol,C.allowErrorProps;const An=_.createContext(null);function po(t,e){const r=mi({links:[Ii({enabled:s=>process.env.NODE_ENV==="development"&&typeof window<"u"||s.direction==="down"&&s.result instanceof Error}),Fi({url:`${t}/trpc`,headers:()=>({Authorization:`Bearer ${e}`}),transformer:C})]}),n=async(s,a,u=null)=>{const l=a.map(f=>{const p=f.name.toLowerCase(),m=ws(p);return{...f,mimeType:m}}).filter(f=>f.mimeType!==null);if(l.length===0)return{filesToCreate:[]};const c=await r.fileRouter.getFilesByProject.query({projectId:s}),d=l.filter(f=>u===null?!c.some(p=>p.path===f.blobUrl):!c.some(p=>p.path===f.blobUrl&&p.parentId===u));return d.length===0?{filesToCreate:[]}:{filesToCreate:d.map(f=>({projectId:s,mimeType:f.mimeType,path:f.blobUrl,name:f.name,size:0,metadata:null,isArtifact:!1,summary:null,chunkingStatus:Ht.NOT_CHUNKED,isDirectory:!1,parentId:u}))}};return{getProjectsForUser:async()=>{const s=await r.projectRouter.getAllProjects.query();if(s.length===0){const a=await r.projectRouter.createProject.mutate({name:"Default Project"});return[{name:a.name,id:a.id}]}return s.map(a=>({name:a.name,id:a.id}))},addProjectForUser:async s=>{const a=await r.projectRouter.createProject.mutate({name:s});return{name:a.name,id:a.id}},addFilesToProject:async(s,a)=>{const{filesToCreate:u}=await n(s,a);return u.length===0?[]:(await r.fileRouter.createFiles.mutate({files:u})).map(c=>({blobUrl:c.path,name:c.name,id:c.id,parentId:c.parentId,isDirectory:c.isDirectory}))},getFilesForProject:async s=>(await r.fileRouter.getFilesByProject.query({projectId:s})).map(u=>({blobUrl:u.path,name:u.name,id:u.id,parentId:u.parentId,isDirectory:u.isDirectory})),addDirectoryWithFilesToProject:async(s,a,u,l)=>{if((await r.fileRouter.getFilesByProject.query({projectId:s})).some(m=>m.name===a&&m.isDirectory===!0&&m.parentId===null))return console.warn(`A directory named "${a}" already exists at the root level. Skipping creation.`),{directory:null,files:[]};const h=await r.fileRouter.createFile.mutate({file:{projectId:s,mimeType:Wt.DIRECTORY,path:"",name:a,size:0,metadata:u,isArtifact:!1,isDirectory:!0,parentId:null,summary:null,chunkingStatus:Ht.NOT_CHUNKED}});if(l.length===0)return{directory:{blobUrl:h.path,name:h.name,id:h.id,parentId:h.parentId,isDirectory:h.isDirectory},files:[]};const{filesToCreate:f}=await n(s,l,h.id);if(f.length===0)return{directory:{blobUrl:h.path,name:h.name,id:h.id,parentId:h.parentId,isDirectory:h.isDirectory},files:[]};const p=await r.fileRouter.createFiles.mutate({files:f});return{directory:h?{blobUrl:h.path,name:h.name,id:h.id,parentId:h.parentId,isDirectory:h.isDirectory}:null,files:p.map(m=>({blobUrl:m.path,name:m.name,id:m.id,parentId:m.parentId,isDirectory:m.isDirectory}))}}}}function mo({children:t,host:e="http://localhost",port:r=5174,token:n}){const[s,a]=_.useState(null),u=_.useMemo(()=>new js({defaultOptions:{queries:{staleTime:30*1e3,refetchOnWindowFocus:!1}}}),[]);return _.useEffect(()=>{const l=`${e}:${r}`,c=po(l,n);a(c)},[e,r,n]),mt.jsx(Ls,{client:u,children:mt.jsx(An.Provider,{value:{host:e,port:r,client:s,token:n},children:t})})}function Xe(){const t=_.useContext(An);if(!t)throw new Error("useFolioContext must be used within a FolioProvider");return t}const{useEffect:go,useRef:bo,useState:vo}=M;function wo({width:t="100%",height:e="100vh",allow:r="camera; microphone; clipboard-read; clipboard-write; fullscreen",style:n,className:s="",iframeProps:a={}}){const{host:u,port:l,token:c}=Xe(),d=bo(null),[h,f]=vo();return go(()=>{(()=>{const P=`${`${u}:${l}`}?jwt=${encodeURIComponent(c)}`;f(P)})()},[u,l,c]),h?mt.jsx("div",{className:`folio-embed-container ${s}`,style:{width:t,height:e,overflow:"hidden",...n},children:mt.jsx("iframe",{ref:d,src:h,width:"100%",height:"100%",style:{border:"none",width:"100%",height:"100%",overflow:"auto"},allow:r,allowFullScreen:!0,...a})}):null}function Eo(){const{client:t}=Xe(),e=en({queryKey:["folioProjects"],queryFn:async()=>{if(!t)throw new Error("Folio client not initialized");return t.getProjectsForUser()},enabled:!!t});return{projects:e.data||[],isLoading:e.isLoading,isError:e.isError,error:e.error,refetch:e.refetch}}function Oo(t){const{client:e}=Xe(),r=en({queryKey:["folioFiles",t],queryFn:async()=>{if(!e)throw new Error("Folio client not initialized");if(!t)throw new Error("Project ID is required");return e.getFilesForProject(t)},enabled:!!e&&!!t});return{files:r.data||[],isLoading:r.isLoading,isError:r.isError,error:r.error,refetch:r.refetch}}function Po(){const{client:t}=Xe(),e=vt(),r=ir({mutationFn:async n=>{if(!t)throw new Error("Folio client not initialized");return t.addProjectForUser(n)},onSuccess:()=>{e.invalidateQueries({queryKey:["folioProjects"]})}});return{addProject:r.mutate,addProjectAsync:r.mutateAsync,isAdding:r.isPending,isError:r.isError,error:r.error,newProject:r.data}}function Ro(t){const{client:e}=Xe(),r=vt(),n=ir({mutationFn:async s=>{if(!e)throw new Error("Folio client not initialized");if(!t)throw new Error("Project ID is required");return e.addFilesToProject(t,s)},onSuccess:()=>{r.invalidateQueries({queryKey:["folioFiles",t]})}});return{addFiles:n.mutate,addFilesAsync:n.mutateAsync,isAdding:n.isPending,isError:n.isError,error:n.error,newFiles:n.data}}function So(t){const{client:e}=Xe(),r=vt(),n=ir({mutationFn:async s=>{if(!e)throw new Error("Folio client not initialized");if(!t)throw new Error("Project ID is required");const a=Array.isArray(s)?s:[s],u=[];for(const l of a){const c=JSON.stringify(l.directoryMetadata),d=await e.addDirectoryWithFilesToProject(t,l.directoryName,c,l.files);u.push(d)}return Array.isArray(s)?u:u[0]},onSuccess:()=>{r.invalidateQueries({queryKey:["folioFiles",t]})}});return{addDirectoriesWithFiles:n.mutate,addDirectoriesWithFilesAsync:n.mutateAsync,isAdding:n.isPending,isError:n.isError,error:n.error,result:n.data}}F.FolioEmbed=wo,F.FolioProvider=mo,F.useAddFolioDirectoriesWithFiles=So,F.useAddFolioFiles=Ro,F.useAddFolioProject=Po,F.useFolioFiles=Oo,F.useFolioProjects=Eo,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
|
|
34
|
+
`;l.push("%c",e==="up"?">>":"<<",r,`#${a}`,`%c${s}%c`,"%O"),c.push(f,`${f}; font-weight: bold;`,`${f}; font-weight: normal;`)}return e==="up"?c.push(n?{input:u,context:t.context}:{input:u}):c.push({input:u,result:t.result,elapsedMs:t.elapsedMs,...n&&{context:t.context}}),{parts:l,args:c}}const _i=({c:t=console,colorMode:e="css",withContext:r})=>n=>{const s=n.input,a=Ai(s)?Object.fromEntries(s):s,{parts:u,args:l}=Di({...n,colorMode:e,input:a,withContext:r}),c=n.direction==="down"&&n.result&&(n.result instanceof Error||"error"in n.result.result&&n.result.result.error)?"error":"log";t[c].apply(null,[u.join(" ")].concat(l))};function Ii(t={}){const{enabled:e=()=>!0}=t,r=t.colorMode??(typeof window>"u"?"ansi":"css"),n=t.withContext??r==="css",{logger:s=_i({c:t.console,colorMode:r,withContext:n})}=t;return()=>({op:a,next:u})=>Be(l=>{e({...a,direction:"up"})&&s({...a,direction:"up"});const c=Date.now();function d(h){const f=Date.now()-c;e({...a,direction:"down",result:h})&&s({...a,direction:"down",elapsedMs:f,result:h})}return u(a).pipe(ti({next(h){d(h)},error(h){d(h)}})).subscribe(l)})}const ki=(t,...e)=>typeof t=="function"?t(...e):t;function ji(){let t,e;return{promise:new Promise((n,s)=>{t=n,e=s}),resolve:t,reject:e}}async function qi(t){const e=await ki(t.url);if(!t.connectionParams)return e;const n=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+n}function ke(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ui(t){const{promise:e,resolve:r,reject:n}=ji();return t.addEventListener("open",()=>{t.removeEventListener("error",n),r()}),t.addEventListener("error",n),e}function Mi(t,{intervalMs:e,pongTimeoutMs:r}){let n,s;function a(){n=setTimeout(()=>{t.send("PING"),s=setTimeout(()=>{t.close()},r)},e)}function u(){clearTimeout(n),a()}function l(){clearTimeout(s),u()}t.addEventListener("open",a),t.addEventListener("message",({data:c})=>{clearTimeout(n),a(),c==="PONG"&&l()}),t.addEventListener("close",()=>{clearTimeout(n),clearTimeout(s)})}class Ut{get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){if(this.openPromise)return this.openPromise;this.id=++Ut.connectCount;const e=qi(this.urlOptions).then(r=>new this.WebSocketPonyfill(r));this.openPromise=e.then(Ui),this.ws=await e,this.ws.addEventListener("message",function({data:r}){r==="PING"&&this.send("PONG")}),this.keepAliveOpts.enabled&&Mi(this.ws,this.keepAliveOpts),this.ws.addEventListener("close",()=>{this.ws=null});try{await this.openPromise}finally{this.openPromise=null}}async close(){var e;try{await this.openPromise}finally{(e=this.ws)==null||e.close()}}constructor(e){if(ke(this,"id",++Ut.connectCount),ke(this,"WebSocketPonyfill",void 0),ke(this,"urlOptions",void 0),ke(this,"keepAliveOpts",void 0),ke(this,"wsObservable",ri(null)),ke(this,"openPromise",null),this.WebSocketPonyfill=e.WebSocketPonyfill??WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=e.urlOptions,this.keepAliveOpts=e.keepAlive}}ke(Ut,"connectCount",0);class Ni{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,r){this.keyToValue.set(e,r),this.valueToKey.set(r,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}}class hn{constructor(e){this.generateIdentifier=e,this.kv=new Ni}register(e,r){this.kv.getByValue(e)||(r||(r=this.generateIdentifier(e)),this.kv.set(r,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}}class Li extends hn{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,r){typeof r=="object"?(r.allowProps&&this.classToAllowedProps.set(e,r.allowProps),super.register(e,r.identifier)):super.register(e,r)}getAllowedProps(e){return this.classToAllowedProps.get(e)}}function Qi(t){if("values"in Object)return Object.values(t);const e=[];for(const r in t)t.hasOwnProperty(r)&&e.push(t[r]);return e}function $i(t,e){const r=Qi(t);if("find"in r)return r.find(e);const n=r;for(let s=0;s<n.length;s++){const a=n[s];if(e(a))return a}}function Ge(t,e){Object.entries(t).forEach(([r,n])=>e(n,r))}function Mt(t,e){return t.indexOf(e)!==-1}function dn(t,e){for(let r=0;r<t.length;r++){const n=t[r];if(e(n))return n}}class Ki{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return $i(this.transfomers,r=>r.isApplicable(e))}findByName(e){return this.transfomers[e]}}const Vi=t=>Object.prototype.toString.call(t).slice(8,-1),yn=t=>typeof t>"u",zi=t=>t===null,Et=t=>typeof t!="object"||t===null||t===Object.prototype?!1:Object.getPrototypeOf(t)===null?!0:Object.getPrototypeOf(t)===Object.prototype,cr=t=>Et(t)&&Object.keys(t).length===0,be=t=>Array.isArray(t),Hi=t=>typeof t=="string",Wi=t=>typeof t=="number"&&!isNaN(t),Bi=t=>typeof t=="boolean",Gi=t=>t instanceof RegExp,Ot=t=>t instanceof Map,Pt=t=>t instanceof Set,pn=t=>Vi(t)==="Symbol",Yi=t=>t instanceof Date&&!isNaN(t.valueOf()),Xi=t=>t instanceof Error,mn=t=>typeof t=="number"&&isNaN(t),Ji=t=>Bi(t)||zi(t)||yn(t)||Wi(t)||Hi(t)||pn(t),Zi=t=>typeof t=="bigint",eo=t=>t===1/0||t===-1/0,to=t=>ArrayBuffer.isView(t)&&!(t instanceof DataView),ro=t=>t instanceof URL,gn=t=>t.replace(/\./g,"\\."),lr=t=>t.map(String).map(gn).join("."),Rt=t=>{const e=[];let r="";for(let s=0;s<t.length;s++){let a=t.charAt(s);if(a==="\\"&&t.charAt(s+1)==="."){r+=".",s++;continue}if(a==="."){e.push(r),r="";continue}r+=a}const n=r;return e.push(n),e};function ue(t,e,r,n){return{isApplicable:t,annotation:e,transform:r,untransform:n}}const bn=[ue(yn,"undefined",()=>null,()=>{}),ue(Zi,"bigint",t=>t.toString(),t=>typeof BigInt<"u"?BigInt(t):(console.error("Please add a BigInt polyfill."),t)),ue(Yi,"Date",t=>t.toISOString(),t=>new Date(t)),ue(Xi,"Error",(t,e)=>{const r={name:t.name,message:t.message};return e.allowedErrorProps.forEach(n=>{r[n]=t[n]}),r},(t,e)=>{const r=new Error(t.message);return r.name=t.name,r.stack=t.stack,e.allowedErrorProps.forEach(n=>{r[n]=t[n]}),r}),ue(Gi,"regexp",t=>""+t,t=>{const e=t.slice(1,t.lastIndexOf("/")),r=t.slice(t.lastIndexOf("/")+1);return new RegExp(e,r)}),ue(Pt,"set",t=>[...t.values()],t=>new Set(t)),ue(Ot,"map",t=>[...t.entries()],t=>new Map(t)),ue(t=>mn(t)||eo(t),"number",t=>mn(t)?"NaN":t>0?"Infinity":"-Infinity",Number),ue(t=>t===0&&1/t===-1/0,"number",()=>"-0",Number),ue(ro,"URL",t=>t.toString(),t=>new URL(t))];function Nt(t,e,r,n){return{isApplicable:t,annotation:e,transform:r,untransform:n}}const vn=Nt((t,e)=>pn(t)?!!e.symbolRegistry.getIdentifier(t):!1,(t,e)=>["symbol",e.symbolRegistry.getIdentifier(t)],t=>t.description,(t,e,r)=>{const n=r.symbolRegistry.getValue(e[1]);if(!n)throw new Error("Trying to deserialize unknown symbol");return n}),no=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((t,e)=>(t[e.name]=e,t),{}),wn=Nt(to,t=>["typed-array",t.constructor.name],t=>[...t],(t,e)=>{const r=no[e[1]];if(!r)throw new Error("Trying to deserialize unknown typed array");return new r(t)});function En(t,e){return t!=null&&t.constructor?!!e.classRegistry.getIdentifier(t.constructor):!1}const On=Nt(En,(t,e)=>["class",e.classRegistry.getIdentifier(t.constructor)],(t,e)=>{const r=e.classRegistry.getAllowedProps(t.constructor);if(!r)return{...t};const n={};return r.forEach(s=>{n[s]=t[s]}),n},(t,e,r)=>{const n=r.classRegistry.getValue(e[1]);if(!n)throw new Error(`Trying to deserialize unknown class '${e[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(n.prototype),t)}),Pn=Nt((t,e)=>!!e.customTransformerRegistry.findApplicable(t),(t,e)=>["custom",e.customTransformerRegistry.findApplicable(t).name],(t,e)=>e.customTransformerRegistry.findApplicable(t).serialize(t),(t,e,r)=>{const n=r.customTransformerRegistry.findByName(e[1]);if(!n)throw new Error("Trying to deserialize unknown custom value");return n.deserialize(t)}),so=[On,vn,Pn,wn],Rn=(t,e)=>{const r=dn(so,s=>s.isApplicable(t,e));if(r)return{value:r.transform(t,e),type:r.annotation(t,e)};const n=dn(bn,s=>s.isApplicable(t,e));if(n)return{value:n.transform(t,e),type:n.annotation}},Sn={};bn.forEach(t=>{Sn[t.annotation]=t});const io=(t,e,r)=>{if(be(e))switch(e[0]){case"symbol":return vn.untransform(t,e,r);case"class":return On.untransform(t,e,r);case"custom":return Pn.untransform(t,e,r);case"typed-array":return wn.untransform(t,e,r);default:throw new Error("Unknown transformation: "+e)}else{const n=Sn[e];if(!n)throw new Error("Unknown transformation: "+e);return n.untransform(t,r)}},Ye=(t,e)=>{if(e>t.size)throw new Error("index out of bounds");const r=t.keys();for(;e>0;)r.next(),e--;return r.next().value};function Cn(t){if(Mt(t,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(Mt(t,"prototype"))throw new Error("prototype is not allowed as a property");if(Mt(t,"constructor"))throw new Error("constructor is not allowed as a property")}const oo=(t,e)=>{Cn(e);for(let r=0;r<e.length;r++){const n=e[r];if(Pt(t))t=Ye(t,+n);else if(Ot(t)){const s=+n,a=+e[++r]==0?"key":"value",u=Ye(t,s);switch(a){case"key":t=u;break;case"value":t=t.get(u);break}}else t=t[n]}return t},fr=(t,e,r)=>{if(Cn(e),e.length===0)return r(t);let n=t;for(let a=0;a<e.length-1;a++){const u=e[a];if(be(n)){const l=+u;n=n[l]}else if(Et(n))n=n[u];else if(Pt(n)){const l=+u;n=Ye(n,l)}else if(Ot(n)){if(a===e.length-2)break;const c=+u,d=+e[++a]==0?"key":"value",h=Ye(n,c);switch(d){case"key":n=h;break;case"value":n=n.get(h);break}}}const s=e[e.length-1];if(be(n)?n[+s]=r(n[+s]):Et(n)&&(n[s]=r(n[s])),Pt(n)){const a=Ye(n,+s),u=r(a);a!==u&&(n.delete(a),n.add(u))}if(Ot(n)){const a=+e[e.length-2],u=Ye(n,a);switch(+s==0?"key":"value"){case"key":{const c=r(u);n.set(c,n.get(u)),c!==u&&n.delete(u);break}case"value":{n.set(u,r(n.get(u)));break}}}return t};function hr(t,e,r=[]){if(!t)return;if(!be(t)){Ge(t,(a,u)=>hr(a,e,[...r,...Rt(u)]));return}const[n,s]=t;s&&Ge(s,(a,u)=>{hr(a,e,[...r,...Rt(u)])}),e(n,r)}function ao(t,e,r){return hr(e,(n,s)=>{t=fr(t,s,a=>io(a,n,r))}),t}function uo(t,e){function r(n,s){const a=oo(t,Rt(s));n.map(Rt).forEach(u=>{t=fr(t,u,()=>a)})}if(be(e)){const[n,s]=e;n.forEach(a=>{t=fr(t,Rt(a),()=>t)}),s&&Ge(s,r)}else Ge(e,r);return t}const co=(t,e)=>Et(t)||be(t)||Ot(t)||Pt(t)||En(t,e);function lo(t,e,r){const n=r.get(t);n?n.push(e):r.set(t,[e])}function fo(t,e){const r={};let n;return t.forEach(s=>{if(s.length<=1)return;e||(s=s.map(l=>l.map(String)).sort((l,c)=>l.length-c.length));const[a,...u]=s;a.length===0?n=u.map(lr):r[lr(a)]=u.map(lr)}),n?cr(r)?[n]:[n,r]:cr(r)?void 0:r}const Tn=(t,e,r,n,s=[],a=[],u=new Map)=>{const l=Ji(t);if(!l){lo(t,s,e);const m=u.get(t);if(m)return n?{transformedValue:null}:m}if(!co(t,r)){const m=Rn(t,r),O=m?{transformedValue:m.value,annotations:[m.type]}:{transformedValue:t};return l||u.set(t,O),O}if(Mt(a,t))return{transformedValue:null};const c=Rn(t,r),d=(c==null?void 0:c.value)??t,h=be(d)?[]:{},f={};Ge(d,(m,O)=>{if(O==="__proto__"||O==="constructor"||O==="prototype")throw new Error(`Detected property ${O}. This is a prototype pollution risk, please remove it from your object.`);const v=Tn(m,e,r,n,[...s,O],[...a,t],u);h[O]=v.transformedValue,be(v.annotations)?f[O]=v.annotations:Et(v.annotations)&&Ge(v.annotations,(P,D)=>{f[gn(O)+"."+D]=P})});const p=cr(f)?{transformedValue:h,annotations:c?[c.type]:void 0}:{transformedValue:h,annotations:c?[c.type,f]:f};return l||u.set(t,p),p};function xn(t){return Object.prototype.toString.call(t).slice(8,-1)}function Fn(t){return xn(t)==="Array"}function ho(t){if(xn(t)!=="Object")return!1;const e=Object.getPrototypeOf(t);return!!e&&e.constructor===Object&&e===Object.prototype}function yo(t,e,r,n,s){const a={}.propertyIsEnumerable.call(n,e)?"enumerable":"nonenumerable";a==="enumerable"&&(t[e]=r),s&&a==="nonenumerable"&&Object.defineProperty(t,e,{value:r,enumerable:!1,writable:!0,configurable:!0})}function dr(t,e={}){if(Fn(t))return t.map(s=>dr(s,e));if(!ho(t))return t;const r=Object.getOwnPropertyNames(t),n=Object.getOwnPropertySymbols(t);return[...r,...n].reduce((s,a)=>{if(Fn(e.props)&&!e.props.includes(a))return s;const u=t[a],l=dr(u,e);return yo(s,a,l,t,e.nonenumerable),s},{})}class C{constructor({dedupe:e=!1}={}){this.classRegistry=new Li,this.symbolRegistry=new hn(r=>r.description??""),this.customTransformerRegistry=new Ki,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const r=new Map,n=Tn(e,r,this,this.dedupe),s={json:n.transformedValue};n.annotations&&(s.meta={...s.meta,values:n.annotations});const a=fo(r,this.dedupe);return a&&(s.meta={...s.meta,referentialEqualities:a}),s}deserialize(e){const{json:r,meta:n}=e;let s=dr(r);return n!=null&&n.values&&(s=ao(s,n.values,this)),n!=null&&n.referentialEqualities&&(s=uo(s,n.referentialEqualities)),s}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,r){this.classRegistry.register(e,r)}registerSymbol(e,r){this.symbolRegistry.register(e,r)}registerCustom(e,r){this.customTransformerRegistry.register({name:r,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}}C.defaultInstance=new C,C.serialize=C.defaultInstance.serialize.bind(C.defaultInstance),C.deserialize=C.defaultInstance.deserialize.bind(C.defaultInstance),C.stringify=C.defaultInstance.stringify.bind(C.defaultInstance),C.parse=C.defaultInstance.parse.bind(C.defaultInstance),C.registerClass=C.defaultInstance.registerClass.bind(C.defaultInstance),C.registerSymbol=C.defaultInstance.registerSymbol.bind(C.defaultInstance),C.registerCustom=C.defaultInstance.registerCustom.bind(C.defaultInstance),C.allowErrorProps=C.defaultInstance.allowErrorProps.bind(C.defaultInstance),C.serialize,C.deserialize,C.stringify,C.parse,C.registerClass,C.registerCustom,C.registerSymbol,C.allowErrorProps;const An=_.createContext(null);function po(t,e){const r=mi({links:[Ii({enabled:s=>process.env.NODE_ENV==="development"&&typeof window<"u"||s.direction==="down"&&s.result instanceof Error}),Fi({url:`${t}/trpc`,headers:()=>({Authorization:`Bearer ${e}`}),transformer:C})]}),n=async(s,a,u=null)=>{const l=a.map(f=>{const p=f.name.toLowerCase(),m=p.includes(".")?p.substring(p.lastIndexOf(".")):"",O=ws(m);return{...f,mimeType:O}}).filter(f=>f.mimeType!==null);if(l.length===0)return{filesToCreate:[]};const c=await r.fileRouter.getFilesByProject.query({projectId:s}),d=l.filter(f=>u===null?!c.some(p=>p.path===f.blobUrl):!c.some(p=>p.path===f.blobUrl&&p.parentId===u));return d.length===0?{filesToCreate:[]}:{filesToCreate:d.map(f=>({projectId:s,mimeType:f.mimeType,path:f.blobUrl,name:f.name,size:0,metadata:null,isArtifact:!1,summary:null,chunkingStatus:Ht.NOT_CHUNKED,isDirectory:!1,parentId:u}))}};return{getProjectsForUser:async()=>{const s=await r.projectRouter.getAllProjects.query();if(s.length===0){const a=await r.projectRouter.createProject.mutate({name:"Default Project"});return[{name:a.name,id:a.id}]}return s.map(a=>({name:a.name,id:a.id}))},addProjectForUser:async s=>{const a=await r.projectRouter.createProject.mutate({name:s});return{name:a.name,id:a.id}},addFilesToProject:async(s,a)=>{const{filesToCreate:u}=await n(s,a);return u.length===0?[]:(await r.fileRouter.createFiles.mutate({files:u})).map(c=>({blobUrl:c.path,name:c.name,id:c.id,parentId:c.parentId,isDirectory:c.isDirectory}))},getFilesForProject:async s=>(await r.fileRouter.getFilesByProject.query({projectId:s})).map(u=>({blobUrl:u.path,name:u.name,id:u.id,parentId:u.parentId,isDirectory:u.isDirectory})),addDirectoryWithFilesToProject:async(s,a,u,l)=>{if((await r.fileRouter.getFilesByProject.query({projectId:s})).some(m=>m.name===a&&m.isDirectory===!0&&m.parentId===null))return console.warn(`A directory named "${a}" already exists at the root level. Skipping creation.`),{directory:null,files:[]};const h=await r.fileRouter.createFile.mutate({file:{projectId:s,mimeType:Wt.DIRECTORY,path:"",name:a,size:0,metadata:u,isArtifact:!1,isDirectory:!0,parentId:null,summary:null,chunkingStatus:Ht.NOT_CHUNKED}});if(l.length===0)return{directory:{blobUrl:h.path,name:h.name,id:h.id,parentId:h.parentId,isDirectory:h.isDirectory},files:[]};const{filesToCreate:f}=await n(s,l,h.id);if(f.length===0)return{directory:{blobUrl:h.path,name:h.name,id:h.id,parentId:h.parentId,isDirectory:h.isDirectory},files:[]};const p=await r.fileRouter.createFiles.mutate({files:f});return{directory:h?{blobUrl:h.path,name:h.name,id:h.id,parentId:h.parentId,isDirectory:h.isDirectory}:null,files:p.map(m=>({blobUrl:m.path,name:m.name,id:m.id,parentId:m.parentId,isDirectory:m.isDirectory}))}}}}function mo({children:t,host:e="http://localhost",port:r=5174,token:n}){const[s,a]=_.useState(null),u=_.useMemo(()=>new js({defaultOptions:{queries:{staleTime:30*1e3,refetchOnWindowFocus:!1}}}),[]);return _.useEffect(()=>{const l=`${e}:${r}`,c=po(l,n);a(c)},[e,r,n]),mt.jsx(Ls,{client:u,children:mt.jsx(An.Provider,{value:{host:e,port:r,client:s,token:n},children:t})})}function Xe(){const t=_.useContext(An);if(!t)throw new Error("useFolioContext must be used within a FolioProvider");return t}const{useEffect:go,useRef:bo,useState:vo}=M;function wo({width:t="100%",height:e="100vh",allow:r="camera; microphone; clipboard-read; clipboard-write; fullscreen",style:n,className:s="",iframeProps:a={}}){const{host:u,port:l,token:c}=Xe(),d=bo(null),[h,f]=vo();return go(()=>{(()=>{const O=`${`${u}:${l}`}?jwt=${encodeURIComponent(c)}`;f(O)})()},[u,l,c]),h?mt.jsx("div",{className:`folio-embed-container ${s}`,style:{width:t,height:e,overflow:"hidden",...n},children:mt.jsx("iframe",{ref:d,src:h,width:"100%",height:"100%",style:{border:"none",width:"100%",height:"100%",overflow:"auto"},allow:r,allowFullScreen:!0,...a})}):null}function Eo(){const{client:t}=Xe(),e=en({queryKey:["folioProjects"],queryFn:async()=>{if(!t)throw new Error("Folio client not initialized");return t.getProjectsForUser()},enabled:!!t});return{projects:e.data||[],isLoading:e.isLoading,isError:e.isError,error:e.error,refetch:e.refetch}}function Oo(t){const{client:e}=Xe(),r=en({queryKey:["folioFiles",t],queryFn:async()=>{if(!e)throw new Error("Folio client not initialized");if(!t)throw new Error("Project ID is required");return e.getFilesForProject(t)},enabled:!!e&&!!t});return{files:r.data||[],isLoading:r.isLoading,isError:r.isError,error:r.error,refetch:r.refetch}}function Po(){const{client:t}=Xe(),e=vt(),r=ir({mutationFn:async n=>{if(!t)throw new Error("Folio client not initialized");return t.addProjectForUser(n)},onSuccess:()=>{e.invalidateQueries({queryKey:["folioProjects"]})}});return{addProject:r.mutate,addProjectAsync:r.mutateAsync,isAdding:r.isPending,isError:r.isError,error:r.error,newProject:r.data}}function Ro(t){const{client:e}=Xe(),r=vt(),n=ir({mutationFn:async s=>{if(!e)throw new Error("Folio client not initialized");if(!t)throw new Error("Project ID is required");return e.addFilesToProject(t,s)},onSuccess:()=>{r.invalidateQueries({queryKey:["folioFiles",t]})}});return{addFiles:n.mutate,addFilesAsync:n.mutateAsync,isAdding:n.isPending,isError:n.isError,error:n.error,newFiles:n.data}}function So(t){const{client:e}=Xe(),r=vt(),n=ir({mutationFn:async s=>{if(!e)throw new Error("Folio client not initialized");if(!t)throw new Error("Project ID is required");const a=Array.isArray(s)?s:[s],u=[];for(const l of a){const c=JSON.stringify(l.directoryMetadata),d=await e.addDirectoryWithFilesToProject(t,l.directoryName,c,l.files);u.push(d)}return Array.isArray(s)?u:u[0]},onSuccess:()=>{r.invalidateQueries({queryKey:["folioFiles",t]})}});return{addDirectoriesWithFiles:n.mutate,addDirectoriesWithFilesAsync:n.mutateAsync,isAdding:n.isPending,isError:n.isError,error:n.error,result:n.data}}F.FolioEmbed=wo,F.FolioProvider=mo,F.useAddFolioDirectoriesWithFiles=So,F.useAddFolioFiles=Ro,F.useAddFolioProject=Po,F.useFolioFiles=Oo,F.useFolioProjects=Eo,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
|