@tradalab/lyra 3.18.0 → 3.21.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.
- package/README.md +3 -3
- package/dist/{account-menu-q2VMEk3b.d.ts → account-menu-CGAOXP_j.d.ts} +6 -1
- package/dist/blocks/index.d.ts +336 -3
- package/dist/blocks/index.js +983 -23
- package/dist/blocks/index.js.map +1 -1
- package/dist/{chunk-D7DMRCDY.js → chunk-24BDCHMS.js} +60 -3
- package/dist/chunk-24BDCHMS.js.map +1 -0
- package/dist/chunk-RK4ODMGO.js +114 -0
- package/dist/chunk-RK4ODMGO.js.map +1 -0
- package/dist/{chunk-ASSRDIKG.js → chunk-RLCWEDMW.js} +5 -5
- package/dist/chunk-RLCWEDMW.js.map +1 -0
- package/dist/{chunk-UNRT3B6P.js → chunk-ZJRNRX6T.js} +113 -13
- package/dist/chunk-ZJRNRX6T.js.map +1 -0
- package/dist/hooks/index.d.ts +35 -1
- package/dist/hooks/index.js +2 -2
- package/dist/shell/index.d.ts +16 -2
- package/dist/shell/index.js +25 -6
- package/dist/shell/index.js.map +1 -1
- package/dist/sidebar-width-BK0gbgLG.d.ts +22 -0
- package/dist/ui/index.d.ts +3 -2
- package/dist/ui/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-ASSRDIKG.js.map +0 -1
- package/dist/chunk-D2O4GTCC.js +0 -30
- package/dist/chunk-D2O4GTCC.js.map +0 -1
- package/dist/chunk-D7DMRCDY.js.map +0 -1
- package/dist/chunk-UNRT3B6P.js.map +0 -1
package/dist/blocks/index.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Label, Badge, Combobox, ComboboxInput, ComboboxContent, ComboboxEmpty, ComboboxList, ComboboxItem, Drawer, DrawerTrigger, DrawerContent, DrawerHeader, DrawerTitle, DrawerDescription, Calendar,
|
|
3
|
-
export { PreferenceScript } from '../chunk-
|
|
4
|
-
import { NativeSelect, NativeSelectOption } from '../chunk-KSF233MC.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
2
|
+
import { Label, Badge, Spinner, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Combobox, ComboboxInput, ComboboxContent, ComboboxEmpty, ComboboxList, ComboboxItem, Drawer, DrawerTrigger, DrawerContent, DrawerHeader, DrawerTitle, DrawerDescription, Calendar, Alert, AlertDescription, FieldGroup, FieldSet, FieldLegend, FieldDescription, Field, FieldContent, FieldLabel, FieldSeparator, Progress } from '../chunk-RLCWEDMW.js';
|
|
3
|
+
export { PreferenceScript } from '../chunk-RLCWEDMW.js';
|
|
4
|
+
import { NativeSelect, NativeSelectOption, Checkbox } from '../chunk-KSF233MC.js';
|
|
5
|
+
import { useBackClose, useSeen } from '../chunk-RK4ODMGO.js';
|
|
6
|
+
export { useCompact, usePlate } from '../chunk-RK4ODMGO.js';
|
|
7
|
+
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, SidebarGroupContent, SidebarMenu, SidebarContent, SidebarGroup, Switch, RadioGroup, RadioGroupItem } from '../chunk-ZJRNRX6T.js';
|
|
8
|
+
export { PlatePicker } from '../chunk-ZJRNRX6T.js';
|
|
9
|
+
export { BEARING_PLATES, PLATES, derivePlate, isPlate } from '../chunk-24BDCHMS.js';
|
|
9
10
|
import '../chunk-OH3OMK7A.js';
|
|
10
|
-
import { isConnectionColor, CONNECTION_COLOR_NAMES, CONNECTION_COLORS, addTag } from '../chunk-A3T2BEQH.js';
|
|
11
|
-
import { Dialog, DialogOverlay, DialogContent, DialogTitle, DialogDescription, Popover, PopoverTrigger, PopoverContent } from '../chunk-L4LQCVOF.js';
|
|
11
|
+
import { isConnectionColor, CONNECTION_COLOR_NAMES, CONNECTION_COLORS, addTag, matchesKeyword } from '../chunk-A3T2BEQH.js';
|
|
12
|
+
import { Dialog, DialogOverlay, DialogContent, DialogTitle, DialogDescription, DialogHeader, DialogFooter, Popover, PopoverTrigger, PopoverContent } from '../chunk-L4LQCVOF.js';
|
|
12
13
|
import { foldText } from '../chunk-5XFDQRXV.js';
|
|
13
14
|
import { Textarea, InputGroup, InputGroupInput, InputGroupAddon, Avatar, AvatarImage, AvatarFallback, InputGroupButton } from '../chunk-VXW3K5O5.js';
|
|
14
15
|
import { Button, Input } from '../chunk-VGOGWZCF.js';
|
|
15
16
|
import { cn } from '../chunk-XH55BHUU.js';
|
|
16
17
|
import * as React6 from 'react';
|
|
17
|
-
import { createContext, useState, useRef, useContext, useCallback,
|
|
18
|
+
import { createContext, useState, useRef, useMemo, useContext, useCallback, useId, createElement, useEffect } from 'react';
|
|
18
19
|
import { Slot } from 'radix-ui';
|
|
19
20
|
import { FormProvider, Controller, useFormContext } from 'react-hook-form';
|
|
20
21
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
21
|
-
import { ChevronRight, XIcon, LockIcon, CheckIcon, CopyIcon, RefreshCwIcon,
|
|
22
|
+
import { ChevronRight, XIcon, PlusIcon, Trash2Icon, PlugIcon, SaveIcon, LockIcon, CheckIcon, CopyIcon, RefreshCwIcon, ListIcon, CalendarIcon, FolderOpen, Folder, File } from 'lucide-react';
|
|
22
23
|
import { format } from 'date-fns';
|
|
23
24
|
import { enUS } from 'date-fns/locale/en-US';
|
|
24
25
|
import { ja } from 'date-fns/locale/ja';
|
|
@@ -91,6 +92,7 @@ function Panel({ items }) {
|
|
|
91
92
|
/* @__PURE__ */ jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ jsx("div", { className: "inline-flex rounded-lg bg-muted p-1", children: items?.map((s) => /* @__PURE__ */ jsx(
|
|
92
93
|
"button",
|
|
93
94
|
{
|
|
95
|
+
type: "button",
|
|
94
96
|
onClick: () => setActive(s.key),
|
|
95
97
|
className: cn(
|
|
96
98
|
"rounded-md px-3 py-1.5 text-sm transition-all",
|
|
@@ -207,16 +209,19 @@ function ConfirmProvider({ children }) {
|
|
|
207
209
|
const [state, setState] = useState(null);
|
|
208
210
|
const open = useRef(null);
|
|
209
211
|
const next = useRef(0);
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
212
|
+
const { confirm, confirmReason, blocked } = useMemo(() => {
|
|
213
|
+
const show = (o) => {
|
|
214
|
+
open.current?.dismiss();
|
|
215
|
+
open.current = o;
|
|
216
|
+
setState(o);
|
|
217
|
+
};
|
|
218
|
+
const confirm2 = (options) => new Promise((resolve) => show({ id: ++next.current, kind: "confirm", options, resolve, dismiss: () => resolve(false) }));
|
|
219
|
+
const confirmReason2 = (options) => new Promise(
|
|
220
|
+
(resolve) => show({ id: ++next.current, kind: "reason", options, resolve, dismiss: () => resolve(null) })
|
|
221
|
+
);
|
|
222
|
+
const blocked2 = (options) => new Promise((resolve) => show({ id: ++next.current, kind: "blocked", options, resolve, dismiss: () => resolve() }));
|
|
223
|
+
return { confirm: confirm2, confirmReason: confirmReason2, blocked: blocked2 };
|
|
224
|
+
}, []);
|
|
220
225
|
const done = (fn) => {
|
|
221
226
|
fn();
|
|
222
227
|
open.current = null;
|
|
@@ -801,6 +806,696 @@ function TagInput({ value, onChange, suggestions = [], placeholder, removeLabel,
|
|
|
801
806
|
}
|
|
802
807
|
);
|
|
803
808
|
}
|
|
809
|
+
|
|
810
|
+
// src/blocks/connection/tree-data.ts
|
|
811
|
+
var collator = new Intl.Collator(void 0, { numeric: true, sensitivity: "base" });
|
|
812
|
+
function bySortOrder(a, b) {
|
|
813
|
+
return (a.sort_order ?? 0) - (b.sort_order ?? 0) || collator.compare(a.name, b.name);
|
|
814
|
+
}
|
|
815
|
+
function buildConnectionTree(groups, connections) {
|
|
816
|
+
const sorted = [...connections].sort(bySortOrder);
|
|
817
|
+
const known = new Set(groups.map((g) => g.id));
|
|
818
|
+
const leaf = (c, level) => ({ id: c.id, name: c.name, level, isGroup: false, connection: c });
|
|
819
|
+
const grouped = [...groups].sort(bySortOrder).map((g) => ({
|
|
820
|
+
id: g.id,
|
|
821
|
+
name: g.name,
|
|
822
|
+
level: 0,
|
|
823
|
+
isGroup: true,
|
|
824
|
+
group: g,
|
|
825
|
+
children: sorted.filter((c) => c.group_id === g.id).map((c) => leaf(c, 1))
|
|
826
|
+
}));
|
|
827
|
+
const loose = sorted.filter((c) => !c.group_id || !known.has(c.group_id)).map((c) => leaf(c, 0));
|
|
828
|
+
return [...grouped, ...loose];
|
|
829
|
+
}
|
|
830
|
+
function connectionNameMatches(item, keyword) {
|
|
831
|
+
return matchesKeyword([item.name], keyword);
|
|
832
|
+
}
|
|
833
|
+
function ConnectionTree({
|
|
834
|
+
groups,
|
|
835
|
+
connections,
|
|
836
|
+
keyword = "",
|
|
837
|
+
matches = connectionNameMatches,
|
|
838
|
+
storageKey,
|
|
839
|
+
activeId,
|
|
840
|
+
onOpen,
|
|
841
|
+
onDrop,
|
|
842
|
+
icon,
|
|
843
|
+
iconClassName,
|
|
844
|
+
badges,
|
|
845
|
+
actions,
|
|
846
|
+
className
|
|
847
|
+
}) {
|
|
848
|
+
const tree = useMemo(() => buildConnectionTree(groups, connections), [groups, connections]);
|
|
849
|
+
const filtering = keyword.trim() !== "";
|
|
850
|
+
const shown = useMemo(() => filtering ? filterTree(tree, (i) => matches(i, keyword)) : tree, [tree, filtering, matches, keyword]);
|
|
851
|
+
const members = useMemo(() => new Map(tree.filter((i) => i.isGroup).map((g) => [g.id, g.children?.map((c) => c.id) ?? []])), [tree]);
|
|
852
|
+
const [expanded, setExpanded] = useState(() => loadExpanded(storageKey));
|
|
853
|
+
const [whileFiltering, setWhileFiltering] = useState(null);
|
|
854
|
+
const [selected, setSelected] = useState([]);
|
|
855
|
+
const shownExpanded = useMemo(() => {
|
|
856
|
+
if (!filtering) return expanded;
|
|
857
|
+
if (whileFiltering?.keyword === keyword) return whileFiltering.ids;
|
|
858
|
+
return new Set(shown.filter((i) => i.isGroup).map((i) => i.id));
|
|
859
|
+
}, [filtering, keyword, whileFiltering, shown, expanded]);
|
|
860
|
+
const onExpandedChange = useCallback(
|
|
861
|
+
(ids) => {
|
|
862
|
+
if (filtering) {
|
|
863
|
+
setWhileFiltering({ keyword, ids });
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
setExpanded(ids);
|
|
867
|
+
saveExpanded(storageKey, ids);
|
|
868
|
+
},
|
|
869
|
+
[filtering, keyword, storageKey]
|
|
870
|
+
);
|
|
871
|
+
const drop = useCallback(
|
|
872
|
+
(plan) => {
|
|
873
|
+
if (plan.kind === "leaf" && plan.groupId && !expanded.has(plan.groupId)) {
|
|
874
|
+
const next = /* @__PURE__ */ new Set([...expanded, plan.groupId]);
|
|
875
|
+
setExpanded(next);
|
|
876
|
+
saveExpanded(storageKey, next);
|
|
877
|
+
}
|
|
878
|
+
void onDrop?.(plan);
|
|
879
|
+
},
|
|
880
|
+
[expanded, onDrop, storageKey]
|
|
881
|
+
);
|
|
882
|
+
return /* @__PURE__ */ jsx(TreeDndProvider, { tree, enabled: !filtering && !!onDrop, onDrop: drop, children: /* @__PURE__ */ jsx(DropArea, { className, children: /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(TreeProvider, { expandedIds: shownExpanded, onExpandedChange, selectedIds: selected, onSelectionChange: setSelected, multiSelect: true, children: /* @__PURE__ */ jsx(TreeView, { className: "px-1 py-2", children: shown.map((item) => /* @__PURE__ */ jsx(
|
|
883
|
+
Node,
|
|
884
|
+
{
|
|
885
|
+
item,
|
|
886
|
+
members,
|
|
887
|
+
activeId,
|
|
888
|
+
onOpen,
|
|
889
|
+
icon,
|
|
890
|
+
iconClassName,
|
|
891
|
+
badges,
|
|
892
|
+
actions
|
|
893
|
+
},
|
|
894
|
+
item.id
|
|
895
|
+
)) }) }) }) }) }) });
|
|
896
|
+
}
|
|
897
|
+
function DropArea({ className, children }) {
|
|
898
|
+
const root = useTreeDndRoot();
|
|
899
|
+
return /* @__PURE__ */ jsx(SidebarContent, { className: cn(root.className, className), ...root.rootProps, children: /* @__PURE__ */ jsx(SidebarGroup, { className: "p-0", ...root.treeProps, children }) });
|
|
900
|
+
}
|
|
901
|
+
function Node(props) {
|
|
902
|
+
const { item, members, activeId, onOpen, icon, iconClassName, badges, actions } = props;
|
|
903
|
+
const dnd = useTreeDndNode(item);
|
|
904
|
+
const connection = item.connection;
|
|
905
|
+
const open = !item.isGroup && connection && onOpen ? (e) => {
|
|
906
|
+
e.stopPropagation();
|
|
907
|
+
onOpen(connection);
|
|
908
|
+
} : void 0;
|
|
909
|
+
return /* @__PURE__ */ jsxs(TreeNode, { nodeId: item.id, level: item.level, isLast: item.level === 0, onDoubleClick: open, children: [
|
|
910
|
+
/* @__PURE__ */ jsxs(
|
|
911
|
+
TreeNodeTrigger,
|
|
912
|
+
{
|
|
913
|
+
"data-active": !item.isGroup && item.id === activeId ? "" : void 0,
|
|
914
|
+
className: cn("group/item px-1 py-1.5 data-[active]:bg-accent data-[active]:font-medium data-[active]:text-accent-foreground", dnd.className),
|
|
915
|
+
...dnd.props,
|
|
916
|
+
children: [
|
|
917
|
+
/* @__PURE__ */ jsx(TreeExpander, { hasChildren: item.isGroup }),
|
|
918
|
+
/* @__PURE__ */ jsx(TreeIcon, { hasChildren: item.isGroup, icon: item.isGroup ? void 0 : icon?.(item), className: iconClassName?.(item) }),
|
|
919
|
+
/* @__PURE__ */ jsx(TreeLabel, { children: item.name }),
|
|
920
|
+
badges?.(item, members.get(item.id) ?? []),
|
|
921
|
+
actions && /* @__PURE__ */ jsx("span", { className: "ml-1 opacity-0 group-hover/item:opacity-100 focus-within:opacity-100", children: actions(item) })
|
|
922
|
+
]
|
|
923
|
+
}
|
|
924
|
+
),
|
|
925
|
+
item.isGroup && item.children && /* @__PURE__ */ jsx(TreeNodeContent, { hasChildren: true, children: item.children.map((child) => /* @__PURE__ */ createElement(Node, { ...props, key: child.id, item: child })) })
|
|
926
|
+
] });
|
|
927
|
+
}
|
|
928
|
+
var DEFAULT_LABELS = { add: "Add", delete: "Delete", test: "Test connection", save: "Save" };
|
|
929
|
+
function ConfigListDialog({
|
|
930
|
+
open,
|
|
931
|
+
onOpenChange,
|
|
932
|
+
title,
|
|
933
|
+
items,
|
|
934
|
+
getId,
|
|
935
|
+
renderItem,
|
|
936
|
+
selectedId,
|
|
937
|
+
onSelect,
|
|
938
|
+
onAdd,
|
|
939
|
+
loading,
|
|
940
|
+
onSave,
|
|
941
|
+
onTest,
|
|
942
|
+
onDelete,
|
|
943
|
+
labels,
|
|
944
|
+
children,
|
|
945
|
+
className
|
|
946
|
+
}) {
|
|
947
|
+
const l = { ...DEFAULT_LABELS, ...labels };
|
|
948
|
+
const [busy, setBusy] = useState(() => /* @__PURE__ */ new Set());
|
|
949
|
+
const exec = async (action, handler) => {
|
|
950
|
+
if (!handler || busy.has(action)) return;
|
|
951
|
+
setBusy((prev) => new Set(prev).add(action));
|
|
952
|
+
try {
|
|
953
|
+
await handler();
|
|
954
|
+
} catch {
|
|
955
|
+
return;
|
|
956
|
+
} finally {
|
|
957
|
+
setBusy((prev) => {
|
|
958
|
+
const next = new Set(prev);
|
|
959
|
+
next.delete(action);
|
|
960
|
+
return next;
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
const run = (action, handler) => () => {
|
|
965
|
+
void exec(action, handler);
|
|
966
|
+
};
|
|
967
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(
|
|
968
|
+
DialogContent,
|
|
969
|
+
{
|
|
970
|
+
className: cn("flex h-[85vh] flex-col p-0 sm:max-w-[700px]", className),
|
|
971
|
+
onInteractOutside: (e) => e.preventDefault(),
|
|
972
|
+
onEscapeKeyDown: (e) => e.preventDefault(),
|
|
973
|
+
children: [
|
|
974
|
+
/* @__PURE__ */ jsx(DialogHeader, { className: "px-4 pt-4", children: /* @__PURE__ */ jsx(DialogTitle, { className: "text-sm", children: title }) }),
|
|
975
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 overflow-hidden", children: [
|
|
976
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-[260px] flex-col border-r", children: [
|
|
977
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 border-b p-2", children: /* @__PURE__ */ jsx(Button, { size: "icon", variant: "ghost", "aria-label": l.add, title: l.add, onClick: onAdd, children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-4 w-4" }) }) }),
|
|
978
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto", role: "listbox", "aria-label": typeof title === "string" ? title : void 0, children: [
|
|
979
|
+
loading && /* @__PURE__ */ jsx("div", { className: "flex justify-center p-4", children: /* @__PURE__ */ jsx(Spinner, {}) }),
|
|
980
|
+
items.map((item) => {
|
|
981
|
+
const id = getId(item);
|
|
982
|
+
const active = id === selectedId;
|
|
983
|
+
return /* @__PURE__ */ jsx(
|
|
984
|
+
"button",
|
|
985
|
+
{
|
|
986
|
+
type: "button",
|
|
987
|
+
role: "option",
|
|
988
|
+
"aria-selected": active,
|
|
989
|
+
onClick: () => onSelect(item),
|
|
990
|
+
className: cn(
|
|
991
|
+
"block w-full cursor-pointer truncate border-l-2 px-3 py-2 text-left text-sm",
|
|
992
|
+
active ? "border-primary bg-muted" : "border-transparent hover:bg-muted"
|
|
993
|
+
),
|
|
994
|
+
children: renderItem(item)
|
|
995
|
+
},
|
|
996
|
+
id
|
|
997
|
+
);
|
|
998
|
+
})
|
|
999
|
+
] })
|
|
1000
|
+
] }),
|
|
1001
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1 overflow-auto p-4", children })
|
|
1002
|
+
] }),
|
|
1003
|
+
selectedId !== void 0 && /* @__PURE__ */ jsxs(DialogFooter, { className: "flex gap-2 border-t p-2", children: [
|
|
1004
|
+
onDelete && /* @__PURE__ */ jsxs(Button, { size: "sm", variant: "destructive", disabled: busy.has("delete"), onClick: run("delete", onDelete), children: [
|
|
1005
|
+
busy.has("delete") ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsx(Trash2Icon, {}),
|
|
1006
|
+
l.delete
|
|
1007
|
+
] }),
|
|
1008
|
+
onTest && /* @__PURE__ */ jsxs(Button, { size: "sm", variant: "outline", disabled: busy.has("test"), onClick: run("test", onTest), children: [
|
|
1009
|
+
busy.has("test") ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsx(PlugIcon, {}),
|
|
1010
|
+
l.test
|
|
1011
|
+
] }),
|
|
1012
|
+
onSave && /* @__PURE__ */ jsxs(Button, { size: "sm", disabled: busy.has("save"), onClick: run("save", onSave), children: [
|
|
1013
|
+
busy.has("save") ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsx(SaveIcon, {}),
|
|
1014
|
+
l.save
|
|
1015
|
+
] })
|
|
1016
|
+
] })
|
|
1017
|
+
]
|
|
1018
|
+
}
|
|
1019
|
+
) });
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
// src/blocks/connection/fields-common.ts
|
|
1023
|
+
function requiredRules(l) {
|
|
1024
|
+
return { required: l.required, validate: (v) => (typeof v === "string" ? v.trim() !== "" : v != null) || l.required };
|
|
1025
|
+
}
|
|
1026
|
+
function portRules(l) {
|
|
1027
|
+
return {
|
|
1028
|
+
required: l.required,
|
|
1029
|
+
validate: (v) => Number.isInteger(v) && v >= 1 && v <= 65535 || l.portRange
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
function portInput(field) {
|
|
1033
|
+
return {
|
|
1034
|
+
name: field.name,
|
|
1035
|
+
type: "number",
|
|
1036
|
+
inputMode: "numeric",
|
|
1037
|
+
value: field.value ?? "",
|
|
1038
|
+
onBlur: field.onBlur,
|
|
1039
|
+
onChange: (e) => field.onChange(e.target.value === "" ? void 0 : Number(e.target.value))
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
function optional(label, l) {
|
|
1043
|
+
return `${label} (${l.optional})`;
|
|
1044
|
+
}
|
|
1045
|
+
function proxyDefaults(p = {}) {
|
|
1046
|
+
return {
|
|
1047
|
+
id: p.id,
|
|
1048
|
+
protocol: p.protocol || "http",
|
|
1049
|
+
host: p.host ?? "",
|
|
1050
|
+
port: p.port || 8080,
|
|
1051
|
+
username: p.username ?? "",
|
|
1052
|
+
password: p.password ?? ""
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
var DEFAULTS = {
|
|
1056
|
+
protocol: "Protocol",
|
|
1057
|
+
host: "Host",
|
|
1058
|
+
port: "Port",
|
|
1059
|
+
username: "Username",
|
|
1060
|
+
password: "Password",
|
|
1061
|
+
optional: "optional",
|
|
1062
|
+
required: "Required",
|
|
1063
|
+
portRange: "Between 1 and 65535"
|
|
1064
|
+
};
|
|
1065
|
+
function ProxyFields({
|
|
1066
|
+
form,
|
|
1067
|
+
labels,
|
|
1068
|
+
secretPlaceholder
|
|
1069
|
+
}) {
|
|
1070
|
+
const l = { ...DEFAULTS, ...labels };
|
|
1071
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
1072
|
+
/* @__PURE__ */ jsx(
|
|
1073
|
+
FormField,
|
|
1074
|
+
{
|
|
1075
|
+
control: form.control,
|
|
1076
|
+
name: "protocol",
|
|
1077
|
+
rules: { required: l.required },
|
|
1078
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
1079
|
+
/* @__PURE__ */ jsx(FormLabel, { children: l.protocol }),
|
|
1080
|
+
/* @__PURE__ */ jsxs(Select, { onValueChange: field.onChange, value: field.value, children: [
|
|
1081
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsx(SelectValue, {}) }) }),
|
|
1082
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
1083
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "http", children: "HTTP" }),
|
|
1084
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "socks5", children: "SOCKS5" })
|
|
1085
|
+
] })
|
|
1086
|
+
] }),
|
|
1087
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
1088
|
+
] })
|
|
1089
|
+
}
|
|
1090
|
+
),
|
|
1091
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-4 gap-4", children: [
|
|
1092
|
+
/* @__PURE__ */ jsx(
|
|
1093
|
+
FormField,
|
|
1094
|
+
{
|
|
1095
|
+
control: form.control,
|
|
1096
|
+
name: "host",
|
|
1097
|
+
rules: requiredRules(l),
|
|
1098
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "col-span-3", children: [
|
|
1099
|
+
/* @__PURE__ */ jsx(FormLabel, { children: l.host }),
|
|
1100
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { placeholder: "127.0.0.1", ...field }) }),
|
|
1101
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
1102
|
+
] })
|
|
1103
|
+
}
|
|
1104
|
+
),
|
|
1105
|
+
/* @__PURE__ */ jsx(
|
|
1106
|
+
FormField,
|
|
1107
|
+
{
|
|
1108
|
+
control: form.control,
|
|
1109
|
+
name: "port",
|
|
1110
|
+
rules: portRules(l),
|
|
1111
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
1112
|
+
/* @__PURE__ */ jsx(FormLabel, { children: l.port }),
|
|
1113
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...portInput(field) }) }),
|
|
1114
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
1115
|
+
] })
|
|
1116
|
+
}
|
|
1117
|
+
)
|
|
1118
|
+
] }),
|
|
1119
|
+
/* @__PURE__ */ jsx(
|
|
1120
|
+
FormField,
|
|
1121
|
+
{
|
|
1122
|
+
control: form.control,
|
|
1123
|
+
name: "username",
|
|
1124
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
1125
|
+
/* @__PURE__ */ jsx(FormLabel, { children: optional(l.username, l) }),
|
|
1126
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...field, value: field.value ?? "", autoComplete: "off" }) })
|
|
1127
|
+
] })
|
|
1128
|
+
}
|
|
1129
|
+
),
|
|
1130
|
+
/* @__PURE__ */ jsx(
|
|
1131
|
+
FormField,
|
|
1132
|
+
{
|
|
1133
|
+
control: form.control,
|
|
1134
|
+
name: "password",
|
|
1135
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
1136
|
+
/* @__PURE__ */ jsx(FormLabel, { children: optional(l.password, l) }),
|
|
1137
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { type: "password", ...field, value: field.value ?? "", placeholder: secretPlaceholder, autoComplete: "new-password" }) })
|
|
1138
|
+
] })
|
|
1139
|
+
}
|
|
1140
|
+
)
|
|
1141
|
+
] });
|
|
1142
|
+
}
|
|
1143
|
+
function tlsDefaults(t = {}) {
|
|
1144
|
+
return {
|
|
1145
|
+
id: t.id,
|
|
1146
|
+
name: t.name ?? "",
|
|
1147
|
+
verify: typeof t.verify === "boolean" ? t.verify : true,
|
|
1148
|
+
use_sni: Boolean(t.use_sni),
|
|
1149
|
+
server_name: t.server_name ?? "",
|
|
1150
|
+
ca_cert: t.ca_cert ?? "",
|
|
1151
|
+
client_auth: Boolean(t.client_auth),
|
|
1152
|
+
cert: t.cert ?? "",
|
|
1153
|
+
key: t.key ?? ""
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1156
|
+
var DEFAULTS2 = {
|
|
1157
|
+
name: "Name",
|
|
1158
|
+
optional: "optional",
|
|
1159
|
+
verify: "Verify the server certificate",
|
|
1160
|
+
verifyHint: "Turn off only for a server with a self-signed certificate you trust.",
|
|
1161
|
+
useSni: "Send SNI",
|
|
1162
|
+
useSniHint: "Name the server in the handshake, for hosts that serve several certificates.",
|
|
1163
|
+
serverName: "Server name",
|
|
1164
|
+
caCert: "Root CA certificate",
|
|
1165
|
+
clientAuth: "Client certificate",
|
|
1166
|
+
clientAuthHint: "For servers that ask the client to prove who it is (mutual TLS).",
|
|
1167
|
+
clientCert: "Client certificate",
|
|
1168
|
+
clientKey: "Client private key"
|
|
1169
|
+
};
|
|
1170
|
+
var PEM_CERT = "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----";
|
|
1171
|
+
var PEM_KEY = "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----";
|
|
1172
|
+
function TlsFields({
|
|
1173
|
+
form,
|
|
1174
|
+
labels,
|
|
1175
|
+
serverNamePlaceholder,
|
|
1176
|
+
secretPlaceholder
|
|
1177
|
+
}) {
|
|
1178
|
+
const l = { ...DEFAULTS2, ...labels };
|
|
1179
|
+
const verify = form.watch("verify");
|
|
1180
|
+
const useSni = form.watch("use_sni");
|
|
1181
|
+
const clientAuth = form.watch("client_auth");
|
|
1182
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid gap-6 pb-4", children: [
|
|
1183
|
+
/* @__PURE__ */ jsx(
|
|
1184
|
+
FormField,
|
|
1185
|
+
{
|
|
1186
|
+
control: form.control,
|
|
1187
|
+
name: "name",
|
|
1188
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
1189
|
+
/* @__PURE__ */ jsx(FormLabel, { children: `${l.name} (${l.optional})` }),
|
|
1190
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...field, value: field.value ?? "" }) })
|
|
1191
|
+
] })
|
|
1192
|
+
}
|
|
1193
|
+
),
|
|
1194
|
+
/* @__PURE__ */ jsxs("section", { className: "space-y-6 border p-4", children: [
|
|
1195
|
+
/* @__PURE__ */ jsx(Toggle, { form, name: "verify", label: l.verify, hint: l.verifyHint }),
|
|
1196
|
+
/* @__PURE__ */ jsx("hr", { className: "border-border" }),
|
|
1197
|
+
/* @__PURE__ */ jsx(Toggle, { form, name: "use_sni", label: l.useSni, hint: l.useSniHint }),
|
|
1198
|
+
(useSni || verify) && /* @__PURE__ */ jsx(
|
|
1199
|
+
FormField,
|
|
1200
|
+
{
|
|
1201
|
+
control: form.control,
|
|
1202
|
+
name: "server_name",
|
|
1203
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
1204
|
+
/* @__PURE__ */ jsx(FormLabel, { children: l.serverName }),
|
|
1205
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...field, value: field.value ?? "", placeholder: serverNamePlaceholder }) }),
|
|
1206
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
1207
|
+
] })
|
|
1208
|
+
}
|
|
1209
|
+
),
|
|
1210
|
+
/* @__PURE__ */ jsx("hr", { className: "border-border" }),
|
|
1211
|
+
/* @__PURE__ */ jsx(Pem, { form, name: "ca_cert", label: l.caCert, placeholder: PEM_CERT })
|
|
1212
|
+
] }),
|
|
1213
|
+
/* @__PURE__ */ jsxs("section", { className: "space-y-6 border p-4", children: [
|
|
1214
|
+
/* @__PURE__ */ jsx(Toggle, { form, name: "client_auth", label: l.clientAuth, hint: l.clientAuthHint }),
|
|
1215
|
+
clientAuth && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1216
|
+
/* @__PURE__ */ jsx("hr", { className: "border-border" }),
|
|
1217
|
+
/* @__PURE__ */ jsx(Pem, { form, name: "cert", label: l.clientCert, placeholder: PEM_CERT }),
|
|
1218
|
+
/* @__PURE__ */ jsx(Pem, { form, name: "key", label: l.clientKey, placeholder: secretPlaceholder ?? PEM_KEY })
|
|
1219
|
+
] })
|
|
1220
|
+
] })
|
|
1221
|
+
] });
|
|
1222
|
+
}
|
|
1223
|
+
function Toggle({ form, name, label, hint }) {
|
|
1224
|
+
return /* @__PURE__ */ jsx(
|
|
1225
|
+
FormField,
|
|
1226
|
+
{
|
|
1227
|
+
control: form.control,
|
|
1228
|
+
name,
|
|
1229
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "flex items-center justify-between gap-4", children: [
|
|
1230
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1231
|
+
/* @__PURE__ */ jsx(FormLabel, { children: label }),
|
|
1232
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: hint })
|
|
1233
|
+
] }),
|
|
1234
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Switch, { checked: field.value, onCheckedChange: field.onChange }) })
|
|
1235
|
+
] })
|
|
1236
|
+
}
|
|
1237
|
+
);
|
|
1238
|
+
}
|
|
1239
|
+
function Pem({ form, name, label, placeholder }) {
|
|
1240
|
+
return /* @__PURE__ */ jsx(
|
|
1241
|
+
FormField,
|
|
1242
|
+
{
|
|
1243
|
+
control: form.control,
|
|
1244
|
+
name,
|
|
1245
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
1246
|
+
/* @__PURE__ */ jsx(FormLabel, { children: label }),
|
|
1247
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Textarea, { ...field, value: field.value ?? "", rows: 6, placeholder, className: "font-mono text-xs whitespace-pre" }) }),
|
|
1248
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
1249
|
+
] })
|
|
1250
|
+
}
|
|
1251
|
+
);
|
|
1252
|
+
}
|
|
1253
|
+
function sshDefaults(s = {}) {
|
|
1254
|
+
return {
|
|
1255
|
+
id: s.id,
|
|
1256
|
+
host: s.host ?? "",
|
|
1257
|
+
port: s.port || 22,
|
|
1258
|
+
timeout: s.timeout || 60,
|
|
1259
|
+
username: s.username ?? "",
|
|
1260
|
+
kind: s.kind === "keypair" || s.kind === "agent" ? s.kind : "password",
|
|
1261
|
+
password: s.password ?? "",
|
|
1262
|
+
private_key: s.private_key ?? "",
|
|
1263
|
+
passphrase: s.passphrase ?? "",
|
|
1264
|
+
host_key: s.host_key ?? ""
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
var DEFAULTS3 = {
|
|
1268
|
+
host: "Host",
|
|
1269
|
+
port: "Port",
|
|
1270
|
+
username: "Username",
|
|
1271
|
+
password: "Password",
|
|
1272
|
+
optional: "optional",
|
|
1273
|
+
required: "Required",
|
|
1274
|
+
portRange: "Between 1 and 65535",
|
|
1275
|
+
timeout: "Timeout (s)",
|
|
1276
|
+
kind: "Authentication",
|
|
1277
|
+
kindPassword: "Password",
|
|
1278
|
+
kindKeypair: "Key pair",
|
|
1279
|
+
kindAgent: "SSH agent",
|
|
1280
|
+
privateKey: "Private key",
|
|
1281
|
+
privateKeyPlaceholder: "-----BEGIN OPENSSH PRIVATE KEY-----",
|
|
1282
|
+
passphrase: "Passphrase",
|
|
1283
|
+
hostKey: "Host key",
|
|
1284
|
+
hostKeyUntrusted: "Not trusted yet",
|
|
1285
|
+
hostKeyHint: "Only the server holding this key is connected to. Test the connection to see the key it presents."
|
|
1286
|
+
};
|
|
1287
|
+
function SshFields({
|
|
1288
|
+
form,
|
|
1289
|
+
labels,
|
|
1290
|
+
kinds = ["password", "keypair", "agent"],
|
|
1291
|
+
secretPlaceholder,
|
|
1292
|
+
pinHostKey = false
|
|
1293
|
+
}) {
|
|
1294
|
+
const l = { ...DEFAULTS3, ...labels };
|
|
1295
|
+
const kind = form.watch("kind");
|
|
1296
|
+
const kindLabel = { password: l.kindPassword, keypair: l.kindKeypair, agent: l.kindAgent };
|
|
1297
|
+
usePinFollowsAddress(form, pinHostKey);
|
|
1298
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid gap-4", children: [
|
|
1299
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-4 gap-4", children: [
|
|
1300
|
+
/* @__PURE__ */ jsx(
|
|
1301
|
+
FormField,
|
|
1302
|
+
{
|
|
1303
|
+
control: form.control,
|
|
1304
|
+
name: "host",
|
|
1305
|
+
rules: requiredRules(l),
|
|
1306
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "col-span-3", children: [
|
|
1307
|
+
/* @__PURE__ */ jsx(FormLabel, { children: l.host }),
|
|
1308
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
1309
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
1310
|
+
] })
|
|
1311
|
+
}
|
|
1312
|
+
),
|
|
1313
|
+
/* @__PURE__ */ jsx(
|
|
1314
|
+
FormField,
|
|
1315
|
+
{
|
|
1316
|
+
control: form.control,
|
|
1317
|
+
name: "port",
|
|
1318
|
+
rules: portRules(l),
|
|
1319
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
1320
|
+
/* @__PURE__ */ jsx(FormLabel, { children: l.port }),
|
|
1321
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...portInput(field) }) }),
|
|
1322
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
1323
|
+
] })
|
|
1324
|
+
}
|
|
1325
|
+
)
|
|
1326
|
+
] }),
|
|
1327
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-4 gap-4", children: [
|
|
1328
|
+
/* @__PURE__ */ jsx(
|
|
1329
|
+
FormField,
|
|
1330
|
+
{
|
|
1331
|
+
control: form.control,
|
|
1332
|
+
name: "username",
|
|
1333
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "col-span-3", children: [
|
|
1334
|
+
/* @__PURE__ */ jsx(FormLabel, { children: l.username }),
|
|
1335
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...field, autoComplete: "off" }) }),
|
|
1336
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
1337
|
+
] })
|
|
1338
|
+
}
|
|
1339
|
+
),
|
|
1340
|
+
/* @__PURE__ */ jsx(
|
|
1341
|
+
FormField,
|
|
1342
|
+
{
|
|
1343
|
+
control: form.control,
|
|
1344
|
+
name: "timeout",
|
|
1345
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
1346
|
+
/* @__PURE__ */ jsx(FormLabel, { children: l.timeout }),
|
|
1347
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...portInput(field) }) }),
|
|
1348
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
1349
|
+
] })
|
|
1350
|
+
}
|
|
1351
|
+
)
|
|
1352
|
+
] }),
|
|
1353
|
+
/* @__PURE__ */ jsx(
|
|
1354
|
+
FormField,
|
|
1355
|
+
{
|
|
1356
|
+
control: form.control,
|
|
1357
|
+
name: "kind",
|
|
1358
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
1359
|
+
/* @__PURE__ */ jsx(FormLabel, { children: l.kind }),
|
|
1360
|
+
/* @__PURE__ */ jsxs(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
1361
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsx(SelectValue, {}) }) }),
|
|
1362
|
+
/* @__PURE__ */ jsx(SelectContent, { children: kinds.map((k) => /* @__PURE__ */ jsx(SelectItem, { value: k, children: kindLabel[k] }, k)) })
|
|
1363
|
+
] }),
|
|
1364
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
1365
|
+
] })
|
|
1366
|
+
}
|
|
1367
|
+
),
|
|
1368
|
+
kind === "password" && /* @__PURE__ */ jsx(
|
|
1369
|
+
FormField,
|
|
1370
|
+
{
|
|
1371
|
+
control: form.control,
|
|
1372
|
+
name: "password",
|
|
1373
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
1374
|
+
/* @__PURE__ */ jsx(FormLabel, { children: l.password }),
|
|
1375
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...field, value: field.value ?? "", type: "password", placeholder: secretPlaceholder, autoComplete: "new-password" }) }),
|
|
1376
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
1377
|
+
] })
|
|
1378
|
+
}
|
|
1379
|
+
),
|
|
1380
|
+
kind === "keypair" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1381
|
+
/* @__PURE__ */ jsx(
|
|
1382
|
+
FormField,
|
|
1383
|
+
{
|
|
1384
|
+
control: form.control,
|
|
1385
|
+
name: "private_key",
|
|
1386
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
1387
|
+
/* @__PURE__ */ jsx(FormLabel, { children: l.privateKey }),
|
|
1388
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
|
|
1389
|
+
Textarea,
|
|
1390
|
+
{
|
|
1391
|
+
...field,
|
|
1392
|
+
value: field.value ?? "",
|
|
1393
|
+
className: "min-h-[120px] font-mono text-xs",
|
|
1394
|
+
placeholder: secretPlaceholder ?? l.privateKeyPlaceholder
|
|
1395
|
+
}
|
|
1396
|
+
) }),
|
|
1397
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
1398
|
+
] })
|
|
1399
|
+
}
|
|
1400
|
+
),
|
|
1401
|
+
/* @__PURE__ */ jsx(
|
|
1402
|
+
FormField,
|
|
1403
|
+
{
|
|
1404
|
+
control: form.control,
|
|
1405
|
+
name: "passphrase",
|
|
1406
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
1407
|
+
/* @__PURE__ */ jsx(FormLabel, { children: `${l.passphrase} (${l.optional})` }),
|
|
1408
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { ...field, value: field.value ?? "", type: "password", placeholder: secretPlaceholder, autoComplete: "new-password" }) }),
|
|
1409
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
1410
|
+
] })
|
|
1411
|
+
}
|
|
1412
|
+
)
|
|
1413
|
+
] }),
|
|
1414
|
+
pinHostKey && /* @__PURE__ */ jsx(
|
|
1415
|
+
FormField,
|
|
1416
|
+
{
|
|
1417
|
+
control: form.control,
|
|
1418
|
+
name: "host_key",
|
|
1419
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
1420
|
+
/* @__PURE__ */ jsx(FormLabel, { children: l.hostKey }),
|
|
1421
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { value: field.value || l.hostKeyUntrusted, readOnly: true, className: "font-mono text-xs" }) }),
|
|
1422
|
+
/* @__PURE__ */ jsx(FormDescription, { children: l.hostKeyHint })
|
|
1423
|
+
] })
|
|
1424
|
+
}
|
|
1425
|
+
)
|
|
1426
|
+
] });
|
|
1427
|
+
}
|
|
1428
|
+
function usePinFollowsAddress(form, on) {
|
|
1429
|
+
useEffect(() => {
|
|
1430
|
+
if (!on) return;
|
|
1431
|
+
const sub = form.watch((v, { name, type }) => {
|
|
1432
|
+
if (type !== "change" || name !== "host" && name !== "port") return;
|
|
1433
|
+
const origin = form.formState.defaultValues;
|
|
1434
|
+
const same = v.host === origin?.host && v.port === origin?.port;
|
|
1435
|
+
form.setValue("host_key", same ? origin?.host_key ?? "" : "");
|
|
1436
|
+
});
|
|
1437
|
+
return () => sub.unsubscribe();
|
|
1438
|
+
}, [form, on]);
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
// src/blocks/connection/host-key.ts
|
|
1442
|
+
var HOST_KEY_UNKNOWN = "ssh_host_key_unknown";
|
|
1443
|
+
var HOST_KEY_CHANGED = "ssh_host_key_changed";
|
|
1444
|
+
function hostKeyAsk(e) {
|
|
1445
|
+
if (typeof e !== "object" || e === null) return null;
|
|
1446
|
+
const { code, details } = e;
|
|
1447
|
+
if (code !== HOST_KEY_UNKNOWN && code !== HOST_KEY_CHANGED) return null;
|
|
1448
|
+
const d = typeof details === "object" && details !== null ? details : {};
|
|
1449
|
+
if (typeof d.key !== "string" || !d.key) return null;
|
|
1450
|
+
return { key: d.key, fingerprint: typeof d.fingerprint === "string" ? d.fingerprint : "", changed: code === HOST_KEY_CHANGED, details: d };
|
|
1451
|
+
}
|
|
1452
|
+
function sharedWhilePending() {
|
|
1453
|
+
const pending = /* @__PURE__ */ new Map();
|
|
1454
|
+
return (id, run) => {
|
|
1455
|
+
const inFlight = pending.get(id);
|
|
1456
|
+
if (inFlight) return inFlight;
|
|
1457
|
+
const p = run().finally(() => pending.delete(id));
|
|
1458
|
+
pending.set(id, p);
|
|
1459
|
+
return p;
|
|
1460
|
+
};
|
|
1461
|
+
}
|
|
1462
|
+
async function retryAfterTrust(run, confirm, trustFor) {
|
|
1463
|
+
try {
|
|
1464
|
+
return { declined: false, value: await run(), trusted: false };
|
|
1465
|
+
} catch (e) {
|
|
1466
|
+
const ask = hostKeyAsk(e);
|
|
1467
|
+
const pin = ask ? trustFor(ask) : void 0;
|
|
1468
|
+
if (!ask || !pin) throw e;
|
|
1469
|
+
if (!await confirm(ask)) return { declined: true, error: e };
|
|
1470
|
+
await pin();
|
|
1471
|
+
return { declined: false, value: await run(), trusted: true };
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
var shared = sharedWhilePending();
|
|
1475
|
+
function useHostKeyTrust(labels) {
|
|
1476
|
+
const confirm = useConfirm();
|
|
1477
|
+
const latest = useRef({ confirm, labels });
|
|
1478
|
+
useEffect(() => {
|
|
1479
|
+
latest.current = { confirm, labels };
|
|
1480
|
+
});
|
|
1481
|
+
const confirmHostKey = useCallback((ask, scope = "") => {
|
|
1482
|
+
return shared(`${scope}|${ask.changed}|${ask.key}`, () => {
|
|
1483
|
+
const { confirm: confirm2, labels: labels2 } = latest.current;
|
|
1484
|
+
return confirm2({
|
|
1485
|
+
title: ask.changed ? labels2.changedTitle : labels2.trustTitle,
|
|
1486
|
+
description: ask.changed ? labels2.changedDescription(ask.fingerprint) : labels2.trustDescription(ask.fingerprint),
|
|
1487
|
+
confirmText: labels2.trust,
|
|
1488
|
+
cancelText: labels2.cancel,
|
|
1489
|
+
danger: ask.changed
|
|
1490
|
+
});
|
|
1491
|
+
});
|
|
1492
|
+
}, []);
|
|
1493
|
+
const runWithTrust = useCallback(
|
|
1494
|
+
(run, trustFor, scope = "") => retryAfterTrust(run, (ask) => confirmHostKey(ask, scope), trustFor),
|
|
1495
|
+
[confirmHostKey]
|
|
1496
|
+
);
|
|
1497
|
+
return { confirmHostKey, runWithTrust };
|
|
1498
|
+
}
|
|
804
1499
|
var FALLBACK_ZONES = [
|
|
805
1500
|
"UTC",
|
|
806
1501
|
"Asia/Ho_Chi_Minh",
|
|
@@ -933,7 +1628,14 @@ function TzPicker({
|
|
|
933
1628
|
);
|
|
934
1629
|
}
|
|
935
1630
|
function MobileSheet({ title, description, trigger, open, onOpenChange, className, children }) {
|
|
936
|
-
|
|
1631
|
+
const [inner, setInner] = useState(false);
|
|
1632
|
+
const shown = open ?? inner;
|
|
1633
|
+
const change = (next) => {
|
|
1634
|
+
if (open === void 0) setInner(next);
|
|
1635
|
+
onOpenChange?.(next);
|
|
1636
|
+
};
|
|
1637
|
+
useBackClose(shown, () => change(false));
|
|
1638
|
+
return /* @__PURE__ */ jsxs(Drawer, { open: shown, onOpenChange: change, children: [
|
|
937
1639
|
trigger && /* @__PURE__ */ jsx(DrawerTrigger, { asChild: true, children: trigger }),
|
|
938
1640
|
/* @__PURE__ */ jsxs(DrawerContent, { children: [
|
|
939
1641
|
/* @__PURE__ */ jsxs(DrawerHeader, { children: [
|
|
@@ -2083,6 +2785,264 @@ function LlmSettings({ api, labels, className, header, footer }) {
|
|
|
2083
2785
|
);
|
|
2084
2786
|
}
|
|
2085
2787
|
|
|
2086
|
-
|
|
2788
|
+
// src/blocks/release-notes-parse.ts
|
|
2789
|
+
var HEADING = /^(#{1,6})\s+(.*?)\s*#*\s*$/;
|
|
2790
|
+
var RULE = /^\s*([-*_])(\s*\1){2,}\s*$/;
|
|
2791
|
+
var FENCE = /^\s*(`{3,}|~{3,})/;
|
|
2792
|
+
var ITEM = /^(\s*)([-*+]|\d+[.)])\s+(.*)$/;
|
|
2793
|
+
var SAFE_HREF = /^(https?:|mailto:)/i;
|
|
2794
|
+
function safeHref(href) {
|
|
2795
|
+
const trimmed = href.trim();
|
|
2796
|
+
return SAFE_HREF.test(trimmed) ? trimmed : null;
|
|
2797
|
+
}
|
|
2798
|
+
function parseReleaseNotes(markdown) {
|
|
2799
|
+
const blocks = [];
|
|
2800
|
+
const lines = markdown.replace(/\r\n?/g, "\n").split("\n");
|
|
2801
|
+
let paragraph = [];
|
|
2802
|
+
let list = null;
|
|
2803
|
+
const flushParagraph = () => {
|
|
2804
|
+
if (paragraph.length) blocks.push({ kind: "paragraph", inline: parseInline(paragraph.join("\n")) });
|
|
2805
|
+
paragraph = [];
|
|
2806
|
+
};
|
|
2807
|
+
const flushList = () => {
|
|
2808
|
+
if (list) blocks.push({ kind: "list", ordered: list.ordered, items: list.items.map((i) => ({ depth: i.depth, inline: parseInline(i.text) })) });
|
|
2809
|
+
list = null;
|
|
2810
|
+
};
|
|
2811
|
+
const flush = () => {
|
|
2812
|
+
flushParagraph();
|
|
2813
|
+
flushList();
|
|
2814
|
+
};
|
|
2815
|
+
for (let i = 0; i < lines.length; i++) {
|
|
2816
|
+
const line = lines[i] ?? "";
|
|
2817
|
+
const fence = FENCE.exec(line);
|
|
2818
|
+
if (fence) {
|
|
2819
|
+
flush();
|
|
2820
|
+
const marker = fence[1] ?? "```";
|
|
2821
|
+
const body = [];
|
|
2822
|
+
for (i++; i < lines.length && !(lines[i] ?? "").trim().startsWith(marker); i++) body.push(lines[i] ?? "");
|
|
2823
|
+
blocks.push({ kind: "code", text: body.join("\n") });
|
|
2824
|
+
continue;
|
|
2825
|
+
}
|
|
2826
|
+
if (!line.trim()) {
|
|
2827
|
+
flush();
|
|
2828
|
+
continue;
|
|
2829
|
+
}
|
|
2830
|
+
const heading = HEADING.exec(line);
|
|
2831
|
+
if (heading) {
|
|
2832
|
+
flush();
|
|
2833
|
+
blocks.push({ kind: "heading", level: heading[1]?.length ?? 1, inline: parseInline(heading[2] ?? "") });
|
|
2834
|
+
continue;
|
|
2835
|
+
}
|
|
2836
|
+
if (RULE.test(line)) {
|
|
2837
|
+
flush();
|
|
2838
|
+
blocks.push({ kind: "rule" });
|
|
2839
|
+
continue;
|
|
2840
|
+
}
|
|
2841
|
+
const item = ITEM.exec(line);
|
|
2842
|
+
if (item) {
|
|
2843
|
+
flushParagraph();
|
|
2844
|
+
const ordered = /\d/.test(item[2] ?? "");
|
|
2845
|
+
if (list && list.ordered !== ordered && (item[1] ?? "").length === 0) flushList();
|
|
2846
|
+
list ??= { ordered, items: [] };
|
|
2847
|
+
list.items.push({ depth: Math.floor((item[1] ?? "").replace(/\t/g, " ").length / 2), text: item[3] ?? "" });
|
|
2848
|
+
continue;
|
|
2849
|
+
}
|
|
2850
|
+
const last = list?.items.at(-1);
|
|
2851
|
+
if (last && /^\s/.test(line)) {
|
|
2852
|
+
last.text += " " + line.trim();
|
|
2853
|
+
continue;
|
|
2854
|
+
}
|
|
2855
|
+
flushList();
|
|
2856
|
+
paragraph.push(line.trim());
|
|
2857
|
+
}
|
|
2858
|
+
flush();
|
|
2859
|
+
return blocks;
|
|
2860
|
+
}
|
|
2861
|
+
var INLINE = /(`+)([\s\S]+?)\1|\*\*([\s\S]+?)\*\*|__([\s\S]+?)__|\*([^*\s][^*]*?)\*|\[([^\]]+)\]\(((?:[^()\s]|\([^()\s]*\))+)(?:\s+"[^"]*")?\)|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+[^\s<.,:;!?)\]'"])/g;
|
|
2862
|
+
function parseInline(text) {
|
|
2863
|
+
const out = [];
|
|
2864
|
+
let at = 0;
|
|
2865
|
+
const push = (node) => {
|
|
2866
|
+
const prev = out.at(-1);
|
|
2867
|
+
if (node.kind === "text" && prev?.kind === "text") prev.text += node.text;
|
|
2868
|
+
else out.push(node);
|
|
2869
|
+
};
|
|
2870
|
+
for (const m of text.matchAll(INLINE)) {
|
|
2871
|
+
const start = m.index;
|
|
2872
|
+
if (start > at) push({ kind: "text", text: text.slice(at, start) });
|
|
2873
|
+
at = start + m[0].length;
|
|
2874
|
+
const [whole, , code, strong, strongAlt, em, label, href, angled, bare] = m;
|
|
2875
|
+
if (code !== void 0) push({ kind: "code", text: code.trim() || code });
|
|
2876
|
+
else if (strong !== void 0 || strongAlt !== void 0) push({ kind: "strong", children: parseInline(strong ?? strongAlt ?? "") });
|
|
2877
|
+
else if (em !== void 0) push({ kind: "em", children: parseInline(em) });
|
|
2878
|
+
else if (label !== void 0 && href !== void 0) {
|
|
2879
|
+
const safe = safeHref(href);
|
|
2880
|
+
if (safe) push({ kind: "link", href: safe, children: parseInline(label) });
|
|
2881
|
+
else for (const node of parseInline(label)) push(node);
|
|
2882
|
+
} else if ((angled ?? bare) !== void 0) {
|
|
2883
|
+
const url = angled ?? bare ?? "";
|
|
2884
|
+
push({ kind: "link", href: url, children: [{ kind: "text", text: url }] });
|
|
2885
|
+
} else push({ kind: "text", text: whole });
|
|
2886
|
+
}
|
|
2887
|
+
if (at < text.length) push({ kind: "text", text: text.slice(at) });
|
|
2888
|
+
return out;
|
|
2889
|
+
}
|
|
2890
|
+
function ReleaseNotes({ notes, onOpenLink, className }) {
|
|
2891
|
+
const blocks = parseReleaseNotes(notes);
|
|
2892
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "release-notes", className: cn("grid gap-1.5 text-sm break-words", className), children: blocks.map((block, i) => /* @__PURE__ */ jsx(Block, { block, onOpenLink }, i)) });
|
|
2893
|
+
}
|
|
2894
|
+
function Block({ block, onOpenLink }) {
|
|
2895
|
+
switch (block.kind) {
|
|
2896
|
+
case "heading":
|
|
2897
|
+
return /* @__PURE__ */ jsx("p", { role: "heading", "aria-level": block.level, className: cn("font-semibold", block.level <= 2 ? "text-sm" : "text-xs", "mt-1 first:mt-0"), children: /* @__PURE__ */ jsx(Inline, { nodes: block.inline, onOpenLink }) });
|
|
2898
|
+
case "paragraph":
|
|
2899
|
+
return /* @__PURE__ */ jsx("p", { className: "whitespace-pre-line", children: /* @__PURE__ */ jsx(Inline, { nodes: block.inline, onOpenLink }) });
|
|
2900
|
+
case "list": {
|
|
2901
|
+
const List = block.ordered ? "ol" : "ul";
|
|
2902
|
+
return /* @__PURE__ */ jsx(List, { className: cn("grid gap-0.5 pl-4", block.ordered ? "list-decimal" : "list-disc"), children: block.items.map((item, i) => /* @__PURE__ */ jsx("li", { style: item.depth ? { marginInlineStart: `${item.depth}rem` } : void 0, children: /* @__PURE__ */ jsx(Inline, { nodes: item.inline, onOpenLink }) }, i)) });
|
|
2903
|
+
}
|
|
2904
|
+
case "code":
|
|
2905
|
+
return /* @__PURE__ */ jsx("pre", { className: "overflow-x-auto rounded-sm bg-muted p-2 font-mono text-xs", children: block.text });
|
|
2906
|
+
case "rule":
|
|
2907
|
+
return /* @__PURE__ */ jsx("hr", { className: "border-border" });
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
function Inline({ nodes, onOpenLink }) {
|
|
2911
|
+
return /* @__PURE__ */ jsx(Fragment, { children: nodes.map((node, i) => {
|
|
2912
|
+
switch (node.kind) {
|
|
2913
|
+
case "text":
|
|
2914
|
+
return node.text;
|
|
2915
|
+
case "code":
|
|
2916
|
+
return /* @__PURE__ */ jsx("code", { className: "rounded-sm bg-muted px-1 font-mono text-[0.85em]", children: node.text }, i);
|
|
2917
|
+
case "strong":
|
|
2918
|
+
return /* @__PURE__ */ jsx("strong", { className: "font-semibold", children: /* @__PURE__ */ jsx(Inline, { nodes: node.children, onOpenLink }) }, i);
|
|
2919
|
+
case "em":
|
|
2920
|
+
return /* @__PURE__ */ jsx("em", { children: /* @__PURE__ */ jsx(Inline, { nodes: node.children, onOpenLink }) }, i);
|
|
2921
|
+
case "link": {
|
|
2922
|
+
const open = onOpenLink ? (e) => {
|
|
2923
|
+
e.preventDefault();
|
|
2924
|
+
onOpenLink(node.href);
|
|
2925
|
+
} : void 0;
|
|
2926
|
+
return /* @__PURE__ */ jsx("a", { href: node.href, target: "_blank", rel: "noopener noreferrer", onClick: open, className: "underline underline-offset-2", children: /* @__PURE__ */ jsx(Inline, { nodes: node.children, onOpenLink }) }, i);
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
}) });
|
|
2930
|
+
}
|
|
2931
|
+
function Segmented({ options, value, onValueChange, label, className }) {
|
|
2932
|
+
return /* @__PURE__ */ jsx("div", { role: "radiogroup", "aria-label": label, className: cn("flex w-full gap-1.5", className), children: options.map((o) => /* @__PURE__ */ jsx(
|
|
2933
|
+
Button,
|
|
2934
|
+
{
|
|
2935
|
+
type: "button",
|
|
2936
|
+
role: "radio",
|
|
2937
|
+
"aria-checked": o.value === value,
|
|
2938
|
+
variant: o.value === value ? "default" : "outline",
|
|
2939
|
+
className: "min-w-0 flex-1",
|
|
2940
|
+
onClick: () => onValueChange(o.value),
|
|
2941
|
+
children: o.label
|
|
2942
|
+
},
|
|
2943
|
+
o.value
|
|
2944
|
+
)) });
|
|
2945
|
+
}
|
|
2946
|
+
function ConsentCheck({ checked, onCheckedChange, label, title, icon, summary, policyLabel, onOpenPolicy, className }) {
|
|
2947
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-4", className), children: [
|
|
2948
|
+
(title || summary || onOpenPolicy) && /* @__PURE__ */ jsxs("div", { className: "space-y-2 border p-3", children: [
|
|
2949
|
+
title && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm font-medium [&_svg]:size-4", children: [
|
|
2950
|
+
icon,
|
|
2951
|
+
title
|
|
2952
|
+
] }),
|
|
2953
|
+
summary && /* @__PURE__ */ jsx("p", { className: "text-xs leading-relaxed text-muted-foreground", children: summary }),
|
|
2954
|
+
onOpenPolicy && policyLabel && /* @__PURE__ */ jsx("button", { type: "button", className: "text-xs font-medium text-primary underline underline-offset-4", onClick: onOpenPolicy, children: policyLabel })
|
|
2955
|
+
] }),
|
|
2956
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
2957
|
+
/* @__PURE__ */ jsx(Checkbox, { id: "lyra-consent", checked, onCheckedChange: (v) => onCheckedChange(v === true), className: "mt-0.5" }),
|
|
2958
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "lyra-consent", className: "text-sm leading-relaxed font-normal", children: label })
|
|
2959
|
+
] })
|
|
2960
|
+
] });
|
|
2961
|
+
}
|
|
2962
|
+
function Onboarding({ steps, labels, onDone, className }) {
|
|
2963
|
+
const [index, setIndex] = useState(0);
|
|
2964
|
+
const at = Math.min(index, steps.length - 1);
|
|
2965
|
+
const step = steps[at];
|
|
2966
|
+
if (!step) return null;
|
|
2967
|
+
const last = at === steps.length - 1;
|
|
2968
|
+
const blocked = step.canContinue === false;
|
|
2969
|
+
return /* @__PURE__ */ jsxs(
|
|
2970
|
+
"div",
|
|
2971
|
+
{
|
|
2972
|
+
className: cn(
|
|
2973
|
+
"flex h-full flex-col overflow-y-auto px-6 pt-[calc(env(safe-area-inset-top)+2rem)] pb-[calc(env(safe-area-inset-bottom)+1.5rem)]",
|
|
2974
|
+
className
|
|
2975
|
+
),
|
|
2976
|
+
children: [
|
|
2977
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 animate-in flex-col gap-4 duration-300 fade-in slide-in-from-right-4", children: [
|
|
2978
|
+
step.icon && /* @__PURE__ */ jsx("div", { className: "text-primary [&_svg]:size-10", children: step.icon }),
|
|
2979
|
+
/* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold", children: step.title }),
|
|
2980
|
+
step.description && /* @__PURE__ */ jsx("p", { className: "text-sm leading-relaxed text-muted-foreground", children: step.description }),
|
|
2981
|
+
step.content
|
|
2982
|
+
] }, step.id),
|
|
2983
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-6 flex items-center gap-3", children: [
|
|
2984
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-1 gap-1.5", "aria-hidden": true, children: steps.map((s, i) => /* @__PURE__ */ jsx("span", { className: cn("h-1.5 transition-all", i === at ? "w-6 bg-primary" : "w-1.5 bg-muted-foreground/40") }, s.id)) }),
|
|
2985
|
+
at > 0 && /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", onClick: () => setIndex(at - 1), children: labels.back }),
|
|
2986
|
+
/* @__PURE__ */ jsx(Button, { type: "button", size: "lg", disabled: blocked, onClick: () => last ? onDone() : setIndex(at + 1), children: last ? labels.done : labels.next })
|
|
2987
|
+
] })
|
|
2988
|
+
]
|
|
2989
|
+
}
|
|
2990
|
+
);
|
|
2991
|
+
}
|
|
2992
|
+
function Hint({ storageKey, children, icon, when = true, dismissLabel = "Dismiss", className }) {
|
|
2993
|
+
const [seen, markSeen, ready] = useSeen(storageKey);
|
|
2994
|
+
if (!ready || seen || !when) return null;
|
|
2995
|
+
return /* @__PURE__ */ jsxs("div", { role: "note", className: cn("flex animate-in items-start gap-2 border bg-popover p-3 text-sm text-popover-foreground shadow-md fade-in", className), children: [
|
|
2996
|
+
icon && /* @__PURE__ */ jsx("span", { className: "mt-0.5 shrink-0 text-primary [&_svg]:size-4", children: icon }),
|
|
2997
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1 leading-relaxed", children }),
|
|
2998
|
+
/* @__PURE__ */ jsx("button", { type: "button", "aria-label": dismissLabel, onClick: markSeen, className: "-m-1 shrink-0 p-1 text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ jsx(XIcon, { className: "size-4" }) })
|
|
2999
|
+
] });
|
|
3000
|
+
}
|
|
3001
|
+
function ListSectionTitle({ className, ...props }) {
|
|
3002
|
+
return /* @__PURE__ */ jsx("h2", { "data-slot": "list-section-title", className: cn("py-2 text-xs text-muted-foreground", className), ...props });
|
|
3003
|
+
}
|
|
3004
|
+
function ListSection({ title, footer, className, children }) {
|
|
3005
|
+
return /* @__PURE__ */ jsxs("section", { "data-slot": "list-section", className, children: [
|
|
3006
|
+
title && /* @__PURE__ */ jsx(ListSectionTitle, { children: title }),
|
|
3007
|
+
/* @__PURE__ */ jsx(Card, { className: "gap-0 divide-y divide-border p-0 shadow-none", children }),
|
|
3008
|
+
footer && /* @__PURE__ */ jsx("p", { className: "pt-2 text-xs text-muted-foreground", children: footer })
|
|
3009
|
+
] });
|
|
3010
|
+
}
|
|
3011
|
+
function ListLabel({ icon: Icon, inset, label, hint }) {
|
|
3012
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex min-w-0 items-center gap-3", inset && !Icon && "pl-8"), children: [
|
|
3013
|
+
Icon && /* @__PURE__ */ jsx(Icon, { className: "size-5 shrink-0 text-muted-foreground" }),
|
|
3014
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
3015
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm", children: label }),
|
|
3016
|
+
hint && /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: hint })
|
|
3017
|
+
] })
|
|
3018
|
+
] });
|
|
3019
|
+
}
|
|
3020
|
+
var row = "flex w-full items-center justify-between gap-4 px-3 py-3 text-left";
|
|
3021
|
+
function ListItem({ icon, inset, label, hint, value, className, ...props }) {
|
|
3022
|
+
return /* @__PURE__ */ jsxs(
|
|
3023
|
+
"button",
|
|
3024
|
+
{
|
|
3025
|
+
type: "button",
|
|
3026
|
+
"data-slot": "list-item",
|
|
3027
|
+
className: cn(row, "active:bg-muted disabled:opacity-50", className),
|
|
3028
|
+
...props,
|
|
3029
|
+
children: [
|
|
3030
|
+
/* @__PURE__ */ jsx(ListLabel, { icon, inset, label, hint }),
|
|
3031
|
+
/* @__PURE__ */ jsxs("span", { className: "flex shrink-0 items-center gap-1 text-sm text-muted-foreground", children: [
|
|
3032
|
+
value,
|
|
3033
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "size-4" })
|
|
3034
|
+
] })
|
|
3035
|
+
]
|
|
3036
|
+
}
|
|
3037
|
+
);
|
|
3038
|
+
}
|
|
3039
|
+
function ListRow({ icon, inset, label, hint, className, children }) {
|
|
3040
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "list-row", className: cn(row, className), children: [
|
|
3041
|
+
/* @__PURE__ */ jsx(ListLabel, { icon, inset, label, hint }),
|
|
3042
|
+
children && /* @__PURE__ */ jsx("div", { className: "shrink-0", children })
|
|
3043
|
+
] });
|
|
3044
|
+
}
|
|
3045
|
+
|
|
3046
|
+
export { AuthCard, AvatarTile, BarList, BlockedContext, BlockedDialog, ChoiceDrawer, ColorSwatches, ConfigListDialog, ConfirmContext, ConfirmDialog, ConfirmProvider, ConfirmReasonContext, ConnectionTree, ConsentCheck, DateField, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HOST_KEY_CHANGED, HOST_KEY_UNKNOWN, Hint, ListItem, ListRow, ListSection, ListSectionTitle, LlmSettings, LockedReason, McpSettings, MobileSheet, Onboarding, OptionPicker, Panel, PanelCard, ProxyFields, ReleaseNotes, Segmented, SshFields, StatTile, TagInput, TlsFields, TreeDndProvider, TreeExpander, TreeIcon, TreeLabel, TreeLines, TreeNode, TreeNodeContent, TreeNodeTrigger, TreeProvider, TreeView, TzPicker, UnsavedBadge, buildConnectionTree, connectionNameMatches, datePattern, filterTree, flattenTree, formatDate, hostKeyAsk, loadExpanded, moveId, parseDate, planDrop, proxyDefaults, retryAfterTrust, sameOrder, saveExpanded, sharedWhilePending, sortTree, sshDefaults, tlsDefaults, useBlocked, useConfirm, useConfirmReason, useFormField, useHostKeyTrust, useTreeDndNode, useTreeDndRoot };
|
|
2087
3047
|
//# sourceMappingURL=index.js.map
|
|
2088
3048
|
//# sourceMappingURL=index.js.map
|