@canton-network/core-wallet-ui-components 1.16.0 → 1.18.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.
Files changed (220) hide show
  1. package/dist/activity-utils-CmKMEsoq.cjs +4 -0
  2. package/dist/activity-utils-CmKMEsoq.cjs.map +1 -0
  3. package/dist/activity-utils-DI0OIiL2.js +1744 -0
  4. package/dist/activity-utils-DI0OIiL2.js.map +1 -0
  5. package/dist/components/api-key-card.d.ts +1 -1
  6. package/dist/components/api-key-card.d.ts.map +1 -1
  7. package/dist/components/api-key-form.d.ts +1 -1
  8. package/dist/components/api-key-form.d.ts.map +1 -1
  9. package/dist/components/app-header.d.ts +6 -6
  10. package/dist/components/app-header.d.ts.map +1 -1
  11. package/dist/components/app-layout.d.ts +6 -6
  12. package/dist/components/app-layout.d.ts.map +1 -1
  13. package/dist/components/auth-editor.d.ts +3 -3
  14. package/dist/components/auth-editor.d.ts.map +1 -1
  15. package/dist/components/back-link.d.ts +2 -2
  16. package/dist/components/back-link.d.ts.map +1 -1
  17. package/dist/components/copy-button.d.ts +3 -3
  18. package/dist/components/copy-button.d.ts.map +1 -1
  19. package/dist/components/custom-toast.d.ts +5 -5
  20. package/dist/components/custom-toast.d.ts.map +1 -1
  21. package/dist/components/error-page.d.ts +5 -5
  22. package/dist/components/error-page.d.ts.map +1 -1
  23. package/dist/components/form-input.d.ts +6 -6
  24. package/dist/components/form-input.d.ts.map +1 -1
  25. package/dist/components/idp-card.d.ts +2 -2
  26. package/dist/components/idp-card.d.ts.map +1 -1
  27. package/dist/components/idp-form.d.ts +3 -3
  28. package/dist/components/idp-form.d.ts.map +1 -1
  29. package/dist/components/loading-state.d.ts +1 -1
  30. package/dist/components/loading-state.d.ts.map +1 -1
  31. package/dist/components/login-form.d.ts +5 -5
  32. package/dist/components/login-form.d.ts.map +1 -1
  33. package/dist/components/message-detail.d.ts +30 -0
  34. package/dist/components/message-detail.d.ts.map +1 -0
  35. package/dist/components/network-card.d.ts +4 -4
  36. package/dist/components/network-card.d.ts.map +1 -1
  37. package/dist/components/network-form.d.ts +1 -1
  38. package/dist/components/network-form.d.ts.map +1 -1
  39. package/dist/components/not-found.d.ts +1 -1
  40. package/dist/components/not-found.d.ts.map +1 -1
  41. package/dist/components/pagination.d.ts +3 -3
  42. package/dist/components/pagination.d.ts.map +1 -1
  43. package/dist/components/transaction-card.d.ts +9 -9
  44. package/dist/components/transaction-card.d.ts.map +1 -1
  45. package/dist/components/transaction-detail.d.ts +16 -16
  46. package/dist/components/transaction-detail.d.ts.map +1 -1
  47. package/dist/components/wallet-card.d.ts +5 -5
  48. package/dist/components/wallet-card.d.ts.map +1 -1
  49. package/dist/components/wallet-create-form.d.ts +3 -3
  50. package/dist/components/wallet-create-form.d.ts.map +1 -1
  51. package/dist/components/wallet-edit-form.d.ts +2 -2
  52. package/dist/components/wallet-edit-form.d.ts.map +1 -1
  53. package/dist/components/wallet-form.d.ts +8 -4
  54. package/dist/components/wallet-form.d.ts.map +1 -1
  55. package/dist/components/wallet-picker.d.ts +14 -2
  56. package/dist/components/wallet-picker.d.ts.map +1 -1
  57. package/dist/components/wallets-sync.d.ts +1 -1
  58. package/dist/components/wallets-sync.d.ts.map +1 -1
  59. package/dist/handle-errors.d.ts +2 -7
  60. package/dist/handle-errors.d.ts.map +1 -1
  61. package/dist/index.cjs +740 -743
  62. package/dist/index.cjs.map +1 -1
  63. package/dist/index.css +2 -1
  64. package/dist/index.d.ts +1 -3
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +13001 -8818
  67. package/dist/index.js.map +1 -1
  68. package/dist/internal/activity-render.d.ts +2 -0
  69. package/dist/internal/activity-render.d.ts.map +1 -0
  70. package/dist/internal/activity-utils.d.ts +2 -0
  71. package/dist/internal/activity-utils.d.ts.map +1 -1
  72. package/dist/internal/error-toast.d.ts +12 -0
  73. package/dist/internal/error-toast.d.ts.map +1 -0
  74. package/dist/react/components/ApiKeyCard.d.ts +8 -0
  75. package/dist/react/components/ApiKeyCard.d.ts.map +1 -0
  76. package/dist/react/components/ApiKeyForm.d.ts +8 -0
  77. package/dist/react/components/ApiKeyForm.d.ts.map +1 -0
  78. package/dist/react/components/AppHeader.d.ts +30 -0
  79. package/dist/react/components/AppHeader.d.ts.map +1 -0
  80. package/dist/react/components/ApprovalActions.d.ts +20 -0
  81. package/dist/react/components/ApprovalActions.d.ts.map +1 -0
  82. package/dist/react/components/AuthEditor.d.ts +21 -0
  83. package/dist/react/components/AuthEditor.d.ts.map +1 -0
  84. package/dist/react/components/BackLink.d.ts +18 -0
  85. package/dist/react/components/BackLink.d.ts.map +1 -0
  86. package/dist/react/components/CardDetailRow.d.ts +15 -0
  87. package/dist/react/components/CardDetailRow.d.ts.map +1 -0
  88. package/dist/react/components/CopyButton.d.ts +8 -0
  89. package/dist/react/components/CopyButton.d.ts.map +1 -0
  90. package/dist/react/components/ErrorPage.d.ts +10 -0
  91. package/dist/react/components/ErrorPage.d.ts.map +1 -0
  92. package/dist/react/components/IdpCard.d.ts +9 -0
  93. package/dist/react/components/IdpCard.d.ts.map +1 -0
  94. package/dist/react/components/IdpForm.d.ts +19 -0
  95. package/dist/react/components/IdpForm.d.ts.map +1 -0
  96. package/dist/react/components/LoadingState.d.ts +7 -0
  97. package/dist/react/components/LoadingState.d.ts.map +1 -0
  98. package/dist/react/components/LoginForm.d.ts +30 -0
  99. package/dist/react/components/LoginForm.d.ts.map +1 -0
  100. package/dist/react/components/MessageDetail.d.ts +27 -0
  101. package/dist/react/components/MessageDetail.d.ts.map +1 -0
  102. package/dist/react/components/NetworkCard.d.ts +13 -0
  103. package/dist/react/components/NetworkCard.d.ts.map +1 -0
  104. package/dist/react/components/NetworkForm.d.ts +17 -0
  105. package/dist/react/components/NetworkForm.d.ts.map +1 -0
  106. package/dist/react/components/Pagination.d.ts +13 -0
  107. package/dist/react/components/Pagination.d.ts.map +1 -0
  108. package/dist/react/components/SigningProviderSelect.d.ts +15 -0
  109. package/dist/react/components/SigningProviderSelect.d.ts.map +1 -0
  110. package/dist/react/components/Toast.d.ts +20 -0
  111. package/dist/react/components/Toast.d.ts.map +1 -0
  112. package/dist/react/components/TransactionCard.d.ts +17 -0
  113. package/dist/react/components/TransactionCard.d.ts.map +1 -0
  114. package/dist/react/components/TransactionDetail.d.ts +29 -0
  115. package/dist/react/components/TransactionDetail.d.ts.map +1 -0
  116. package/dist/react/components/WalletCard.d.ts +21 -0
  117. package/dist/react/components/WalletCard.d.ts.map +1 -0
  118. package/dist/react/components/WalletCreateForm.d.ts +35 -0
  119. package/dist/react/components/WalletCreateForm.d.ts.map +1 -0
  120. package/dist/react/components/WalletEditForm.d.ts +35 -0
  121. package/dist/react/components/WalletEditForm.d.ts.map +1 -0
  122. package/dist/react/components/WalletForm.d.ts +25 -0
  123. package/dist/react/components/WalletForm.d.ts.map +1 -0
  124. package/dist/react/components/WalletsSync.d.ts +13 -0
  125. package/dist/react/components/WalletsSync.d.ts.map +1 -0
  126. package/dist/react/contexts/ToastContext.d.ts +14 -0
  127. package/dist/react/contexts/ToastContext.d.ts.map +1 -0
  128. package/dist/react/contexts/ToastProvider.d.ts +10 -0
  129. package/dist/react/contexts/ToastProvider.d.ts.map +1 -0
  130. package/dist/react/hooks/useErrorToast.d.ts +8 -0
  131. package/dist/react/hooks/useErrorToast.d.ts.map +1 -0
  132. package/dist/react/hooks/useToast.d.ts +4 -0
  133. package/dist/react/hooks/useToast.d.ts.map +1 -0
  134. package/dist/react/index.cjs +19 -0
  135. package/dist/react/index.cjs.map +1 -0
  136. package/dist/react/index.d.ts +31 -0
  137. package/dist/react/index.d.ts.map +1 -0
  138. package/dist/react/index.js +2011 -0
  139. package/dist/react/index.js.map +1 -0
  140. package/dist/react/logger.d.ts +2 -0
  141. package/dist/react/logger.d.ts.map +1 -0
  142. package/dist/routing.d.ts +1 -1
  143. package/dist/routing.d.ts.map +1 -1
  144. package/dist/windows/popup.d.ts.map +1 -1
  145. package/dist/windows/wallet-picker.d.ts.map +1 -1
  146. package/package.json +57 -26
  147. package/dist/components/api-key-card.test.d.ts +0 -1
  148. package/dist/components/api-key-card.test.d.ts.map +0 -1
  149. package/dist/components/api-key-form.test.d.ts +0 -1
  150. package/dist/components/api-key-form.test.d.ts.map +0 -1
  151. package/dist/components/app-header.test.d.ts +0 -1
  152. package/dist/components/app-header.test.d.ts.map +0 -1
  153. package/dist/components/app-layout.test.d.ts +0 -2
  154. package/dist/components/app-layout.test.d.ts.map +0 -1
  155. package/dist/components/auth-editor.test.d.ts +0 -1
  156. package/dist/components/auth-editor.test.d.ts.map +0 -1
  157. package/dist/components/back-link.test.d.ts +0 -2
  158. package/dist/components/back-link.test.d.ts.map +0 -1
  159. package/dist/components/copy-button.test.d.ts +0 -1
  160. package/dist/components/copy-button.test.d.ts.map +0 -1
  161. package/dist/components/custom-toast.test.d.ts +0 -1
  162. package/dist/components/custom-toast.test.d.ts.map +0 -1
  163. package/dist/components/error-page.test.d.ts +0 -2
  164. package/dist/components/error-page.test.d.ts.map +0 -1
  165. package/dist/components/fixtures.d.ts +0 -15
  166. package/dist/components/fixtures.d.ts.map +0 -1
  167. package/dist/components/form-input.test.d.ts +0 -1
  168. package/dist/components/form-input.test.d.ts.map +0 -1
  169. package/dist/components/idp-card.test.d.ts +0 -1
  170. package/dist/components/idp-card.test.d.ts.map +0 -1
  171. package/dist/components/idp-form.test.d.ts +0 -2
  172. package/dist/components/idp-form.test.d.ts.map +0 -1
  173. package/dist/components/loading-state.test.d.ts +0 -2
  174. package/dist/components/loading-state.test.d.ts.map +0 -1
  175. package/dist/components/login-form.test.d.ts +0 -2
  176. package/dist/components/login-form.test.d.ts.map +0 -1
  177. package/dist/components/network-card.test.d.ts +0 -1
  178. package/dist/components/network-card.test.d.ts.map +0 -1
  179. package/dist/components/network-form.test.d.ts +0 -1
  180. package/dist/components/network-form.test.d.ts.map +0 -1
  181. package/dist/components/network-table.d.ts +0 -10
  182. package/dist/components/network-table.d.ts.map +0 -1
  183. package/dist/components/network-table.test.d.ts +0 -1
  184. package/dist/components/network-table.test.d.ts.map +0 -1
  185. package/dist/components/networks.d.ts +0 -16
  186. package/dist/components/networks.d.ts.map +0 -1
  187. package/dist/components/networks.test.d.ts +0 -2
  188. package/dist/components/networks.test.d.ts.map +0 -1
  189. package/dist/components/not-found.test.d.ts +0 -2
  190. package/dist/components/not-found.test.d.ts.map +0 -1
  191. package/dist/components/pagination.test.d.ts +0 -1
  192. package/dist/components/pagination.test.d.ts.map +0 -1
  193. package/dist/components/sessions.d.ts +0 -8
  194. package/dist/components/sessions.d.ts.map +0 -1
  195. package/dist/components/sessions.test.d.ts +0 -1
  196. package/dist/components/sessions.test.d.ts.map +0 -1
  197. package/dist/components/transaction-card.test.d.ts +0 -1
  198. package/dist/components/transaction-card.test.d.ts.map +0 -1
  199. package/dist/components/transaction-detail.test.d.ts +0 -1
  200. package/dist/components/transaction-detail.test.d.ts.map +0 -1
  201. package/dist/components/wallet-card.test.d.ts +0 -1
  202. package/dist/components/wallet-card.test.d.ts.map +0 -1
  203. package/dist/components/wallet-create-form.test.d.ts +0 -1
  204. package/dist/components/wallet-create-form.test.d.ts.map +0 -1
  205. package/dist/components/wallet-edit-form.test.d.ts +0 -1
  206. package/dist/components/wallet-edit-form.test.d.ts.map +0 -1
  207. package/dist/components/wallet-picker.test.d.ts +0 -1
  208. package/dist/components/wallet-picker.test.d.ts.map +0 -1
  209. package/dist/components/wallets-sync.test.d.ts +0 -1
  210. package/dist/components/wallets-sync.test.d.ts.map +0 -1
  211. package/dist/handle-errors.test.d.ts +0 -1
  212. package/dist/handle-errors.test.d.ts.map +0 -1
  213. package/dist/routing.test.d.ts +0 -2
  214. package/dist/routing.test.d.ts.map +0 -1
  215. package/dist/utils.test.d.ts +0 -2
  216. package/dist/utils.test.d.ts.map +0 -1
  217. package/dist/windows/popup.test.d.ts +0 -2
  218. package/dist/windows/popup.test.d.ts.map +0 -1
  219. package/dist/windows/wallet-picker.test.d.ts +0 -2
  220. package/dist/windows/wallet-picker.test.d.ts.map +0 -1
