@book.dev/ui 1.64.0 → 1.65.0

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.
@@ -10,17 +10,17 @@ import * as D from "@radix-ui/react-dialog";
10
10
  import { Slot as O } from "@radix-ui/react-slot";
11
11
  import { cva as k } from "class-variance-authority";
12
12
  import { useImmer as A } from "use-immer";
13
- import { Activity as j, AlarmClock as M, AlertTriangle as N, Anchor as P, Aperture as ie, Archive as F, Award as I, Backpack as L, BarChart3 as ae, Battery as R, Beaker as z, Bell as B, Bike as oe, Binary as se, Bird as V, Book as ce, BookOpen as H, Bookmark as U, Box as W, Brain as G, Briefcase as le, Brush as ue, Bug as de, Building2 as fe, Bus as pe, Cake as me, Calculator as he, Calendar as ge, Camera as _e, Car as ve, Carrot as ye, Check as be, CheckCircle2 as xe, ChefHat as Se, Cherry as Ce, Circle as we, Clapperboard as Te, Clipboard as Ee, Clock as De, Cloud as Oe, Code2 as ke, Coffee as Ae, Cog as je, Coins as Me, Compass as Ne, Cpu as Pe, CreditCard as Fe, Crown as Ie, Database as Le, Diamond as Re, Dog as ze, DollarSign as Be, Download as Ve, Droplet as He, Dumbbell as Ue, Egg as We, Eye as Ge, Feather as Ke, FileText as qe, Film as Je, Filter as Ye, Flag as Xe, Flame as Ze, FlaskConical as Qe, Flower2 as $e, Folder as et, Footprints as tt, Gamepad2 as nt, Gauge as rt, Gem as it, Gift as at, GitBranch as ot, Globe as st, GraduationCap as ct, Grid3x3 as lt, Hammer as ut, Hand as dt, Hash as ft, Headphones as pt, Heart as mt, HelpCircle as ht, Home as gt, Image as _t, Inbox as vt, Infinity as yt, Info as bt, Key as xt, Keyboard as St, Lamp as Ct, Laptop as wt, Layers as Tt, Layout as Et, Leaf as Dt, Library as Ot, Lightbulb as kt, Link as At, List as jt, Lock as Mt, Mail as Nt, Map as Pt, MapPin as Ft, Megaphone as It, MessageCircle as Lt, MessageSquare as Rt, Mic as zt, Monitor as Bt, Moon as Vt, Mountain as Ht, Mouse as Ut, Music as Wt, Navigation as Gt, Newspaper as Kt, Package as qt, Palette as Jt, PanelLeft as Yt, Paperclip as Xt, PartyPopper as Zt, PenTool as Qt, Pencil as $t, Phone as en, PieChart as tn, PiggyBank as nn, Pin as rn, Plane as an, Play as on, Plug as sn, Plus as cn, Puzzle as ln, Rabbit as un, Radio as dn, Rocket as fn, Ruler as pn, Save as mn, Scale as hn, Scissors as gn, Search as _n, Send as vn, Settings as yn, Share2 as bn, Shield as xn, ShoppingBag as Sn, ShoppingCart as Cn, Smile as wn, Snowflake as Tn, Sparkles as En, Speaker as Dn, Sprout as On, Star as kn, Sticker as An, Sun as jn, Sword as Mn, Table as Nn, Tag as Pn, Target as Fn, Tent as In, Terminal as Ln, ThumbsUp as Rn, Ticket as zn, Timer as Bn, ToggleLeft as Vn, Trash2 as Hn, TreePine as Un, TrendingUp as Wn, Trophy as Gn, Truck as Kn, Tv as qn, Umbrella as Jn, User as Yn, Users as Xn, Utensils as Zn, Video as Qn, Wallet as $n, Wand2 as er, Watch as tr, Waves as nr, Wifi as rr, Wind as ir, Wrench as ar, Zap as or } from "lucide-react";
13
+ import { Activity as j, AlarmClock as M, AlertTriangle as N, Anchor as P, Aperture as F, Archive as I, Award as L, Backpack as R, BarChart3 as ie, Battery as z, Beaker as B, Bell as V, Bike as ae, Binary as oe, Bird as H, Book as se, BookOpen as U, Bookmark as W, Box as G, Brain as K, Briefcase as ce, Brush as le, Bug as ue, Building2 as de, Bus as fe, Cake as pe, Calculator as me, Calendar as he, Camera as ge, Car as _e, Carrot as ve, Check as ye, CheckCircle2 as be, ChefHat as xe, Cherry as Se, Circle as Ce, Clapperboard as we, Clipboard as Te, Clock as Ee, Cloud as De, Code2 as Oe, Coffee as ke, Cog as Ae, Coins as je, Compass as Me, Cpu as Ne, CreditCard as Pe, Crown as Fe, Database as Ie, Diamond as Le, Dog as Re, DollarSign as ze, Download as Be, Droplet as Ve, Dumbbell as He, Egg as Ue, Eye as We, Feather as Ge, FileText as Ke, Film as qe, Filter as Je, Flag as Ye, Flame as Xe, FlaskConical as Ze, Flower2 as Qe, Folder as $e, Footprints as et, Gamepad2 as tt, Gauge as nt, Gem as rt, Gift as it, GitBranch as at, Globe as ot, GraduationCap as st, Grid3x3 as ct, Hammer as lt, Hand as ut, Hash as dt, Headphones as ft, Heart as pt, HelpCircle as mt, Home as ht, Image as gt, Inbox as _t, Infinity as vt, Info as yt, Key as bt, Keyboard as xt, Lamp as St, Laptop as Ct, Layers as wt, Layout as Tt, Leaf as Et, Library as Dt, Lightbulb as Ot, Link as kt, List as At, Lock as jt, Mail as Mt, Map as Nt, MapPin as Pt, Megaphone as Ft, MessageCircle as It, MessageSquare as Lt, Mic as Rt, Monitor as zt, Moon as Bt, Mountain as Vt, Mouse as Ht, Music as Ut, Navigation as Wt, Newspaper as Gt, Package as Kt, Palette as qt, PanelLeft as Jt, Paperclip as Yt, PartyPopper as Xt, PenTool as Zt, Pencil as Qt, Phone as $t, PieChart as en, PiggyBank as tn, Pin as nn, Plane as rn, Play as an, Plug as on, Plus as sn, Puzzle as cn, Rabbit as ln, Radio as un, Rocket as dn, Ruler as fn, Save as pn, Scale as mn, Scissors as hn, Search as gn, Send as _n, Settings as vn, Share2 as yn, Shield as bn, ShoppingBag as xn, ShoppingCart as Sn, Smile as Cn, Snowflake as wn, Sparkles as Tn, Speaker as En, Sprout as Dn, Star as On, Sticker as kn, Sun as An, Sword as jn, Table as Mn, Tag as Nn, Target as Pn, Tent as Fn, Terminal as In, ThumbsUp as Ln, Ticket as Rn, Timer as zn, ToggleLeft as Bn, Trash2 as Vn, TreePine as Hn, TrendingUp as Un, Trophy as Wn, Truck as Gn, Tv as Kn, Umbrella as qn, User as Jn, Users as Yn, Utensils as Xn, Video as Zn, Wallet as Qn, Wand2 as $n, Watch as er, Waves as tr, Wifi as nr, Wind as rr, Wrench as ir, Zap as ar } from "lucide-react";
14
14
  //#region src/lib/utils.ts
