@nivaro/react 0.3.57 → 0.3.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/shared/components/CollectionBrowserView.js +2633 -2590
- package/dist/shared/components/DataTable.js +247 -236
- package/dist/shared/components/ItemEditForm.js +1693 -1668
- package/dist/shared/components/ProfileView.js +716 -715
- package/dist/shared/components/RecordReadView.js +367 -364
- package/dist/shared/components/ReportView.js +64 -39
- package/dist/shared/components/alerts/AlertManagerView.js +284 -271
- package/dist/shared/components/cbv/row-focus.js +19 -0
- package/dist/shared/components/help-videos/HelpVideoPlayer.js +152 -147
- package/dist/shared/components/integrations/console/SignalCard.js +59 -59
- package/dist/shared/components/integrations/console/tone.js +52 -30
- package/dist/shared/components/item-edit/CatalogPickerField.js +525 -505
- package/dist/shared/components/item-edit/FieldRow.js +175 -173
- package/dist/shared/components/item-edit/InlineTableField.js +407 -402
- package/dist/shared/components/item-edit/M2MCombobox.js +313 -291
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +1 -1
- package/dist/shared/components/item-edit/PlanGrid.js +826 -803
- package/dist/shared/components/item-edit/QuickCreateButton.js +115 -79
- package/dist/shared/components/item-edit/RecordLiveSync.js +77 -75
- package/dist/shared/components/item-edit/RelationCombobox.js +412 -328
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +147 -125
- package/dist/shared/components/item-edit/SummaryPanel.js +406 -392
- package/dist/shared/components/item-edit/option-disambiguate.js +44 -32
- package/dist/shared/components/item-edit/related-missing.js +45 -0
- package/dist/shared/components/item-edit/save-outcome.js +5 -5
- package/dist/shared/components/notifications/NotificationRulesEditor.js +130 -123
- package/dist/shared/components/panels/AccessDeniedPanel.js +52 -48
- package/dist/shared/components/panels/ItemLockBanner.js +2 -3
- package/dist/shared/components/panels/PipelinePanel.js +1027 -978
- package/dist/shared/components/panels/RevisionsPanel.js +4 -1
- package/dist/shared/components/panels/TaskPanel.js +265 -249
- package/dist/shared/components/panels/landing-state.js +27 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +86 -78
- package/dist/shared/components/profile/AiMemoryCard.js +12 -10
- package/dist/shared/components/queue/OwnerAvatars.js +80 -41
- package/dist/shared/components/queue/QueueQuickFilters.js +48 -48
- package/dist/shared/components/queue/QueueWorklist.js +357 -358
- package/dist/shared/components/queue/group-sums.js +27 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +186 -168
- package/dist/shared/lib/back-closes.js +25 -0
- package/dist/shared/lib/form-usage-beacon.js +7 -7
- package/dist/shared/lib/list-page-memory.js +41 -0
- package/dist/shared/lib/live.js +44 -44
- package/dist/shared/lib/own-writes.js +76 -28
- package/dist/shared/lib/request-gate.js +110 -109
- package/dist/shared/lib/validation-rules.js +34 -19
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const s = (i) => String(i ?? "").toUpperCase();
|
|
2
|
+
function k(i, u, p) {
|
|
3
|
+
const n = new Map(u.map((t) => [s(t.id), t])).get(s(i));
|
|
4
|
+
if (!n) return null;
|
|
5
|
+
if (!p) return { state: n, skipped: [] };
|
|
6
|
+
const a = (t) => {
|
|
7
|
+
for (const [e, o] of Object.entries(p)) if (s(e) === s(t)) return o;
|
|
8
|
+
}, b = [...u].filter((t) => t.sort != null && Number.isFinite(Number(t.sort))).sort((t, e) => Number(t.sort) - Number(e.sort)), d = [];
|
|
9
|
+
let r = n;
|
|
10
|
+
for (let t = 0; t < u.length; t++) {
|
|
11
|
+
const e = a(r.id);
|
|
12
|
+
if (!(e != null && e.skipped)) break;
|
|
13
|
+
d.push({ state: r, reasons: (e.skip_reasons ?? []).filter(Boolean) });
|
|
14
|
+
const o = b.find(
|
|
15
|
+
(f) => {
|
|
16
|
+
var l;
|
|
17
|
+
return Number(f.sort) > Number(r.sort) && ((l = a(f.id)) == null ? void 0 : l.on_path) !== !1;
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
if (!o) return { state: n, skipped: [] };
|
|
21
|
+
r = o;
|
|
22
|
+
}
|
|
23
|
+
return { state: r, skipped: d };
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
k as landingState
|
|
27
|
+
};
|
|
@@ -750,8 +750,8 @@ function rs({
|
|
|
750
750
|
placeholder: "Field…",
|
|
751
751
|
onChange: (i) => {
|
|
752
752
|
const _ = i.path.join(".");
|
|
753
|
-
r((
|
|
754
|
-
...
|
|
753
|
+
r((E) => ({
|
|
754
|
+
...E,
|
|
755
755
|
[_]: {
|
|
756
756
|
type: i.fieldType,
|
|
757
757
|
relatedCollection: i.relatedCollection
|
|
@@ -2012,9 +2012,9 @@ function bs({
|
|
|
2012
2012
|
required: i.required
|
|
2013
2013
|
});
|
|
2014
2014
|
}, O = (i) => {
|
|
2015
|
-
const { active: _, over:
|
|
2016
|
-
if (!
|
|
2017
|
-
const
|
|
2015
|
+
const { active: _, over: E } = i;
|
|
2016
|
+
if (!E || _.id === E.id) return;
|
|
2017
|
+
const F = x.indexOf(_.id), B = x.indexOf(E.id), j = Ve(x, F, B);
|
|
2018
2018
|
o(j), j.forEach((K, W) => {
|
|
2019
2019
|
var te;
|
|
2020
2020
|
((te = l.find((ae) => ae.id === K)) == null ? void 0 : te.sort) !== W && S.mutate({ dimId: K, body: { sort: W } });
|
|
@@ -2039,11 +2039,11 @@ function bs({
|
|
|
2039
2039
|
relations: (b == null ? void 0 : b.relations) ?? [],
|
|
2040
2040
|
value: d.field,
|
|
2041
2041
|
onChange: (_) => {
|
|
2042
|
-
const
|
|
2043
|
-
N((
|
|
2044
|
-
...
|
|
2045
|
-
field:
|
|
2046
|
-
label:
|
|
2042
|
+
const E = _.path.join(".");
|
|
2043
|
+
N((F) => ({
|
|
2044
|
+
...F,
|
|
2045
|
+
field: E,
|
|
2046
|
+
label: F.label || _.pathLabels.join(" → ")
|
|
2047
2047
|
}));
|
|
2048
2048
|
},
|
|
2049
2049
|
onClear: () => N((_) => ({ ..._, field: "" }))
|
|
@@ -2056,7 +2056,7 @@ function bs({
|
|
|
2056
2056
|
U,
|
|
2057
2057
|
{
|
|
2058
2058
|
value: d.label,
|
|
2059
|
-
onChange: (_) => N((
|
|
2059
|
+
onChange: (_) => N((E) => ({ ...E, label: _.target.value })),
|
|
2060
2060
|
placeholder: "e.g. Region",
|
|
2061
2061
|
className: "h-8 text-[13px]"
|
|
2062
2062
|
}
|
|
@@ -2068,7 +2068,7 @@ function bs({
|
|
|
2068
2068
|
{
|
|
2069
2069
|
type: "checkbox",
|
|
2070
2070
|
checked: d.is_row_axis,
|
|
2071
|
-
onChange: (_) => N((
|
|
2071
|
+
onChange: (_) => N((E) => ({ ...E, is_row_axis: _.target.checked })),
|
|
2072
2072
|
className: "rounded"
|
|
2073
2073
|
}
|
|
2074
2074
|
),
|
|
@@ -2080,7 +2080,7 @@ function bs({
|
|
|
2080
2080
|
{
|
|
2081
2081
|
type: "checkbox",
|
|
2082
2082
|
checked: d.required,
|
|
2083
|
-
onChange: (_) => N((
|
|
2083
|
+
onChange: (_) => N((E) => ({ ...E, required: _.target.checked })),
|
|
2084
2084
|
className: "rounded"
|
|
2085
2085
|
}
|
|
2086
2086
|
),
|
|
@@ -2144,10 +2144,10 @@ function bs({
|
|
|
2144
2144
|
value: m.field,
|
|
2145
2145
|
onChange: (i) => {
|
|
2146
2146
|
const _ = i.path.join(".");
|
|
2147
|
-
f((
|
|
2148
|
-
...
|
|
2147
|
+
f((E) => ({
|
|
2148
|
+
...E,
|
|
2149
2149
|
field: _,
|
|
2150
|
-
label:
|
|
2150
|
+
label: E.label || i.pathLabels.join(" → ")
|
|
2151
2151
|
}));
|
|
2152
2152
|
},
|
|
2153
2153
|
onClear: () => f((i) => ({ ...i, field: "" }))
|
|
@@ -2217,7 +2217,7 @@ function wn({
|
|
|
2217
2217
|
var qt;
|
|
2218
2218
|
const l = Z(), x = ke(), o = new Set(g ?? []), [r, h] = $(!1), [v, u] = $(""), [d, N] = $(!1), [m, f] = $(null), [b, p] = $(!1), [w, k] = $(null), [S, A] = $(null), [L, O] = $(
|
|
2219
2219
|
null
|
|
2220
|
-
), [y, i] = $(""), [_,
|
|
2220
|
+
), [y, i] = $(""), [_, E] = $(""), [F, B] = $(null), [j, K] = $(!1), [W, te] = $([]), ae = Kt(
|
|
2221
2221
|
Ye(zt),
|
|
2222
2222
|
Ye(Bt, { coordinateGetter: Qt })
|
|
2223
2223
|
), { data: oe } = H({
|
|
@@ -2437,7 +2437,7 @@ function wn({
|
|
|
2437
2437
|
}), wt = M({
|
|
2438
2438
|
mutationFn: (s) => l.request(I(`/pipelines/${a}/bind`, s)),
|
|
2439
2439
|
onSuccess: () => {
|
|
2440
|
-
le(), i(""),
|
|
2440
|
+
le(), i(""), E(""), T.success("Collection bound");
|
|
2441
2441
|
},
|
|
2442
2442
|
onError: () => T.error("Failed to bind collection")
|
|
2443
2443
|
}), sa = M({
|
|
@@ -2686,15 +2686,15 @@ function wn({
|
|
|
2686
2686
|
{
|
|
2687
2687
|
s,
|
|
2688
2688
|
groups: (Ze == null ? void 0 : Ze[s.id]) ?? [],
|
|
2689
|
-
expandedStateId:
|
|
2690
|
-
onToggleExpand: () => B(
|
|
2689
|
+
expandedStateId: F,
|
|
2690
|
+
onToggleExpand: () => B(F === s.id ? null : s.id),
|
|
2691
2691
|
onEdit: () => f(s),
|
|
2692
2692
|
onDelete: () => {
|
|
2693
2693
|
confirm(`Delete state "${s.label}"?`) && ea.mutate(s.id);
|
|
2694
2694
|
}
|
|
2695
2695
|
}
|
|
2696
2696
|
),
|
|
2697
|
-
|
|
2697
|
+
F === s.id && (m == null ? void 0 : m.id) !== s.id && /* @__PURE__ */ t("div", { className: "ml-4 mb-2 mt-2 rounded-xl border border-slate-200 bg-slate-50 p-4 space-y-4", children: [
|
|
2698
2698
|
/* @__PURE__ */ e(
|
|
2699
2699
|
Ha,
|
|
2700
2700
|
{
|
|
@@ -3249,7 +3249,7 @@ function wn({
|
|
|
3249
3249
|
pe,
|
|
3250
3250
|
{
|
|
3251
3251
|
value: _,
|
|
3252
|
-
onChange:
|
|
3252
|
+
onChange: E,
|
|
3253
3253
|
options: (oe ?? []).map((s) => ({
|
|
3254
3254
|
value: s.field,
|
|
3255
3255
|
label: s.field
|
|
@@ -4392,7 +4392,7 @@ function Es({
|
|
|
4392
4392
|
A.set(i, [...A.get(i) ?? [], y]);
|
|
4393
4393
|
}
|
|
4394
4394
|
const L = [...A.entries()].sort(
|
|
4395
|
-
(y, i) => i[1].reduce((_,
|
|
4395
|
+
(y, i) => i[1].reduce((_, E) => _ + E.count, 0) - y[1].reduce((_, E) => _ + E.count, 0)
|
|
4396
4396
|
), O = (y, i) => /* @__PURE__ */ t(
|
|
4397
4397
|
"span",
|
|
4398
4398
|
{
|
|
@@ -4432,13 +4432,21 @@ function Es({
|
|
|
4432
4432
|
k > 0 && /* @__PURE__ */ t("span", { className: "flex items-center gap-1.5 text-slate-700 dark:text-foreground", children: [
|
|
4433
4433
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-500" }),
|
|
4434
4434
|
/* @__PURE__ */ e("span", { className: "font-semibold tabular-nums", children: k }),
|
|
4435
|
-
"
|
|
4435
|
+
" record",
|
|
4436
4436
|
k === 1 ? "" : "s",
|
|
4437
|
-
" across",
|
|
4437
|
+
" with no owner group across",
|
|
4438
4438
|
" ",
|
|
4439
4439
|
/* @__PURE__ */ e("span", { className: "font-semibold tabular-nums", children: b.length }),
|
|
4440
4440
|
" combination",
|
|
4441
|
-
b.length === 1 ? "" : "s"
|
|
4441
|
+
b.length === 1 ? "" : "s",
|
|
4442
|
+
/* @__PURE__ */ e(
|
|
4443
|
+
"span",
|
|
4444
|
+
{
|
|
4445
|
+
className: "ml-1 text-[11px] font-normal text-slate-500 dark:text-muted-foreground",
|
|
4446
|
+
"data-tip": "Queues may still list an owner for these: when no group covers a step, the record’s creator stands in as a fallback owner.",
|
|
4447
|
+
children: "(the creator may still stand in)"
|
|
4448
|
+
}
|
|
4449
|
+
)
|
|
4442
4450
|
] }),
|
|
4443
4451
|
((p == null ? void 0 : p.group_seats) ?? 0) > 0 && /* @__PURE__ */ t("span", { className: "flex items-center gap-1.5 text-slate-700 dark:text-foreground", children: [
|
|
4444
4452
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 rounded-full bg-violet-500" }),
|
|
@@ -4539,7 +4547,7 @@ function Es({
|
|
|
4539
4547
|
] })
|
|
4540
4548
|
] }),
|
|
4541
4549
|
L.map(([y, i]) => {
|
|
4542
|
-
const _ = S.get(y),
|
|
4550
|
+
const _ = S.get(y), E = i.reduce((F, B) => F + B.count, 0);
|
|
4543
4551
|
return /* @__PURE__ */ t(
|
|
4544
4552
|
"div",
|
|
4545
4553
|
{
|
|
@@ -4555,9 +4563,9 @@ function Es({
|
|
|
4555
4563
|
),
|
|
4556
4564
|
/* @__PURE__ */ e("span", { className: "text-[12px] font-semibold text-slate-700 dark:text-foreground", children: (_ == null ? void 0 : _.label) ?? Jt(y) }),
|
|
4557
4565
|
/* @__PURE__ */ t("span", { className: "ml-auto text-[11px] tabular-nums text-slate-400", children: [
|
|
4558
|
-
|
|
4566
|
+
E,
|
|
4559
4567
|
" record",
|
|
4560
|
-
|
|
4568
|
+
E === 1 ? "" : "s",
|
|
4561
4569
|
" · ",
|
|
4562
4570
|
i.length,
|
|
4563
4571
|
" ",
|
|
@@ -4565,22 +4573,22 @@ function Es({
|
|
|
4565
4573
|
i.length === 1 ? "" : "s"
|
|
4566
4574
|
] })
|
|
4567
4575
|
] }),
|
|
4568
|
-
/* @__PURE__ */ e("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: i.map((
|
|
4569
|
-
const j = `${
|
|
4576
|
+
/* @__PURE__ */ e("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: i.map((F, B) => {
|
|
4577
|
+
const j = `${F.state_id}|${JSON.stringify(F.dims)}`;
|
|
4570
4578
|
return (
|
|
4571
4579
|
// biome-ignore lint/suspicious/noArrayIndexKey: server-ordered clusters
|
|
4572
4580
|
/* @__PURE__ */ t("div", { className: "px-3 py-2", children: [
|
|
4573
4581
|
/* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
4574
|
-
/* @__PURE__ */ e("span", { className: "w-8 shrink-0 text-[13px] font-semibold tabular-nums text-slate-800 dark:text-foreground", children:
|
|
4575
|
-
Object.entries(
|
|
4582
|
+
/* @__PURE__ */ e("span", { className: "w-8 shrink-0 text-[13px] font-semibold tabular-nums text-slate-800 dark:text-foreground", children: F.count }),
|
|
4583
|
+
Object.entries(F.dims).filter(([, K]) => K).length > 0 ? Object.entries(F.dims).filter(([, K]) => K).map(([K, W]) => O(K, W)) : /* @__PURE__ */ e("span", { className: "text-[11px] italic text-slate-400", children: "no dimension values resolved" }),
|
|
4576
4584
|
/* @__PURE__ */ t(
|
|
4577
4585
|
"span",
|
|
4578
4586
|
{
|
|
4579
|
-
className: "ml-auto max-w-[
|
|
4580
|
-
"data-tip":
|
|
4587
|
+
className: "ml-auto max-w-[220px] truncate text-[10.5px] text-slate-400",
|
|
4588
|
+
"data-tip": (F.sample_labels ?? F.sample_items).join(", "),
|
|
4581
4589
|
children: [
|
|
4582
4590
|
"e.g. ",
|
|
4583
|
-
|
|
4591
|
+
(F.sample_labels ?? F.sample_items).slice(0, 3).join(", ")
|
|
4584
4592
|
]
|
|
4585
4593
|
}
|
|
4586
4594
|
),
|
|
@@ -4597,24 +4605,24 @@ function Es({
|
|
|
4597
4605
|
}
|
|
4598
4606
|
)
|
|
4599
4607
|
] }),
|
|
4600
|
-
|
|
4601
|
-
/* @__PURE__ */ e("p", { className: "mt-1 pl-8 text-[11.5px] leading-relaxed", children:
|
|
4608
|
+
F.reason && /* @__PURE__ */ e("p", { className: "mt-1 pl-8 text-[11.5px] leading-relaxed text-slate-600 dark:text-slate-300", children: F.reason }),
|
|
4609
|
+
/* @__PURE__ */ e("p", { className: "mt-1 pl-8 text-[11.5px] leading-relaxed", children: F.suggestion ? /* @__PURE__ */ t(_e, { children: [
|
|
4602
4610
|
/* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-muted-foreground", children: [
|
|
4603
4611
|
"Closest group",
|
|
4604
4612
|
" "
|
|
4605
4613
|
] }),
|
|
4606
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children:
|
|
4614
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children: F.suggestion.group_label }),
|
|
4607
4615
|
/* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-muted-foreground", children: [
|
|
4608
4616
|
" ",
|
|
4609
4617
|
"already matches",
|
|
4610
4618
|
" ",
|
|
4611
|
-
Mt(
|
|
4619
|
+
Mt(F.suggestion.matched_filters.join(", ")) || "nothing"
|
|
4612
4620
|
] }),
|
|
4613
|
-
|
|
4621
|
+
F.suggestion.mismatched_filters.length > 0 && /* @__PURE__ */ t("span", { className: "text-amber-700 dark:text-amber-400", children: [
|
|
4614
4622
|
" ",
|
|
4615
4623
|
"— it misses",
|
|
4616
4624
|
" ",
|
|
4617
|
-
Mt(
|
|
4625
|
+
Mt(F.suggestion.mismatched_filters.join(", ")),
|
|
4618
4626
|
", so assigning creates a group for this combination"
|
|
4619
4627
|
] })
|
|
4620
4628
|
] }) : /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1 text-amber-700 dark:text-amber-400", children: [
|
|
@@ -4625,7 +4633,7 @@ function Es({
|
|
|
4625
4633
|
$s,
|
|
4626
4634
|
{
|
|
4627
4635
|
templateId: a,
|
|
4628
|
-
cluster:
|
|
4636
|
+
cluster: F,
|
|
4629
4637
|
onDone: () => v(null)
|
|
4630
4638
|
}
|
|
4631
4639
|
)
|
|
@@ -4803,19 +4811,19 @@ function Rs({ templateId: a }) {
|
|
|
4803
4811
|
staleTime: 3e4
|
|
4804
4812
|
}), h = (r == null ? void 0 : r.states) ?? [], v = (r == null ? void 0 : r.transitions) ?? [], u = wa(() => {
|
|
4805
4813
|
var Me;
|
|
4806
|
-
const i = new Map(h.map((Q) => [String(Q.id).toUpperCase(), Q])), _ = /* @__PURE__ */ new Map(),
|
|
4814
|
+
const i = new Map(h.map((Q) => [String(Q.id).toUpperCase(), Q])), _ = /* @__PURE__ */ new Map(), E = h.filter((Q) => Q.is_initial).map((Q) => ({ id: String(Q.id).toUpperCase(), r: 0 })), F = /* @__PURE__ */ new Map();
|
|
4807
4815
|
for (const Q of v) {
|
|
4808
4816
|
if (!Q.from_state) continue;
|
|
4809
4817
|
const X = String(Q.from_state).toUpperCase();
|
|
4810
|
-
|
|
4818
|
+
F.set(X, [...F.get(X) ?? [], String(Q.to_state).toUpperCase()]);
|
|
4811
4819
|
}
|
|
4812
|
-
for (;
|
|
4813
|
-
const { id: Q, r: X } =
|
|
4820
|
+
for (; E.length > 0; ) {
|
|
4821
|
+
const { id: Q, r: X } = E.shift();
|
|
4814
4822
|
if (!(_.has(Q) && _.get(Q) <= X)) {
|
|
4815
4823
|
_.has(Q) || _.set(Q, X);
|
|
4816
|
-
for (const de of
|
|
4824
|
+
for (const de of F.get(Q) ?? []) {
|
|
4817
4825
|
const me = i.get(de);
|
|
4818
|
-
!_.has(de) && (((Me = i.get(Q)) == null ? void 0 : Me.sort) ?? 0) <= ((me == null ? void 0 : me.sort) ?? 0) &&
|
|
4826
|
+
!_.has(de) && (((Me = i.get(Q)) == null ? void 0 : Me.sort) ?? 0) <= ((me == null ? void 0 : me.sort) ?? 0) && E.push({ id: de, r: X + 1 });
|
|
4819
4827
|
}
|
|
4820
4828
|
}
|
|
4821
4829
|
}
|
|
@@ -4857,17 +4865,17 @@ function Rs({ templateId: a }) {
|
|
|
4857
4865
|
m(i);
|
|
4858
4866
|
return;
|
|
4859
4867
|
}
|
|
4860
|
-
const
|
|
4861
|
-
o.current = { id: i, startX: _.clientX, startY: _.clientY, origX:
|
|
4868
|
+
const E = d(i);
|
|
4869
|
+
o.current = { id: i, startX: _.clientX, startY: _.clientY, origX: E.x, origY: E.y }, _.target.setPointerCapture(_.pointerId);
|
|
4862
4870
|
}, S = (i) => {
|
|
4863
4871
|
if (N) {
|
|
4864
|
-
const
|
|
4865
|
-
b({ x: i.clientX -
|
|
4872
|
+
const E = i.currentTarget.getBoundingClientRect();
|
|
4873
|
+
b({ x: i.clientX - E.left, y: i.clientY - E.top });
|
|
4866
4874
|
return;
|
|
4867
4875
|
}
|
|
4868
4876
|
const _ = o.current;
|
|
4869
|
-
_ && x((
|
|
4870
|
-
...
|
|
4877
|
+
_ && x((E) => ({
|
|
4878
|
+
...E,
|
|
4871
4879
|
[_.id]: {
|
|
4872
4880
|
x: Math.max(0, _.origX + i.clientX - _.startX),
|
|
4873
4881
|
y: Math.max(0, _.origY + i.clientY - _.startY)
|
|
@@ -4877,8 +4885,8 @@ function Rs({ templateId: a }) {
|
|
|
4877
4885
|
if (N) {
|
|
4878
4886
|
if (f) {
|
|
4879
4887
|
const i = h.find((_) => {
|
|
4880
|
-
const
|
|
4881
|
-
return f.x >=
|
|
4888
|
+
const E = String(_.id).toUpperCase(), F = d(E);
|
|
4889
|
+
return f.x >= F.x && f.x <= F.x + u.NODE_W && f.y >= F.y && f.y <= F.y + u.NODE_H && E !== N;
|
|
4882
4890
|
});
|
|
4883
4891
|
i && w.mutate({ from: N, to: String(i.id) });
|
|
4884
4892
|
}
|
|
@@ -4887,11 +4895,11 @@ function Rs({ templateId: a }) {
|
|
|
4887
4895
|
}
|
|
4888
4896
|
o.current && (o.current = null, x((i) => (localStorage.setItem(`nvr_canvas_${a}`, JSON.stringify(i)), i)));
|
|
4889
4897
|
}, L = (c == null ? void 0 : c.kind) === "state" ? h.find((i) => String(i.id) === c.id) : null, O = (c == null ? void 0 : c.kind) === "transition" ? v.find((i) => String(i.id) === c.id) : null, y = (i) => {
|
|
4890
|
-
const
|
|
4898
|
+
const E = Array.from(document.querySelectorAll("h3, p, span, button")).find((F) => {
|
|
4891
4899
|
var B;
|
|
4892
|
-
return ((B =
|
|
4900
|
+
return ((B = F.textContent) == null ? void 0 : B.trim()) === i;
|
|
4893
4901
|
});
|
|
4894
|
-
|
|
4902
|
+
E == null || E.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
4895
4903
|
};
|
|
4896
4904
|
return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white p-4 dark:border-border dark:bg-card", children: [
|
|
4897
4905
|
/* @__PURE__ */ e("h3", { className: "text-[14px] font-semibold text-slate-800 dark:text-foreground", children: "Canvas" }),
|
|
@@ -4920,7 +4928,7 @@ function Rs({ templateId: a }) {
|
|
|
4920
4928
|
) }),
|
|
4921
4929
|
v.map((i) => {
|
|
4922
4930
|
if (!i.from_state) return null;
|
|
4923
|
-
const _ = d(String(i.from_state).toUpperCase()),
|
|
4931
|
+
const _ = d(String(i.from_state).toUpperCase()), E = d(String(i.to_state).toUpperCase()), F = _.x + u.NODE_W, B = _.y + u.NODE_H / 2, j = E.x, K = E.y + u.NODE_H / 2, W = j < F, te = W ? Math.max(F, j + u.NODE_W) + 40 : (F + j) / 2, ae = W ? `M ${F} ${B} C ${F + 60} ${B - 40}, ${j - 60} ${K - 40}, ${j} ${K}` : `M ${F} ${B} C ${te} ${B}, ${te} ${K}, ${j} ${K}`, oe = (c == null ? void 0 : c.kind) === "transition" && c.id === String(i.id), ce = Array.isArray(i.condition_rules) ? i.condition_rules.length > 0 : !!i.condition_rules;
|
|
4924
4932
|
return (
|
|
4925
4933
|
// biome-ignore lint/a11y/useKeyWithClickEvents: canvas edge, inspect-only
|
|
4926
4934
|
/* @__PURE__ */ t(
|
|
@@ -4944,7 +4952,7 @@ function Rs({ templateId: a }) {
|
|
|
4944
4952
|
(i.auto_trigger || ce) && /* @__PURE__ */ t(
|
|
4945
4953
|
"text",
|
|
4946
4954
|
{
|
|
4947
|
-
x: (
|
|
4955
|
+
x: (F + j) / 2,
|
|
4948
4956
|
y: (B + K) / 2 - 6,
|
|
4949
4957
|
textAnchor: "middle",
|
|
4950
4958
|
className: "fill-slate-500 text-[11px]",
|
|
@@ -4973,13 +4981,13 @@ function Rs({ templateId: a }) {
|
|
|
4973
4981
|
}
|
|
4974
4982
|
),
|
|
4975
4983
|
h.map((i) => {
|
|
4976
|
-
const _ = String(i.id).toUpperCase(),
|
|
4984
|
+
const _ = String(i.id).toUpperCase(), E = d(_), F = (c == null ? void 0 : c.kind) === "state" && c.id === String(i.id);
|
|
4977
4985
|
return (
|
|
4978
4986
|
// biome-ignore lint/a11y/useKeyWithClickEvents: draggable canvas node
|
|
4979
4987
|
/* @__PURE__ */ t(
|
|
4980
4988
|
"g",
|
|
4981
4989
|
{
|
|
4982
|
-
transform: `translate(${
|
|
4990
|
+
transform: `translate(${E.x}, ${E.y})`,
|
|
4983
4991
|
onPointerDown: (B) => k(_, B),
|
|
4984
4992
|
onClick: () => g({ kind: "state", id: String(i.id) }),
|
|
4985
4993
|
className: "cursor-grab",
|
|
@@ -4990,8 +4998,8 @@ function Rs({ templateId: a }) {
|
|
|
4990
4998
|
width: u.NODE_W,
|
|
4991
4999
|
height: u.NODE_H,
|
|
4992
5000
|
rx: 8,
|
|
4993
|
-
strokeWidth:
|
|
4994
|
-
className:
|
|
5001
|
+
strokeWidth: F ? 2 : 1,
|
|
5002
|
+
className: F ? "fill-white stroke-nvr-cyan dark:fill-card" : "fill-white stroke-slate-300 dark:fill-card dark:stroke-slate-600"
|
|
4995
5003
|
}
|
|
4996
5004
|
),
|
|
4997
5005
|
/* @__PURE__ */ e("circle", { cx: 14, cy: u.NODE_H / 2, r: 4, fill: i.color ?? "#94a3b8" }),
|
|
@@ -5097,18 +5105,18 @@ function Ps({ templateId: a }) {
|
|
|
5097
5105
|
for (const y of h)
|
|
5098
5106
|
u.set(y.from, (u.get(y.from) ?? 0) + y.count), d.set(y.to, (d.get(y.to) ?? 0) + y.count);
|
|
5099
5107
|
const N = Math.max(360, r.length * 46), m = (y) => {
|
|
5100
|
-
const i = r.filter((j) => (y.get(j.id) ?? 0) > 0), _ = [...y.values()].reduce((j, K) => j + K, 0) || 1,
|
|
5101
|
-
let
|
|
5108
|
+
const i = r.filter((j) => (y.get(j.id) ?? 0) > 0), _ = [...y.values()].reduce((j, K) => j + K, 0) || 1, E = (i.length + 1) * 8;
|
|
5109
|
+
let F = 20;
|
|
5102
5110
|
const B = /* @__PURE__ */ new Map();
|
|
5103
5111
|
for (const j of i) {
|
|
5104
|
-
const K = Math.max(14, (y.get(j.id) ?? 0) / _ * (N -
|
|
5105
|
-
B.set(j.id, { y:
|
|
5112
|
+
const K = Math.max(14, (y.get(j.id) ?? 0) / _ * (N - E - 40));
|
|
5113
|
+
B.set(j.id, { y: F, h: K }), F += K + 8;
|
|
5106
5114
|
}
|
|
5107
|
-
return { pos: B, height:
|
|
5115
|
+
return { pos: B, height: F + 20 };
|
|
5108
5116
|
}, f = m(u), b = m(d), p = Math.max(f.height, b.height, 380), w = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map(), S = h.map((y) => {
|
|
5109
5117
|
const i = f.pos.get(y.from), _ = b.pos.get(y.to);
|
|
5110
5118
|
if (!i || !_) return null;
|
|
5111
|
-
const
|
|
5119
|
+
const E = y.count / Math.max(1, u.get(y.from) ?? 1), F = y.count / Math.max(1, d.get(y.to) ?? 1), B = Math.max(1.5, i.h * E), j = Math.max(1.5, _.h * F), K = i.y + (w.get(y.from) ?? 0), W = _.y + (k.get(y.to) ?? 0);
|
|
5112
5120
|
w.set(y.from, (w.get(y.from) ?? 0) + B), k.set(y.to, (k.get(y.to) ?? 0) + j);
|
|
5113
5121
|
const te = ge + 8, ae = Pe - ge - 8, oe = (te + ae) / 2, ce = `M ${te} ${K} C ${oe} ${K}, ${oe} ${W}, ${ae} ${W} L ${ae} ${W + j} C ${oe} ${W + j}, ${oe} ${K + B}, ${te} ${K + B} Z`;
|
|
5114
5122
|
return { f: y, path: ce };
|
|
@@ -5157,7 +5165,7 @@ function Ps({ templateId: a }) {
|
|
|
5157
5165
|
) : null
|
|
5158
5166
|
),
|
|
5159
5167
|
[...f.pos.entries()].map(([y, i]) => {
|
|
5160
|
-
var _,
|
|
5168
|
+
var _, E, F;
|
|
5161
5169
|
return /* @__PURE__ */ t("g", { children: [
|
|
5162
5170
|
/* @__PURE__ */ e(
|
|
5163
5171
|
"rect",
|
|
@@ -5179,7 +5187,7 @@ function Ps({ templateId: a }) {
|
|
|
5179
5187
|
width: 6,
|
|
5180
5188
|
height: i.h,
|
|
5181
5189
|
rx: 2,
|
|
5182
|
-
fill: ((
|
|
5190
|
+
fill: ((E = A.get(y)) == null ? void 0 : E.color) ?? "#94a3b8"
|
|
5183
5191
|
}
|
|
5184
5192
|
),
|
|
5185
5193
|
/* @__PURE__ */ e(
|
|
@@ -5189,13 +5197,13 @@ function Ps({ templateId: a }) {
|
|
|
5189
5197
|
y: i.y + i.h / 2 + 3,
|
|
5190
5198
|
textAnchor: "end",
|
|
5191
5199
|
className: "fill-slate-700 text-[10.5px] font-medium dark:fill-slate-200",
|
|
5192
|
-
children: (((
|
|
5200
|
+
children: (((F = A.get(y)) == null ? void 0 : F.label) ?? "").slice(0, 32)
|
|
5193
5201
|
}
|
|
5194
5202
|
)
|
|
5195
5203
|
] }, `L-${y}`);
|
|
5196
5204
|
}),
|
|
5197
5205
|
[...b.pos.entries()].map(([y, i]) => {
|
|
5198
|
-
var _,
|
|
5206
|
+
var _, E, F;
|
|
5199
5207
|
return /* @__PURE__ */ t("g", { children: [
|
|
5200
5208
|
/* @__PURE__ */ e(
|
|
5201
5209
|
"rect",
|
|
@@ -5217,7 +5225,7 @@ function Ps({ templateId: a }) {
|
|
|
5217
5225
|
width: 6,
|
|
5218
5226
|
height: i.h,
|
|
5219
5227
|
rx: 2,
|
|
5220
|
-
fill: ((
|
|
5228
|
+
fill: ((E = A.get(y)) == null ? void 0 : E.color) ?? "#94a3b8"
|
|
5221
5229
|
}
|
|
5222
5230
|
),
|
|
5223
5231
|
/* @__PURE__ */ e(
|
|
@@ -5226,7 +5234,7 @@ function Ps({ templateId: a }) {
|
|
|
5226
5234
|
x: Pe - ge + 8,
|
|
5227
5235
|
y: i.y + i.h / 2 + 3,
|
|
5228
5236
|
className: "fill-slate-700 text-[10.5px] font-medium dark:fill-slate-200",
|
|
5229
|
-
children: (((
|
|
5237
|
+
children: (((F = A.get(y)) == null ? void 0 : F.label) ?? "").slice(0, 32)
|
|
5230
5238
|
}
|
|
5231
5239
|
)
|
|
5232
5240
|
] }, `R-${y}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as i, jsx as t, Fragment as v } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as w, useQuery as C, useMutation as E } from "@tanstack/react-query";
|
|
3
3
|
import { Check as q, X as S, Pencil as I, Trash2 as F, Plus as K, Brain as M, History as _ } from "lucide-react";
|
|
4
4
|
import { useEffect as D, useState as u } from "react";
|
|
@@ -9,18 +9,18 @@ import { AiHistorySwitch as j } from "../ai/AiHistorySwitch.js";
|
|
|
9
9
|
import { SectionCard as N } from "./primitives.js";
|
|
10
10
|
const g = 20, k = 300;
|
|
11
11
|
function G() {
|
|
12
|
-
const d = H(), A = w(), { data:
|
|
12
|
+
const d = H(), A = w(), { data: n } = C({
|
|
13
13
|
queryKey: ["nvr-profile-prefs"],
|
|
14
14
|
queryFn: () => d.request(Q("/users/me")).then((e) => {
|
|
15
15
|
var r;
|
|
16
16
|
return ((r = e.data) == null ? void 0 : r.preferences) ?? {};
|
|
17
17
|
})
|
|
18
|
-
}), h =
|
|
18
|
+
}), h = n !== void 0;
|
|
19
19
|
D(() => {
|
|
20
20
|
var e;
|
|
21
21
|
!h || typeof window > "u" || window.location.hash !== "#ai-memory" || (e = document.querySelector('[data-profile-card="ai-memory"]')) == null || e.scrollIntoView({ block: "start", behavior: "smooth" });
|
|
22
22
|
}, [h]);
|
|
23
|
-
const s = Array.isArray(
|
|
23
|
+
const s = Array.isArray(n == null ? void 0 : n.ai_memory) ? n.ai_memory.filter((e) => e && typeof e.text == "string") : [], [m, p] = u(""), [o, l] = u(null), [x, y] = u(null), c = E({
|
|
24
24
|
mutationFn: (e) => d.request(P("/users/me/preferences", { ai_memory: e.length ? e : null })),
|
|
25
25
|
onSuccess: () => {
|
|
26
26
|
y(null), A.invalidateQueries({ queryKey: ["nvr-profile-prefs"] });
|
|
@@ -39,7 +39,7 @@ function G() {
|
|
|
39
39
|
const e = o.text.trim(), r = e ? s.map((a) => a.id === o.id ? { ...a, text: e } : a) : s.filter((a) => a.id !== o.id);
|
|
40
40
|
c.mutate(r, { onSuccess: () => l(null) });
|
|
41
41
|
};
|
|
42
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ i(
|
|
43
43
|
N,
|
|
44
44
|
{
|
|
45
45
|
icon: /* @__PURE__ */ t(M, { className: "h-4 w-4" }),
|
|
@@ -51,11 +51,12 @@ function G() {
|
|
|
51
51
|
"li",
|
|
52
52
|
{
|
|
53
53
|
className: "group flex items-start gap-2 rounded-md px-1.5 py-1 hover:bg-muted",
|
|
54
|
-
children: (o == null ? void 0 : o.id) === e.id ? /* @__PURE__ */
|
|
54
|
+
children: (o == null ? void 0 : o.id) === e.id ? /* @__PURE__ */ i(v, { children: [
|
|
55
55
|
/* @__PURE__ */ t(
|
|
56
56
|
"input",
|
|
57
57
|
{
|
|
58
58
|
value: o.text,
|
|
59
|
+
"aria-label": "Edit this note",
|
|
59
60
|
maxLength: k,
|
|
60
61
|
onChange: (r) => l({ id: e.id, text: r.target.value }),
|
|
61
62
|
onKeyDown: (r) => {
|
|
@@ -85,7 +86,7 @@ function G() {
|
|
|
85
86
|
children: /* @__PURE__ */ t(S, { className: "h-3.5 w-3.5" })
|
|
86
87
|
}
|
|
87
88
|
)
|
|
88
|
-
] }) : /* @__PURE__ */
|
|
89
|
+
] }) : /* @__PURE__ */ i(v, { children: [
|
|
89
90
|
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 break-words text-[12.5px] text-slate-700 dark:text-slate-200", children: e.text }),
|
|
90
91
|
/* @__PURE__ */ t(
|
|
91
92
|
"button",
|
|
@@ -111,7 +112,7 @@ function G() {
|
|
|
111
112
|
},
|
|
112
113
|
e.id
|
|
113
114
|
)) }),
|
|
114
|
-
s.length < g ? /* @__PURE__ */
|
|
115
|
+
s.length < g ? /* @__PURE__ */ i("div", { className: "mt-3 flex items-center gap-2", children: [
|
|
115
116
|
/* @__PURE__ */ t(
|
|
116
117
|
"input",
|
|
117
118
|
{
|
|
@@ -122,11 +123,12 @@ function G() {
|
|
|
122
123
|
e.key === "Enter" && b();
|
|
123
124
|
},
|
|
124
125
|
placeholder: "e.g. I work Zone 3 inventory requests",
|
|
126
|
+
"aria-label": "New note for the assistant",
|
|
125
127
|
className: "min-w-0 flex-1 rounded-md border border-slate-200 bg-white px-2.5 py-1.5 text-[12.5px] dark:border-border dark:bg-background",
|
|
126
128
|
"data-ai-memory-input": !0
|
|
127
129
|
}
|
|
128
130
|
),
|
|
129
|
-
/* @__PURE__ */
|
|
131
|
+
/* @__PURE__ */ i(
|
|
130
132
|
"button",
|
|
131
133
|
{
|
|
132
134
|
type: "button",
|
|
@@ -139,7 +141,7 @@ function G() {
|
|
|
139
141
|
]
|
|
140
142
|
}
|
|
141
143
|
)
|
|
142
|
-
] }) : /* @__PURE__ */
|
|
144
|
+
] }) : /* @__PURE__ */ i("p", { className: "mt-3 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
143
145
|
g,
|
|
144
146
|
" notes is the limit — remove one to add another."
|
|
145
147
|
] }),
|