@lambda-development/erp-core 0.6.15 → 0.6.16

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.
@@ -13,6 +13,7 @@ export declare const api: {
13
13
  mime_type: string;
14
14
  size_bytes: number;
15
15
  created_at: string;
16
+ warning?: string;
16
17
  }>;
17
18
  getChatAttachmentUrl: (id: string) => string;
18
19
  createChatSession: () => Promise<{
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { jsx as e, jsxs as r, Fragment as Ce } from "react/jsx-runtime";
2
2
  import { useState as w, useEffect as re, useCallback as Pe, useContext as an, createContext as rn, useRef as oe, useMemo as Ne, useLayoutEffect as hn, StrictMode as Ba } from "react";
3
3
  import { createRoot as Ea } from "react-dom/client";
4
4
  import { useQueryClient as He, useQuery as ue, useMutation as me, QueryClientProvider as La, QueryClient as Oa } from "@tanstack/react-query";
5
- import { NavLink as qt, useLocation as bt, useNavigate as Ee, Outlet as qa, Navigate as za, Link as ve, useSearchParams as zt, useParams as dt, createBrowserRouter as Ma, RouterProvider as Fa } from "react-router-dom";
5
+ import { NavLink as qt, useLocation as vt, useNavigate as Ee, Outlet as qa, Navigate as za, Link as ve, useSearchParams as zt, useParams as ut, createBrowserRouter as Ma, RouterProvider as Fa } from "react-router-dom";
6
6
  import { useTranslation as X, initReactI18next as $a } from "react-i18next";
7
7
  import { BookOpen as Ua, ShoppingCart as Hn, CreditCard as Va, FileText as sn, Package as Qn, BarChart3 as Ka, Database as ja, Settings as Ga, MessageCircle as Wa, ChevronDown as Mt, ChevronRight as Dt, Plus as Yn, Trash2 as Jn, LineChart as Ha, ArrowLeft as Qa, TrendingUp as Ya, ArrowDownRight as Ja, ArrowUpRight as Za, Wallet as Xa, Receipt as gn, ChevronLeft as er, Info as tr } from "lucide-react";
8
8
  import { createColumnHelper as Zn, useReactTable as Xn, getCoreRowModel as ea, flexRender as Bt } from "@tanstack/react-table";
@@ -10,12 +10,12 @@ import { createPortal as ta } from "react-dom";
10
10
  import { ResponsiveContainer as nr, LineChart as ar, CartesianGrid as fn, XAxis as yn, YAxis as bn, Tooltip as Kt, Line as rr, PieChart as sr, Pie as ir, Cell as or, BarChart as lr, Bar as cr } from "recharts";
11
11
  import na from "i18next";
12
12
  import { default as il } from "i18next";
13
- let lt = "/api";
13
+ let ct = "/api";
14
14
  function Ho(t) {
15
- lt = t.replace(/\/+$/, "");
15
+ ct = t.replace(/\/+$/, "");
16
16
  }
17
17
  function dr(t) {
18
- return new URL(`${lt}${t}`, window.location.origin).toString();
18
+ return new URL(`${ct}${t}`, window.location.origin).toString();
19
19
  }
20
20
  class Ue extends Error {
21
21
  constructor(n, a) {
@@ -38,7 +38,7 @@ function ur(t) {
38
38
  return String(t);
39
39
  }
40
40
  async function L(t, n) {
41
- const a = await fetch(`${lt}${t}`, {
41
+ const a = await fetch(`${ct}${t}`, {
42
42
  headers: { "Content-Type": "application/json" },
43
43
  credentials: "include",
44
44
  ...n
@@ -65,7 +65,7 @@ const I = {
65
65
  uploadChatAttachment: async (t, n) => {
66
66
  const a = new FormData();
67
67
  a.append("file", n), a.append("session_id", t);
68
- const s = await fetch(`${lt}/chat/attachments`, {
68
+ const s = await fetch(`${ct}/chat/attachments`, {
69
69
  method: "POST",
70
70
  credentials: "include",
71
71
  body: a
@@ -78,7 +78,7 @@ const I = {
78
78
  }
79
79
  return s.json();
80
80
  },
81
- getChatAttachmentUrl: (t) => `${lt}/chat/attachments/${encodeURIComponent(t)}`,
81
+ getChatAttachmentUrl: (t) => `${ct}/chat/attachments/${encodeURIComponent(t)}`,
82
82
  // Chat
83
83
  createChatSession: () => L(
84
84
  "/chat/sessions",
@@ -120,7 +120,7 @@ const I = {
120
120
  uploadProposalAppendix: async (t, n) => {
121
121
  const a = new FormData();
122
122
  a.append("file", n);
123
- const s = await fetch(`${lt}/proposals/${encodeURIComponent(t)}/appendix`, {
123
+ const s = await fetch(`${ct}/proposals/${encodeURIComponent(t)}/appendix`, {
124
124
  method: "POST",
125
125
  credentials: "include",
126
126
  body: a
@@ -134,7 +134,7 @@ const I = {
134
134
  return s.json();
135
135
  },
136
136
  deleteProposalAppendix: (t) => L(`/proposals/${encodeURIComponent(t)}/appendix`, { method: "DELETE" }),
137
- proposalPdfUrl: (t) => `${lt}/documents/proposal/${encodeURIComponent(t)}/pdf`,
137
+ proposalPdfUrl: (t) => `${ct}/documents/proposal/${encodeURIComponent(t)}/pdf`,
138
138
  // Masters
139
139
  listMasters: (t, n) => L(
140
140
  `/masters/${t}${Be(n)}`
@@ -464,10 +464,10 @@ function gr({ children: t }) {
464
464
  }
465
465
  })
466
466
  ).then((ke) => {
467
- const pe = ke.filter((ge) => !!ge);
468
- pe.length && (Se(pe), H((ge) => [
469
- ...pe.filter((gt) => !ge.some((xt) => xt.id === gt.id)),
470
- ...ge
467
+ const pe = ke.filter((fe) => !!fe);
468
+ pe.length && (Se(pe), H((fe) => [
469
+ ...pe.filter((ft) => !fe.some((Nt) => Nt.id === ft.id)),
470
+ ...fe
471
471
  ]));
472
472
  });
473
473
  return;
@@ -509,21 +509,21 @@ function gr({ children: t }) {
509
509
  const q = Array.isArray(j.messages) ? j.messages.map(Nn) : [], G = j.before_id != null, J = !!j.has_more, Me = typeof j.oldest_id == "number" ? j.oldest_id : null;
510
510
  i((pe) => {
511
511
  if (G) {
512
- const ge = pe[O] ?? [], gt = new Set(
513
- ge.map((Xe) => Xe.id).filter((Xe) => typeof Xe == "number")
514
- ), xt = q.filter(
515
- (Xe) => Xe.id === void 0 || !gt.has(Xe.id)
512
+ const fe = pe[O] ?? [], ft = new Set(
513
+ fe.map((Xe) => Xe.id).filter((Xe) => typeof Xe == "number")
514
+ ), Nt = q.filter(
515
+ (Xe) => Xe.id === void 0 || !ft.has(Xe.id)
516
516
  );
517
- return { ...pe, [O]: [...xt, ...ge] };
517
+ return { ...pe, [O]: [...Nt, ...fe] };
518
518
  }
519
519
  return { ...pe, [O]: q };
520
520
  }), c((pe) => ({ ...pe, [O]: J })), d((pe) => ({ ...pe, [O]: Me })), u((pe) => ({ ...pe, [O]: !1 }));
521
521
  const ke = typeof j.title == "string" ? j.title : null;
522
522
  if (ke && H(
523
- (pe) => pe.map((ge) => ge.id === O ? { ...ge, title: ke } : ge)
523
+ (pe) => pe.map((fe) => fe.id === O ? { ...fe, title: ke } : fe)
524
524
  ), !G) {
525
525
  const pe = q[q.length - 1];
526
- pe != null && pe.timestamp && (ce(O, pe.timestamp), H((ge) => ge));
526
+ pe != null && pe.timestamp && (ce(O, pe.timestamp), H((fe) => fe));
527
527
  }
528
528
  return;
529
529
  }
@@ -585,12 +585,12 @@ function gr({ children: t }) {
585
585
  }
586
586
  if (ye === "llm_provider" && O) {
587
587
  const q = typeof j.provider == "string" ? j.provider : void 0, G = typeof j.model == "string" ? j.model : void 0, Me = (typeof j.role == "string" ? j.role : void 0) === "code_specialist" ? "Delegating to code specialist..." : void 0;
588
- ee(O, !0), z(O, (ke) => ke.some((ge) => ge.type === "thinking") ? ke.map((ge) => ge.type === "thinking" ? {
589
- ...ge,
588
+ ee(O, !0), z(O, (ke) => ke.some((fe) => fe.type === "thinking") ? ke.map((fe) => fe.type === "thinking" ? {
589
+ ...fe,
590
590
  provider: q,
591
591
  model: G,
592
592
  ...Me ? { content: Me } : {}
593
- } : ge) : [
593
+ } : fe) : [
594
594
  ...ke,
595
595
  {
596
596
  type: "thinking",
@@ -701,10 +701,10 @@ function gr({ children: t }) {
701
701
  async function Fe(B) {
702
702
  await ie("delete_session", { session_id: B }, "session_deleted");
703
703
  }
704
- async function vt(B) {
704
+ async function xt(B) {
705
705
  await ie("load_history", { session_id: B }, "history_loaded");
706
706
  }
707
- async function mt(B) {
707
+ async function pt(B) {
708
708
  if (p[B]) return;
709
709
  const K = h[B];
710
710
  if (K != null && l[B]) {
@@ -757,13 +757,13 @@ function gr({ children: t }) {
757
757
  function Oe(B) {
758
758
  return B ? !!l[B] : !1;
759
759
  }
760
- function pt(B) {
760
+ function ht(B) {
761
761
  return B ? !!p[B] : !1;
762
762
  }
763
763
  function it(B) {
764
764
  return B ? N[B] ?? "idle" : "idle";
765
765
  }
766
- function ht(B) {
766
+ function gt(B) {
767
767
  return B ? C[B] ?? null : null;
768
768
  }
769
769
  return /* @__PURE__ */ e(
@@ -778,23 +778,23 @@ function gr({ children: t }) {
778
778
  startDemo: Te,
779
779
  completeDemoTyping: Ke,
780
780
  deleteSession: Fe,
781
- loadHistory: vt,
782
- loadMoreHistory: mt,
781
+ loadHistory: xt,
782
+ loadMoreHistory: pt,
783
783
  clearHistory: Je,
784
784
  sendMessage: De,
785
785
  transcribeAudio: Ie,
786
786
  getMessages: je,
787
787
  hasMoreHistory: Oe,
788
- isLoadingOlder: pt,
788
+ isLoadingOlder: ht,
789
789
  isThinking: Qe,
790
790
  getDemoStatus: it,
791
- getDemoTypingCue: ht
791
+ getDemoTypingCue: gt
792
792
  },
793
793
  children: t
794
794
  }
795
795
  );
796
796
  }
797
- function ut() {
797
+ function mt() {
798
798
  const t = an(ra);
799
799
  if (!t)
800
800
  throw new Error("useChat must be used within ChatProvider.");
@@ -985,7 +985,7 @@ function ua() {
985
985
  function vr() {
986
986
  return da().prompt;
987
987
  }
988
- const ct = [
988
+ const dt = [
989
989
  {
990
990
  label: "Introduction",
991
991
  icon: /* @__PURE__ */ e(Ua, { className: "h-4 w-4" }),
@@ -1071,19 +1071,19 @@ const ct = [
1071
1071
  }
1072
1072
  ];
1073
1073
  function xr() {
1074
- return ct;
1074
+ return dt;
1075
1075
  }
1076
1076
  function Yo(t, n) {
1077
- const a = ct.findIndex((s) => s.label === t.label);
1077
+ const a = dt.findIndex((s) => s.label === t.label);
1078
1078
  if (a >= 0) {
1079
- ct[a] = t;
1079
+ dt[a] = t;
1080
1080
  return;
1081
1081
  }
1082
- (n == null ? void 0 : n.index) != null ? ct.splice(n.index, 0, t) : ct.push(t);
1082
+ (n == null ? void 0 : n.index) != null ? dt.splice(n.index, 0, t) : dt.push(t);
1083
1083
  }
1084
1084
  function Jo(t, n) {
1085
- const a = ct.find((s) => s.label === t);
1086
- a ? a.items.push(n) : ct.push({ label: t, icon: null, items: [n] });
1085
+ const a = dt.find((s) => s.label === t);
1086
+ a ? a.items.push(n) : dt.push({ label: t, icon: null, items: [n] });
1087
1087
  }
1088
1088
  let Xt = { appName: "Lambda ERP" };
1089
1089
  function Zo(t) {
@@ -1135,7 +1135,7 @@ const cn = {
1135
1135
  "Custom Analytics": "bg-indigo-300 text-indigo-950 ring-2 ring-inset ring-indigo-100"
1136
1136
  };
1137
1137
  function wr() {
1138
- const [t, n] = ln("chats"), a = bt(), s = Ee(), { t: o } = X(), { sessions: i, createSession: l, deleteSession: c } = ut(), h = async () => {
1138
+ const [t, n] = ln("chats"), a = vt(), s = Ee(), { t: o } = X(), { sessions: i, createSession: l, deleteSession: c } = mt(), h = async () => {
1139
1139
  try {
1140
1140
  const p = await l();
1141
1141
  s(`/chat/${p.id}`);
@@ -1213,7 +1213,7 @@ function dn() {
1213
1213
  );
1214
1214
  }
1215
1215
  function kr() {
1216
- const [t, n, a] = ln("custom-analytics"), s = bt(), o = Ee(), i = He(), { t: l } = X(), { navigationFlash: c, sessions: h, createSession: d } = ut(), p = (c == null ? void 0 : c.group) === "Custom Analytics", u = cn["Custom Analytics"], { data: f } = ue({
1216
+ const [t, n, a] = ln("custom-analytics"), s = vt(), o = Ee(), i = He(), { t: l } = X(), { navigationFlash: c, sessions: h, createSession: d } = mt(), p = (c == null ? void 0 : c.group) === "Custom Analytics", u = cn["Custom Analytics"], { data: f } = ue({
1217
1217
  queryKey: ["runtime-drafts"],
1218
1218
  queryFn: () => I.listRuntimeDrafts(),
1219
1219
  staleTime: 3e4
@@ -1303,7 +1303,7 @@ function kr() {
1303
1303
  ] });
1304
1304
  }
1305
1305
  function Cr({ group: t }) {
1306
- const [n, a] = ln(t.label), { t: s } = X(), { navigationFlash: o } = ut(), i = (o == null ? void 0 : o.group) === t.label, l = cn[t.label] ?? "bg-blue-300 text-blue-950 ring-2 ring-inset ring-blue-100";
1306
+ const [n, a] = ln(t.label), { t: s } = X(), { navigationFlash: o } = mt(), i = (o == null ? void 0 : o.group) === t.label, l = cn[t.label] ?? "bg-blue-300 text-blue-950 ring-2 ring-inset ring-blue-100";
1307
1307
  return /* @__PURE__ */ r("div", { children: [
1308
1308
  /* @__PURE__ */ r(
1309
1309
  "button",
@@ -1445,7 +1445,7 @@ function _r() {
1445
1445
  return /* @__PURE__ */ e(br, { children: /* @__PURE__ */ e(gr, { children: /* @__PURE__ */ e(Tr, {}) }) });
1446
1446
  }
1447
1447
  function Tr() {
1448
- const { pathname: t } = bt(), n = Ee(), { user: a, logout: s } = st(), { navigationFlash: o } = ut(), { t: i } = X(), l = Ar(t, i), c = Pr(t), h = () => {
1448
+ const { pathname: t } = vt(), n = Ee(), { user: a, logout: s } = st(), { navigationFlash: o } = mt(), { t: i } = X(), l = Ar(t, i), c = Pr(t), h = () => {
1449
1449
  var f;
1450
1450
  c && (((f = window.history.state) == null ? void 0 : f.idx) > 0 ? n(-1) : n(c));
1451
1451
  }, [d, p] = w(!1);
@@ -2909,7 +2909,7 @@ function Dn(t, n) {
2909
2909
  }
2910
2910
  function An() {
2911
2911
  var Se;
2912
- const { doctype: t, name: n } = dt(), a = Ee(), s = He(), { t: o } = X(), i = fa(t ?? ""), l = !n, [c, h] = w({}), [d, p] = w(!1), { data: u, isLoading: f } = ue({
2912
+ const { doctype: t, name: n } = ut(), a = Ee(), s = He(), { t: o } = X(), i = fa(t ?? ""), l = !n, [c, h] = w({}), [d, p] = w(!1), { data: u, isLoading: f } = ue({
2913
2913
  queryKey: ["document", t, n],
2914
2914
  queryFn: () => I.getDocument(t, n),
2915
2915
  enabled: !!t && !!n && !l
@@ -3334,7 +3334,7 @@ function Rn({
3334
3334
  ] });
3335
3335
  }
3336
3336
  function ts() {
3337
- const { t } = X(), n = ze(), { doctype: a } = dt(), s = fa(a ?? ""), o = bt(), i = (s == null ? void 0 : s.listFilters) ?? [], l = Ne(() => {
3337
+ const { t } = X(), n = ze(), { doctype: a } = ut(), s = fa(a ?? ""), o = vt(), i = (s == null ? void 0 : s.listFilters) ?? [], l = Ne(() => {
3338
3338
  const P = new URLSearchParams(o.search), V = {};
3339
3339
  for (const ne of i) V[ne] = P.get(ne) ?? "";
3340
3340
  return V;
@@ -3671,7 +3671,7 @@ const Tt = () => ({
3671
3671
  is_recommended: 0
3672
3672
  }), ns = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
3673
3673
  function In() {
3674
- const { name: t } = dt(), n = !t, a = Ee(), s = He(), { t: o } = X(), i = (A, _) => o(A, { defaultValue: _ }), l = ua(), [c, h] = w({
3674
+ const { name: t } = ut(), n = !t, a = Ee(), s = He(), { t: o } = X(), i = (A, _) => o(A, { defaultValue: _ }), l = ua(), [c, h] = w({
3675
3675
  title: "Offerte",
3676
3676
  customer: "",
3677
3677
  company: "",
@@ -3851,7 +3851,7 @@ function In() {
3851
3851
  const as = ["25", "50", "100", "200"];
3852
3852
  function rs() {
3853
3853
  var y;
3854
- const { type: t } = dt(), n = Ee(), a = bt(), s = (y = a.state) == null ? void 0 : y.notice;
3854
+ const { type: t } = ut(), n = Ee(), a = vt(), s = (y = a.state) == null ? void 0 : y.notice;
3855
3855
  re(() => {
3856
3856
  t && ga(`master:${t}`, { filters: {}, search: a.search });
3857
3857
  }, [t, a.search]);
@@ -4047,7 +4047,7 @@ const ss = {
4047
4047
  }, Bn = /* @__PURE__ */ new Set(["customer", "supplier", "item", "warehouse"]);
4048
4048
  function En() {
4049
4049
  var Z;
4050
- const { type: t, name: n } = dt(), a = Ee(), s = He(), { t: o } = X(), i = !n || n === "new", l = is[t ?? ""] ?? t ?? "", c = o(`masters.${t}.one`, { defaultValue: l }), h = ss[t ?? ""] ?? [], d = (g) => o(`fields.${g.label}`, { defaultValue: g.label }), [p, u] = w({}), { data: f, isLoading: v } = ue({
4050
+ const { type: t, name: n } = ut(), a = Ee(), s = He(), { t: o } = X(), i = !n || n === "new", l = is[t ?? ""] ?? t ?? "", c = o(`masters.${t}.one`, { defaultValue: l }), h = ss[t ?? ""] ?? [], d = (g) => o(`fields.${g.label}`, { defaultValue: g.label }), [p, u] = w({}), { data: f, isLoading: v } = ue({
4051
4051
  queryKey: ["master", t, n],
4052
4052
  queryFn: () => I.getMaster(t, n),
4053
4053
  enabled: !!t && !!n && !i
@@ -4945,7 +4945,7 @@ return {
4945
4945
  }
4946
4946
  const xa = As();
4947
4947
  function Ps() {
4948
- const t = Ee(), { sessions: n, createSession: a } = ut(), [s] = le("report_id", ""), [o] = le("metric", ""), [i] = le("group_by", ""), [l] = le("from", ""), [c] = le("to", ""), [h] = le("company", ""), [d, p] = w(xa), [u, f] = w([]), [v, N] = w(null), [b, C] = w(""), [S, x] = w(!1), [y, m] = w(!1), [D, T] = w(""), U = oe(null), Z = oe(""), g = oe(""), R = oe(0), W = Ne(() => !o || !i ? "" : JSON.stringify(Is({
4948
+ const t = Ee(), { sessions: n, createSession: a } = mt(), [s] = le("report_id", ""), [o] = le("metric", ""), [i] = le("group_by", ""), [l] = le("from", ""), [c] = le("to", ""), [h] = le("company", ""), [d, p] = w(xa), [u, f] = w([]), [v, N] = w(null), [b, C] = w(""), [S, x] = w(!1), [y, m] = w(!1), [D, T] = w(""), U = oe(null), Z = oe(""), g = oe(""), R = oe(0), W = Ne(() => !o || !i ? "" : JSON.stringify(Is({
4949
4949
  metric: o,
4950
4950
  groupBy: i,
4951
4951
  fromDate: l || void 0,
@@ -5176,7 +5176,7 @@ function Rs(t) {
5176
5176
  function Is(t) {
5177
5177
  const n = `${Bs(t.metric)} by ${Ts(t.groupBy)}`, a = t.groupBy === "month" ? "helpers.monthKey" : t.groupBy === "quarter" ? "helpers.quarterKey" : "helpers.yearKey";
5178
5178
  if (t.metric === "sales_revenue")
5179
- return yt({
5179
+ return bt({
5180
5180
  title: n,
5181
5181
  dataset: t.groupBy === "item" ? "sales_invoice_lines" : "sales_invoices",
5182
5182
  requestName: "rows",
@@ -5193,7 +5193,7 @@ function Is(t) {
5193
5193
  chartType: t.groupBy === "customer" || t.groupBy === "item" ? "bar" : "line"
5194
5194
  });
5195
5195
  if (t.metric === "sales_returns")
5196
- return yt({
5196
+ return bt({
5197
5197
  title: n,
5198
5198
  dataset: "sales_invoices",
5199
5199
  requestName: "rows",
@@ -5210,7 +5210,7 @@ function Is(t) {
5210
5210
  chartType: t.groupBy === "customer" ? "bar" : "line"
5211
5211
  });
5212
5212
  if (t.metric === "purchases")
5213
- return yt({
5213
+ return bt({
5214
5214
  title: n,
5215
5215
  dataset: t.groupBy === "item" ? "purchase_invoice_lines" : "purchase_invoices",
5216
5216
  requestName: "rows",
@@ -5228,7 +5228,7 @@ function Is(t) {
5228
5228
  });
5229
5229
  if (t.metric === "payments_received" || t.metric === "payments_made") {
5230
5230
  const s = t.metric === "payments_received";
5231
- return yt({
5231
+ return bt({
5232
5232
  title: n,
5233
5233
  dataset: "payments",
5234
5234
  requestName: "rows",
@@ -5248,7 +5248,7 @@ function Is(t) {
5248
5248
  }
5249
5249
  if (t.metric === "outstanding_ar" || t.metric === "outstanding_ap") {
5250
5250
  const s = t.metric === "outstanding_ar", o = s ? "ar_open_items" : "ap_open_items", i = s ? "customer" : "supplier", l = "outstanding_amount";
5251
- return yt({
5251
+ return bt({
5252
5252
  title: n,
5253
5253
  dataset: o,
5254
5254
  requestName: "rows",
@@ -5264,7 +5264,7 @@ function Is(t) {
5264
5264
  chartType: "bar"
5265
5265
  });
5266
5266
  }
5267
- return t.metric === "stock_value" ? yt({
5267
+ return t.metric === "stock_value" ? bt({
5268
5268
  title: n,
5269
5269
  dataset: "stock_balances",
5270
5270
  requestName: "rows",
@@ -5279,7 +5279,7 @@ function Is(t) {
5279
5279
  chartType: "bar"
5280
5280
  }) : JSON.parse(xa);
5281
5281
  }
5282
- function yt(t) {
5282
+ function bt(t) {
5283
5283
  const n = Object.fromEntries(Object.entries(t.filters).filter(([, s]) => s !== void 0)), a = ["month", "quarter", "year"].includes(t.groupBy) ? `${t.timeBucket}(row.${t.keyField})` : `row.${t.keyField} || "—"`;
5284
5284
  return {
5285
5285
  title: t.title,
@@ -5715,7 +5715,7 @@ const Fs = [
5715
5715
  }
5716
5716
  ];
5717
5717
  function wa() {
5718
- const t = Ee(), { sessions: n, createSession: a } = ut();
5718
+ const t = Ee(), { sessions: n, createSession: a } = mt();
5719
5719
  return async (s) => {
5720
5720
  var i;
5721
5721
  let o = ((i = n[0]) == null ? void 0 : i.id) || "";
@@ -6102,7 +6102,7 @@ function Mn(t) {
6102
6102
  });
6103
6103
  }
6104
6104
  function Fn() {
6105
- const { t } = X(), { sessionId: n } = dt(), a = Ee(), s = bt(), [o] = zt(), i = o.get("demo") === "1", [l, c] = w(""), [h, d] = w(""), [p, u] = w([]), [f, v] = w(""), [N, b] = w(!1), [C, S] = w("idle"), x = oe(null), y = oe(null), m = oe([]), {
6105
+ const { t } = X(), { sessionId: n } = ut(), a = Ee(), s = vt(), [o] = zt(), i = o.get("demo") === "1", [l, c] = w(""), [h, d] = w(""), [p, u] = w([]), [f, v] = w(""), [N, b] = w(!1), [C, S] = w("idle"), x = oe(null), y = oe(null), m = oe([]), {
6106
6106
  connectionStatus: D,
6107
6107
  connectionVersion: T,
6108
6108
  createSession: U,
@@ -6118,9 +6118,9 @@ function Fn() {
6118
6118
  isThinking: ee,
6119
6119
  getDemoStatus: se,
6120
6120
  getDemoTypingCue: P
6121
- } = ut(), V = oe(null), ne = oe(null), H = oe(null), ce = oe(null), [Se, E] = w(0), ie = oe(!1), Le = oe(null), Te = oe(0), Ke = oe(!0), Fe = oe(null), vt = oe(!1), mt = oe(null), Je = A(n), De = D === "connected", Ie = ee(n), je = se(n), Qe = P(n), Oe = i || je === "running", pt = _(n), it = z(n), ht = Je[Je.length - 1], B = ht ? `${ht.type}:${ht.timestamp || ""}:${ht.content}` : "empty", K = Pe(() => {
6122
- vt.current = !0, mt.current !== null && window.clearTimeout(mt.current), mt.current = window.setTimeout(() => {
6123
- vt.current = !1, mt.current = null;
6121
+ } = mt(), V = oe(null), ne = oe(null), H = oe(null), ce = oe(null), [Se, E] = w(0), ie = oe(!1), Le = oe(null), Te = oe(0), Ke = oe(!0), Fe = oe(null), xt = oe(!1), pt = oe(null), Je = A(n), De = D === "connected", Ie = ee(n), je = se(n), Qe = P(n), Oe = i || je === "running", ht = _(n), it = z(n), gt = Je[Je.length - 1], B = gt ? `${gt.type}:${gt.timestamp || ""}:${gt.content}` : "empty", K = Pe(() => {
6122
+ xt.current = !0, pt.current !== null && window.clearTimeout(pt.current), pt.current = window.setTimeout(() => {
6123
+ xt.current = !1, pt.current = null;
6124
6124
  }, 600);
6125
6125
  }, []), Y = Pe((k = "smooth") => {
6126
6126
  const F = V.current;
@@ -6145,9 +6145,9 @@ function Fn() {
6145
6145
  let F = 0;
6146
6146
  const ae = new ResizeObserver(() => {
6147
6147
  Fe.current === null && (!Ke.current && !Oe && !Ie || (cancelAnimationFrame(F), F = requestAnimationFrame(() => {
6148
- const fe = V.current;
6149
- if (!fe) return;
6150
- fe.scrollHeight - fe.scrollTop - fe.clientHeight <= 120 && (K(), fe.scrollTo({ top: fe.scrollHeight, behavior: "auto" }));
6148
+ const ge = V.current;
6149
+ if (!ge) return;
6150
+ ge.scrollHeight - ge.scrollTop - ge.clientHeight <= 120 && (K(), ge.scrollTo({ top: ge.scrollHeight, behavior: "auto" }));
6151
6151
  })));
6152
6152
  }), he = k.firstElementChild;
6153
6153
  return he && ae.observe(he), ae.observe(k), () => {
@@ -6160,12 +6160,12 @@ function Fn() {
6160
6160
  return F.observe(k), () => F.disconnect();
6161
6161
  }, []);
6162
6162
  const xe = Pe(() => {
6163
- if (!n || it || !pt) return;
6163
+ if (!n || it || !ht) return;
6164
6164
  const k = V.current;
6165
6165
  Fe.current = k ? k.scrollHeight : null, Ke.current = !1, W(n).catch(() => {
6166
6166
  Fe.current = null;
6167
6167
  });
6168
- }, [n, it, pt, W]), we = oe(null);
6168
+ }, [n, it, ht, W]), we = oe(null);
6169
6169
  re(() => {
6170
6170
  d(""), Le.current = null, Te.current += 1, n && oa(n);
6171
6171
  const k = s.state;
@@ -6196,7 +6196,7 @@ function Fn() {
6196
6196
  }, 50), ie.current = Ie;
6197
6197
  }, [Ie, De]);
6198
6198
  function ot(k) {
6199
- if (vt.current) return;
6199
+ if (xt.current) return;
6200
6200
  const F = k.currentTarget, ae = F.scrollHeight - F.scrollTop - F.clientHeight;
6201
6201
  Ke.current = ae < 80;
6202
6202
  }
@@ -6215,16 +6215,16 @@ function Fn() {
6215
6215
  re(() => {
6216
6216
  if (!Qe || !n || Ze.current === Qe.seq) return;
6217
6217
  Ze.current = Qe.seq;
6218
- const k = n, F = Qe.content, ae = F.length > 0 ? Math.max(8, Qe.typingMs / F.length) : 0, he = Qe.seq, fe = ++Te.current;
6219
- async function ft() {
6218
+ const k = n, F = Qe.content, ae = F.length > 0 ? Math.max(8, Qe.typingMs / F.length) : 0, he = Qe.seq, ge = ++Te.current;
6219
+ async function yt() {
6220
6220
  c("");
6221
6221
  for (const et of F) {
6222
- if (fe !== Te.current) return;
6222
+ if (ge !== Te.current) return;
6223
6223
  c((Ge) => Ge + et), await Qs(ae);
6224
6224
  }
6225
- fe === Te.current && j.current(k, he);
6225
+ ge === Te.current && j.current(k, he);
6226
6226
  }
6227
- ft();
6227
+ yt();
6228
6228
  }, [Qe, n]), re(() => {
6229
6229
  je === "complete" && (Te.current += 1, c(""));
6230
6230
  }, [je]);
@@ -6234,30 +6234,30 @@ function Fn() {
6234
6234
  const F = Array.from(k);
6235
6235
  u((ae) => {
6236
6236
  const he = [...ae];
6237
- for (const fe of F) {
6237
+ for (const ge of F) {
6238
6238
  if (he.length >= Yt) {
6239
6239
  v(`Maximum ${Yt} attachments per message.`);
6240
6240
  break;
6241
6241
  }
6242
- const ft = fe.name.includes(".") ? fe.name.split(".").pop().toLowerCase() : "";
6243
- if (!Ws.has(fe.type) && !Hs.has(ft)) {
6244
- v(`Unsupported file type: ${fe.type || fe.name}`);
6242
+ const yt = ge.name.includes(".") ? ge.name.split(".").pop().toLowerCase() : "";
6243
+ if (!Ws.has(ge.type) && !Hs.has(yt)) {
6244
+ v(`Unsupported file type: ${ge.type || ge.name}`);
6245
6245
  continue;
6246
6246
  }
6247
- if (fe.size > Gs) {
6248
- v(`"${fe.name}" is too large (max 10 MB).`);
6247
+ if (ge.size > Gs) {
6248
+ v(`"${ge.name}" is too large (max 10 MB).`);
6249
6249
  continue;
6250
6250
  }
6251
- const et = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, Ge = fe.type.startsWith("image/") ? URL.createObjectURL(fe) : void 0, Ut = { localId: et, file: fe, previewUrl: Ge, uploading: !0 };
6252
- he.push(Ut), I.uploadChatAttachment(n, fe).then((Nt) => {
6251
+ const et = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, Ge = ge.type.startsWith("image/") ? URL.createObjectURL(ge) : void 0, Ut = { localId: et, file: ge, previewUrl: Ge, uploading: !0 };
6252
+ he.push(Ut), I.uploadChatAttachment(n, ge).then((lt) => {
6253
6253
  u(
6254
6254
  (At) => At.map(
6255
- (wt) => wt.localId === et ? { ...wt, uploading: !1, uploadedId: Nt.id } : wt
6255
+ (wt) => wt.localId === et ? { ...wt, uploading: !1, uploadedId: lt.id } : wt
6256
6256
  )
6257
- );
6258
- }).catch((Nt) => {
6259
- const At = (Nt == null ? void 0 : Nt.message) || "Upload failed";
6260
- v(`"${fe.name}": ${At}`), u(
6257
+ ), lt.warning && v(`"${ge.name}": ${lt.warning}`);
6258
+ }).catch((lt) => {
6259
+ const At = (lt == null ? void 0 : lt.message) || "Upload failed";
6260
+ v(`"${ge.name}": ${At}`), u(
6261
6261
  (wt) => wt.map(
6262
6262
  (Vt) => Vt.localId === et ? { ...Vt, uploading: !1, error: At } : Vt
6263
6263
  )
@@ -6286,17 +6286,17 @@ function Fn() {
6286
6286
  he && F.push(he);
6287
6287
  }
6288
6288
  F.length > 0 && (k.preventDefault(), ye(F));
6289
- }, ke = p.some((k) => k.uploading), pe = p.some((k) => k.error), ge = p.filter((k) => k.uploadedId && !k.error).map((k) => k.uploadedId);
6290
- function gt() {
6289
+ }, ke = p.some((k) => k.uploading), pe = p.some((k) => k.error), fe = p.filter((k) => k.uploadedId && !k.error).map((k) => k.uploadedId);
6290
+ function ft() {
6291
6291
  const k = l.trim();
6292
- if (n && !(!k && ge.length === 0) && !ke && $(n, k, ge.length > 0 ? ge : void 0)) {
6292
+ if (n && !(!k && fe.length === 0) && !ke && $(n, k, fe.length > 0 ? fe : void 0)) {
6293
6293
  for (const F of p)
6294
6294
  F.previewUrl && URL.revokeObjectURL(F.previewUrl);
6295
6295
  u([]), v(""), c("");
6296
6296
  }
6297
6297
  }
6298
- function xt(k) {
6299
- k.key === "Enter" && !k.shiftKey && (k.preventDefault(), gt());
6298
+ function Nt(k) {
6299
+ k.key === "Enter" && !k.shiftKey && (k.preventDefault(), ft());
6300
6300
  }
6301
6301
  function Xe(k) {
6302
6302
  const F = k.trim();
@@ -6326,10 +6326,10 @@ function Fn() {
6326
6326
  S("idle");
6327
6327
  return;
6328
6328
  }
6329
- const he = F.mimeType || ((et = ae[0]) == null ? void 0 : et.type) || "audio/webm", fe = new Blob(ae, { type: he }), ft = (he.split(";")[0].split("/")[1] || "webm").toLowerCase();
6329
+ const he = F.mimeType || ((et = ae[0]) == null ? void 0 : et.type) || "audio/webm", ge = new Blob(ae, { type: he }), yt = (he.split(";")[0].split("/")[1] || "webm").toLowerCase();
6330
6330
  S("transcribing");
6331
6331
  try {
6332
- const Ge = await Ys(fe), Ut = await de(Ge, ft, n);
6332
+ const Ge = await Ys(ge), Ut = await de(Ge, yt, n);
6333
6333
  Xe(Ut);
6334
6334
  } catch (Ge) {
6335
6335
  v(Ge instanceof Error ? Ge.message : t("chat.transcribeFailed"));
@@ -6366,11 +6366,11 @@ function Fn() {
6366
6366
  className: "mx-auto max-w-3xl space-y-4",
6367
6367
  style: { paddingBottom: (Se || 96) + 16 },
6368
6368
  children: [
6369
- (pt || it) && Je.length > 0 && /* @__PURE__ */ e("div", { className: "flex justify-center", children: /* @__PURE__ */ e(
6369
+ (ht || it) && Je.length > 0 && /* @__PURE__ */ e("div", { className: "flex justify-center", children: /* @__PURE__ */ e(
6370
6370
  "button",
6371
6371
  {
6372
6372
  onClick: xe,
6373
- disabled: it || !pt,
6373
+ disabled: it || !ht,
6374
6374
  className: "rounded-full bg-surface px-3 py-1 text-xs text-fg-muted ring-1 ring-line transition-colors hover:bg-surface-subtle hover:text-fg disabled:cursor-not-allowed disabled:opacity-60",
6375
6375
  children: t(it ? "common.loading" : "chat.loadOlder")
6376
6376
  }
@@ -6454,7 +6454,7 @@ function Fn() {
6454
6454
  ref: H,
6455
6455
  value: l,
6456
6456
  onChange: (k) => c(k.target.value),
6457
- onKeyDown: xt,
6457
+ onKeyDown: Nt,
6458
6458
  onPaste: Me,
6459
6459
  placeholder: t(Oe ? "chat.placeholderDemo" : De ? "chat.placeholderType" : "chat.placeholderConnecting"),
6460
6460
  disabled: !De || !n || Ie || Oe,
@@ -6498,8 +6498,8 @@ function Fn() {
6498
6498
  /* @__PURE__ */ e(
6499
6499
  "button",
6500
6500
  {
6501
- onClick: gt,
6502
- disabled: !l.trim() && ge.length === 0 || !De || !n || Ie || Oe || ke || pe,
6501
+ onClick: ft,
6502
+ disabled: !l.trim() && fe.length === 0 || !De || !n || Ie || Oe || ke || pe,
6503
6503
  className: "flex h-11 w-11 shrink-0 items-center justify-center rounded-lg text-brand transition-all hover:bg-brand/10 active:translate-y-px disabled:cursor-not-allowed disabled:text-fg-muted disabled:active:translate-y-0 md:h-10 md:w-10",
6504
6504
  children: /* @__PURE__ */ e(
6505
6505
  "svg",
@@ -8165,7 +8165,7 @@ function Bo() {
8165
8165
  ];
8166
8166
  }
8167
8167
  function Eo({ slug: t, parentSlug: n, linkField: a }) {
8168
- const { name: s = "" } = dt(), o = Ee();
8168
+ const { name: s = "" } = ut(), o = Ee();
8169
8169
  return re(() => {
8170
8170
  let i = !0;
8171
8171
  return I.getDocument(t, s).then((l) => {