15
- function K(...e) {
15
+ function q(...e) {
16
16
  return g(h(e));
17
17
  }
18
18
  //#endregion
19
19
  //#region src/providers/PlatformLibraryProvider.tsx
20
- var sr = o({}), cr = () => c(sr), lr = ({ value: e = {}, children: t }) => /* @__PURE__ */ p(sr.Provider, {
20
+ var or = o({}), sr = () => c(or), cr = ({ value: e = {}, children: t }) => /* @__PURE__ */ p(or.Provider, {
21
21
  value: e,
22
22
  children: t
23
- }), q = {
23
+ }), J = {
24
24
  profile: {
25
25
  name: "",
26
26
  displayName: "",
@@ -33,37 +33,54 @@ var sr = o({}), cr = () => c(sr), lr = ({ value: e = {}, children: t }) => /* @_
33
33
  spellcheck: !0
34
34
  },
35
35
  features: {}
36
- }, ur = o(null), dr = "openbook.preferences";
36
+ };
37
+ function lr(e, t) {
38
+ return {
39
+ profile: {
40
+ ...e.profile,
41
+ ...t.profile
42
+ },
43
+ general: {
44
+ ...e.general,
45
+ ...t.general
46
+ },
47
+ features: {
48
+ ...e.features,
49
+ ...t.features
50
+ }
51
+ };
52
+ }
53
+ var ur = o(null), dr = "openbook.preferences";
37
54
  function fr(e) {
38
55
  return {
39
56
  profile: {
40
- ...q.profile,
57
+ ...J.profile,
41
58
  ...e?.profile
42
59
  },
43
60
  general: {
44
- ...q.general,
61
+ ...J.general,
45
62
  ...e?.general
46
63
  },
47
64
  features: {
48
- ...q.features,
65
+ ...J.features,
49
66
  ...e?.features
50
67
  }
51
68
  };
52
69
  }
53
70
  function pr() {
54
- if (typeof window > "u") return q;
71
+ if (typeof window > "u") return J;
55
72
  try {
56
73
  let e = localStorage.getItem(dr);
57
- return e ? fr(JSON.parse(e)) : q;
74
+ return e ? fr(JSON.parse(e)) : J;
58
75
  } catch {
59
- return q;
76
+ return J;
60
77
  }
61
78
  }
62
79
  var mr = ({ children: e }) => {
63
- let [t, n] = f(q);
80
+ let [t, n] = f(J);
64
81
  l(() => {
65
82
  let e = pr();
66
- e !== q && n(e);
83
+ e !== J && n(e);
67
84
  }, []);
68
85
  let r = t.profile.displayName || t.profile.name;
69
86
  l(() => {
@@ -71,20 +88,7 @@ var mr = ({ children: e }) => {
71
88
  }, [r]);
72
89
  let i = s((e) => {
73
90
  n((t) => {
74
- let n = {
75
- profile: {
76
- ...t.profile,
77
- ...e.profile
78
- },
79
- general: {
80
- ...t.general,
81
- ...e.general
82
- },
83
- features: {
84
- ...t.features,
85
- ...e.features
86
- }
87
- };
91
+ let n = lr(t, e);
88
92
  try {
89
93
  localStorage.setItem(dr, JSON.stringify(n));
90
94
  } catch {}
@@ -102,7 +106,7 @@ var mr = ({ children: e }) => {
102
106
  let e = c(ur);
103
107
  if (!e) throw Error("usePreferences must be used within a <PreferencesProvider>");
104
108
  return e;
105
- }, gr = "openbook.workspaces", J = {
109
+ }, gr = "openbook.workspaces", Y = {
106
110
  id: "local",
107
111
  icon: "🏡",
108
112
  name: "My Workspace",
@@ -115,13 +119,13 @@ var mr = ({ children: e }) => {
115
119
  return e;
116
120
  }
117
121
  }, br = () => {
118
- if (typeof localStorage > "u") return [J];
119
- let e = [J];
122
+ if (typeof localStorage > "u") return [Y];
123
+ let e = [Y];
120
124
  try {
121
125
  let t = localStorage.getItem(gr), n = t ? JSON.parse(t) : null;
122
126
  Array.isArray(n) && n.length > 0 && (e = n);
123
127
  } catch {}
124
- e.some((e) => e.serverUrl === null) || (e = [J, ...e]);
128
+ e.some((e) => e.serverUrl === null) || (e = [Y, ...e]);
125
129
  let t = x();
126
130
  return t && !e.some((e) => _r(e.serverUrl, t)) && (e = [...e, {
127
131
  id: vr(),
@@ -144,20 +148,20 @@ var mr = ({ children: e }) => {
144
148
  return !1;
145
149
  }
146
150
  }, wr = (e) => !!e && typeof e == "object" && typeof e.id == "string" && typeof e.name == "string" && Cr(e.serverUrl), Tr = o({
147
- workspaces: [J],
148
- workspace: J,
151
+ workspaces: [Y],
152
+ workspace: Y,
149
153
  selectWorkspace: () => void 0,
150
- addWorkspace: () => J,
154
+ addWorkspace: () => Y,
151
155
  removeWorkspace: () => void 0,
152
156
  updateWorkspace: () => void 0,
153
- replaceWorkspaces: () => void 0
157
+ replaceWorkspaces: () => []
154
158
  }), Er = () => c(Tr), Dr = ({ children: e }) => {
155
- let [t, n] = f([J]), [r, i] = f(J.id);
159
+ let [t, n] = f([Y]), [r, i] = f(Y.id);
156
160
  l(() => {
157
161
  let e = br();
158
162
  n(e), i(Sr(e)), xr(e);
159
163
  }, []);
160
- let a = u(() => t.find((e) => e.id === r) ?? t[0] ?? J, [t, r]), o = s((e) => {
164
+ let a = u(() => t.find((e) => e.id === r) ?? t[0] ?? Y, [t, r]), o = s((e) => {
161
165
  let n = t.find((t) => t.id === e);
162
166
  if (n) {
163
167
  if (_r(n.serverUrl, x())) {
@@ -193,14 +197,14 @@ var mr = ({ children: e }) => {
193
197
  });
194
198
  }, []), h = s((e) => {
195
199
  let t = (Array.isArray(e) ? e : []).filter(wr);
196
- t.some((e) => e.serverUrl === null) || (t = [J, ...t]);
200
+ t.some((e) => e.serverUrl === null) || (t = [Y, ...t]);
197
201
  let r = x();
198
- r && !t.some((e) => _r(e.serverUrl, r)) && (t = [...t, {
202
+ return r && !t.some((e) => _r(e.serverUrl, r)) && (t = [...t, {
199
203
  id: vr(),
200
204
  icon: "🌐",
201
205
  name: yr(r),
202
206
  serverUrl: r
203
- }]), n(t), i(Sr(t)), xr(t);
207
+ }]), n(t), i(Sr(t)), xr(t), t;
204
208
  }, []), g = u(() => ({
205
209
  workspaces: t,
206
210
  workspace: a,
@@ -3818,7 +3822,7 @@ function Br(e) {
3818
3822
  let t = (e ?? "").toLowerCase().split("-")[0];
3819
3823
  return zr.has(t) ? t : "en";
3820
3824
  }
3821
- function Y(e, t) {
3825
+ function X(e, t) {
3822
3826
  let n = e, r = Pr[Ir][n] ?? Pr.en[n] ?? n;
3823
3827
  return t ? Fr(r, t) : r;
3824
3828
  }
@@ -3961,52 +3965,61 @@ function fi() {
3961
3965
  }
3962
3966
  }
3963
3967
  var pi = ({ children: e }) => {
3964
- let { account: t } = cr(), { preferences: n, update: r } = hr(), { workspaces: i, replaceWorkspaces: a } = Er(), [o, c] = f("disconnected"), [m, h] = f(null), [g, _] = f(null), [te, y] = f(null), [b, x] = f(() => ti()), [C, w] = f(() => ri()), E = u(() => new ee(), []), D = u(() => S(), []), O = u(() => `OpenBook ${t?.redirectUri?.startsWith("openbook:") ? "Desktop" : "Web"} · ${Qr()}`, [t]), k = u(() => t?.secretStore ?? oi(), [t]), A = d(k);
3968
+ let { account: t } = sr(), { preferences: n, update: r } = hr(), { workspaces: i, replaceWorkspaces: a } = Er(), [o, c] = f("disconnected"), [m, h] = f(null), [g, _] = f(null), [te, y] = f(null), [b, x] = f(() => ti()), [C, w] = f(() => ri()), E = u(() => new ee(), []), D = u(() => S(), []), O = u(() => `OpenBook ${t?.redirectUri?.startsWith("openbook:") ? "Desktop" : "Web"} · ${Qr()}`, [t]), k = u(() => t?.secretStore ?? oi(), [t]), A = d(k);
3965
3969
  A.current = k;
3966
- let j = d(null), M = d(null), N = d(/* @__PURE__ */ new Map()), P = d(0), ie = d({
3970
+ let j = d(null), M = d(null), N = d(/* @__PURE__ */ new Map()), P = d(0), F = d({
3967
3971
  preferences: n,
3968
3972
  workspaces: i
3969
3973
  });
3970
- ie.current = {
3974
+ F.current = {
3971
3975
  preferences: n,
3972
3976
  workspaces: i
3973
3977
  };
3974
- let F = s(() => ({
3975
- preferences: ie.current.preferences,
3976
- workspaces: ie.current.workspaces
3977
- }), []), I = d(b);
3978
- I.current = b;
3979
- let L = s((e) => {
3980
- I.current = e, x(e), ni(e);
3981
- }, []), ae = s((e) => L([...I.current.filter((t) => t.id !== e.id), e]), [L]), R = s((e, t) => L(I.current.map((n) => n.id === e ? {
3978
+ let I = s(() => ({
3979
+ preferences: F.current.preferences,
3980
+ workspaces: F.current.workspaces
3981
+ }), []), L = d(b);
3982
+ L.current = b;
3983
+ let R = s((e) => {
3984
+ L.current = e, x(e), ni(e);
3985
+ }, []), ie = s((e) => R([...L.current.filter((t) => t.id !== e.id), e]), [R]), z = s((e, t) => R(L.current.map((n) => n.id === e ? {
3982
3986
  ...n,
3983
3987
  ...t
3984
- } : n)), [L]), z = d(C);
3985
- z.current = C;
3986
- let B = s((e) => {
3987
- z.current = e, w(e), ii(e);
3988
- }, []), oe = s((e) => {
3989
- e.preferences && typeof e.preferences == "object" && r(e.preferences), Array.isArray(e.workspaces) && a(e.workspaces);
3990
- }, [r, a]), se = s(async (e, t) => {
3988
+ } : n)), [R]), B = d(C);
3989
+ B.current = C;
3990
+ let V = s((e) => {
3991
+ B.current = e, w(e), ii(e);
3992
+ }, []), ae = s((e) => {
3993
+ let t = F.current.preferences;
3994
+ if (e.preferences && typeof e.preferences == "object") {
3995
+ let n = e.preferences;
3996
+ t = lr(t, n), r(n);
3997
+ }
3998
+ let n = F.current.workspaces;
3999
+ return Array.isArray(e.workspaces) && (n = a(e.workspaces)), {
4000
+ preferences: t,
4001
+ workspaces: n
4002
+ };
4003
+ }, [r, a]), oe = s(async (e, t) => {
3991
4004
  let { settings: n, updatedAt: r } = await E.getSettings(e);
3992
4005
  if (r === null || !n.preferences && !n.workspaces) {
3993
4006
  if (t) {
3994
- let t = F(), n = await E.putSettings(e, t);
4007
+ let t = I(), n = await E.putSettings(e, t);
3995
4008
  return M.current = JSON.stringify(t), n.updatedAt;
3996
4009
  }
3997
- return M.current = JSON.stringify(F()), r;
4010
+ return M.current = JSON.stringify(I()), r;
3998
4011
  }
3999
- return oe(n), M.current = JSON.stringify(n), r;
4012
+ return M.current = JSON.stringify(ae(n)), r;
4000
4013
  }, [
4001
4014
  E,
4002
- F,
4003
- oe
4004
- ]), V = d(null), ce = s(async (e) => {
4015
+ I,
4016
+ ae
4017
+ ]), H = d(null), se = s(async (e) => {
4005
4018
  try {
4006
4019
  let t = re() ?? fi(), n = await E.getIdentityToken(e, t);
4007
- if (T(n?.identity ?? null), V.current && clearTimeout(V.current), !n) return null;
4020
+ if (T(n?.identity ?? null), H.current && clearTimeout(H.current), !n) return null;
4008
4021
  let r = Math.max(3e4, new Date(n.expiresAt).getTime() - Date.now() - 6e4);
4009
- V.current = setTimeout(() => void H.current(e), r);
4022
+ H.current = setTimeout(() => void U.current(e), r);
4010
4023
  let i = ne(n.identity);
4011
4024
  return i ? {
4012
4025
  subject: `${i.claims.iss}#${i.claims.sub}`,
@@ -4017,64 +4030,64 @@ var pi = ({ children: e }) => {
4017
4030
  } catch {
4018
4031
  return null;
4019
4032
  }
4020
- }, [E]), H = d(ce);
4021
- H.current = ce;
4022
- let U = s(() => {
4023
- V.current && clearTimeout(V.current), V.current = null, T(null);
4024
- }, []), W = d(async () => {}), G = d(async () => {});
4025
- G.current = s(async (e) => {
4026
- let t = z.current === e;
4027
- t && U();
4033
+ }, [E]), U = d(se);
4034
+ U.current = se;
4035
+ let W = s(() => {
4036
+ H.current && clearTimeout(H.current), H.current = null, T(null);
4037
+ }, []), G = d(async () => {}), K = d(async () => {});
4038
+ K.current = s(async (e) => {
4039
+ let t = B.current === e;
4040
+ t && W();
4028
4041
  try {
4029
4042
  await A.current.delete(e);
4030
4043
  } catch {}
4031
4044
  N.current.delete(e);
4032
- let n = I.current.filter((t) => t.id !== e);
4033
- if (L(n), !t) return;
4045
+ let n = L.current.filter((t) => t.id !== e);
4046
+ if (R(n), !t) return;
4034
4047
  let r = n[0];
4035
4048
  if (r) {
4036
4049
  let e = N.current.get(r.id) ?? await A.current.get(r.id);
4037
4050
  if (e) {
4038
- await W.current(r.id, e);
4051
+ await G.current(r.id, e);
4039
4052
  return;
4040
4053
  }
4041
4054
  }
4042
- M.current = null, h(null), _(null), B(null), c("disconnected");
4055
+ M.current = null, h(null), _(null), V(null), c("disconnected");
4043
4056
  }, [
4044
- L,
4045
- B,
4046
- U
4047
- ]), W.current = s(async (e, t) => {
4048
- P.current += 1, c("syncing"), y(null), B(e), h(t), N.current.set(e, t);
4057
+ R,
4058
+ V,
4059
+ W
4060
+ ]), G.current = s(async (e, t) => {
4061
+ P.current += 1, c("syncing"), y(null), V(e), h(t), N.current.set(e, t);
4049
4062
  try {
4050
- let n = await se(t, !1);
4051
- R(e, { lastServerUpdatedAt: n }), _(n), c("connected");
4052
- let r = await H.current(t);
4063
+ let n = await oe(t, !1);
4064
+ z(e, { lastServerUpdatedAt: n }), _(n), c("connected");
4065
+ let r = await U.current(t);
4053
4066
  if (r) {
4054
- let t = I.current.find((t) => t.id === e);
4055
- R(e, {
4067
+ let t = L.current.find((t) => t.id === e);
4068
+ z(e, {
4056
4069
  email: r.email,
4057
4070
  subject: r.subject,
4058
4071
  name: r.email ?? r.name ?? t?.name ?? ei(D)
4059
4072
  });
4060
4073
  }
4061
4074
  } catch (t) {
4062
- t instanceof v && t.status === 401 ? (c("error"), y(Y("account.error.rejectedReauth")), await G.current(e)) : (c("error"), y(Y("account.error.unreachable")));
4075
+ t instanceof v && t.status === 401 ? (c("error"), y(X("account.error.rejectedReauth")), await K.current(e)) : (c("error"), y(X("account.error.unreachable")));
4063
4076
  } finally {
4064
4077
  P.current = Math.max(0, P.current - 1);
4065
4078
  }
4066
4079
  }, [
4067
- B,
4068
- se,
4069
- R,
4080
+ V,
4081
+ oe,
4082
+ z,
4070
4083
  D
4071
4084
  ]);
4072
- let le = s(async (e) => {
4085
+ let ce = s(async (e) => {
4073
4086
  P.current += 1;
4074
- let t = I.current.length === 0;
4087
+ let t = L.current.length === 0;
4075
4088
  c("syncing"), y(null);
4076
4089
  try {
4077
- let n = await se(e, t), r = await H.current(e), i = r?.subject ? I.current.find((e) => e.subject === r.subject) : I.current.find((e) => e.subject === null && e.accountUrl === D), a = i?.id ?? $r(), o = {
4090
+ let n = await oe(e, t), r = await U.current(e), i = r?.subject ? L.current.find((e) => e.subject === r.subject) : L.current.find((e) => e.subject === null && e.accountUrl === D), a = i?.id ?? $r(), o = {
4078
4091
  id: a,
4079
4092
  name: r?.email ?? r?.name ?? i?.name ?? ei(D),
4080
4093
  email: r?.email ?? null,
@@ -4083,29 +4096,29 @@ var pi = ({ children: e }) => {
4083
4096
  connectedAt: Date.now(),
4084
4097
  lastServerUpdatedAt: n
4085
4098
  };
4086
- await k.set(a, e), N.current.set(a, e), ae(o), B(a), h(e), _(n), c("connected");
4099
+ await k.set(a, e), N.current.set(a, e), ie(o), V(a), h(e), _(n), c("connected");
4087
4100
  } catch (e) {
4088
- e instanceof v && e.status === 401 ? (U(), c("error"), y(Y("account.error.rejected"))) : (c(z.current ? "connected" : "disconnected"), y(Y("account.error.unreachable")));
4101
+ e instanceof v && e.status === 401 ? (W(), c("error"), y(X("account.error.rejected"))) : (c(B.current ? "connected" : "disconnected"), y(X("account.error.unreachable")));
4089
4102
  } finally {
4090
4103
  P.current = Math.max(0, P.current - 1);
4091
4104
  }
4092
4105
  }, [
4093
- se,
4106
+ oe,
4094
4107
  k,
4095
- ae,
4096
- B,
4097
- U,
4108
+ ie,
4109
+ V,
4110
+ W,
4098
4111
  D
4099
- ]), ue = s((e, t) => {
4112
+ ]), le = s((e, t) => {
4100
4113
  let n = j.current ?? ui();
4101
- !e || !n || !t || t !== n || (j.current = null, di(), le(e));
4102
- }, [le]);
4114
+ !e || !n || !t || t !== n || (j.current = null, di(), ce(e));
4115
+ }, [ce]);
4103
4116
  l(() => {
4104
- if (t?.onCallback) return t.onCallback(({ token: e, state: t }) => ue(e, t));
4117
+ if (t?.onCallback) return t.onCallback(({ token: e, state: t }) => le(e, t));
4105
4118
  if (typeof window > "u") return;
4106
4119
  let e = (e) => {
4107
4120
  let t = e;
4108
- t?.type === "openbook-account-token" && typeof t.token == "string" && ue(t.token, t.state ?? "");
4121
+ t?.type === "openbook-account-token" && typeof t.token == "string" && le(t.token, t.state ?? "");
4109
4122
  }, n = typeof BroadcastChannel < "u" ? new BroadcastChannel(qr) : null;
4110
4123
  n?.addEventListener("message", (t) => e(t.data));
4111
4124
  let r = (t) => {
@@ -4121,7 +4134,7 @@ var pi = ({ children: e }) => {
4121
4134
  return () => {
4122
4135
  n?.close(), window.removeEventListener("storage", r);
4123
4136
  };
4124
- }, [t, ue]), l(() => {
4137
+ }, [t, le]), l(() => {
4125
4138
  (async () => {
4126
4139
  let e = ti(), t = ri();
4127
4140
  if (e.length === 0) {
@@ -4147,12 +4160,12 @@ var pi = ({ children: e }) => {
4147
4160
  }
4148
4161
  }
4149
4162
  }
4150
- !t && e.length && (t = e[0].id), e.length && (I.current = e, x(e));
4163
+ !t && e.length && (t = e[0].id), e.length && (L.current = e, x(e));
4151
4164
  let n = t ? e.find((e) => e.id === t) : void 0;
4152
4165
  if (!n) return;
4153
- B(n.id), _(n.lastServerUpdatedAt);
4166
+ V(n.id), _(n.lastServerUpdatedAt);
4154
4167
  let r = await A.current.get(n.id);
4155
- r && await W.current(n.id, r);
4168
+ r && await G.current(n.id, r);
4156
4169
  })();
4157
4170
  }, []), l(() => {
4158
4171
  if (!m || P.current > 0) return;
@@ -4164,10 +4177,10 @@ var pi = ({ children: e }) => {
4164
4177
  let r = setTimeout(() => {
4165
4178
  t === M.current || P.current > 0 || (c("syncing"), E.putSettings(m, e).then((e) => {
4166
4179
  M.current = t, _(e.updatedAt), c("connected"), y(null);
4167
- let n = z.current;
4168
- n && R(n, { lastServerUpdatedAt: e.updatedAt });
4180
+ let n = B.current;
4181
+ n && z(n, { lastServerUpdatedAt: e.updatedAt });
4169
4182
  }).catch(() => {
4170
- c("error"), y(Y("account.error.syncFailed"));
4183
+ c("error"), y(X("account.error.syncFailed"));
4171
4184
  }));
4172
4185
  }, 1200);
4173
4186
  return () => clearTimeout(r);
@@ -4176,9 +4189,9 @@ var pi = ({ children: e }) => {
4176
4189
  n,
4177
4190
  i,
4178
4191
  E,
4179
- R
4192
+ z
4180
4193
  ]);
4181
- let de = s(() => {
4194
+ let ue = s(() => {
4182
4195
  let e = Zr();
4183
4196
  j.current = e, li(e), c("connecting"), y(null);
4184
4197
  let n = t?.redirectUri ?? (typeof window < "u" ? `${window.location.origin}/account/callback` : ""), r = E.connectUrl({
@@ -4191,35 +4204,35 @@ var pi = ({ children: e }) => {
4191
4204
  E,
4192
4205
  O,
4193
4206
  t
4194
- ]), fe = s((e) => {
4207
+ ]), de = s((e) => {
4195
4208
  let t = Xr(e);
4196
4209
  if (!t) {
4197
- c((e) => m ? e : "error"), y(Y("account.error.invalidCode"));
4210
+ c((e) => m ? e : "error"), y(X("account.error.invalidCode"));
4198
4211
  return;
4199
4212
  }
4200
- j.current = null, di(), c("connecting"), y(null), le(t);
4201
- }, [le, m]), pe = s(() => {
4213
+ j.current = null, di(), c("connecting"), y(null), ce(t);
4214
+ }, [ce, m]), fe = s(() => {
4202
4215
  j.current = null, di(), c((e) => m ? e : "disconnected"), y(null);
4203
- }, [m]), me = s(() => {
4216
+ }, [m]), pe = s(() => {
4204
4217
  j.current = null, di(), M.current = null, y(null);
4205
- let e = z.current;
4206
- e ? G.current(e) : (U(), h(null), _(null), c("disconnected"));
4207
- }, [U]), he = s(() => {
4208
- let e = z.current;
4209
- e && m && W.current(e, m);
4210
- }, [m]), ge = s((e) => {
4211
- e !== z.current && I.current.some((t) => t.id === e) && (async () => {
4212
- U();
4218
+ let e = B.current;
4219
+ e ? K.current(e) : (W(), h(null), _(null), c("disconnected"));
4220
+ }, [W]), me = s(() => {
4221
+ let e = B.current;
4222
+ e && m && G.current(e, m);
4223
+ }, [m]), he = s((e) => {
4224
+ e !== B.current && L.current.some((t) => t.id === e) && (async () => {
4225
+ W();
4213
4226
  let t = N.current.get(e) ?? await A.current.get(e);
4214
4227
  if (!t) {
4215
- await G.current(e);
4228
+ await K.current(e);
4216
4229
  return;
4217
4230
  }
4218
- await W.current(e, t);
4231
+ await G.current(e, t);
4219
4232
  })();
4220
- }, [U]), _e = s((e) => {
4221
- G.current(e);
4222
- }, []), ve = u(() => b.map((e) => ({
4233
+ }, [W]), ge = s((e) => {
4234
+ K.current(e);
4235
+ }, []), _e = u(() => b.map((e) => ({
4223
4236
  id: e.id,
4224
4237
  name: e.name,
4225
4238
  email: e.email,
@@ -4229,49 +4242,49 @@ var pi = ({ children: e }) => {
4229
4242
  b,
4230
4243
  C,
4231
4244
  o
4232
- ]), ye = u(() => b.find((e) => e.id === C)?.accountUrl ?? D, [
4245
+ ]), ve = u(() => b.find((e) => e.id === C)?.accountUrl ?? D, [
4233
4246
  b,
4234
4247
  C,
4235
4248
  D
4236
- ]), be = s(async () => m ? (await H.current(m))?.aud ?? null : null, [m]), xe = u(() => ({
4249
+ ]), ye = s(async () => m ? (await U.current(m))?.aud ?? null : null, [m]), be = u(() => ({
4237
4250
  status: o,
4238
4251
  connected: !!m && (o === "connected" || o === "syncing"),
4239
4252
  token: m,
4240
4253
  deviceName: O,
4241
4254
  lastSyncedAt: g,
4242
4255
  error: te,
4243
- accountUrl: ye,
4244
- signIn: de,
4245
- submitCode: fe,
4246
- cancel: pe,
4247
- signOut: me,
4248
- syncNow: he,
4249
- accounts: ve,
4256
+ accountUrl: ve,
4257
+ signIn: ue,
4258
+ submitCode: de,
4259
+ cancel: fe,
4260
+ signOut: pe,
4261
+ syncNow: me,
4262
+ accounts: _e,
4250
4263
  activeAccountId: C,
4251
- setActiveAccount: ge,
4252
- addAccount: de,
4253
- removeAccount: _e,
4254
- remintIdentity: be
4264
+ setActiveAccount: he,
4265
+ addAccount: ue,
4266
+ removeAccount: ge,
4267
+ remintIdentity: ye
4255
4268
  }), [
4256
4269
  o,
4257
4270
  m,
4258
4271
  O,
4259
4272
  g,
4260
4273
  te,
4261
- ye,
4274
+ ve,
4275
+ ue,
4262
4276
  de,
4263
4277
  fe,
4264
4278
  pe,
4265
4279
  me,
4266
- he,
4267
- ve,
4280
+ _e,
4268
4281
  C,
4282
+ he,
4269
4283
  ge,
4270
- _e,
4271
- be
4284
+ ye
4272
4285
  ]);
4273
4286
  return /* @__PURE__ */ p(Vr.Provider, {
4274
- value: xe,
4287
+ value: be,
4275
4288
  children: e
4276
4289
  });
4277
4290
  }, mi = () => {
@@ -4280,7 +4293,7 @@ var pi = ({ children: e }) => {
4280
4293
  return e;
4281
4294
  }, hi = D.Root, gi = D.Trigger, _i = D.Portal, vi = i.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ p(D.Overlay, {
4282
4295
  ref: n,
4283
- className: K("fixed inset-0 z-50 bg-background/80 backdrop-blur-[var(--overlay-blur)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", e),
4296
+ className: q("fixed inset-0 z-50 bg-background/80 backdrop-blur-[var(--overlay-blur)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", e),
4284
4297
  ...t
4285
4298
  }));
4286
4299
  vi.displayName = D.Overlay.displayName;
@@ -4288,7 +4301,7 @@ var yi = i.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ *
4288
4301
  className: "fixed inset-0 z-50 flex items-center justify-center p-4",
4289
4302
  children: /* @__PURE__ */ m(D.Content, {
4290
4303
  ref: r,
4291
- className: K("relative grid w-full max-w-lg gap-4 border bg-background p-6 shadow-overlay duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg", e),
4304
+ className: q("relative grid w-full max-w-lg gap-4 border bg-background p-6 shadow-overlay duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg", e),
4292
4305
  ...n,
4293
4306
  children: [t, /* @__PURE__ */ m(D.Close, {
4294
4307
  className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-hover data-[state=open]:text-muted-foreground",
@@ -4301,24 +4314,24 @@ var yi = i.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ *
4301
4314
  })] }));
4302
4315
  yi.displayName = D.Content.displayName;
4303
4316
  var bi = ({ className: e, ...t }) => /* @__PURE__ */ p("div", {
4304
- className: K("flex flex-col space-y-1.5 text-center sm:text-left", e),
4317
+ className: q("flex flex-col space-y-1.5 text-center sm:text-left", e),
4305
4318
  ...t
4306
4319
  });
4307
4320
  bi.displayName = "DialogHeader";
4308
4321
  var xi = ({ className: e, ...t }) => /* @__PURE__ */ p("div", {
4309
- className: K("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e),
4322
+ className: q("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e),
4310
4323
  ...t
4311
4324
  });
4312
4325
  xi.displayName = "DialogFooter";
4313
4326
  var Si = i.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ p(D.Title, {
4314
4327
  ref: n,
4315
- className: K("text-lg font-semibold leading-none tracking-tight", e),
4328
+ className: q("text-lg font-semibold leading-none tracking-tight", e),
4316
4329
  ...t
4317
4330
  }));
4318
4331
  Si.displayName = D.Title.displayName;
4319
4332
  var Ci = i.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ p(D.Description, {
4320
4333
  ref: n,
4321
- className: K("text-sm text-muted-foreground", e),
4334
+ className: q("text-sm text-muted-foreground", e),
4322
4335
  ...t
4323
4336
  }));
4324
4337
  Ci.displayName = D.Description.displayName;
@@ -4346,7 +4359,7 @@ var wi = k("inline-flex items-center justify-center rounded-md text-sm font-medi
4346
4359
  size: "default"
4347
4360
  }
4348
4361
  }), Ti = i.forwardRef(({ className: e, variant: t, size: n, asChild: r = !1, ...i }, a) => /* @__PURE__ */ p(r ? O : "button", {
4349
- className: K(wi({
4362
+ className: q(wi({
4350
4363
  variant: t,
4351
4364
  size: n,
4352
4365
  className: e
@@ -4509,7 +4522,7 @@ var Ri = o(null), zi = ({ client: e, children: t }) => /* @__PURE__ */ p(Ri.Prov
4509
4522
  }), qi = () => typeof localStorage < "u" && localStorage.getItem(Gi) === "1", Ji = (e) => {
4510
4523
  typeof localStorage < "u" && localStorage.setItem(Gi, e ? "1" : "0");
4511
4524
  }, Yi = ({ children: e }) => {
4512
- let { forwarding: t } = cr(), { connected: n, token: r, accountUrl: i, signIn: a, remintIdentity: o } = mi(), c = Bi(), m = !!t, h = d(null), [g, _] = f(() => qi()), [ee, v] = f("idle"), [ne, y] = f(null), [b, re] = f(!1), [x, S] = f(null), [w, T] = f(null), [E, D] = f(null);
4525
+ let { forwarding: t } = sr(), { connected: n, token: r, accountUrl: i, signIn: a, remintIdentity: o } = mi(), c = Bi(), m = !!t, h = d(null), [g, _] = f(() => qi()), [ee, v] = f("idle"), [ne, y] = f(null), [b, re] = f(!1), [x, S] = f(null), [w, T] = f(null), [E, D] = f(null);
4513
4526
  l(() => {
4514
4527
  t && t.keyStore.load().then((e) => e && y(e.host)).catch(() => void 0);
4515
4528
  }, [t]);
@@ -4754,7 +4767,7 @@ var fa = ({ children: e }) => {
4754
4767
  }, []), i = u(() => ({
4755
4768
  locale: t,
4756
4769
  setLocale: r,
4757
- t: Y,
4770
+ t: X,
4758
4771
  locales: Mr
4759
4772
  }), [t, r]);
4760
4773
  return /* @__PURE__ */ p(la.Provider, {
@@ -4765,15 +4778,15 @@ var fa = ({ children: e }) => {
4765
4778
  let e = c(la);
4766
4779
  if (!e) throw Error("useTranslation must be used within an <I18nProvider>");
4767
4780
  return e;
4768
- }, X = null, ma = /* @__PURE__ */ new Set(), ha = (e) => {
4769
- X = e, ma.forEach((e) => e());
4781
+ }, Z = null, ma = /* @__PURE__ */ new Set(), ha = (e) => {
4782
+ Z = e, ma.forEach((e) => e());
4770
4783
  }, ga = (e) => (ma.add(e), () => ma.delete(e)), _a = {
4771
- createSubpage: (e, t) => X ? X.createSubpage(e, t) : Promise.reject(/* @__PURE__ */ Error("page links not ready")),
4772
- openPage: (e, t) => X?.openPage(e, t),
4773
- label: (e) => X?.label(e) ?? "Untitled",
4774
- icon: (e) => X?.icon(e) ?? "📄",
4775
- searchPages: (e, t) => X?.searchPages(e, t) ?? [],
4776
- createPage: (e) => X ? X.createPage(e) : Promise.reject(/* @__PURE__ */ Error("page links not ready"))
4784
+ createSubpage: (e, t) => Z ? Z.createSubpage(e, t) : Promise.reject(/* @__PURE__ */ Error("page links not ready")),
4785
+ openPage: (e, t) => Z?.openPage(e, t),
4786
+ label: (e) => Z?.label(e) ?? "Untitled",
4787
+ icon: (e) => Z?.icon(e) ?? "📄",
4788
+ searchPages: (e, t) => Z?.searchPages(e, t) ?? [],
4789
+ createPage: (e) => Z ? Z.createPage(e) : Promise.reject(/* @__PURE__ */ Error("page links not ready"))
4777
4790
  }, va = "openbook.recents";
4778
4791
  function ya(e, t, n = 12) {
4779
4792
  return [t, ...e.filter((e) => e !== t)].slice(0, n);
@@ -4933,35 +4946,35 @@ var eo = () => {
4933
4946
  tabs: [n],
4934
4947
  activeTabId: n.id
4935
4948
  };
4936
- }, Z = (e) => e.tabs.find((t) => t.id === e.activeTabId) ?? e.tabs[0], Q = (e, t) => {
4937
- let n = Z(e), r = t(n);
4949
+ }, Q = (e) => e.tabs.find((t) => t.id === e.activeTabId) ?? e.tabs[0], Eo = (e, t) => {
4950
+ let n = Q(e), r = t(n);
4938
4951
  return r === n ? e : {
4939
4952
  ...e,
4940
4953
  tabs: e.tabs.map((e) => e.id === n.id ? r : e)
4941
4954
  };
4942
- }, Eo = (e) => fo(e), Do = (e) => fo(Z(e)), Oo = (e) => mo(Z(e)), ko = (e) => ho(Z(e)), Ao = (e) => Z(e).focused, jo = (e) => Z(e).split !== null, Mo = (e) => Z(e).index > 0, No = (e) => {
4943
- let t = Z(e);
4955
+ }, Do = (e) => fo(e), Oo = (e) => fo(Q(e)), ko = (e) => mo(Q(e)), Ao = (e) => ho(Q(e)), jo = (e) => Q(e).focused, Mo = (e) => Q(e).split !== null, No = (e) => Q(e).index > 0, Po = (e) => {
4956
+ let t = Q(e);
4944
4957
  return t.index < t.history.length - 1;
4945
- }, Po = (e, t) => Q(e, (e) => vo(e, t)), Fo = (e, t, n) => Q(e, (e) => {
4958
+ }, Fo = (e, t) => Eo(e, (e) => vo(e, t)), Io = (e, t, n) => Eo(e, (e) => {
4946
4959
  let r = t === "secondary" && po(e) ? "secondary" : "primary";
4947
4960
  return _o(Co(e, r), r, n);
4948
- }), Io = (e) => Q(e, (e) => yo(e, -1)), Lo = (e) => Q(e, (e) => yo(e, 1)), Ro = (e, t) => Q(e, (e) => bo(e, t)), zo = (e) => Q(e, xo), Bo = (e, t) => Q(e, (e) => So(e, t)), Vo = (e, t) => Q(e, (e) => Co(e, t)), Ho = (e, t) => {
4961
+ }), Lo = (e) => Eo(e, (e) => yo(e, -1)), Ro = (e) => Eo(e, (e) => yo(e, 1)), zo = (e, t) => Eo(e, (e) => bo(e, t)), Bo = (e) => Eo(e, xo), Vo = (e, t) => Eo(e, (e) => So(e, t)), Ho = (e, t) => Eo(e, (e) => Co(e, t)), Uo = (e, t) => {
4949
4962
  let n = uo(t);
4950
4963
  return {
4951
4964
  tabs: [...e.tabs, n],
4952
4965
  activeTabId: n.id
4953
4966
  };
4954
- }, Uo = (e, t) => e.tabs.some((e) => e.id === t) ? {
4967
+ }, Wo = (e, t) => e.tabs.some((e) => e.id === t) ? {
4955
4968
  ...e,
4956
4969
  activeTabId: t
4957
- } : e, Wo = (e, t) => {
4970
+ } : e, Go = (e, t) => {
4958
4971
  if (e.tabs.length <= 1) return e;
4959
4972
  let n = e.tabs.findIndex((e) => e.id === t), r = e.tabs.filter((e) => e.id !== t);
4960
4973
  return {
4961
4974
  tabs: r,
4962
4975
  activeTabId: e.activeTabId === t ? r[Math.min(n, r.length - 1)].id : e.activeTabId
4963
4976
  };
4964
- }, Go = (e, t, n) => {
4977
+ }, Ko = (e, t, n) => {
4965
4978
  let r = !1, i = [];
4966
4979
  for (let n of e.tabs) {
4967
4980
  let e = wo(n, t);
@@ -4971,11 +4984,11 @@ var eo = () => {
4971
4984
  tabs: i,
4972
4985
  activeTabId: i.some((t) => t.id === e.activeTabId) ? e.activeTabId : i[0].id
4973
4986
  } : e;
4974
- }, Ko = o(null), qo = () => {
4975
- let e = c(Ko);
4987
+ }, qo = o(null), Jo = () => {
4988
+ let e = c(qo);
4976
4989
  if (!e) throw Error("useNavigation must be used within a <NavigationProvider>");
4977
4990
  return e;
4978
- }, Jo = "openbook.currentPageId", Yo = () => {
4991
+ }, Yo = "openbook.currentPageId", Xo = () => {
4979
4992
  if (typeof window > "u") return {
4980
4993
  page: null,
4981
4994
  split: null
@@ -4985,41 +4998,41 @@ var eo = () => {
4985
4998
  page: e.get("page"),
4986
4999
  split: e.get("split")
4987
5000
  };
4988
- }, Xo = (e, t) => {
5001
+ }, Zo = (e, t) => {
4989
5002
  if (typeof window > "u") return;
4990
5003
  let n = new URL(window.location.href);
4991
5004
  n.searchParams.set("page", e), t ? n.searchParams.set("split", t) : n.searchParams.delete("split"), window.history.replaceState(null, "", `${n.pathname}${n.search}${n.hash}`);
4992
5005
  try {
4993
- localStorage.setItem(Jo, e);
5006
+ localStorage.setItem(Yo, e);
4994
5007
  } catch {}
4995
- }, Zo = (e) => {
5008
+ }, Qo = (e) => {
4996
5009
  let t = new URL(window.location.href);
4997
5010
  return t.searchParams.set("page", e), t.searchParams.delete("split"), t.toString();
4998
- }, Qo = () => {
5011
+ }, $o = () => {
4999
5012
  try {
5000
- return typeof localStorage < "u" ? localStorage.getItem(Jo) : null;
5013
+ return typeof localStorage < "u" ? localStorage.getItem(Yo) : null;
5001
5014
  } catch {
5002
5015
  return null;
5003
5016
  }
5004
- }, $o = ({ children: i }) => {
5005
- let a = Bi(), o = cr(), [c, m] = f([]), [h, g] = f(null), [_, ee] = f({}), [v, te] = f(!0), [ne, re] = f(null), x = d(null), S = d(/* @__PURE__ */ new Set());
5017
+ }, es = ({ children: i }) => {
5018
+ let a = Bi(), o = sr(), [c, m] = f([]), [h, g] = f(null), [_, ee] = f({}), [v, te] = f(!0), [ne, re] = f(null), x = d(null), S = d(/* @__PURE__ */ new Set());
5006
5019
  l(() => {
5007
5020
  if (!h) return;
5008
- let e = Z(h).split, t = e === "config" || e === "customise" || e === "review";
5009
- Xo(Do(h), t ? null : e);
5021
+ let e = Q(h).split, t = e === "config" || e === "customise" || e === "review";
5022
+ Zo(Oo(h), t ? null : e);
5010
5023
  }, [h]);
5011
5024
  let C = s((e) => {
5012
5025
  g((t) => t && e(t));
5013
5026
  }, []), w = s(async () => {
5014
5027
  let e = await a.listPages();
5015
5028
  return m(e), e;
5016
- }, [a]), T = s((e) => C((t) => Po(t, e)), [C]), E = s((e, t) => C((n) => Fo(n, t, e)), [C]), D = s(() => C(Io), [C]), O = s(() => C(Lo), [C]), k = s((e) => C((t) => Vo(t, e)), [C]), A = s((e) => C((t) => Ro(t, e)), [C]), j = s(() => C(zo), [C]), M = s((e) => C((t) => Bo(t, e)), [C]), N = s((e) => C((t) => Uo(t, e)), [C]), P = s((e) => C((t) => Wo(t, e)), [C]), ie = s((e) => g((t) => t && Go(t, (t) => t !== e, c[0]?.id ?? null)), [c]), F = s((e, t) => {
5029
+ }, [a]), T = s((e) => C((t) => Fo(t, e)), [C]), E = s((e, t) => C((n) => Io(n, t, e)), [C]), D = s(() => C(Lo), [C]), O = s(() => C(Ro), [C]), k = s((e) => C((t) => Ho(t, e)), [C]), A = s((e) => C((t) => zo(t, e)), [C]), j = s(() => C(Bo), [C]), M = s((e) => C((t) => Vo(t, e)), [C]), N = s((e) => C((t) => Wo(t, e)), [C]), P = s((e) => C((t) => Go(t, e)), [C]), F = s((e) => g((t) => t && Ko(t, (t) => t !== e, c[0]?.id ?? null)), [c]), I = s((e, t) => {
5017
5030
  if (t === "tab") {
5018
- o.tabs?.inWindow ? C((t) => Ho(t, e)) : typeof window < "u" && window.open(Zo(e), "_blank", "noopener");
5031
+ o.tabs?.inWindow ? C((t) => Uo(t, e)) : typeof window < "u" && window.open(Qo(e), "_blank", "noopener");
5019
5032
  return;
5020
5033
  }
5021
- o.tabs ? o.tabs.openWindow(e) : typeof window < "u" && window.open(Zo(e), "_blank", "noopener,popup,width=1280,height=860");
5022
- }, [o, C]), I = s((e, t) => {
5034
+ o.tabs ? o.tabs.openWindow(e) : typeof window < "u" && window.open(Qo(e), "_blank", "noopener,popup,width=1280,height=860");
5035
+ }, [o, C]), L = s((e, t) => {
5023
5036
  ee((n) => {
5024
5037
  let r = t && t.trim().length > 0 ? t : "Untitled";
5025
5038
  return n[e] === r ? n : {
@@ -5027,15 +5040,15 @@ var eo = () => {
5027
5040
  [e]: r
5028
5041
  };
5029
5042
  });
5030
- }, []), L = s((e) => {
5031
- if (e === "home") return Y("nav.home");
5032
- if (e === "flow") return Y("flow.title");
5043
+ }, []), R = s((e) => {
5044
+ if (e === "home") return X("nav.home");
5045
+ if (e === "flow") return X("flow.title");
5033
5046
  if (e === "config") return "Settings";
5034
5047
  if (e === "customise") return "Customise";
5035
5048
  if (e === "review") return "Review";
5036
5049
  let t = c.find((t) => t.id === e);
5037
5050
  return t ? t.name && t.name.trim().length > 0 ? t.name : "Untitled" : _[e] ?? "Untitled";
5038
- }, [c, _]), ae = s(async (e = null, t = null) => {
5051
+ }, [c, _]), ie = s(async (e = null, t = null) => {
5039
5052
  let n = await a.savePage({
5040
5053
  name: e,
5041
5054
  data: b(),
@@ -5046,7 +5059,7 @@ var eo = () => {
5046
5059
  a,
5047
5060
  w,
5048
5061
  T
5049
- ]), R = s(async (e = null) => {
5062
+ ]), z = s(async (e = null) => {
5050
5063
  let t = await a.savePage({
5051
5064
  name: null,
5052
5065
  data: b(),
@@ -5061,7 +5074,7 @@ var eo = () => {
5061
5074
  a,
5062
5075
  w,
5063
5076
  T
5064
- ]), z = s(async (e, t = "page") => {
5077
+ ]), B = s(async (e, t = "page") => {
5065
5078
  let n = await a.savePage({
5066
5079
  name: null,
5067
5080
  data: b(),
@@ -5072,17 +5085,17 @@ var eo = () => {
5072
5085
  name: null,
5073
5086
  schema: y()
5074
5087
  }), await w(), n.id;
5075
- }, [a, w]), B = s(async (e) => {
5088
+ }, [a, w]), V = s(async (e) => {
5076
5089
  let t = await a.savePage({
5077
5090
  name: null,
5078
5091
  data: b()
5079
5092
  });
5080
- await w(), F(t.id, e);
5093
+ await w(), I(t.id, e);
5081
5094
  }, [
5082
5095
  a,
5083
5096
  w,
5084
- F
5085
- ]), oe = s(async (t) => {
5097
+ I
5098
+ ]), ae = s(async (t) => {
5086
5099
  let r = await a.getPage(t);
5087
5100
  if (!r) return;
5088
5101
  let i = r.name && r.name.trim().length > 0 ? `${r.name} (copy)` : null, o = await a.savePage({
@@ -5095,32 +5108,32 @@ var eo = () => {
5095
5108
  a,
5096
5109
  w,
5097
5110
  T
5098
- ]), se = s(async (e) => {
5111
+ ]), oe = s(async (e) => {
5099
5112
  await a.deletePage(e), oo(e);
5100
5113
  let t = await w();
5101
- g((n) => n && Go(n, (t) => t !== e, t[0]?.id ?? null));
5102
- }, [a, w]), V = s(async (e, t) => {
5103
- await a.renamePage(e, t), I(e, t), await w();
5114
+ g((n) => n && Ko(n, (t) => t !== e, t[0]?.id ?? null));
5115
+ }, [a, w]), H = s(async (e, t) => {
5116
+ await a.renamePage(e, t), L(e, t), await w();
5104
5117
  }, [
5105
5118
  a,
5106
5119
  w,
5107
- I
5108
- ]), ce = s(async (e, t, n) => {
5120
+ L
5121
+ ]), se = s(async (e, t, n) => {
5109
5122
  await a.movePage(e, {
5110
5123
  parentId: t,
5111
5124
  orderedIds: n
5112
5125
  }), await w();
5113
- }, [a, w]), H = s((e, n) => {
5126
+ }, [a, w]), U = s((e, n) => {
5114
5127
  let r = e.trim().toLowerCase(), i = c.filter((e) => !n?.databasesOnly || e.hostedDatabaseId).map((e) => ({
5115
5128
  id: e.id,
5116
- label: L(e.id),
5129
+ label: R(e.id),
5117
5130
  icon: t(e.id)
5118
5131
  })).filter((e) => r === "" || e.label.toLowerCase().includes(r)), a = (e) => {
5119
5132
  let t = e.toLowerCase();
5120
5133
  return t === r ? 2 : +!!t.startsWith(r);
5121
5134
  };
5122
5135
  return i.sort((e, t) => a(t.label) - a(e.label)).slice(0, 8);
5123
- }, [c, L]), U = s(async (e) => {
5136
+ }, [c, R]), W = s(async (e) => {
5124
5137
  let t = await a.savePage({
5125
5138
  name: e.trim() || null,
5126
5139
  data: b()
@@ -5135,8 +5148,8 @@ var eo = () => {
5135
5148
  name: null,
5136
5149
  data: b()
5137
5150
  }), e = await a.listPages()), m(e), S.current = new Set(e.map((e) => e.id));
5138
- let t = new Set(e.map((e) => e.id)), n = async (e) => e ? e === "home" || e === "flow" || t.has(e) ? e : await a.getPage(e) === null ? null : e : null, { page: r, split: i } = Yo(), o = await n(r);
5139
- o ||= await n(Qo()), o ||= e[0]?.id ?? null;
5151
+ let t = new Set(e.map((e) => e.id)), n = async (e) => e ? e === "home" || e === "flow" || t.has(e) ? e : await a.getPage(e) === null ? null : e : null, { page: r, split: i } = Xo(), o = await n(r);
5152
+ o ||= await n($o()), o ||= e[0]?.id ?? null;
5140
5153
  let s = o ? await n(i && i !== o ? i : null) : null;
5141
5154
  g(o ? To(o, s) : null);
5142
5155
  } catch (e) {
@@ -5153,21 +5166,21 @@ var eo = () => {
5153
5166
  if (S.current = t, n.length === 0) return;
5154
5167
  n.forEach(oo);
5155
5168
  let r = new Set(n);
5156
- g((t) => t && Go(t, (e) => !r.has(e), e[0]?.id ?? null));
5169
+ g((t) => t && Ko(t, (e) => !r.has(e), e[0]?.id ?? null));
5157
5170
  }), [a]), l(() => (ha({
5158
- createSubpage: (e, t) => z(e, t),
5171
+ createSubpage: (e, t) => B(e, t),
5159
5172
  openPage: (e, t) => t ? E(e, t) : T(e),
5160
- label: (e) => L(e),
5173
+ label: (e) => R(e),
5161
5174
  icon: (e) => t(e),
5162
- searchPages: H,
5163
- createPage: U
5175
+ searchPages: U,
5176
+ createPage: W
5164
5177
  }), () => ha(null)), [
5165
- z,
5178
+ B,
5166
5179
  T,
5167
5180
  E,
5168
- L,
5169
- H,
5170
- U
5181
+ R,
5182
+ U,
5183
+ W
5171
5184
  ]), l(() => Za(() => A(Oa), () => j()), [A, j]), l(() => {
5172
5185
  c.length !== 0 && ee((e) => {
5173
5186
  let t = { ...e };
@@ -5175,93 +5188,93 @@ var eo = () => {
5175
5188
  return t;
5176
5189
  });
5177
5190
  }, [c]);
5178
- let W = h ? ko(h) : null, G = h ? Do(h) : null;
5191
+ let G = h ? Ao(h) : null, K = h ? Oo(h) : null;
5179
5192
  l(() => {
5180
- W && W !== "home" && W !== "flow" && W !== "config" && W !== "customise" && W !== "review" && wa(W);
5181
- }, [W]);
5182
- let le = h ? Oo(h) : [], ue = h ? Ao(h) : "primary", de = h ? jo(h) : !1, fe = h ? Mo(h) : !1, pe = h ? No(h) : !1, me = o.tabs?.inWindow ?? !1, he = h ? h.tabs.map((e) => ({
5193
+ G && G !== "home" && G !== "flow" && G !== "config" && G !== "customise" && G !== "review" && wa(G);
5194
+ }, [G]);
5195
+ let ce = h ? ko(h) : [], le = h ? jo(h) : "primary", ue = h ? Mo(h) : !1, de = h ? No(h) : !1, fe = h ? Po(h) : !1, pe = o.tabs?.inWindow ?? !1, me = h ? h.tabs.map((e) => ({
5183
5196
  id: e.id,
5184
- pageId: Eo(e)
5185
- })) : [], ge = h?.activeTabId ?? "", _e = u(() => ({
5197
+ pageId: Do(e)
5198
+ })) : [], he = h?.activeTabId ?? "", ge = u(() => ({
5186
5199
  pages: c,
5187
- currentPageId: W,
5188
- primaryPageId: G,
5200
+ currentPageId: G,
5201
+ primaryPageId: K,
5189
5202
  loading: v,
5190
5203
  error: ne,
5191
- inWindowTabs: me,
5192
- tabs: he,
5193
- activeTabId: ge,
5204
+ inWindowTabs: pe,
5205
+ tabs: me,
5206
+ activeTabId: he,
5194
5207
  selectTab: N,
5195
5208
  closeTab: P,
5196
- panes: le,
5197
- focusedPaneId: ue,
5198
- splitOpen: de,
5209
+ panes: ce,
5210
+ focusedPaneId: le,
5211
+ splitOpen: ue,
5199
5212
  focusPane: k,
5200
5213
  openInSplit: A,
5201
5214
  closeSplit: j,
5202
5215
  closePane: M,
5203
- openInNew: F,
5204
- newPageIn: B,
5205
- closePage: ie,
5206
- pageLabel: L,
5207
- setPageHint: I,
5216
+ openInNew: I,
5217
+ newPageIn: V,
5218
+ closePage: F,
5219
+ pageLabel: R,
5220
+ setPageHint: L,
5208
5221
  selectPage: T,
5209
5222
  selectPageInPane: E,
5210
5223
  goBack: D,
5211
5224
  goForward: O,
5212
- canGoBack: fe,
5213
- canGoForward: pe,
5214
- createPage: ae,
5215
- createDatabasePage: R,
5216
- createSubpage: z,
5217
- duplicatePage: oe,
5218
- deletePage: se,
5219
- renamePage: V,
5220
- movePage: ce,
5225
+ canGoBack: de,
5226
+ canGoForward: fe,
5227
+ createPage: ie,
5228
+ createDatabasePage: z,
5229
+ createSubpage: B,
5230
+ duplicatePage: ae,
5231
+ deletePage: oe,
5232
+ renamePage: H,
5233
+ movePage: se,
5221
5234
  reload: w
5222
5235
  }), [
5223
5236
  c,
5224
- W,
5225
5237
  G,
5238
+ K,
5226
5239
  v,
5227
5240
  ne,
5241
+ pe,
5228
5242
  me,
5229
5243
  he,
5230
- ge,
5231
5244
  N,
5232
5245
  P,
5246
+ ce,
5233
5247
  le,
5234
5248
  ue,
5235
- de,
5236
5249
  k,
5237
5250
  A,
5238
5251
  j,
5239
5252
  M,
5253
+ I,
5254
+ V,
5240
5255
  F,
5241
- B,
5242
- ie,
5256
+ R,
5243
5257
  L,
5244
- I,
5245
5258
  T,
5246
5259
  E,
5247
5260
  D,
5248
5261
  O,
5262
+ de,
5249
5263
  fe,
5250
- pe,
5251
- ae,
5252
- R,
5264
+ ie,
5253
5265
  z,
5266
+ B,
5267
+ ae,
5254
5268
  oe,
5269
+ H,
5255
5270
  se,
5256
- V,
5257
- ce,
5258
5271
  w
5259
5272
  ]);
5260
- return /* @__PURE__ */ p(Ko.Provider, {
5261
- value: _e,
5273
+ return /* @__PURE__ */ p(qo.Provider, {
5274
+ value: ge,
5262
5275
  children: i
5263
5276
  });
5264
- }, es = {
5277
+ }, ts = {
5265
5278
  background: "0 0% 100%",
5266
5279
  foreground: "34 9% 19%",
5267
5280
  card: "0 0% 100%",
@@ -5288,7 +5301,7 @@ var eo = () => {
5288
5301
  brand: "207 76% 47%",
5289
5302
  brandForeground: "0 0% 100%",
5290
5303
  brandSubtle: "207 86% 95%"
5291
- }, ts = {
5304
+ }, ns = {
5292
5305
  background: "0 0% 13%",
5293
5306
  foreground: "0 0% 82%",
5294
5307
  card: "0 0% 16%",
@@ -5331,17 +5344,17 @@ function $(e, t, n, r, i) {
5331
5344
  nameKey: `theme.${e}`,
5332
5345
  group: t,
5333
5346
  neutral: i,
5334
- light: a(es, n),
5335
- dark: a(ts, r)
5347
+ light: a(ts, n),
5348
+ dark: a(ns, r)
5336
5349
  };
5337
5350
  }
5338
- var ns = "default", rs = [
5351
+ var rs = "default", is = [
5339
5352
  {
5340
5353
  id: "default",
5341
5354
  nameKey: "theme.default",
5342
5355
  group: "bold",
5343
- light: es,
5344
- dark: ts
5356
+ light: ts,
5357
+ dark: ns
5345
5358
  },
5346
5359
  $("sandstone", "gray", {
5347
5360
  primary: "28 12% 34%",
@@ -5472,11 +5485,11 @@ var ns = "default", rs = [
5472
5485
  primaryForeground: "40 50% 12%",
5473
5486
  brandSubtle: "44 42% 22%"
5474
5487
  })
5475
- ], is = {
5488
+ ], as = {
5476
5489
  warm: "sandstone",
5477
5490
  neutral: "graphite",
5478
5491
  cool: "slate"
5479
- }, as = (e) => rs.find((t) => t.id === e) ?? rs.find((t) => t.id === is[e]) ?? rs[0], os = {
5492
+ }, os = (e) => is.find((t) => t.id === e) ?? is.find((t) => t.id === as[e]) ?? is[0], ss = {
5480
5493
  gray: {
5481
5494
  light: "0 0% 96.5%",
5482
5495
  dark: "0 0% 15%"
@@ -5509,17 +5522,17 @@ var ns = "default", rs = [
5509
5522
  light: "330 58% 97.5%",
5510
5523
  dark: "330 24% 15.5%"
5511
5524
  }
5512
- }, ss = {
5513
- themeId: ns,
5525
+ }, cs = {
5526
+ themeId: rs,
5514
5527
  interfaceIntensity: 2,
5515
5528
  controlIntensity: 2,
5516
5529
  blurOverlays: !1
5517
5530
  };
5518
- function cs(e) {
5531
+ function ls(e) {
5519
5532
  let t = { ...e };
5520
- return t.tint !== void 0 && t.interfaceIntensity === void 0 && (t.interfaceIntensity = t.tint), t.accentIntensity !== void 0 && t.controlIntensity === void 0 && (t.controlIntensity = t.accentIntensity), typeof t.themeId == "string" && is[t.themeId] && (t.themeId = is[t.themeId]), delete t.tint, delete t.accentIntensity, delete t.neutral, delete t.tintedSidebar, t;
5533
+ return t.tint !== void 0 && t.interfaceIntensity === void 0 && (t.interfaceIntensity = t.tint), t.accentIntensity !== void 0 && t.controlIntensity === void 0 && (t.controlIntensity = t.accentIntensity), typeof t.themeId == "string" && as[t.themeId] && (t.themeId = as[t.themeId]), delete t.tint, delete t.accentIntensity, delete t.neutral, delete t.tintedSidebar, t;
5521
5534
  }
5522
- function ls(e, t) {
5535
+ function us(e, t) {
5523
5536
  if (!t) return e;
5524
5537
  let n = { ...e };
5525
5538
  for (let e of Object.keys(t)) {
@@ -5528,8 +5541,8 @@ function ls(e, t) {
5528
5541
  }
5529
5542
  return n;
5530
5543
  }
5531
- var us = (e, t, n) => Math.min(n, Math.max(t, e));
5532
- function ds(e) {
5544
+ var ds = (e, t, n) => Math.min(n, Math.max(t, e));
5545
+ function fs(e) {
5533
5546
  let [t, n, r] = e.replace(/%/g, "").trim().split(/\s+/).map(Number);
5534
5547
  return {
5535
5548
  h: t || 0,
@@ -5537,37 +5550,37 @@ function ds(e) {
5537
5550
  l: r || 0
5538
5551
  };
5539
5552
  }
5540
- var fs = (e) => String(Number.isInteger(e) ? e : Math.round(e * 10) / 10), ps = ({ h: e, s: t, l: n }) => `${fs((e % 360 + 360) % 360)} ${fs(us(t, 0, 100))}% ${fs(us(n, 0, 100))}%`, ms = (e) => ds(e).h, hs = [
5553
+ var ps = (e) => String(Number.isInteger(e) ? e : Math.round(e * 10) / 10), ms = ({ h: e, s: t, l: n }) => `${ps((e % 360 + 360) % 360)} ${ps(ds(t, 0, 100))}% ${ps(ds(n, 0, 100))}%`, hs = (e) => fs(e).h, gs = [
5541
5554
  0,
5542
5555
  .55,
5543
5556
  1,
5544
5557
  1.5
5545
- ], gs = [
5558
+ ], _s = [
5546
5559
  0,
5547
5560
  0,
5548
5561
  0,
5549
5562
  3
5550
- ], _s = [
5563
+ ], vs = [
5551
5564
  0,
5552
5565
  0,
5553
5566
  0,
5554
5567
  6
5555
- ], vs = [
5568
+ ], ys = [
5556
5569
  0,
5557
5570
  .55,
5558
5571
  1,
5559
5572
  1.7
5560
- ], ys = [
5573
+ ], bs = [
5561
5574
  0,
5562
5575
  0,
5563
5576
  0,
5564
5577
  6
5565
- ], bs = [
5578
+ ], xs = [
5566
5579
  0,
5567
5580
  0,
5568
5581
  0,
5569
5582
  11
5570
- ], xs = {
5583
+ ], Ss = {
5571
5584
  background: .35,
5572
5585
  card: .35,
5573
5586
  popover: .32,
@@ -5577,32 +5590,32 @@ var fs = (e) => String(Number.isInteger(e) ? e : Math.round(e * 10) / 10), ps =
5577
5590
  border: .85,
5578
5591
  sheet1: 1.2,
5579
5592
  sheet2: 1.3
5580
- }, Ss = Object.keys(xs), Cs = {
5593
+ }, Cs = Object.keys(Ss), ws = {
5581
5594
  warm: 40,
5582
5595
  cool: 220,
5583
5596
  neutral: 0
5584
5597
  };
5585
- function ws(e, t) {
5586
- let n = as(e.themeId), r = t === "dark" ? n.dark : n.light, i = { ...r }, a = ms(r.primary), o = n.neutral ?? "warm", s = Cs[o], c = o === "neutral", l = (t === "dark" ? _s : gs)[e.interfaceIntensity];
5587
- for (let t of Ss) {
5588
- let n = ds(r[t]), a = xs[t], o = c ? 0 : Math.max(n.s * hs[e.interfaceIntensity], l * a);
5589
- i[t] = ps({
5598
+ function Ts(e, t) {
5599
+ let n = os(e.themeId), r = t === "dark" ? n.dark : n.light, i = { ...r }, a = hs(r.primary), o = n.neutral ?? "warm", s = ws[o], c = o === "neutral", l = (t === "dark" ? vs : _s)[e.interfaceIntensity];
5600
+ for (let t of Cs) {
5601
+ let n = fs(r[t]), a = Ss[t], o = c ? 0 : Math.max(n.s * gs[e.interfaceIntensity], l * a);
5602
+ i[t] = ms({
5590
5603
  h: c ? n.h : s,
5591
5604
  s: o,
5592
5605
  l: n.l
5593
5606
  });
5594
5607
  }
5595
5608
  {
5596
- let n = ds(r.accent), a = (t === "dark" ? bs : ys)[e.controlIntensity], o = c ? 0 : Math.max(n.s * vs[e.controlIntensity], a);
5597
- i.accent = ps({
5609
+ let n = fs(r.accent), a = (t === "dark" ? xs : bs)[e.controlIntensity], o = c ? 0 : Math.max(n.s * ys[e.controlIntensity], a);
5610
+ i.accent = ms({
5598
5611
  h: c ? n.h : s,
5599
5612
  s: o,
5600
5613
  l: n.l
5601
5614
  });
5602
5615
  }
5603
- e.background && os[e.background] && (i.background = os[e.background][t]);
5616
+ e.background && ss[e.background] && (i.background = ss[e.background][t]);
5604
5617
  {
5605
- let n = hs[e.interfaceIntensity], r = t === "dark" ? {
5618
+ let n = gs[e.interfaceIntensity], r = t === "dark" ? {
5606
5619
  s1: 34,
5607
5620
  l1: 16,
5608
5621
  s2: 40,
@@ -5613,11 +5626,11 @@ function ws(e, t) {
5613
5626
  s2: 50,
5614
5627
  l2: 90.5
5615
5628
  };
5616
- i.sheet1 = ps({
5629
+ i.sheet1 = ms({
5617
5630
  h: a,
5618
5631
  s: c ? 0 : r.s1 * n,
5619
5632
  l: r.l1
5620
- }), i.sheet2 = ps({
5633
+ }), i.sheet2 = ms({
5621
5634
  h: a,
5622
5635
  s: c ? 0 : r.s2 * n,
5623
5636
  l: r.l2
@@ -5625,50 +5638,50 @@ function ws(e, t) {
5625
5638
  }
5626
5639
  return i;
5627
5640
  }
5628
- var Ts = (e) => `--${e.replace(/([A-Z0-9])/g, "-$1").toLowerCase()}`;
5629
- function Es(e, t) {
5630
- let n = ws(e, t), r = {};
5631
- for (let [e, t] of Object.entries(n)) r[Ts(e)] = t;
5641
+ var Es = (e) => `--${e.replace(/([A-Z0-9])/g, "-$1").toLowerCase()}`;
5642
+ function Ds(e, t) {
5643
+ let n = Ts(e, t), r = {};
5644
+ for (let [e, t] of Object.entries(n)) r[Es(e)] = t;
5632
5645
  return r;
5633
5646
  }
5634
- function Ds(e, t, n) {
5647
+ function Os(e, t, n) {
5635
5648
  let r = n ?? (typeof document > "u" ? null : document.documentElement);
5636
5649
  if (!r) return;
5637
- let i = ws(e, t);
5638
- for (let [e, t] of Object.entries(i)) r.style.setProperty(Ts(e), t);
5650
+ let i = Ts(e, t);
5651
+ for (let [e, t] of Object.entries(i)) r.style.setProperty(Es(e), t);
5639
5652
  }
5640
5653
  //#endregion
5641
5654
  //#region src/providers/ThemeProvider.tsx
5642
- var Os = "openbook.appearance", ks = "openbook.theme";
5643
- function As() {
5644
- if (typeof window > "u") return ss;
5655
+ var ks = "openbook.appearance", As = "openbook.theme";
5656
+ function js() {
5657
+ if (typeof window > "u") return cs;
5645
5658
  try {
5646
- let e = localStorage.getItem(Os);
5659
+ let e = localStorage.getItem(ks);
5647
5660
  if (e) return {
5648
- ...ss,
5649
- ...cs(JSON.parse(e))
5661
+ ...cs,
5662
+ ...ls(JSON.parse(e))
5650
5663
  };
5651
5664
  } catch {}
5652
- let e = localStorage.getItem(ks);
5665
+ let e = localStorage.getItem(As);
5653
5666
  return e ? {
5654
- ...ss,
5667
+ ...cs,
5655
5668
  themeId: e
5656
- } : ss;
5669
+ } : cs;
5657
5670
  }
5658
- var js = {
5671
+ var Ms = {
5659
5672
  mode: "system",
5660
5673
  colorScheme: "light",
5661
5674
  setMode: () => null,
5662
- appearance: ss,
5675
+ appearance: cs,
5663
5676
  setAppearance: () => null,
5664
- themeId: ns,
5677
+ themeId: rs,
5665
5678
  setThemeId: () => null,
5666
- themes: rs
5667
- }, Ms = a.createContext(js);
5668
- function Ns({ children: e, defaultColorMode: t = "system", storageKey: n = "theme", ...r }) {
5669
- let [i, o] = a.useState(() => typeof window < "u" && localStorage.getItem(n) || t), [s, c] = a.useState("light"), [l, u] = a.useState(As), d = i === "system" ? s : i;
5679
+ themes: is
5680
+ }, Ns = a.createContext(Ms);
5681
+ function Ps({ children: e, defaultColorMode: t = "system", storageKey: n = "theme", ...r }) {
5682
+ let [i, o] = a.useState(() => typeof window < "u" && localStorage.getItem(n) || t), [s, c] = a.useState("light"), [l, u] = a.useState(js), d = i === "system" ? s : i;
5670
5683
  a.useEffect(() => {
5671
- Ds(l, d);
5684
+ Os(l, d);
5672
5685
  }, [l, d]), a.useEffect(() => {
5673
5686
  typeof document > "u" || document.documentElement.style.setProperty("--overlay-blur", l.blurOverlays ? "8px" : "0px");
5674
5687
  }, [l.blurOverlays]), a.useEffect(() => {
@@ -5689,7 +5702,7 @@ function Ns({ children: e, defaultColorMode: t = "system", storageKey: n = "them
5689
5702
  ...e
5690
5703
  };
5691
5704
  try {
5692
- localStorage.setItem(Os, JSON.stringify(n));
5705
+ localStorage.setItem(ks, JSON.stringify(n));
5693
5706
  } catch {}
5694
5707
  return n;
5695
5708
  });
@@ -5703,201 +5716,201 @@ function Ns({ children: e, defaultColorMode: t = "system", storageKey: n = "them
5703
5716
  setAppearance: f,
5704
5717
  themeId: l.themeId,
5705
5718
  setThemeId: (e) => f({ themeId: e }),
5706
- themes: rs
5719
+ themes: is
5707
5720
  };
5708
- return /* @__PURE__ */ p(Ms.Provider, {
5721
+ return /* @__PURE__ */ p(Ns.Provider, {
5709
5722
  ...r,
5710
5723
  value: m,
5711
5724
  children: e
5712
5725
  });
5713
5726
  }
5714
- var Ps = () => {
5715
- let e = a.useContext(Ms);
5727
+ var Fs = () => {
5728
+ let e = a.useContext(Ns);
5716
5729
  if (e === void 0) throw Error("useTheme must be used within a ThemeProvider");
5717
5730
  return e;
5718
- }, Fs = "lucide:", Is = (e) => !!e && e.startsWith("lucide:"), Ls = (e) => !e || Is(e) ? "" : e, Rs = {
5719
- Star: kn,
5720
- Heart: mt,
5721
- Bookmark: U,
5722
- Flag: Xe,
5723
- Pin: rn,
5724
- Tag: Pn,
5725
- Crown: Ie,
5726
- Award: I,
5727
- Trophy: Gn,
5728
- Gem: it,
5729
- Diamond: Re,
5730
- Sparkles: En,
5731
- Flame: Ze,
5732
- Zap: or,
5733
- Gift: at,
5734
- PartyPopper: Zt,
5735
- Smile: wn,
5736
- ThumbsUp: Rn,
5737
- Check: be,
5738
- CheckCircle2: xe,
5739
- Target: Fn,
5740
- Infinity: yt,
5741
- FileText: qe,
5742
- Folder: et,
5743
- Book: ce,
5744
- BookOpen: H,
5745
- Library: Ot,
5746
- Newspaper: Kt,
5747
- Clipboard: Ee,
5748
- List: jt,
5749
- Archive: F,
5750
- Inbox: vt,
5751
- Briefcase: le,
5752
- Calendar: ge,
5753
- Clock: De,
5731
+ }, Is = "lucide:", Ls = (e) => !!e && e.startsWith("lucide:"), Rs = (e) => !e || Ls(e) ? "" : e, zs = {
5732
+ Star: On,
5733
+ Heart: pt,
5734
+ Bookmark: W,
5735
+ Flag: Ye,
5736
+ Pin: nn,
5737
+ Tag: Nn,
5738
+ Crown: Fe,
5739
+ Award: L,
5740
+ Trophy: Wn,
5741
+ Gem: rt,
5742
+ Diamond: Le,
5743
+ Sparkles: Tn,
5744
+ Flame: Xe,
5745
+ Zap: ar,
5746
+ Gift: it,
5747
+ PartyPopper: Xt,
5748
+ Smile: Cn,
5749
+ ThumbsUp: Ln,
5750
+ Check: ye,
5751
+ CheckCircle2: be,
5752
+ Target: Pn,
5753
+ Infinity: vt,
5754
+ FileText: Ke,
5755
+ Folder: $e,
5756
+ Book: se,
5757
+ BookOpen: U,
5758
+ Library: Dt,
5759
+ Newspaper: Gt,
5760
+ Clipboard: Te,
5761
+ List: At,
5762
+ Archive: I,
5763
+ Inbox: _t,
5764
+ Briefcase: ce,
5765
+ Calendar: he,
5766
+ Clock: Ee,
5754
5767
  AlarmClock: M,
5755
- Timer: Bn,
5756
- Paperclip: Xt,
5757
- BarChart3: ae,
5758
- PieChart: tn,
5759
- TrendingUp: Wn,
5760
- Table: Nn,
5761
- Grid3x3: lt,
5762
- Database: Le,
5763
- Layers: Tt,
5764
- Gauge: rt,
5765
- Calculator: he,
5766
- DollarSign: Be,
5767
- Coins: Me,
5768
- Wallet: $n,
5769
- CreditCard: Fe,
5770
- PiggyBank: nn,
5771
- ShoppingBag: Sn,
5772
- ShoppingCart: Cn,
5773
- Scale: hn,
5774
- Code2: ke,
5775
- Terminal: Ln,
5776
- Cpu: Pe,
5777
- Binary: se,
5778
- GitBranch: ot,
5779
- Bug: de,
5780
- Cog: je,
5781
- Settings: yn,
5782
- Wrench: ar,
5783
- Hammer: ut,
5784
- Plug: sn,
5785
- Key: xt,
5786
- Lock: Mt,
5787
- Shield: xn,
5788
- Wifi: rr,
5789
- Monitor: Bt,
5790
- Laptop: wt,
5791
- Keyboard: St,
5792
- Mouse: Ut,
5793
- Mail: Nt,
5794
- MessageCircle: Lt,
5795
- MessageSquare: Rt,
5796
- Send: vn,
5797
- Bell: B,
5798
- Megaphone: It,
5799
- Phone: en,
5800
- Share2: bn,
5801
- Link: At,
5802
- Hash: ft,
5803
- Image: _t,
5804
- Camera: _e,
5805
- Video: Qn,
5806
- Film: Je,
5807
- Clapperboard: Te,
5808
- Music: Wt,
5809
- Headphones: pt,
5810
- Mic: zt,
5811
- Speaker: Dn,
5812
- Radio: dn,
5813
- Tv: qn,
5814
- Play: on,
5815
- Gamepad2: nt,
5816
- Palette: Jt,
5817
- Brush: ue,
5818
- PenTool: Qt,
5819
- Pencil: $t,
5820
- Aperture: ie,
5821
- User: Yn,
5822
- Users: Xn,
5823
- Hand: dt,
5824
- Eye: Ge,
5825
- Brain: G,
5826
- Footprints: tt,
5827
- GraduationCap: ct,
5828
- Dumbbell: Ue,
5829
- Leaf: Dt,
5830
- Sprout: On,
5831
- Flower2: $e,
5832
- TreePine: Un,
5833
- Mountain: Ht,
5834
- Globe: st,
5835
- Sun: jn,
5836
- Moon: Vt,
5837
- Cloud: Oe,
5838
- Snowflake: Tn,
5839
- Droplet: He,
5840
- Waves: nr,
5841
- Wind: ir,
5842
- Umbrella: Jn,
5843
- Feather: Ke,
5844
- Bird: V,
5845
- Dog: ze,
5846
- Rabbit: un,
5847
- Coffee: Ae,
5848
- Utensils: Zn,
5849
- Cake: me,
5850
- ChefHat: Se,
5851
- Carrot: ye,
5852
- Cherry: Ce,
5853
- Egg: We,
5854
- Beaker: z,
5855
- FlaskConical: Qe,
5856
- Home: gt,
5857
- Building2: fe,
5858
- Tent: In,
5859
- MapPin: Ft,
5860
- Map: Pt,
5861
- Compass: Ne,
5862
- Navigation: Gt,
5863
- Rocket: fn,
5864
- Plane: an,
5865
- Car: ve,
5866
- Bus: pe,
5867
- Bike: oe,
5868
- Truck: Kn,
5768
+ Timer: zn,
5769
+ Paperclip: Yt,
5770
+ BarChart3: ie,
5771
+ PieChart: en,
5772
+ TrendingUp: Un,
5773
+ Table: Mn,
5774
+ Grid3x3: ct,
5775
+ Database: Ie,
5776
+ Layers: wt,
5777
+ Gauge: nt,
5778
+ Calculator: me,
5779
+ DollarSign: ze,
5780
+ Coins: je,
5781
+ Wallet: Qn,
5782
+ CreditCard: Pe,
5783
+ PiggyBank: tn,
5784
+ ShoppingBag: xn,
5785
+ ShoppingCart: Sn,
5786
+ Scale: mn,
5787
+ Code2: Oe,
5788
+ Terminal: In,
5789
+ Cpu: Ne,
5790
+ Binary: oe,
5791
+ GitBranch: at,
5792
+ Bug: ue,
5793
+ Cog: Ae,
5794
+ Settings: vn,
5795
+ Wrench: ir,
5796
+ Hammer: lt,
5797
+ Plug: on,
5798
+ Key: bt,
5799
+ Lock: jt,
5800
+ Shield: bn,
5801
+ Wifi: nr,
5802
+ Monitor: zt,
5803
+ Laptop: Ct,
5804
+ Keyboard: xt,
5805
+ Mouse: Ht,
5806
+ Mail: Mt,
5807
+ MessageCircle: It,
5808
+ MessageSquare: Lt,
5809
+ Send: _n,
5810
+ Bell: V,
5811
+ Megaphone: Ft,
5812
+ Phone: $t,
5813
+ Share2: yn,
5814
+ Link: kt,
5815
+ Hash: dt,
5816
+ Image: gt,
5817
+ Camera: ge,
5818
+ Video: Zn,
5819
+ Film: qe,
5820
+ Clapperboard: we,
5821
+ Music: Ut,
5822
+ Headphones: ft,
5823
+ Mic: Rt,
5824
+ Speaker: En,
5825
+ Radio: un,
5826
+ Tv: Kn,
5827
+ Play: an,
5828
+ Gamepad2: tt,
5829
+ Palette: qt,
5830
+ Brush: le,
5831
+ PenTool: Zt,
5832
+ Pencil: Qt,
5833
+ Aperture: F,
5834
+ User: Jn,
5835
+ Users: Yn,
5836
+ Hand: ut,
5837
+ Eye: We,
5838
+ Brain: K,
5839
+ Footprints: et,
5840
+ GraduationCap: st,
5841
+ Dumbbell: He,
5842
+ Leaf: Et,
5843
+ Sprout: Dn,
5844
+ Flower2: Qe,
5845
+ TreePine: Hn,
5846
+ Mountain: Vt,
5847
+ Globe: ot,
5848
+ Sun: An,
5849
+ Moon: Bt,
5850
+ Cloud: De,
5851
+ Snowflake: wn,
5852
+ Droplet: Ve,
5853
+ Waves: tr,
5854
+ Wind: rr,
5855
+ Umbrella: qn,
5856
+ Feather: Ge,
5857
+ Bird: H,
5858
+ Dog: Re,
5859
+ Rabbit: ln,
5860
+ Coffee: ke,
5861
+ Utensils: Xn,
5862
+ Cake: pe,
5863
+ ChefHat: xe,
5864
+ Carrot: ve,
5865
+ Cherry: Se,
5866
+ Egg: Ue,
5867
+ Beaker: B,
5868
+ FlaskConical: Ze,
5869
+ Home: ht,
5870
+ Building2: de,
5871
+ Tent: Fn,
5872
+ MapPin: Pt,
5873
+ Map: Nt,
5874
+ Compass: Me,
5875
+ Navigation: Wt,
5876
+ Rocket: dn,
5877
+ Plane: rn,
5878
+ Car: _e,
5879
+ Bus: fe,
5880
+ Bike: ae,
5881
+ Truck: Gn,
5869
5882
  Anchor: P,
5870
- Backpack: L,
5871
- Ticket: zn,
5872
- Lamp: Ct,
5873
- Lightbulb: kt,
5874
- Box: W,
5875
- Package: qt,
5876
- Puzzle: ln,
5877
- Ruler: pn,
5878
- Scissors: gn,
5879
- Sword: Mn,
5880
- Sticker: An,
5881
- Watch: tr,
5882
- Battery: R,
5883
- Wand2: er,
5883
+ Backpack: R,
5884
+ Ticket: Rn,
5885
+ Lamp: St,
5886
+ Lightbulb: Ot,
5887
+ Box: G,
5888
+ Package: Kt,
5889
+ Puzzle: cn,
5890
+ Ruler: fn,
5891
+ Scissors: hn,
5892
+ Sword: jn,
5893
+ Sticker: kn,
5894
+ Watch: er,
5895
+ Battery: z,
5896
+ Wand2: $n,
5884
5897
  Activity: j,
5885
- Search: _n,
5886
- Filter: Ye,
5887
- Plus: cn,
5888
- Download: Ve,
5889
- Save: mn,
5890
- Trash2: Hn,
5891
- Info: bt,
5892
- HelpCircle: ht,
5898
+ Search: gn,
5899
+ Filter: Je,
5900
+ Plus: sn,
5901
+ Download: Be,
5902
+ Save: pn,
5903
+ Trash2: Vn,
5904
+ Info: yt,
5905
+ HelpCircle: mt,
5893
5906
  AlertTriangle: N,
5894
- ToggleLeft: Vn,
5895
- PanelLeft: Yt,
5896
- Layout: Et,
5897
- Circle: we
5898
- }, zs = Object.keys(Rs);
5899
- function Bs(e) {
5900
- return Rs[e.startsWith("lucide:") ? e.slice(7) : e] ?? null;
5907
+ ToggleLeft: Bn,
5908
+ PanelLeft: Jt,
5909
+ Layout: Tt,
5910
+ Circle: Ce
5911
+ }, Bs = Object.keys(zs);
5912
+ function Vs(e) {
5913
+ return zs[e.startsWith("lucide:") ? e.slice(7) : e] ?? null;
5901
5914
  }
5902
5915
  //#endregion
5903
- export { Wi as $, ka as A, lr as At, _a as B, Ya as C, Dr as Ct, Xa as D, dr as Dt, qa as E, q as Et, Ia as F, ca as G, fa as H, Pa as I, Qi as J, sa as K, Fa as L, Da as M, K as Mt, Ea as N, ja as O, mr as Ot, Aa as P, zi as Q, Ca as R, Ka as S, Tr as St, Ja as T, yr as Tt, pa as U, ga as V, oa as W, Yi as X, ea as Y, Xi as Z, io as _, pi as _t, Is as a, Ti as at, ao as b, mi as bt, Ps as c, Ci as ct, as as d, vi as dt, Ui as et, ls as f, _i as ft, qo as g, Jr as gt, $o as h, qr as ht, Fs as i, Oi as it, Ma as j, cr as jt, Oa as k, hr as kt, os as l, xi as lt, rs as m, gi as mt, zs as n, Vi as nt, Ls as o, hi as ot, cs as p, Si as pt, Zi as q, Bs as r, Di as rt, Ns as s, yi as st, Rs as t, Bi as tt, Es as u, bi as ut, ro as v, Xr as vt, Wa as w, Er as wt, Ga as x, Y as xt, so as y, Yr as yt, Ta as z };
5916
+ export { Wi as $, ka as A, hr as At, _a as B, Ya as C, Dr as Ct, Xa as D, dr as Dt, qa as E, J as Et, Ia as F, ca as G, fa as H, Pa as I, Qi as J, sa as K, Fa as L, Da as M, sr as Mt, Ea as N, q as Nt, ja as O, mr as Ot, Aa as P, zi as Q, Ca as R, Ka as S, Tr as St, Ja as T, yr as Tt, pa as U, ga as V, oa as W, Yi as X, ea as Y, Xi as Z, io as _, pi as _t, Ls as a, Ti as at, ao as b, mi as bt, Fs as c, Ci as ct, os as d, vi as dt, Ui as et, us as f, _i as ft, Jo as g, Jr as gt, es as h, qr as ht, Is as i, Oi as it, Ma as j, cr as jt, Oa as k, lr as kt, ss as l, xi as lt, is as m, gi as mt, Bs as n, Vi as nt, Rs as o, hi as ot, ls as p, Si as pt, Zi as q, Vs as r, Di as rt, Ps as s, yi as st, zs as t, Bi as tt, Ds as u, bi as ut, ro as v, Xr as vt, Wa as w, Er as wt, Ga as x, X as xt, so as y, Yr as yt, Ta as z };