@@ -0,0 +1,2011 @@
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, s as o, t as s } from "../activity-utils-DI0OIiL2.js";
2
+ import { Alert as c, AlertTitle as l, AppBar as u, Box as d, Button as f, Card as p, CardActionArea as m, CardActions as h, CardContent as g, Checkbox as _, Chip as v, CircularProgress as y, Collapse as b, Divider as x, FormControlLabel as S, IconButton as C, InputAdornment as w, Link as T, ListItemIcon as E, ListItemText as D, Menu as O, MenuItem as k, Paper as A, Snackbar as j, Stack as M, TextField as N, Toolbar as ee, Tooltip as te, Typography as P, useTheme as ne } from "@mui/material";
3
+ import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
4
+ import { createContext as re, memo as ie, useCallback as R, useContext as ae, useEffect as oe, useId as se, useMemo as ce, useRef as le, useState as z } from "react";
5
+ import ue from "@mui/icons-material/Menu";
6
+ import de from "@mui/icons-material/ContentCopy";
7
+ import fe from "@mui/icons-material/ChevronLeft";
8
+ import pe from "@mui/icons-material/WarningAmber";
9
+ import B from "@mui/icons-material/ArrowBack";
10
+ import me from "@mui/icons-material/Refresh";
11
+ import { keyframes as he } from "@mui/material/styles";
12
+ import ge from "@mui/icons-material/ArrowForward";
13
+ import _e from "@mui/icons-material/ExpandMore";
14
+ // src/react/components/CardDetailRow.tsx
15
+ var V = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, muted: r = !1, action: i }) => {
16
+ let a = typeof t == "string";
17
+ return /* @__PURE__ */ L(d, {
18
+ sx: {
19
+ display: "flex",
20
+ alignItems: "center",
21
+ gap: 2,
22
+ minWidth: 0,
23
+ minHeight: 40
24
+ },
25
+ children: [
26
+ /* @__PURE__ */ I(P, {
27
+ variant: "body2",
28
+ noWrap: !0,
29
+ sx: {
30
+ fontWeight: "bold",
31
+ flexShrink: 0,
32
+ minWidth: "8rem"
33
+ },
34
+ children: e
35
+ }),
36
+ /* @__PURE__ */ I(P, {
37
+ variant: "body2",
38
+ component: "div",
39
+ noWrap: a,
40
+ title: a ? n : void 0,
41
+ color: r ? "text.secondary" : "text.primary",
42
+ sx: {
43
+ flex: 1,
44
+ minWidth: 0,
45
+ textAlign: "right",
46
+ ...!a && {
47
+ display: "flex",
48
+ flexWrap: "wrap",
49
+ alignItems: "center",
50
+ justifyContent: "flex-end",
51
+ gap: .5
52
+ }
53
+ },
54
+ children: t
55
+ }),
56
+ i && /* @__PURE__ */ I(d, {
57
+ sx: {
58
+ position: "relative",
59
+ zIndex: 1,
60
+ flexShrink: 0
61
+ },
62
+ children: i
63
+ })
64
+ ]
65
+ });
66
+ }, ve = ({ apiKey: e, onRevoke: t }) => /* @__PURE__ */ L(p, { children: [
67
+ /* @__PURE__ */ L(g, { children: [/* @__PURE__ */ I(P, {
68
+ variant: "body1",
69
+ sx: {
70
+ mb: 2,
71
+ fontWeight: "bold"
72
+ },
73
+ children: e.name
74
+ }), /* @__PURE__ */ L(M, {
75
+ spacing: 1,
76
+ children: [/* @__PURE__ */ I(V, {
77
+ label: "ID",
78
+ value: e.id
79
+ }), /* @__PURE__ */ I(V, {
80
+ label: "Created At",
81
+ value: e.createdAt
82
+ })]
83
+ })] }),
84
+ /* @__PURE__ */ I(x, {}),
85
+ /* @__PURE__ */ I(h, { children: /* @__PURE__ */ I(f, {
86
+ color: "error",
87
+ onClick: () => t(e),
88
+ children: "Revoke"
89
+ }) })
90
+ ] }), ye = () => /* @__PURE__ */ I(y, {
91
+ size: 16,
92
+ color: "inherit",
93
+ "aria-hidden": "true"
94
+ }), H = ({ onApprove: e, onReject: t, approveLabel: n = "Approve", approving: r = !1, rejecting: i = !1, signing: a = !1, disabled: o = !1 }) => /* @__PURE__ */ L(M, {
95
+ direction: "row",
96
+ spacing: 2,
97
+ children: [t && /* @__PURE__ */ I(f, {
98
+ variant: "outlined",
99
+ color: "error",
100
+ fullWidth: !0,
101
+ disabled: o || r || i,
102
+ startIcon: i ? /* @__PURE__ */ I(ye, {}) : void 0,
103
+ onClick: t,
104
+ children: "Reject"
105
+ }), /* @__PURE__ */ I(f, {
106
+ variant: "contained",
107
+ fullWidth: !0,
108
+ disabled: o || r || i || a,
109
+ startIcon: r || a ? /* @__PURE__ */ I(ye, {}) : void 0,
110
+ onClick: e,
111
+ children: n
112
+ })]
113
+ }), be = ({ onGenerate: e }) => {
114
+ let [t, n] = z("");
115
+ return /* @__PURE__ */ L(d, {
116
+ component: "form",
117
+ onSubmit: (n) => {
118
+ n.preventDefault(), e({ name: t });
119
+ },
120
+ sx: {
121
+ display: "flex",
122
+ flexDirection: "column",
123
+ height: "100%"
124
+ },
125
+ children: [/* @__PURE__ */ I(M, {
126
+ spacing: 2,
127
+ children: /* @__PURE__ */ I(N, {
128
+ label: "Name",
129
+ required: !0,
130
+ fullWidth: !0,
131
+ value: t,
132
+ onChange: (e) => n(e.target.value)
133
+ })
134
+ }), /* @__PURE__ */ I(d, {
135
+ sx: {
136
+ mt: "auto",
137
+ pt: 3
138
+ },
139
+ children: /* @__PURE__ */ I(f, {
140
+ type: "submit",
141
+ variant: "contained",
142
+ fullWidth: !0,
143
+ children: "Generate"
144
+ })
145
+ })]
146
+ });
147
+ }, xe = ({ online: e }) => /* @__PURE__ */ I(d, { sx: {
148
+ display: "inline-block",
149
+ flexShrink: 0,
150
+ width: "10px",
151
+ height: "10px",
152
+ borderRadius: "50%",
153
+ bgcolor: e ? "success.main" : "text.disabled"
154
+ } }), Se = [
155
+ {
156
+ label: "Parties",
157
+ href: "/parties/"
158
+ },
159
+ {
160
+ label: "Activities",
161
+ href: "/activities/"
162
+ },
163
+ {
164
+ label: "Networks",
165
+ href: "/networks/"
166
+ },
167
+ {
168
+ label: "API Keys",
169
+ href: "/api-keys/"
170
+ },
171
+ {
172
+ label: "Identity Providers",
173
+ href: "/identity-providers/"
174
+ }
175
+ ], Ce = ({ iconSrc: e = r, networkName: t = "No network connected", networkConnected: n = !1, dappApiUrl: i, homeHref: a = "/", navItems: o, onLogout: s, onDappApiUrlCopy: c }) => {
176
+ let [l, f] = z(null), p = !!l, m = se(), h = () => f(null), g = ne().components?.MuiButtonBase?.defaultProps?.LinkComponent ?? "a";
177
+ return /* @__PURE__ */ L(u, {
178
+ position: "sticky",
179
+ color: "default",
180
+ children: [/* @__PURE__ */ L(ee, {
181
+ sx: {
182
+ display: "grid",
183
+ gridTemplateColumns: "minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr)",
184
+ alignItems: "center",
185
+ gap: 1
186
+ },
187
+ children: [
188
+ /* @__PURE__ */ I(C, {
189
+ href: a,
190
+ "aria-label": "Go to home",
191
+ sx: {
192
+ justifySelf: "start",
193
+ p: .5
194
+ },
195
+ children: /* @__PURE__ */ I(d, {
196
+ component: "img",
197
+ src: e,
198
+ alt: "",
199
+ sx: {
200
+ height: 30,
201
+ display: "block"
202
+ }
203
+ })
204
+ }),
205
+ /* @__PURE__ */ L(d, {
206
+ title: t,
207
+ "data-testid": `network-status-${n ? "connected" : "disconnected"}`,
208
+ sx: {
209
+ display: "flex",
210
+ alignItems: "center",
211
+ gap: 1,
212
+ minWidth: 0,
213
+ maxWidth: "min(52vw, 420px)"
214
+ },
215
+ children: [/* @__PURE__ */ I(xe, { online: n }), /* @__PURE__ */ I(P, {
216
+ variant: "subtitle1",
217
+ noWrap: !0,
218
+ children: t
219
+ })]
220
+ }),
221
+ /* @__PURE__ */ I(C, {
222
+ "aria-label": "menu",
223
+ "aria-controls": p ? m : void 0,
224
+ "aria-haspopup": "true",
225
+ "aria-expanded": p ? "true" : void 0,
226
+ onClick: (e) => f(e.currentTarget),
227
+ sx: { justifySelf: "end" },
228
+ children: /* @__PURE__ */ I(ue, {})
229
+ })
230
+ ]
231
+ }), /* @__PURE__ */ L(O, {
232
+ id: m,
233
+ anchorEl: l,
234
+ open: p,
235
+ onClose: h,
236
+ children: [
237
+ o.map(({ label: e, href: t }) => /* @__PURE__ */ I(k, {
238
+ component: g,
239
+ href: t,
240
+ onClick: h,
241
+ children: e
242
+ }, t)),
243
+ c && /* @__PURE__ */ L(k, {
244
+ title: i || "Copy dApp API URL",
245
+ "aria-label": i ? `Copy dApp API URL: ${i}` : "Copy dApp API URL",
246
+ onClick: () => {
247
+ h(), c();
248
+ },
249
+ children: [/* @__PURE__ */ I(D, { children: "Dapp API URL" }), /* @__PURE__ */ I(E, {
250
+ sx: { justifyContent: "flex-end" },
251
+ children: /* @__PURE__ */ I(de, { fontSize: "small" })
252
+ })]
253
+ }),
254
+ /* @__PURE__ */ I(x, {}),
255
+ /* @__PURE__ */ I(k, {
256
+ onClick: () => {
257
+ h(), s();
258
+ },
259
+ children: "Logout"
260
+ })
261
+ ]
262
+ })]
263
+ });
264
+ }, we = [
265
+ "authorization_code",
266
+ "client_credentials",
267
+ "self_signed",
268
+ "self_issued"
269
+ ], U = (e) => typeof e?.method == "string", Te = (e) => {
270
+ switch (e) {
271
+ case "authorization_code": return {
272
+ method: e,
273
+ clientId: "",
274
+ audience: "",
275
+ scope: ""
276
+ };
277
+ case "client_credentials": return {
278
+ method: e,
279
+ clientId: "",
280
+ audience: "",
281
+ scope: "",
282
+ clientSecret: ""
283
+ };
284
+ case "self_issued": return {
285
+ method: e,
286
+ audience: "",
287
+ scope: ""
288
+ };
289
+ case "self_signed": return {
290
+ method: e,
291
+ clientId: "",
292
+ audience: "",
293
+ scope: "",
294
+ issuer: "",
295
+ clientSecret: ""
296
+ };
297
+ }
298
+ }, Ee = (e) => e ? "********" : "(not set)", De = (e) => {
299
+ let t = [
300
+ {
301
+ key: "Method",
302
+ value: e.method
303
+ },
304
+ {
305
+ key: "Audience",
306
+ value: e.audience ?? ""
307
+ },
308
+ {
309
+ key: "Scope",
310
+ value: e.scope ?? ""
311
+ }
312
+ ];
313
+ return "clientId" in e && t.splice(1, 0, {
314
+ key: "Client Id",
315
+ value: e.clientId ?? ""
316
+ }), "issuer" in e && t.push({
317
+ key: "Issuer",
318
+ value: e.issuer ?? ""
319
+ }), "clientSecret" in e && t.push({
320
+ key: "Client Secret",
321
+ value: Ee(e.clientSecret)
322
+ }), e.method === "client_credentials" && e.identityProviderId && t.push({
323
+ key: "Identity Provider Id",
324
+ value: e.identityProviderId
325
+ }), t;
326
+ }, Oe = (e, t) => {
327
+ let n = "clientId" in e ? e.clientId : "", r = e.audience ?? "", i = e.scope ?? "";
328
+ switch (t) {
329
+ case "authorization_code": return {
330
+ method: t,
331
+ clientId: n,
332
+ audience: r,
333
+ scope: i
334
+ };
335
+ case "self_signed": return {
336
+ method: t,
337
+ clientId: n,
338
+ audience: r,
339
+ scope: i,
340
+ issuer: e.issuer ?? "",
341
+ clientSecret: e.clientSecret ?? ""
342
+ };
343
+ case "self_issued": return {
344
+ method: t,
345
+ audience: r,
346
+ scope: i
347
+ };
348
+ case "client_credentials": return {
349
+ method: t,
350
+ ...e.method === "client_credentials" && e.identityProviderId ? { identityProviderId: e.identityProviderId } : {},
351
+ clientId: n,
352
+ audience: r,
353
+ scope: i,
354
+ clientSecret: e.clientSecret ?? ""
355
+ };
356
+ default: throw Error(`Unsupported auth method: ${String(t)}`);
357
+ }
358
+ }, W = ({ label: e, testId: t, value: n, onChange: r, required: i = !1, placeholder: a, helperText: o }) => /* @__PURE__ */ I(N, {
359
+ label: e,
360
+ required: i,
361
+ fullWidth: !0,
362
+ value: n,
363
+ placeholder: a,
364
+ helperText: o,
365
+ onChange: (e) => r(e.target.value),
366
+ slotProps: { htmlInput: { "data-test-id": t } }
367
+ }), ke = ({ auth: e, onChange: t, allowedMethods: n = we, optional: r = !1, label: i = "auth" }) => {
368
+ let a = `No ${i} configured.`, o = `${i.charAt(0).toUpperCase()}${i.slice(1)} will be removed after submitting this form.`, [s, l] = z(() => r ? U(e) ? "view" : "none" : "edit"), [u, p] = z(), [m, h] = z(""), g = () => {
369
+ h(""), l("add");
370
+ }, _ = () => {
371
+ e && p(structuredClone(e)), h(""), l("edit");
372
+ }, v = () => {
373
+ e && p(structuredClone(e)), t(void 0), l("pending-remove");
374
+ }, y = () => {
375
+ u ? (t(structuredClone(u)), l("view")) : l(r ? "none" : "edit");
376
+ }, b = () => {
377
+ u ? (t(structuredClone(u)), l("view")) : (t(void 0), l(r ? "none" : "edit")), h("");
378
+ }, x = /* @__PURE__ */ L(M, {
379
+ spacing: 1,
380
+ "data-test-id": "auth-editor-empty-state",
381
+ children: [/* @__PURE__ */ I(P, {
382
+ variant: "body2",
383
+ color: "text.secondary",
384
+ "data-test-id": "auth-editor-empty-text",
385
+ children: a
386
+ }), /* @__PURE__ */ I(d, { children: /* @__PURE__ */ I(f, {
387
+ size: "small",
388
+ "data-test-id": "auth-editor-add-button",
389
+ onClick: g,
390
+ children: "Add"
391
+ }) })]
392
+ });
393
+ if (s === "none") return x;
394
+ if (s === "pending-remove") return /* @__PURE__ */ L(M, {
395
+ spacing: 1,
396
+ "data-test-id": "auth-editor-pending-remove-state",
397
+ children: [/* @__PURE__ */ I(c, {
398
+ severity: "warning",
399
+ "data-test-id": "auth-editor-pending-remove-text",
400
+ children: o
401
+ }), /* @__PURE__ */ I(d, { children: /* @__PURE__ */ I(f, {
402
+ size: "small",
403
+ "data-test-id": "auth-editor-cancel-remove-button",
404
+ onClick: y,
405
+ children: "Cancel"
406
+ }) })]
407
+ });
408
+ if (s === "view" && U(e)) return /* @__PURE__ */ L(M, {
409
+ spacing: 1,
410
+ "data-test-id": "auth-editor-view-state",
411
+ children: [/* @__PURE__ */ I(d, {
412
+ component: "dl",
413
+ "data-test-id": "auth-editor-summary-list",
414
+ sx: { m: 0 },
415
+ children: De(e).map((e) => /* @__PURE__ */ L(d, {
416
+ "data-test-id": "auth-editor-summary-row",
417
+ sx: {
418
+ display: "flex",
419
+ gap: 2,
420
+ minHeight: 32,
421
+ alignItems: "center"
422
+ },
423
+ children: [/* @__PURE__ */ I(P, {
424
+ component: "dt",
425
+ variant: "body2",
426
+ noWrap: !0,
427
+ sx: {
428
+ fontWeight: "bold",
429
+ flexShrink: 0,
430
+ minWidth: "8rem"
431
+ },
432
+ children: e.key
433
+ }), /* @__PURE__ */ I(P, {
434
+ component: "dd",
435
+ variant: "body2",
436
+ noWrap: !0,
437
+ title: e.value,
438
+ sx: {
439
+ m: 0,
440
+ flex: 1,
441
+ minWidth: 0,
442
+ textAlign: "right"
443
+ },
444
+ children: e.value
445
+ })]
446
+ }, e.key))
447
+ }), /* @__PURE__ */ L(M, {
448
+ direction: "row",
449
+ spacing: 1,
450
+ children: [/* @__PURE__ */ I(f, {
451
+ size: "small",
452
+ "data-test-id": "auth-editor-edit-button",
453
+ onClick: _,
454
+ children: "Edit"
455
+ }), /* @__PURE__ */ I(f, {
456
+ size: "small",
457
+ color: "error",
458
+ "data-test-id": "auth-editor-remove-button",
459
+ onClick: v,
460
+ children: "Remove"
461
+ })]
462
+ })]
463
+ });
464
+ let S = U(e) ? e : Te(n[0] ?? "authorization_code"), C = S.method, w = (e) => t({
465
+ ...S,
466
+ ...e
467
+ }), T = u && "clientSecret" in u ? u.clientSecret : void 0, E = "clientSecret" in S ? S.clientSecret : void 0, D = m.trim() === "" && s !== "add" && (typeof E == "string" && E !== "" || typeof T == "string" && T.length > 0), O = (e) => {
468
+ h(e);
469
+ let t;
470
+ t = e.trim() === "" ? s === "add" ? "" : typeof T == "string" ? T : E ?? "" : e, w({ clientSecret: t });
471
+ }, k = (e) => {
472
+ let n = e.trim(), { identityProviderId: r, ...i } = S;
473
+ t(n ? {
474
+ ...i,
475
+ identityProviderId: n
476
+ } : i);
477
+ }, A = "clientId" in S && /* @__PURE__ */ I(W, {
478
+ label: "Client Id",
479
+ testId: "auth-editor-client-id-input",
480
+ required: !0,
481
+ value: S.clientId ?? "",
482
+ onChange: (e) => w({ clientId: e })
483
+ }), j = /* @__PURE__ */ I(W, {
484
+ label: "Client Secret",
485
+ testId: "auth-editor-client-secret-input",
486
+ required: !D,
487
+ value: m,
488
+ placeholder: D ? "********" : "",
489
+ helperText: D ? /* @__PURE__ */ I("span", {
490
+ "data-test-id": "auth-editor-secret-help",
491
+ children: "Current secret is hidden. Enter a new value to replace it."
492
+ }) : void 0,
493
+ onChange: O
494
+ });
495
+ return /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ L(M, {
496
+ spacing: 2,
497
+ "data-test-id": "auth-editor-edit-state",
498
+ children: [
499
+ /* @__PURE__ */ L(N, {
500
+ select: !0,
501
+ label: "Method",
502
+ required: !0,
503
+ fullWidth: !0,
504
+ value: C,
505
+ onChange: (e) => t(Oe(S, e.target.value)),
506
+ slotProps: {
507
+ select: { native: !0 },
508
+ htmlInput: { "data-test-id": "auth-editor-method-select" }
509
+ },
510
+ children: [!n.includes(C) && /* @__PURE__ */ I("option", {
511
+ value: C,
512
+ disabled: !0,
513
+ children: C
514
+ }), n.map((e) => /* @__PURE__ */ I("option", {
515
+ value: e,
516
+ children: e
517
+ }, e))]
518
+ }),
519
+ /* @__PURE__ */ I(W, {
520
+ label: "Audience",
521
+ testId: "auth-editor-audience-input",
522
+ required: !0,
523
+ value: S.audience ?? "",
524
+ onChange: (e) => w({ audience: e })
525
+ }),
526
+ /* @__PURE__ */ I(W, {
527
+ label: "Scope",
528
+ testId: "auth-editor-scope-input",
529
+ required: !0,
530
+ value: S.scope ?? "",
531
+ onChange: (e) => w({ scope: e })
532
+ }),
533
+ C === "authorization_code" && A,
534
+ C === "client_credentials" && /* @__PURE__ */ L(F, { children: [
535
+ A,
536
+ /* @__PURE__ */ I(W, {
537
+ label: "Identity Provider Id Override",
538
+ testId: "auth-editor-identity-provider-id-input",
539
+ value: S.identityProviderId ?? "",
540
+ helperText: "Optional. Uses the network identity provider when empty.",
541
+ onChange: k
542
+ }),
543
+ j
544
+ ] }),
545
+ C === "self_signed" && /* @__PURE__ */ L(F, { children: [
546
+ A,
547
+ /* @__PURE__ */ I(W, {
548
+ label: "Issuer",
549
+ testId: "auth-editor-issuer-input",
550
+ required: !0,
551
+ value: S.issuer ?? "",
552
+ onChange: (e) => w({ issuer: e })
553
+ }),
554
+ j
555
+ ] }),
556
+ ![
557
+ "authorization_code",
558
+ "client_credentials",
559
+ "self_signed",
560
+ "self_issued"
561
+ ].includes(C) && /* @__PURE__ */ L(c, {
562
+ severity: "warning",
563
+ "data-test-id": "auth-editor-unsupported-method-warning",
564
+ children: [
565
+ "Unsupported auth method \"",
566
+ C,
567
+ "\". Select a supported method to continue."
568
+ ]
569
+ })
570
+ ]
571
+ }), r && /* @__PURE__ */ I(d, {
572
+ sx: { mt: 1 },
573
+ children: /* @__PURE__ */ I(f, {
574
+ size: "small",
575
+ "data-test-id": "auth-editor-cancel-edit-button",
576
+ onClick: b,
577
+ children: "Cancel"
578
+ })
579
+ })] });
580
+ }, G = ({ label: e = "Back", href: t, onClick: n }) => /* @__PURE__ */ I(f, {
581
+ color: "inherit",
582
+ size: "small",
583
+ startIcon: /* @__PURE__ */ I(fe, {}),
584
+ ...t === void 0 ? { onClick: n } : { href: t },
585
+ children: e
586
+ }), Ae = t(["core", "wallet-ui-components/react"]), K = ({ onCopy: e, value: t, label: n = "Copy to clipboard" }) => {
587
+ let [r, i] = z(!1), a = le(void 0);
588
+ return oe(() => () => clearTimeout(a.current), []), /* @__PURE__ */ I(te, {
589
+ title: r ? "Copied" : n,
590
+ children: /* @__PURE__ */ I(C, {
591
+ "aria-label": n,
592
+ onClick: async (n) => {
593
+ if (n.stopPropagation(), t) try {
594
+ if (navigator.clipboard?.writeText) await navigator.clipboard.writeText(t);
595
+ else throw Error("Browser does not support clipboard functionality.");
596
+ e !== void 0 && e(t), clearTimeout(a.current), a.current = setTimeout(() => i(!1), 1200), i(!0);
597
+ } catch (e) {
598
+ Ae.getChild("CopyButton").error("Unable to copy value", { error: e });
599
+ }
600
+ },
601
+ children: /* @__PURE__ */ I(de, { color: r ? "success" : "inherit" })
602
+ })
603
+ });
604
+ }, je = ({ mode: e, title: t = "Something went wrong", message: n = "An unexpected error occurred while loading this page.", onAction: r }) => /* @__PURE__ */ I(A, { children: /* @__PURE__ */ L(M, {
605
+ sx: {
606
+ justifyContent: "center",
607
+ alignItems: "center",
608
+ p: 4
609
+ },
610
+ children: [
611
+ /* @__PURE__ */ I(d, { children: /* @__PURE__ */ I(pe, { color: "error" }) }),
612
+ /* @__PURE__ */ L(d, { children: [/* @__PURE__ */ I(P, {
613
+ variant: "h5",
614
+ component: "h1",
615
+ children: t
616
+ }), /* @__PURE__ */ I(P, {
617
+ variant: "body1",
618
+ children: n
619
+ })] }),
620
+ /* @__PURE__ */ I(d, {
621
+ sx: { mt: 4 },
622
+ children: /* @__PURE__ */ I(f, {
623
+ variant: "contained",
624
+ color: "primary",
625
+ startIcon: I(e === "back" ? B : me, {}),
626
+ onClick: r,
627
+ children: e === "back" ? "Back" : "Refresh"
628
+ })
629
+ })
630
+ ]
631
+ }) }), Me = ({ idp: e, onReview: t }) => {
632
+ let n = "configUrl" in e ? e.configUrl : "";
633
+ return /* @__PURE__ */ I(p, {
634
+ component: "article",
635
+ "data-testid": "idp-card",
636
+ variant: "outlined",
637
+ sx: {
638
+ position: "relative",
639
+ ...t && { "&:hover": {
640
+ borderColor: "primary.main",
641
+ boxShadow: 2
642
+ } }
643
+ },
644
+ children: /* @__PURE__ */ L(g, { children: [/* @__PURE__ */ I(d, {
645
+ sx: { mb: 1 },
646
+ children: t ? /* @__PURE__ */ I(T, {
647
+ component: "button",
648
+ type: "button",
649
+ variant: "body1",
650
+ color: "inherit",
651
+ underline: "none",
652
+ onClick: () => t(e),
653
+ sx: {
654
+ fontWeight: "bold",
655
+ textAlign: "left",
656
+ position: "static",
657
+ "&::after": {
658
+ content: "\"\"",
659
+ position: "absolute",
660
+ inset: 0,
661
+ cursor: "pointer"
662
+ }
663
+ },
664
+ children: e.id
665
+ }) : /* @__PURE__ */ I(P, {
666
+ variant: "body1",
667
+ sx: { fontWeight: "bold" },
668
+ children: e.id
669
+ })
670
+ }), /* @__PURE__ */ L(M, {
671
+ spacing: .5,
672
+ children: [
673
+ /* @__PURE__ */ I(V, {
674
+ label: "Type",
675
+ value: e.type
676
+ }),
677
+ "issuer" in e && /* @__PURE__ */ I(V, {
678
+ label: "Issuer",
679
+ value: e.issuer,
680
+ action: /* @__PURE__ */ I(K, {
681
+ value: e.issuer,
682
+ label: "Copy issuer URL"
683
+ })
684
+ }),
685
+ n && /* @__PURE__ */ I(V, {
686
+ label: "Config URL",
687
+ value: n,
688
+ action: /* @__PURE__ */ I(K, {
689
+ value: n,
690
+ label: "Copy config URL"
691
+ })
692
+ })
693
+ ]
694
+ })] })
695
+ });
696
+ }, Ne = {
697
+ id: "",
698
+ type: "oauth",
699
+ issuer: "",
700
+ configUrl: ""
701
+ }, Pe = (e) => "issuer" in e ? e.issuer : "", Fe = (e) => "configUrl" in e ? e.configUrl : "", Ie = ({ idp: e, loading: t = !1, onSave: n, onDelete: r, onCancel: i }) => {
702
+ let a = e ?? Ne, [o, s] = z(a.id), [l, u] = z(a.type), [p, m] = z(Pe(a)), [h, g] = z(Fe(a)), [_, v] = z(""), [y, b] = z(e);
703
+ return e !== y && (b(e), s(a.id), u(a.type), m(Pe(a)), g(Fe(a)), v("")), /* @__PURE__ */ L(d, {
704
+ component: "form",
705
+ onSubmit: (e) => {
706
+ if (e.preventDefault(), !o || l !== "self_issued" && !p || l === "oauth" && !h) v("Please fill in all required fields");
707
+ else switch (v(""), l) {
708
+ case "oauth":
709
+ n({
710
+ id: o,
711
+ type: l,
712
+ issuer: p,
713
+ configUrl: h
714
+ });
715
+ break;
716
+ case "self_signed":
717
+ n({
718
+ id: o,
719
+ type: l,
720
+ issuer: p
721
+ });
722
+ break;
723
+ case "self_issued": n({
724
+ id: o,
725
+ type: l
726
+ });
727
+ }
728
+ },
729
+ sx: {
730
+ display: "flex",
731
+ flexDirection: "column",
732
+ height: "100%"
733
+ },
734
+ children: [
735
+ /* @__PURE__ */ L(M, {
736
+ spacing: 2,
737
+ children: [
738
+ /* @__PURE__ */ I(N, {
739
+ id: "idp-id",
740
+ label: "ID",
741
+ required: !0,
742
+ fullWidth: !0,
743
+ placeholder: "Enter the identity provider ID",
744
+ helperText: "A unique identifier for the identity provider",
745
+ disabled: t,
746
+ value: o,
747
+ onChange: (e) => s(e.target.value)
748
+ }),
749
+ /* @__PURE__ */ L(N, {
750
+ id: "idp-type",
751
+ select: !0,
752
+ label: "Type",
753
+ required: !0,
754
+ fullWidth: !0,
755
+ disabled: t,
756
+ value: l,
757
+ onChange: (e) => u(e.target.value),
758
+ slotProps: { select: { native: !0 } },
759
+ children: [
760
+ /* @__PURE__ */ I("option", {
761
+ value: "oauth",
762
+ children: "oauth"
763
+ }),
764
+ /* @__PURE__ */ I("option", {
765
+ value: "self_signed",
766
+ children: "self_signed"
767
+ }),
768
+ /* @__PURE__ */ I("option", {
769
+ value: "self_issued",
770
+ children: "self_issued"
771
+ })
772
+ ]
773
+ }),
774
+ l !== "self_issued" && /* @__PURE__ */ I(N, {
775
+ id: "idp-issuer",
776
+ label: "Issuer URL",
777
+ required: !0,
778
+ fullWidth: !0,
779
+ placeholder: "Enter the issuer URL",
780
+ disabled: t,
781
+ value: p,
782
+ onChange: (e) => m(e.target.value)
783
+ }),
784
+ l === "oauth" && /* @__PURE__ */ I(N, {
785
+ id: "idp-config-url",
786
+ label: "Config URL",
787
+ required: !0,
788
+ fullWidth: !0,
789
+ placeholder: "Enter the configuration URL",
790
+ disabled: t,
791
+ value: h,
792
+ onChange: (e) => g(e.target.value)
793
+ })
794
+ ]
795
+ }),
796
+ _ && /* @__PURE__ */ I(c, {
797
+ severity: "error",
798
+ sx: { mt: 2 },
799
+ children: _
800
+ }),
801
+ e ? /* @__PURE__ */ L(F, { children: [r && /* @__PURE__ */ L(d, {
802
+ sx: { mt: 4 },
803
+ children: [
804
+ /* @__PURE__ */ I(x, { sx: { mb: 3 } }),
805
+ /* @__PURE__ */ I(P, {
806
+ variant: "subtitle1",
807
+ component: "h2",
808
+ sx: {
809
+ fontWeight: "bold",
810
+ mb: 1
811
+ },
812
+ children: "Delete identity provider"
813
+ }),
814
+ /* @__PURE__ */ I(P, {
815
+ variant: "body2",
816
+ color: "text.secondary",
817
+ sx: { mb: 2 },
818
+ children: "You will not be able to undo the change once you delete this Identity Provider."
819
+ }),
820
+ /* @__PURE__ */ I(f, {
821
+ variant: "outlined",
822
+ color: "error",
823
+ onClick: () => r(e),
824
+ children: "Delete identity provider"
825
+ })
826
+ ]
827
+ }), /* @__PURE__ */ L(M, {
828
+ direction: "row",
829
+ spacing: 2,
830
+ sx: { mt: 3 },
831
+ children: [i && /* @__PURE__ */ I(f, {
832
+ variant: "outlined",
833
+ color: "inherit",
834
+ fullWidth: !0,
835
+ onClick: i,
836
+ children: "Cancel"
837
+ }), /* @__PURE__ */ I(f, {
838
+ type: "submit",
839
+ variant: "contained",
840
+ fullWidth: !0,
841
+ disabled: t,
842
+ children: "Update"
843
+ })]
844
+ })] }) : /* @__PURE__ */ I(d, {
845
+ sx: {
846
+ mt: "auto",
847
+ pt: 3
848
+ },
849
+ children: /* @__PURE__ */ I(f, {
850
+ type: "submit",
851
+ variant: "contained",
852
+ fullWidth: !0,
853
+ disabled: t,
854
+ children: "Add"
855
+ })
856
+ })
857
+ ]
858
+ });
859
+ }, Le = he`
860
+ 0%, 80%, 100% {
861
+ transform: scale(0.7);
862
+ opacity: 0.4;
863
+ }
864
+ 40% {
865
+ transform: scale(1);
866
+ opacity: 1;
867
+ }
868
+ `, Re = ({ text: e = "Loading" }) => /* @__PURE__ */ L(M, {
869
+ role: "status",
870
+ "aria-live": "polite",
871
+ spacing: 2,
872
+ sx: {
873
+ minHeight: 180,
874
+ justifyContent: "center",
875
+ alignItems: "center",
876
+ p: 3
877
+ },
878
+ children: [/* @__PURE__ */ I(M, {
879
+ direction: "row",
880
+ spacing: 1,
881
+ "aria-hidden": "true",
882
+ children: [
883
+ 0,
884
+ 1,
885
+ 2
886
+ ].map((e) => /* @__PURE__ */ I(d, { sx: {
887
+ width: 8,
888
+ height: 8,
889
+ borderRadius: "50%",
890
+ bgcolor: "primary.main",
891
+ animation: `${Le} 1s infinite ease-in-out`,
892
+ animationDelay: `${e * .15}s`,
893
+ "@media (prefers-reduced-motion: reduce)": { animation: "none" }
894
+ } }, e))
895
+ }), /* @__PURE__ */ I(P, {
896
+ variant: "body1",
897
+ color: "text.secondary",
898
+ children: e
899
+ })]
900
+ }), q = (e) => e.authMethod !== "client_credentials", ze = ({ networks: e, idps: t, loading: n = !1, connecting: i = !1, message: a = null, onConnect: o }) => {
901
+ let [s, l] = z(), [u, p] = z(null), [m, h] = z(""), [g, _] = z(""), [v, y] = z(null), [b, x] = z(null), S = e.find((e) => e.id === s), C = s === null ? null : S && q(S) ? S : e.find(q) ?? null, w = t.find((e) => e.id === C?.identityProviderId) ?? null, T = w?.type === "self_issued" || C?.authMethod === "self_issued", E = !T && w?.type === "self_signed", D = v ? {
902
+ type: "error",
903
+ text: v
904
+ } : a && a !== b ? a : null, O = (e) => {
905
+ l(e === "" ? null : e), p(null), y(null), x(a);
906
+ };
907
+ return /* @__PURE__ */ L(d, {
908
+ component: "form",
909
+ onSubmit: (e) => {
910
+ e.preventDefault(), y(null), x(a), C ? w ? w.type === "self_signed" ? o(C, w, u || C.clientId, m) : w.type === "self_issued" ? o(C, w, void 0, void 0, g.trim()) : o(C, w) : y("Identity provider misconfigured for this network.") : y("Please select a network before connecting.");
911
+ },
912
+ sx: {
913
+ minHeight: "100dvh",
914
+ display: "flex",
915
+ flexDirection: "column"
916
+ },
917
+ children: [
918
+ /* @__PURE__ */ I(d, {
919
+ sx: {
920
+ height: 44,
921
+ display: "flex",
922
+ alignItems: "center",
923
+ px: 2,
924
+ borderBottom: 1,
925
+ borderColor: "divider"
926
+ },
927
+ children: /* @__PURE__ */ I("img", {
928
+ src: r,
929
+ alt: "Canton logo",
930
+ width: 24,
931
+ height: 24,
932
+ style: { objectFit: "contain" }
933
+ })
934
+ }),
935
+ /* @__PURE__ */ L(M, {
936
+ spacing: 2,
937
+ sx: {
938
+ flex: 1,
939
+ px: 2,
940
+ pt: 2
941
+ },
942
+ children: [
943
+ /* @__PURE__ */ I(P, {
944
+ variant: "h5",
945
+ component: "h1",
946
+ sx: { fontWeight: "bold" },
947
+ children: "Wallet Gateway"
948
+ }),
949
+ /* @__PURE__ */ L(N, {
950
+ select: !0,
951
+ fullWidth: !0,
952
+ label: "Select a network",
953
+ value: C?.id ?? "",
954
+ disabled: n || i,
955
+ onChange: (e) => O(e.target.value),
956
+ slotProps: {
957
+ select: { native: !0 },
958
+ inputLabel: { shrink: !0 }
959
+ },
960
+ children: [/* @__PURE__ */ I("option", {
961
+ value: "",
962
+ children: "Select network"
963
+ }), e.map((e) => /* @__PURE__ */ I("option", {
964
+ value: e.id,
965
+ disabled: !q(e),
966
+ children: e.name
967
+ }, e.id))]
968
+ }),
969
+ T && /* @__PURE__ */ I(N, {
970
+ fullWidth: !0,
971
+ required: !0,
972
+ label: "Username",
973
+ autoComplete: "username",
974
+ value: g,
975
+ disabled: i,
976
+ onChange: (e) => _(e.target.value)
977
+ }),
978
+ E && /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ I(N, {
979
+ fullWidth: !0,
980
+ label: "Client ID",
981
+ autoComplete: "username",
982
+ value: u ?? C?.clientId ?? "",
983
+ disabled: i,
984
+ onChange: (e) => p(e.target.value)
985
+ }), /* @__PURE__ */ I(N, {
986
+ fullWidth: !0,
987
+ label: "Client Secret",
988
+ type: "password",
989
+ autoComplete: "current-password",
990
+ value: m,
991
+ disabled: i,
992
+ onChange: (e) => h(e.target.value)
993
+ })] }),
994
+ D ? /* @__PURE__ */ I(c, {
995
+ severity: D.type,
996
+ children: D.text
997
+ }) : /* @__PURE__ */ I(P, {
998
+ variant: "body2",
999
+ color: "text.secondary",
1000
+ children: n ? "Loading networks..." : C ? `Selected: ${C.name}` : "Choose a network to continue."
1001
+ })
1002
+ ]
1003
+ }),
1004
+ /* @__PURE__ */ I(d, {
1005
+ sx: { p: 2 },
1006
+ children: /* @__PURE__ */ I(f, {
1007
+ type: "submit",
1008
+ variant: "contained",
1009
+ size: "large",
1010
+ fullWidth: !0,
1011
+ disabled: n || i || !C,
1012
+ children: i ? "Connecting…" : "Connect"
1013
+ })
1014
+ })
1015
+ ]
1016
+ });
1017
+ }, Be = ({ messageId: t, message: r, status: i, origin: a = null, externalTxId: o = null, backHref: s, approving: c = !1, rejecting: l = !1, signing: u = !1, disabled: f = !1, onApprove: p, onReject: m }) => /* @__PURE__ */ L(M, {
1018
+ spacing: 2,
1019
+ children: [
1020
+ /* @__PURE__ */ L(M, {
1021
+ direction: "row",
1022
+ sx: {
1023
+ alignItems: "center",
1024
+ justifyContent: "space-between"
1025
+ },
1026
+ children: [/* @__PURE__ */ I(P, {
1027
+ variant: "h5",
1028
+ component: "h1",
1029
+ children: "Message Details"
1030
+ }), s && /* @__PURE__ */ I(G, { href: s })]
1031
+ }),
1032
+ /* @__PURE__ */ L(M, {
1033
+ spacing: .5,
1034
+ children: [
1035
+ /* @__PURE__ */ I(V, {
1036
+ label: "Status",
1037
+ value: /* @__PURE__ */ I(v, {
1038
+ "data-testid": "activity-status",
1039
+ label: e(i),
1040
+ color: n(i),
1041
+ size: "small"
1042
+ })
1043
+ }),
1044
+ a && /* @__PURE__ */ I(V, {
1045
+ label: "Requested by",
1046
+ value: a
1047
+ }),
1048
+ o && /* @__PURE__ */ I(V, {
1049
+ label: "External transaction ID",
1050
+ value: o,
1051
+ action: /* @__PURE__ */ I(K, {
1052
+ value: o,
1053
+ label: "Copy external transaction ID"
1054
+ })
1055
+ }),
1056
+ /* @__PURE__ */ L(d, { children: [/* @__PURE__ */ I(P, {
1057
+ variant: "body2",
1058
+ component: "h2",
1059
+ sx: {
1060
+ fontWeight: "bold",
1061
+ py: 1
1062
+ },
1063
+ children: "Message"
1064
+ }), /* @__PURE__ */ I(d, {
1065
+ component: "pre",
1066
+ sx: {
1067
+ m: 0,
1068
+ p: 1.5,
1069
+ overflow: "auto",
1070
+ whiteSpace: "pre-wrap",
1071
+ bgcolor: "action.hover",
1072
+ borderRadius: 1,
1073
+ fontSize: "0.8125rem"
1074
+ },
1075
+ children: r
1076
+ })] })
1077
+ ]
1078
+ }),
1079
+ i === "pending" && /* @__PURE__ */ I(H, {
1080
+ approving: c,
1081
+ rejecting: l,
1082
+ signing: u,
1083
+ disabled: f,
1084
+ onApprove: () => p(t),
1085
+ onReject: m && (() => m(t))
1086
+ })
1087
+ ]
1088
+ }), Ve = ({ network: e, activeSession: t = !1, accessToken: n = "", onReview: r }) => {
1089
+ let i = e.synchronizerId ?? "";
1090
+ return /* @__PURE__ */ I(p, {
1091
+ component: "article",
1092
+ "data-testid": "network-card",
1093
+ variant: "outlined",
1094
+ sx: {
1095
+ position: "relative",
1096
+ ...r && { "&:hover": {
1097
+ borderColor: "primary.main",
1098
+ boxShadow: 2
1099
+ } }
1100
+ },
1101
+ children: /* @__PURE__ */ L(g, { children: [/* @__PURE__ */ L(M, {
1102
+ direction: "row",
1103
+ spacing: 1,
1104
+ sx: {
1105
+ alignItems: "center",
1106
+ mb: 1
1107
+ },
1108
+ children: [r ? /* @__PURE__ */ I(T, {
1109
+ component: "button",
1110
+ type: "button",
1111
+ variant: "body1",
1112
+ color: "inherit",
1113
+ underline: "none",
1114
+ onClick: () => r(e),
1115
+ sx: {
1116
+ fontWeight: "bold",
1117
+ textAlign: "left",
1118
+ position: "static",
1119
+ "&::after": {
1120
+ content: "\"\"",
1121
+ position: "absolute",
1122
+ inset: 0,
1123
+ cursor: "pointer"
1124
+ }
1125
+ },
1126
+ children: e.name
1127
+ }) : /* @__PURE__ */ I(P, {
1128
+ variant: "body1",
1129
+ sx: { fontWeight: "bold" },
1130
+ children: e.name
1131
+ }), t && /* @__PURE__ */ I(v, {
1132
+ label: "CONNECTED",
1133
+ color: "success",
1134
+ size: "small"
1135
+ })]
1136
+ }), /* @__PURE__ */ L(M, {
1137
+ spacing: .5,
1138
+ children: [
1139
+ /* @__PURE__ */ I(V, {
1140
+ label: "ID",
1141
+ value: e.id
1142
+ }),
1143
+ t && /* @__PURE__ */ I(V, {
1144
+ label: "Access Token",
1145
+ value: "[private]",
1146
+ muted: !0,
1147
+ action: /* @__PURE__ */ I(K, {
1148
+ value: n,
1149
+ label: "Copy access token"
1150
+ })
1151
+ }),
1152
+ /* @__PURE__ */ I(V, {
1153
+ label: "Auth",
1154
+ value: e.authMethod
1155
+ }),
1156
+ i && /* @__PURE__ */ I(V, {
1157
+ label: "Synchronizer",
1158
+ value: i,
1159
+ action: /* @__PURE__ */ I(K, {
1160
+ value: i,
1161
+ label: "Copy synchronizer ID"
1162
+ })
1163
+ }),
1164
+ e.identityProviderId && /* @__PURE__ */ I(V, {
1165
+ label: "Identity provider",
1166
+ value: e.identityProviderId
1167
+ })
1168
+ ]
1169
+ })] })
1170
+ });
1171
+ }, J = ie(ke), He = ["client_credentials"], Ue = {
1172
+ id: "",
1173
+ name: "",
1174
+ description: "",
1175
+ identityProviderId: "",
1176
+ ledgerApi: "",
1177
+ auth: {
1178
+ method: "authorization_code",
1179
+ audience: "",
1180
+ scope: "",
1181
+ clientId: ""
1182
+ }
1183
+ }, We = (e) => {
1184
+ try {
1185
+ return new URL(e), !0;
1186
+ } catch {
1187
+ return !1;
1188
+ }
1189
+ }, Ge = (e) => ({
1190
+ synchronizerId: !e.synchronizerId || e.synchronizerId.includes("::") && e.synchronizerId.length >= 10 ? void 0 : "Must contain \"::\" and be at least 10 characters",
1191
+ ledgerApi: We(e.ledgerApi) ? void 0 : "Must be a valid URL"
1192
+ }), Y = ({ title: e, children: t }) => {
1193
+ let n = se();
1194
+ return /* @__PURE__ */ L(d, {
1195
+ component: "section",
1196
+ "aria-labelledby": n,
1197
+ children: [/* @__PURE__ */ I(P, {
1198
+ id: n,
1199
+ variant: "subtitle1",
1200
+ component: "h3",
1201
+ sx: {
1202
+ fontWeight: "bold",
1203
+ mb: 1
1204
+ },
1205
+ children: e
1206
+ }), t]
1207
+ });
1208
+ }, Ke = ({ network: e, onSave: t, onDelete: n, onCancel: r }) => {
1209
+ let i = e ?? Ue, [a, o] = z(i), [s, l] = z(e), [u, p] = z(0), [m, h] = z(!1);
1210
+ e !== s && (l(e), o(i), p((e) => e + 1), h(!1));
1211
+ let g = m ? Ge(a) : {
1212
+ synchronizerId: void 0,
1213
+ ledgerApi: void 0
1214
+ }, _ = Object.values(g).some(Boolean), v = (e) => o((t) => ({
1215
+ ...t,
1216
+ ...e
1217
+ })), y = R((e) => {
1218
+ e && o((t) => ({
1219
+ ...t,
1220
+ auth: e
1221
+ }));
1222
+ }, []), b = R((e, t) => o((n) => {
1223
+ let r = { ...n };
1224
+ return delete r[e], t ? {
1225
+ ...r,
1226
+ [e]: t
1227
+ } : r;
1228
+ }), []), S = R((e) => b("adminAuth", e), [b]), C = R((e) => b("serviceAccountAuth", e), [b]);
1229
+ return /* @__PURE__ */ L(d, {
1230
+ component: "form",
1231
+ onSubmit: (e) => {
1232
+ e.preventDefault(), h(!0), !Object.values(Ge(a)).some(Boolean) && t(a);
1233
+ },
1234
+ sx: {
1235
+ display: "flex",
1236
+ flexDirection: "column",
1237
+ height: "100%"
1238
+ },
1239
+ children: [
1240
+ /* @__PURE__ */ L(M, {
1241
+ spacing: 2,
1242
+ children: [
1243
+ /* @__PURE__ */ I(N, {
1244
+ label: "Network Id",
1245
+ required: !0,
1246
+ fullWidth: !0,
1247
+ helperText: "A unique identifier for the network",
1248
+ value: a.id,
1249
+ onChange: (e) => v({ id: e.target.value })
1250
+ }),
1251
+ /* @__PURE__ */ I(N, {
1252
+ label: "Name",
1253
+ required: !0,
1254
+ fullWidth: !0,
1255
+ value: a.name,
1256
+ onChange: (e) => v({ name: e.target.value })
1257
+ }),
1258
+ /* @__PURE__ */ I(N, {
1259
+ label: "Description",
1260
+ required: !0,
1261
+ fullWidth: !0,
1262
+ value: a.description,
1263
+ onChange: (e) => v({ description: e.target.value })
1264
+ }),
1265
+ /* @__PURE__ */ I(N, {
1266
+ label: "Synchronizer Id",
1267
+ fullWidth: !0,
1268
+ error: !!g.synchronizerId,
1269
+ helperText: g.synchronizerId,
1270
+ value: a.synchronizerId ?? "",
1271
+ onChange: (e) => {
1272
+ let t = { ...a };
1273
+ e.target.value ? t.synchronizerId = e.target.value : delete t.synchronizerId, o(t);
1274
+ }
1275
+ }),
1276
+ /* @__PURE__ */ I(N, {
1277
+ label: "Identity Provider Id",
1278
+ required: !0,
1279
+ fullWidth: !0,
1280
+ value: a.identityProviderId,
1281
+ onChange: (e) => v({ identityProviderId: e.target.value })
1282
+ }),
1283
+ /* @__PURE__ */ I(N, {
1284
+ label: "Ledger API Base Url",
1285
+ required: !0,
1286
+ fullWidth: !0,
1287
+ error: !!g.ledgerApi,
1288
+ helperText: g.ledgerApi,
1289
+ value: a.ledgerApi,
1290
+ onChange: (e) => v({ ledgerApi: e.target.value })
1291
+ }),
1292
+ /* @__PURE__ */ I(Y, {
1293
+ title: "Configure user auth",
1294
+ children: /* @__PURE__ */ I(J, {
1295
+ auth: a.auth,
1296
+ onChange: y
1297
+ }, u)
1298
+ }),
1299
+ /* @__PURE__ */ I(Y, {
1300
+ title: "Configure admin auth",
1301
+ children: /* @__PURE__ */ I(J, {
1302
+ auth: a.adminAuth,
1303
+ optional: !0,
1304
+ label: "admin auth",
1305
+ onChange: S
1306
+ }, u)
1307
+ }),
1308
+ /* @__PURE__ */ I(Y, {
1309
+ title: "Configure service account auth",
1310
+ children: /* @__PURE__ */ I(J, {
1311
+ auth: a.serviceAccountAuth,
1312
+ allowedMethods: He,
1313
+ optional: !0,
1314
+ label: "service account auth",
1315
+ onChange: C
1316
+ }, u)
1317
+ })
1318
+ ]
1319
+ }),
1320
+ _ && /* @__PURE__ */ I(c, {
1321
+ severity: "error",
1322
+ sx: { mt: 2 },
1323
+ children: "Invalid network data, please ensure all fields are set correctly"
1324
+ }),
1325
+ e ? /* @__PURE__ */ L(F, { children: [n && /* @__PURE__ */ L(d, {
1326
+ sx: { mt: 4 },
1327
+ children: [
1328
+ /* @__PURE__ */ I(x, { sx: { mb: 3 } }),
1329
+ /* @__PURE__ */ I(P, {
1330
+ variant: "subtitle1",
1331
+ component: "h2",
1332
+ sx: {
1333
+ fontWeight: "bold",
1334
+ mb: 1
1335
+ },
1336
+ children: "Delete network"
1337
+ }),
1338
+ /* @__PURE__ */ I(P, {
1339
+ variant: "body2",
1340
+ color: "text.secondary",
1341
+ sx: { mb: 2 },
1342
+ children: "You will not be able to undo the change once you delete this network."
1343
+ }),
1344
+ /* @__PURE__ */ I(f, {
1345
+ variant: "outlined",
1346
+ color: "error",
1347
+ onClick: () => n(e),
1348
+ children: "Delete Network"
1349
+ })
1350
+ ]
1351
+ }), /* @__PURE__ */ L(M, {
1352
+ direction: "row",
1353
+ spacing: 2,
1354
+ sx: { mt: 3 },
1355
+ children: [r && /* @__PURE__ */ I(f, {
1356
+ variant: "outlined",
1357
+ color: "inherit",
1358
+ fullWidth: !0,
1359
+ onClick: r,
1360
+ children: "Cancel"
1361
+ }), /* @__PURE__ */ I(f, {
1362
+ type: "submit",
1363
+ variant: "contained",
1364
+ fullWidth: !0,
1365
+ "data-test-id": "update-network-button",
1366
+ children: "Update"
1367
+ })]
1368
+ })] }) : /* @__PURE__ */ I(d, {
1369
+ sx: {
1370
+ mt: "auto",
1371
+ pt: 3
1372
+ },
1373
+ children: /* @__PURE__ */ I(f, {
1374
+ type: "submit",
1375
+ variant: "contained",
1376
+ fullWidth: !0,
1377
+ "data-test-id": "add-network-button",
1378
+ children: "Add"
1379
+ })
1380
+ })
1381
+ ]
1382
+ });
1383
+ }, qe = ({ total: e, pageSize: t = 5, page: n = 1, onPageChange: r }) => {
1384
+ let i = Math.max(t, 1), a = Math.max(1, Math.ceil(e / i)), o = Math.min(Math.max(n, 1), a), s = e > 0 ? (o - 1) * i + 1 : 0, c = e > 0 ? Math.min(s + i - 1, e) : 0;
1385
+ return /* @__PURE__ */ L(M, {
1386
+ component: "nav",
1387
+ "aria-label": "Pagination",
1388
+ direction: "row",
1389
+ spacing: 1,
1390
+ sx: {
1391
+ alignItems: "center",
1392
+ display: "inline-flex"
1393
+ },
1394
+ children: [
1395
+ /* @__PURE__ */ I(C, {
1396
+ size: "small",
1397
+ "aria-label": "Previous page",
1398
+ disabled: o <= 1,
1399
+ onClick: () => r(o - 1),
1400
+ children: /* @__PURE__ */ I(B, { fontSize: "small" })
1401
+ }),
1402
+ /* @__PURE__ */ L(P, {
1403
+ variant: "body2",
1404
+ component: "span",
1405
+ children: [
1406
+ s,
1407
+ "-",
1408
+ c,
1409
+ " of ",
1410
+ e
1411
+ ]
1412
+ }),
1413
+ /* @__PURE__ */ I(C, {
1414
+ size: "small",
1415
+ "aria-label": "Next page",
1416
+ disabled: o >= a,
1417
+ onClick: () => r(o + 1),
1418
+ children: /* @__PURE__ */ I(ge, { fontSize: "small" })
1419
+ })
1420
+ ]
1421
+ });
1422
+ }, X = ({ signingProviders: e, value: t, onChange: n, disabled: r = !1, disabledProviders: i = [] }) => {
1423
+ let a = e === void 0, o = e?.length === 0;
1424
+ return /* @__PURE__ */ L(N, {
1425
+ id: "signing-provider-id",
1426
+ select: !0,
1427
+ label: "Signing Provider",
1428
+ required: !0,
1429
+ fullWidth: !0,
1430
+ value: t,
1431
+ disabled: r || a || o,
1432
+ onChange: (e) => n(e.target.value),
1433
+ slotProps: {
1434
+ select: { native: !0 },
1435
+ inputLabel: { shrink: !0 }
1436
+ },
1437
+ children: [/* @__PURE__ */ I("option", {
1438
+ value: "",
1439
+ disabled: !0,
1440
+ children: a ? "Loading signing providers..." : o ? "No signing providers available" : "Select signing provider"
1441
+ }), e?.map((e) => /* @__PURE__ */ I("option", {
1442
+ value: e,
1443
+ disabled: i.includes(e),
1444
+ children: e
1445
+ }, e))]
1446
+ });
1447
+ }, Z = ({ title: e, message: t, type: n = "error", buttonText: r = "Dismiss notification", autoHideDuration: i, onExited: a }) => {
1448
+ let [o, s] = z(!0);
1449
+ return /* @__PURE__ */ I(j, {
1450
+ open: o,
1451
+ autoHideDuration: i,
1452
+ onClose: (e, t) => {
1453
+ t !== "clickaway" && s(!1);
1454
+ },
1455
+ slotProps: { transition: { onExited: () => a?.() } },
1456
+ sx: {
1457
+ position: "static",
1458
+ pointerEvents: "auto"
1459
+ },
1460
+ children: /* @__PURE__ */ L(c, {
1461
+ role: n === "error" ? "alert" : "status",
1462
+ severity: n,
1463
+ closeText: r,
1464
+ onClose: () => s(!1),
1465
+ sx: { width: "100%" },
1466
+ children: [/* @__PURE__ */ I(l, { children: e }), t]
1467
+ })
1468
+ });
1469
+ }, Je = ({ transactionId: t, commandId: r, externalTxId: o = null, status: c, parsed: l = null, createdAt: u = null, loading: d = !1, onReview: f }) => {
1470
+ let h = a(l), _ = i(l), y = s(u);
1471
+ return /* @__PURE__ */ I(p, {
1472
+ variant: "outlined",
1473
+ "data-testid": "transaction-card",
1474
+ children: /* @__PURE__ */ I(m, {
1475
+ disabled: d,
1476
+ "aria-label": `Open activity ${r}`,
1477
+ onClick: () => f(t, r),
1478
+ children: /* @__PURE__ */ I(g, { children: /* @__PURE__ */ L(M, {
1479
+ spacing: .5,
1480
+ children: [
1481
+ /* @__PURE__ */ I(V, {
1482
+ label: "Command ID",
1483
+ value: r
1484
+ }),
1485
+ o && /* @__PURE__ */ I(V, {
1486
+ label: "External transaction ID",
1487
+ value: o
1488
+ }),
1489
+ /* @__PURE__ */ I(V, {
1490
+ label: "Status",
1491
+ value: /* @__PURE__ */ I(v, {
1492
+ "data-testid": "activity-status",
1493
+ label: e(c),
1494
+ color: n(c),
1495
+ size: "small"
1496
+ })
1497
+ }),
1498
+ /* @__PURE__ */ I(V, {
1499
+ label: "Action type",
1500
+ value: h
1501
+ }),
1502
+ /* @__PURE__ */ I(V, {
1503
+ label: "Created at",
1504
+ value: y
1505
+ }),
1506
+ /* @__PURE__ */ I(V, {
1507
+ label: "Amount",
1508
+ value: _
1509
+ })
1510
+ ]
1511
+ }) })
1512
+ })
1513
+ });
1514
+ }, Q = ({ label: e, value: t, copyLabel: n }) => /* @__PURE__ */ I(V, {
1515
+ label: e,
1516
+ value: t || "N/A",
1517
+ action: t ? /* @__PURE__ */ I(K, {
1518
+ value: t,
1519
+ label: n
1520
+ }) : void 0
1521
+ }), Ye = ({ commandId: t, externalTxId: r = null, status: i, txHash: o, parsed: c = null, createdAt: l = null, backHref: u, approving: p = !1, rejecting: m = !1, signing: h = !1, submitFailed: g = !1, disabled: _ = !1, onApprove: y, onReject: x }) => {
1522
+ let [S, C] = z(!1), w = c?.signatories ?? [], T = c?.jsonString, E = i === "pending" || i === "signed";
1523
+ return /* @__PURE__ */ L(M, {
1524
+ spacing: 2,
1525
+ children: [
1526
+ /* @__PURE__ */ L(M, {
1527
+ direction: "row",
1528
+ sx: {
1529
+ alignItems: "center",
1530
+ justifyContent: "space-between"
1531
+ },
1532
+ children: [/* @__PURE__ */ I(P, {
1533
+ variant: "h5",
1534
+ component: "h1",
1535
+ children: "Activity Details"
1536
+ }), u && /* @__PURE__ */ I(G, { href: u })]
1537
+ }),
1538
+ /* @__PURE__ */ L(M, {
1539
+ spacing: .5,
1540
+ children: [
1541
+ /* @__PURE__ */ I(V, {
1542
+ label: "Status",
1543
+ value: /* @__PURE__ */ I(v, {
1544
+ "data-testid": "activity-status",
1545
+ label: e(i),
1546
+ color: n(i),
1547
+ size: "small"
1548
+ })
1549
+ }),
1550
+ /* @__PURE__ */ I(V, {
1551
+ label: "Action type",
1552
+ value: a(c)
1553
+ }),
1554
+ /* @__PURE__ */ I(V, {
1555
+ label: "Created at",
1556
+ value: s(l)
1557
+ }),
1558
+ /* @__PURE__ */ I(V, {
1559
+ label: "Signatories",
1560
+ value: w.length ? /* @__PURE__ */ I(M, {
1561
+ spacing: .5,
1562
+ sx: { alignItems: "flex-end" },
1563
+ children: w.map((e) => /* @__PURE__ */ L(M, {
1564
+ direction: "row",
1565
+ sx: { alignItems: "center" },
1566
+ children: [/* @__PURE__ */ I(P, {
1567
+ variant: "body2",
1568
+ noWrap: !0,
1569
+ title: e,
1570
+ children: e
1571
+ }), /* @__PURE__ */ I(K, {
1572
+ value: e,
1573
+ label: "Copy signatory"
1574
+ })]
1575
+ }, e))
1576
+ }) : "N/A"
1577
+ }),
1578
+ /* @__PURE__ */ I(Q, {
1579
+ label: "Template",
1580
+ value: c?.templateId,
1581
+ copyLabel: "Copy template"
1582
+ }),
1583
+ /* @__PURE__ */ I(Q, {
1584
+ label: "Command ID",
1585
+ value: t,
1586
+ copyLabel: "Copy command ID"
1587
+ }),
1588
+ r && /* @__PURE__ */ I(Q, {
1589
+ label: "External transaction ID",
1590
+ value: r,
1591
+ copyLabel: "Copy external transaction ID"
1592
+ }),
1593
+ /* @__PURE__ */ I(Q, {
1594
+ label: "Transaction hash",
1595
+ value: o,
1596
+ copyLabel: "Copy transaction hash"
1597
+ }),
1598
+ /* @__PURE__ */ L(d, { children: [/* @__PURE__ */ L(M, {
1599
+ direction: "row",
1600
+ sx: {
1601
+ alignItems: "center",
1602
+ justifyContent: "space-between"
1603
+ },
1604
+ children: [/* @__PURE__ */ I(f, {
1605
+ color: "inherit",
1606
+ "aria-expanded": S,
1607
+ endIcon: /* @__PURE__ */ I(_e, { sx: { transform: S ? "rotate(180deg)" : "none" } }),
1608
+ onClick: () => C((e) => !e),
1609
+ children: "Transaction JSON Object"
1610
+ }), T && /* @__PURE__ */ I(K, {
1611
+ value: T,
1612
+ label: "Copy transaction json object"
1613
+ })]
1614
+ }), /* @__PURE__ */ I(b, {
1615
+ in: S,
1616
+ unmountOnExit: !0,
1617
+ children: /* @__PURE__ */ I(d, {
1618
+ component: "pre",
1619
+ sx: {
1620
+ m: 0,
1621
+ p: 1.5,
1622
+ overflow: "auto",
1623
+ bgcolor: "action.hover",
1624
+ borderRadius: 1,
1625
+ fontSize: "0.8125rem"
1626
+ },
1627
+ children: T || "N/A"
1628
+ })
1629
+ })] })
1630
+ ]
1631
+ }),
1632
+ E && /* @__PURE__ */ I(H, {
1633
+ approveLabel: i === "signed" && g ? "Retry submit" : "Approve",
1634
+ approving: p,
1635
+ rejecting: m,
1636
+ signing: h,
1637
+ disabled: _,
1638
+ onApprove: () => y(t),
1639
+ onReject: i === "pending" && x ? () => x(t) : void 0
1640
+ })
1641
+ ]
1642
+ });
1643
+ }, Xe = [
1644
+ "CanActAs",
1645
+ "CanReadAs",
1646
+ "CanExecuteAs"
1647
+ ], Ze = 72, Qe = 24, $e = (e) => e.length > Qe ? `${e.slice(0, 10)}...${e.slice(-10)}` : e, et = ({ children: e }) => /* @__PURE__ */ I(P, {
1648
+ variant: "body2",
1649
+ noWrap: !0,
1650
+ sx: {
1651
+ fontWeight: "bold",
1652
+ flexShrink: 0,
1653
+ width: "8rem"
1654
+ },
1655
+ children: e
1656
+ }), tt = ({ wallet: e, verified: t = !1, loading: n = !1, onAllocate: r, onSetPrimary: i, onEdit: a, onSelect: o, selectLabel: s = "Select" }) => {
1657
+ let c = new Set(e.rights), l = Xe.filter((e) => c.has(e)), u = !!(e.reason && (e.reason.length > Ze || e.reason.includes("\n"))), m = e.primary ? /* @__PURE__ */ I(v, {
1658
+ label: "PRIMARY",
1659
+ color: "success",
1660
+ size: "small"
1661
+ }, "badge") : e.disabled ? /* @__PURE__ */ I(v, {
1662
+ label: "Disabled",
1663
+ color: "error",
1664
+ size: "small"
1665
+ }, "badge") : null, _ = [];
1666
+ o ? _.push(/* @__PURE__ */ I(f, {
1667
+ size: "small",
1668
+ disabled: n,
1669
+ onClick: () => o(e),
1670
+ children: s
1671
+ }, "select")) : (_.push(m), t ? (!e.primary && !e.disabled && i && _.push(/* @__PURE__ */ I(f, {
1672
+ size: "small",
1673
+ disabled: n,
1674
+ onClick: () => i(e),
1675
+ children: "Set as primary"
1676
+ }, "set-primary")), a && _.push(/* @__PURE__ */ I(f, {
1677
+ size: "small",
1678
+ disabled: n,
1679
+ onClick: () => a(e),
1680
+ children: "Edit"
1681
+ }, "edit"))) : r && _.push(/* @__PURE__ */ I(f, {
1682
+ size: "small",
1683
+ variant: "outlined",
1684
+ color: "inherit",
1685
+ disabled: n || e.disabled === !0,
1686
+ onClick: () => r(e),
1687
+ children: "Allocate party"
1688
+ }, "allocate")));
1689
+ let y = _.some(Boolean);
1690
+ return /* @__PURE__ */ L(p, {
1691
+ component: "article",
1692
+ variant: "outlined",
1693
+ "data-testid": "wallet-card",
1694
+ "party-id": e.partyId,
1695
+ sx: {
1696
+ display: "flex",
1697
+ flexDirection: "column",
1698
+ height: "100%"
1699
+ },
1700
+ children: [/* @__PURE__ */ I(g, {
1701
+ sx: { flexGrow: 1 },
1702
+ children: /* @__PURE__ */ L(M, {
1703
+ spacing: .5,
1704
+ "data-test-external-tx-id": e.externalTxId ?? "",
1705
+ children: [
1706
+ /* @__PURE__ */ I(V, {
1707
+ label: "Party hint",
1708
+ value: e.hint || "-",
1709
+ action: e.hint ? /* @__PURE__ */ I(K, {
1710
+ value: e.hint,
1711
+ label: "Copy party hint"
1712
+ }) : void 0
1713
+ }),
1714
+ /* @__PURE__ */ I(V, {
1715
+ label: "Party ID",
1716
+ value: $e(e.partyId),
1717
+ title: e.partyId,
1718
+ action: /* @__PURE__ */ I(K, {
1719
+ value: e.partyId,
1720
+ label: "Copy party ID"
1721
+ })
1722
+ }),
1723
+ /* @__PURE__ */ I(V, {
1724
+ label: "Signing provider",
1725
+ value: e.signingProviderId
1726
+ }),
1727
+ e.reason && (u ? /* @__PURE__ */ L(d, {
1728
+ sx: {
1729
+ minHeight: 40,
1730
+ py: .5
1731
+ },
1732
+ children: [/* @__PURE__ */ I(et, { children: "Reason" }), /* @__PURE__ */ I(P, {
1733
+ variant: "body2",
1734
+ title: e.reason,
1735
+ sx: { whiteSpace: "pre-wrap" },
1736
+ children: e.reason
1737
+ })]
1738
+ }) : /* @__PURE__ */ I(V, {
1739
+ label: "Reason",
1740
+ value: e.reason
1741
+ })),
1742
+ l.length > 0 && /* @__PURE__ */ I(V, {
1743
+ label: "Permissions",
1744
+ value: l.map((e) => /* @__PURE__ */ I(v, {
1745
+ label: e,
1746
+ size: "small"
1747
+ }, e))
1748
+ })
1749
+ ]
1750
+ })
1751
+ }), y && /* @__PURE__ */ I(h, {
1752
+ sx: { justifyContent: "space-between" },
1753
+ children: _
1754
+ })]
1755
+ });
1756
+ }, $ = ({ children: e, onSubmit: t, submitLabel: n, submittingLabel: r, submittingMessage: i, submitting: a = !1, loading: o = !1, submitDisabled: s = !1 }) => {
1757
+ let c = a || o || s;
1758
+ return /* @__PURE__ */ L(d, {
1759
+ component: "form",
1760
+ onSubmit: (e) => {
1761
+ e.preventDefault(), !c && t();
1762
+ },
1763
+ sx: {
1764
+ display: "flex",
1765
+ flexDirection: "column",
1766
+ height: "100%"
1767
+ },
1768
+ children: [/* @__PURE__ */ I(M, {
1769
+ spacing: 2,
1770
+ children: e
1771
+ }), /* @__PURE__ */ L(M, {
1772
+ spacing: 1,
1773
+ sx: {
1774
+ mt: "auto",
1775
+ pt: 3
1776
+ },
1777
+ children: [/* @__PURE__ */ I(f, {
1778
+ type: "submit",
1779
+ variant: "contained",
1780
+ fullWidth: !0,
1781
+ disabled: c,
1782
+ startIcon: a ? /* @__PURE__ */ I(y, {
1783
+ size: 16,
1784
+ color: "inherit",
1785
+ "aria-hidden": "true"
1786
+ }) : void 0,
1787
+ children: a ? r : n
1788
+ }), a && /* @__PURE__ */ I(P, {
1789
+ variant: "body2",
1790
+ color: "text.secondary",
1791
+ role: "status",
1792
+ "aria-live": "polite",
1793
+ children: i
1794
+ })]
1795
+ })]
1796
+ });
1797
+ }, nt = ({ signingProviders: e, keySigningProviders: t = [], publicKeys: n, selectedSigningProvider: r, showPrimary: i = !0, submitting: a = !1, submitLabel: o = "Add", submittingLabel: s = "Adding...", submittingMessage: c = "Creating party, please wait...", onCreate: l, onSigningProviderChange: u }) => {
1798
+ let [f, p] = z(""), [m, h] = z(""), [g, v] = z(!1), [y, b] = z(""), x = r ?? m, C = !!x && t.includes(x), w = e?.length === 0, T = a || e === void 0 || C && n === void 0;
1799
+ return /* @__PURE__ */ I(d, {
1800
+ "data-testid": "wallet-create-form",
1801
+ sx: { height: "100%" },
1802
+ children: /* @__PURE__ */ L($, {
1803
+ submitLabel: o,
1804
+ submittingLabel: s,
1805
+ submittingMessage: c,
1806
+ submitting: a,
1807
+ loading: T,
1808
+ submitDisabled: w,
1809
+ onSubmit: () => {
1810
+ if (T || w) return;
1811
+ let e = n?.find((e) => e.id === y)?.name;
1812
+ e ? l(f, x, g, e) : l(f, x, g);
1813
+ },
1814
+ children: [
1815
+ /* @__PURE__ */ I(N, {
1816
+ id: "party-id-hint",
1817
+ label: "Party ID Hint",
1818
+ required: !0,
1819
+ fullWidth: !0,
1820
+ placeholder: "Enter the name of your wallet?",
1821
+ disabled: a,
1822
+ value: f,
1823
+ onChange: (e) => p(e.target.value)
1824
+ }),
1825
+ /* @__PURE__ */ I(X, {
1826
+ signingProviders: e,
1827
+ value: x,
1828
+ onChange: (e) => {
1829
+ h(e), b(""), u?.(e);
1830
+ },
1831
+ disabled: a
1832
+ }),
1833
+ C && /* @__PURE__ */ L(N, {
1834
+ id: "vault-name",
1835
+ select: !0,
1836
+ label: "Vault name",
1837
+ required: !0,
1838
+ fullWidth: !0,
1839
+ disabled: T,
1840
+ value: y,
1841
+ onChange: (e) => b(e.target.value),
1842
+ slotProps: {
1843
+ select: { native: !0 },
1844
+ inputLabel: { shrink: !0 }
1845
+ },
1846
+ children: [/* @__PURE__ */ I("option", {
1847
+ value: "",
1848
+ disabled: !0,
1849
+ children: T ? "Loading vaults..." : "Select vault name"
1850
+ }), n?.map((e) => /* @__PURE__ */ I("option", {
1851
+ value: e.id,
1852
+ children: e.name
1853
+ }, e.id))]
1854
+ }),
1855
+ i && /* @__PURE__ */ I(S, {
1856
+ label: "Set as primary wallet",
1857
+ control: /* @__PURE__ */ I(_, {
1858
+ id: "primary",
1859
+ checked: g,
1860
+ disabled: a,
1861
+ onChange: (e) => v(e.target.checked)
1862
+ })
1863
+ })
1864
+ ]
1865
+ })
1866
+ });
1867
+ }, rt = ({ partyId: e, signingProviders: t, disabledSigningProviders: n = [], publicKeys: r, selectedSigningProvider: i, selectedPublicKey: a, submitting: o = !1, submitLabel: s = "Edit", submittingLabel: c = "Editing...", submittingMessage: l = "Editing party, please wait...", onEdit: u, onSigningProviderChange: d }) => {
1868
+ let [f, p] = z(i ?? ""), [m, h] = z(a ?? ""), [g, _] = z(i), [v, b] = z(a);
1869
+ i !== g && (_(i), p(i ?? "")), a !== v && (b(a), h(a ?? ""));
1870
+ let x = t?.length === 0, S = r === void 0, C = n.includes(f), T = o || t === void 0;
1871
+ return /* @__PURE__ */ L($, {
1872
+ submitLabel: s,
1873
+ submittingLabel: c,
1874
+ submittingMessage: l,
1875
+ submitting: o,
1876
+ loading: T,
1877
+ submitDisabled: x || !f || C || S,
1878
+ onSubmit: () => {
1879
+ !T && m && f && u(e, f, m);
1880
+ },
1881
+ children: [
1882
+ /* @__PURE__ */ I(N, {
1883
+ id: "party-id",
1884
+ label: "Party ID",
1885
+ fullWidth: !0,
1886
+ disabled: !0,
1887
+ value: e,
1888
+ slotProps: { htmlInput: { readOnly: !0 } }
1889
+ }),
1890
+ /* @__PURE__ */ I(X, {
1891
+ signingProviders: t,
1892
+ value: f,
1893
+ onChange: (e) => {
1894
+ p(e), h(""), d?.(e);
1895
+ },
1896
+ disabled: o,
1897
+ disabledProviders: n
1898
+ }),
1899
+ /* @__PURE__ */ L(N, {
1900
+ id: "public-key-id",
1901
+ select: !0,
1902
+ label: "Public Key",
1903
+ required: !0,
1904
+ fullWidth: !0,
1905
+ disabled: o,
1906
+ value: C ? "" : m,
1907
+ onChange: (e) => h(e.target.value),
1908
+ slotProps: {
1909
+ select: { native: !0 },
1910
+ inputLabel: { shrink: !0 },
1911
+ ...S && { input: { startAdornment: /* @__PURE__ */ I(w, {
1912
+ position: "start",
1913
+ children: /* @__PURE__ */ I(y, {
1914
+ size: 16,
1915
+ "aria-label": "Loading public keys"
1916
+ })
1917
+ }) } }
1918
+ },
1919
+ children: [/* @__PURE__ */ I("option", {
1920
+ value: "",
1921
+ disabled: !0,
1922
+ children: S ? "" : C ? "Select different signing provider" : "Select public key"
1923
+ }), r?.map((e) => /* @__PURE__ */ L("option", {
1924
+ value: e.publicKey,
1925
+ children: [
1926
+ e.name,
1927
+ " (",
1928
+ e.publicKey,
1929
+ ")"
1930
+ ]
1931
+ }, e.publicKey))]
1932
+ })
1933
+ ]
1934
+ });
1935
+ }, it = he`
1936
+ from {
1937
+ transform: rotate(0deg);
1938
+ }
1939
+ to {
1940
+ transform: rotate(360deg);
1941
+ }
1942
+ `, at = ({ syncNeeded: e = !1, syncing: t = !1, disabled: n = !1, onSync: r }) => {
1943
+ let i = t ? "Syncing parties..." : e ? "Refresh parties (changes available)" : "Refresh parties";
1944
+ return /* @__PURE__ */ I(te, {
1945
+ title: i,
1946
+ describeChild: !0,
1947
+ children: /* @__PURE__ */ I("span", { children: /* @__PURE__ */ I(C, {
1948
+ size: "small",
1949
+ "aria-label": i,
1950
+ color: e ? "primary" : "default",
1951
+ disabled: n || t,
1952
+ onClick: r,
1953
+ children: /* @__PURE__ */ I(me, {
1954
+ fontSize: "small",
1955
+ sx: t ? {
1956
+ animation: `${it} 1s linear infinite`,
1957
+ "@media (prefers-reduced-motion: reduce)": { animation: "none" }
1958
+ } : void 0
1959
+ })
1960
+ }) })
1961
+ });
1962
+ }, ot = re(null), st = ({ children: e, autoHideDuration: t = 5e3 }) => {
1963
+ let [n, r] = z([]), i = le(0), a = R((e) => {
1964
+ r((t) => [...t, {
1965
+ ...e,
1966
+ id: i.current++
1967
+ }]);
1968
+ }, []), o = ce(() => ({ showToast: a }), [a]);
1969
+ return /* @__PURE__ */ L(ot.Provider, {
1970
+ value: o,
1971
+ children: [e, n.length > 0 && /* @__PURE__ */ I(M, {
1972
+ spacing: 1,
1973
+ sx: {
1974
+ position: "fixed",
1975
+ right: {
1976
+ xs: 16,
1977
+ sm: 20
1978
+ },
1979
+ bottom: {
1980
+ xs: 16,
1981
+ sm: 20
1982
+ },
1983
+ zIndex: (e) => e.zIndex.snackbar,
1984
+ width: {
1985
+ xs: "calc(100vw - 32px)",
1986
+ sm: 380
1987
+ },
1988
+ maxWidth: "calc(100vw - 32px)",
1989
+ pointerEvents: "none"
1990
+ },
1991
+ children: n.map(({ id: e, ...n }) => /* @__PURE__ */ I(Z, {
1992
+ ...n,
1993
+ autoHideDuration: t,
1994
+ onExited: () => r((t) => t.filter((t) => t.id !== e))
1995
+ }, e))
1996
+ })]
1997
+ });
1998
+ }, ct = () => {
1999
+ let e = ae(ot);
2000
+ if (!e) throw Error("useToast must be used within a ToastProvider");
2001
+ return e;
2002
+ }, lt = () => {
2003
+ let { showToast: e } = ct();
2004
+ return R((t, n) => e({
2005
+ ...o(t, n),
2006
+ type: "error"
2007
+ }), [e]);
2008
+ };
2009
+ export { ve as ApiKeyCard, be as ApiKeyForm, Ce as AppHeader, H as ApprovalActions, ke as AuthEditor, G as BackLink, V as CardDetailRow, K as CopyButton, je as ErrorPage, Me as IdpCard, Ie as IdpForm, Re as LoadingState, ze as LoginForm, Be as MessageDetail, Ve as NetworkCard, Ke as NetworkForm, qe as Pagination, X as SigningProviderSelect, xe as StatusDot, Z as Toast, st as ToastProvider, Je as TransactionCard, Ye as TransactionDetail, tt as WalletCard, nt as WalletCreateForm, rt as WalletEditForm, $ as WalletForm, at as WalletsSync, Se as defaultNavItems, lt as useErrorToast, ct as useToast };
2010
+
2011
+ //# sourceMappingURL=index.js.map