@blade-hq/agent-react 2612.0.0-beta.77 → 2612.0.0-beta.78

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 (56) hide show
  1. package/README.md +12 -2
  2. package/dist/SessionPluginConfigForm-7LJ5SUNY.js +9 -0
  3. package/dist/SessionPluginConfigForm-7LJ5SUNY.js.map +1 -0
  4. package/dist/chat/LiteMessageList.d.ts +4 -0
  5. package/dist/{chunk-IVGTMWRV.js → chunk-66JXSDLB.js} +284 -289
  6. package/dist/chunk-66JXSDLB.js.map +1 -0
  7. package/dist/{chunk-VBHHFIII.js → chunk-C3LBNHVM.js} +12 -10
  8. package/dist/{chunk-VBHHFIII.js.map → chunk-C3LBNHVM.js.map} +1 -1
  9. package/dist/chunk-F4MWGSKX.js +1308 -0
  10. package/dist/chunk-F4MWGSKX.js.map +1 -0
  11. package/dist/{chunk-ZIECHNZA.js → chunk-FBGCDXRK.js} +110 -115
  12. package/dist/chunk-FBGCDXRK.js.map +1 -0
  13. package/dist/{chunk-26NE55SJ.js → chunk-FDB3J5QF.js} +8 -6
  14. package/dist/{chunk-26NE55SJ.js.map → chunk-FDB3J5QF.js.map} +1 -1
  15. package/dist/{chunk-WO2VCQ5N.js → chunk-FH5HA3GW.js} +551 -455
  16. package/dist/chunk-FH5HA3GW.js.map +1 -0
  17. package/dist/chunk-KHJEIHMJ.js +973 -0
  18. package/dist/chunk-KHJEIHMJ.js.map +1 -0
  19. package/dist/{chunk-XBEN2ASY.js → chunk-MWILWSPG.js} +4262 -3186
  20. package/dist/chunk-MWILWSPG.js.map +1 -0
  21. package/dist/{chunk-EQOKPZI2.js → chunk-NRYLAO3X.js} +87 -154
  22. package/dist/chunk-NRYLAO3X.js.map +1 -0
  23. package/dist/{chunk-F2IJZX2Z.js → chunk-SK43YNRX.js} +151 -1442
  24. package/dist/chunk-SK43YNRX.js.map +1 -0
  25. package/dist/components/BrowserConnectionDialog.d.ts +3 -2
  26. package/dist/components/ConfigConnection.d.ts +16 -0
  27. package/dist/components/ConnectorDetail.d.ts +46 -0
  28. package/dist/components/ConnectorRulesPanel.d.ts +2 -1
  29. package/dist/components/ConnectorRuntimeDiagnostics.d.ts +2 -2
  30. package/dist/components/DeviceConnection.d.ts +3 -1
  31. package/dist/components/FeishuPermissionStatus.d.ts +3 -1
  32. package/dist/components/ManagedConnection.d.ts +5 -2
  33. package/dist/components/PackEventNotice.d.ts +3 -0
  34. package/dist/components/SessionPluginConfigForm.d.ts +2 -1
  35. package/dist/connectors.d.ts +3 -0
  36. package/dist/connectors.js +7 -2
  37. package/dist/embed/entry.d.ts +4 -0
  38. package/dist/index.d.ts +3 -0
  39. package/dist/index.js +13 -7
  40. package/dist/internal.js +16 -9
  41. package/dist/internal.js.map +1 -1
  42. package/dist/questions.js +8 -6
  43. package/dist/questions.js.map +1 -1
  44. package/dist/rich-input.js +16 -13
  45. package/dist/rich-input.js.map +1 -1
  46. package/dist/style.full.css +1 -1
  47. package/dist/tool-details.js +5 -4
  48. package/dist/tool-details.js.map +1 -1
  49. package/package.json +2 -2
  50. package/public-api.md +41 -3
  51. package/dist/chunk-EQOKPZI2.js.map +0 -1
  52. package/dist/chunk-F2IJZX2Z.js.map +0 -1
  53. package/dist/chunk-IVGTMWRV.js.map +0 -1
  54. package/dist/chunk-WO2VCQ5N.js.map +0 -1
  55. package/dist/chunk-XBEN2ASY.js.map +0 -1
  56. package/dist/chunk-ZIECHNZA.js.map +0 -1
@@ -1,19 +1,50 @@
1
1
  import {
2
+ AlertDialog,
3
+ AlertDialogAction,
4
+ AlertDialogCancel,
5
+ AlertDialogContent,
6
+ AlertDialogDescription,
7
+ AlertDialogFooter,
8
+ AlertDialogHeader,
9
+ AlertDialogTitle,
10
+ AlertDialogTrigger,
2
11
  Button,
3
- LoaderCircle,
12
+ ConnectorDetail,
13
+ Dialog,
14
+ DialogContent,
15
+ DialogTitle,
4
16
  cn,
5
17
  cva,
6
18
  dist_exports,
7
- dist_exports4 as dist_exports2,
19
+ dist_exports3 as dist_exports2,
8
20
  dist_exports5 as dist_exports3,
9
- dist_exports7 as dist_exports4,
10
- loopTabInShadowRoot,
11
- useOverlayRoot
12
- } from "./chunk-XBEN2ASY.js";
21
+ dist_exports6 as dist_exports4
22
+ } from "./chunk-MWILWSPG.js";
23
+ import {
24
+ LoaderCircle
25
+ } from "./chunk-KHJEIHMJ.js";
13
26
 
14
27
  // src/components/DeviceConnection.tsx
15
28
  import { useEffect, useRef, useState } from "react";
16
29
 
30
+ // ../ui/src/composites/switch.tsx
31
+ import { jsx } from "react/jsx-runtime";
32
+ function Switch({
33
+ className,
34
+ thumbClassName,
35
+ ...props
36
+ }) {
37
+ return /* @__PURE__ */ jsx(
38
+ dist_exports4.Root,
39
+ {
40
+ "data-slot": "switch",
41
+ className: cn("outline-none focus-visible:ring-3 focus-visible:ring-ring/50", className),
42
+ ...props,
43
+ children: /* @__PURE__ */ jsx(dist_exports4.Thumb, { "data-slot": "switch-thumb", className: thumbClassName })
44
+ }
45
+ );
46
+ }
47
+
17
48
  // ../../node_modules/.pnpm/qrcode.react@4.2.0_react@19.2.4/node_modules/qrcode.react/lib/esm/index.js
18
49
  import React from "react";
19
50
  var __defProp = Object.defineProperty;
@@ -1116,162 +1147,8 @@ var QRCodeSVG = React.forwardRef(
1116
1147
  );
1117
1148
  QRCodeSVG.displayName = "QRCodeSVG";
1118
1149
 
1119
- // ../ui/src/components/alert-dialog.tsx
1120
- import { jsx, jsxs } from "react/jsx-runtime";
1121
- function AlertDialog({
1122
- ...props
1123
- }) {
1124
- return /* @__PURE__ */ jsx(dist_exports2.Root, { "data-slot": "alert-dialog", ...props });
1125
- }
1126
- function AlertDialogTrigger({
1127
- ...props
1128
- }) {
1129
- return /* @__PURE__ */ jsx(dist_exports2.Trigger, { "data-slot": "alert-dialog-trigger", ...props });
1130
- }
1131
- function AlertDialogOverlay({
1132
- className,
1133
- ...props
1134
- }) {
1135
- return /* @__PURE__ */ jsx(
1136
- dist_exports2.Overlay,
1137
- {
1138
- "data-slot": "alert-dialog-overlay",
1139
- className: cn(
1140
- "fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
1141
- className
1142
- ),
1143
- ...props
1144
- }
1145
- );
1146
- }
1147
- function AlertDialogHeader({
1148
- className,
1149
- ...props
1150
- }) {
1151
- return /* @__PURE__ */ jsx(
1152
- "div",
1153
- {
1154
- "data-slot": "alert-dialog-header",
1155
- className: cn(
1156
- "grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",
1157
- className
1158
- ),
1159
- ...props
1160
- }
1161
- );
1162
- }
1163
- function AlertDialogFooter({
1164
- className,
1165
- ...props
1166
- }) {
1167
- return /* @__PURE__ */ jsx(
1168
- "div",
1169
- {
1170
- "data-slot": "alert-dialog-footer",
1171
- className: cn(
1172
- "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",
1173
- className
1174
- ),
1175
- ...props
1176
- }
1177
- );
1178
- }
1179
- function AlertDialogTitle({
1180
- className,
1181
- ...props
1182
- }) {
1183
- return /* @__PURE__ */ jsx(
1184
- dist_exports2.Title,
1185
- {
1186
- "data-slot": "alert-dialog-title",
1187
- className: cn(
1188
- "text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
1189
- className
1190
- ),
1191
- ...props
1192
- }
1193
- );
1194
- }
1195
- function AlertDialogDescription({
1196
- className,
1197
- ...props
1198
- }) {
1199
- return /* @__PURE__ */ jsx(
1200
- dist_exports2.Description,
1201
- {
1202
- "data-slot": "alert-dialog-description",
1203
- className: cn(
1204
- "text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
1205
- className
1206
- ),
1207
- ...props
1208
- }
1209
- );
1210
- }
1211
- function AlertDialogAction({
1212
- className,
1213
- variant = "default",
1214
- size = "default",
1215
- ...props
1216
- }) {
1217
- return /* @__PURE__ */ jsx(Button, { variant, size, asChild: true, children: /* @__PURE__ */ jsx(
1218
- dist_exports2.Action,
1219
- {
1220
- "data-slot": "alert-dialog-action",
1221
- className: cn(className),
1222
- ...props
1223
- }
1224
- ) });
1225
- }
1226
- function AlertDialogCancel({
1227
- className,
1228
- variant = "outline",
1229
- size = "default",
1230
- ...props
1231
- }) {
1232
- return /* @__PURE__ */ jsx(Button, { variant, size, asChild: true, children: /* @__PURE__ */ jsx(
1233
- dist_exports2.Cancel,
1234
- {
1235
- "data-slot": "alert-dialog-cancel",
1236
- className: cn(className),
1237
- ...props
1238
- }
1239
- ) });
1240
- }
1241
-
1242
- // ../ui/src/composites/alert-dialog.tsx
1243
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
1244
- function AlertDialogContent({
1245
- className,
1246
- overlayClassName,
1247
- size = "default",
1248
- onKeyDown,
1249
- ...props
1250
- }) {
1251
- const overlayRoot = useOverlayRoot();
1252
- return /* @__PURE__ */ jsxs2(dist_exports2.Portal, { "data-slot": "alert-dialog-portal", container: overlayRoot, children: [
1253
- /* @__PURE__ */ jsx2(AlertDialogOverlay, { className: overlayClassName }),
1254
- /* @__PURE__ */ jsx2(
1255
- dist_exports2.Content,
1256
- {
1257
- onKeyDown: (event) => {
1258
- onKeyDown?.(event);
1259
- loopTabInShadowRoot(event);
1260
- },
1261
- "data-slot": "alert-dialog-content",
1262
- "data-size": size,
1263
- className: cn(
1264
- "group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
1265
- className
1266
- ),
1267
- ...props
1268
- }
1269
- )
1270
- ] });
1271
- }
1272
-
1273
1150
  // src/components/FeishuCapabilitySelection.tsx
1274
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1151
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
1275
1152
  var capabilityStatus = {
1276
1153
  available: "\u53EF\u4F7F\u7528",
1277
1154
  not_selected: "\u5C1A\u672A\u5F00\u901A",
@@ -1294,25 +1171,25 @@ function FeishuCapabilitySelection({ capabilities, permissions = [], domains = [
1294
1171
  const key = item.category || "other";
1295
1172
  groups.set(key, [...groups.get(key) ?? [], item]);
1296
1173
  }
1297
- return /* @__PURE__ */ jsxs3("div", { className: "space-y-4", children: [
1298
- /* @__PURE__ */ jsx3("p", { className: "text-sm", children: "\u521D\u6B21\u8FDE\u63A5\u91C7\u7528\u98DE\u4E66\u5E73\u53F0\u9ED8\u8BA4\u6A21\u677F\u53CA\u5B98\u65B9\u63A8\u8350\u6743\u9650\u3002\u5728\u98DE\u4E66\u9875\u9762\u786E\u8BA4\uFF0C\u514D\u5BA1\u548C\u5BA1\u6838\u8981\u6C42\u4EE5\u6240\u5728\u4F01\u4E1A\u89C4\u5219\u4E3A\u51C6\u3002" }),
1299
- /* @__PURE__ */ jsx3("p", { className: "text-xs opacity-70", children: "\u9996\u6B21\u53EF\u80FD\u9700\u8981\u4E24\u6B21\u626B\u7801\uFF1A\u5148\u5173\u8054\u5E94\u7528\uFF0C\u518D\u786E\u8BA4\u672C\u4EBA\u6388\u6743\u3002\u90E8\u5206\u6743\u9650\u672A\u5F00\u901A\u65F6\uFF0C\u5DF2\u5F00\u901A\u6743\u9650\u4ECD\u53EF\u4F7F\u7528\u3002" }),
1300
- /* @__PURE__ */ jsxs3("details", { className: "rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4 text-sm", children: [
1301
- /* @__PURE__ */ jsx3("summary", { className: "cursor-pointer", children: "\u67E5\u770B\u5F53\u524D\u53EF\u7528\u7684\u5DE5\u4F5C\u80FD\u529B" }),
1302
- /* @__PURE__ */ jsx3("div", { className: "mt-3 grid gap-3 sm:grid-cols-2", children: [...groups].map(([id, items]) => /* @__PURE__ */ jsxs3("section", { className: "space-y-2", children: [
1303
- /* @__PURE__ */ jsx3("h4", { className: "font-medium", children: domains.find((domain) => domain.id === id)?.name || items[0]?.category_name || "\u5176\u4ED6\u5DE5\u4F5C\u80FD\u529B" }),
1304
- items.map((item) => /* @__PURE__ */ jsxs3("details", { className: "text-xs", children: [
1305
- /* @__PURE__ */ jsxs3("summary", { className: "cursor-pointer", children: [
1174
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
1175
+ /* @__PURE__ */ jsx2("p", { className: "text-sm", children: "\u521D\u6B21\u8FDE\u63A5\u91C7\u7528\u98DE\u4E66\u5E73\u53F0\u9ED8\u8BA4\u6A21\u677F\u53CA\u5B98\u65B9\u63A8\u8350\u6743\u9650\u3002\u5728\u98DE\u4E66\u9875\u9762\u786E\u8BA4\uFF0C\u514D\u5BA1\u548C\u5BA1\u6838\u8981\u6C42\u4EE5\u6240\u5728\u4F01\u4E1A\u89C4\u5219\u4E3A\u51C6\u3002" }),
1176
+ /* @__PURE__ */ jsx2("p", { className: "text-xs opacity-70", children: "\u9996\u6B21\u53EF\u80FD\u9700\u8981\u4E24\u6B21\u626B\u7801\uFF1A\u5148\u5173\u8054\u5E94\u7528\uFF0C\u518D\u786E\u8BA4\u672C\u4EBA\u6388\u6743\u3002\u90E8\u5206\u6743\u9650\u672A\u5F00\u901A\u65F6\uFF0C\u5DF2\u5F00\u901A\u6743\u9650\u4ECD\u53EF\u4F7F\u7528\u3002" }),
1177
+ /* @__PURE__ */ jsxs("details", { className: "rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4 text-sm", children: [
1178
+ /* @__PURE__ */ jsx2("summary", { className: "cursor-pointer", children: "\u67E5\u770B\u5F53\u524D\u53EF\u7528\u7684\u5DE5\u4F5C\u80FD\u529B" }),
1179
+ /* @__PURE__ */ jsx2("div", { className: "mt-3 grid gap-3 sm:grid-cols-2", children: [...groups].map(([id, items]) => /* @__PURE__ */ jsxs("section", { className: "space-y-2", children: [
1180
+ /* @__PURE__ */ jsx2("h4", { className: "font-medium", children: domains.find((domain) => domain.id === id)?.name || items[0]?.category_name || "\u5176\u4ED6\u5DE5\u4F5C\u80FD\u529B" }),
1181
+ items.map((item) => /* @__PURE__ */ jsxs("details", { className: "text-xs", children: [
1182
+ /* @__PURE__ */ jsxs("summary", { className: "cursor-pointer", children: [
1306
1183
  item.name,
1307
1184
  " \xB7 ",
1308
1185
  capabilityStatus[item.status] || "\u5F85\u6838\u9A8C"
1309
1186
  ] }),
1310
- /* @__PURE__ */ jsx3("p", { className: "mt-1", children: item.description }),
1311
- item.reason && /* @__PURE__ */ jsx3("p", { children: item.reason }),
1312
- item.next_action && /* @__PURE__ */ jsx3("p", { children: item.next_action }),
1313
- /* @__PURE__ */ jsx3("p", { children: item.identity === "bot" ? "\u673A\u5668\u4EBA\u8EAB\u4EFD" : "\u672C\u4EBA\u8EAB\u4EFD" }),
1314
- item.scopes.map((scope) => /* @__PURE__ */ jsx3("p", { className: "break-all", children: permissions.find((p) => p.scope === scope && p.identity === item.identity)?.name || scope }, scope)),
1315
- /* @__PURE__ */ jsx3("p", { children: "\u5BA1\u6838\u8981\u6C42\u4EE5\u98DE\u4E66\u5B98\u65B9\u9875\u9762\u548C\u4F01\u4E1A\u89C4\u5219\u4E3A\u51C6\u3002" })
1187
+ /* @__PURE__ */ jsx2("p", { className: "mt-1", children: item.description }),
1188
+ item.reason && /* @__PURE__ */ jsx2("p", { children: item.reason }),
1189
+ item.next_action && /* @__PURE__ */ jsx2("p", { children: item.next_action }),
1190
+ /* @__PURE__ */ jsx2("p", { children: item.identity === "bot" ? "\u673A\u5668\u4EBA\u8EAB\u4EFD" : "\u672C\u4EBA\u8EAB\u4EFD" }),
1191
+ item.scopes.map((scope) => /* @__PURE__ */ jsx2("p", { className: "break-all", children: permissions.find((p) => p.scope === scope && p.identity === item.identity)?.name || scope }, scope)),
1192
+ /* @__PURE__ */ jsx2("p", { children: "\u5BA1\u6838\u8981\u6C42\u4EE5\u98DE\u4E66\u5B98\u65B9\u9875\u9762\u548C\u4F01\u4E1A\u89C4\u5219\u4E3A\u51C6\u3002" })
1316
1193
  ] }, item.id))
1317
1194
  ] }, id)) })
1318
1195
  ] })
@@ -1320,7 +1197,7 @@ function FeishuCapabilitySelection({ capabilities, permissions = [], domains = [
1320
1197
  }
1321
1198
 
1322
1199
  // src/components/ConnectorAuthorizationProgress.tsx
1323
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1200
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
1324
1201
  function ConnectorAuthorizationProgress({ result, onCheck, busy }) {
1325
1202
  if (!result || result.status === "complete" || result.status === "waiting") return null;
1326
1203
  let manualURL;
@@ -1329,29 +1206,29 @@ function ConnectorAuthorizationProgress({ result, onCheck, busy }) {
1329
1206
  if (url.protocol === "https:" && url.hostname === "open.feishu.cn" && !url.username && !url.password && !url.port && /^\/app(?:\/[^/]+\/auth)?$/.test(url.pathname)) manualURL = url.href;
1330
1207
  } catch {
1331
1208
  }
1332
- return /* @__PURE__ */ jsxs4("output", { className: "block space-y-2 rounded-lg border p-4 text-sm", children: [
1333
- /* @__PURE__ */ jsx4("span", { className: "block", children: result.status === "partial" ? "\u90E8\u5206\u6743\u9650\u5DF2\u751F\u6548\uFF0C\u672C\u6B21\u64CD\u4F5C\u6240\u9700\u6743\u9650\u5C1A\u672A\u8865\u9F50" : "\u672C\u6B21\u64CD\u4F5C\u6240\u9700\u6743\u9650\u5C1A\u672A\u751F\u6548" }),
1334
- /* @__PURE__ */ jsx4("span", { className: "block", children: result.next_action }),
1335
- result.missing_permissions.map((item) => /* @__PURE__ */ jsxs4("span", { className: "block break-all text-xs", children: [
1209
+ return /* @__PURE__ */ jsxs2("output", { className: "block space-y-2 rounded-lg border p-4 text-sm", children: [
1210
+ /* @__PURE__ */ jsx3("span", { className: "block", children: result.status === "partial" ? "\u90E8\u5206\u6743\u9650\u5DF2\u751F\u6548\uFF0C\u672C\u6B21\u64CD\u4F5C\u6240\u9700\u6743\u9650\u5C1A\u672A\u8865\u9F50" : "\u672C\u6B21\u64CD\u4F5C\u6240\u9700\u6743\u9650\u5C1A\u672A\u751F\u6548" }),
1211
+ /* @__PURE__ */ jsx3("span", { className: "block", children: result.next_action }),
1212
+ result.missing_permissions.map((item) => /* @__PURE__ */ jsxs2("span", { className: "block break-all text-xs", children: [
1336
1213
  item.identity === "bot" ? "\u5E94\u7528\u8EAB\u4EFD" : "\u672C\u4EBA\u8EAB\u4EFD",
1337
1214
  " \xB7 ",
1338
1215
  item.scope
1339
1216
  ] }, `${item.identity}:${item.scope}`)),
1340
- result.mode === "manual" && manualURL && /* @__PURE__ */ jsx4("a", { className: "block underline", href: manualURL, target: "_blank", rel: "noopener noreferrer", children: "\u6253\u5F00\u98DE\u4E66\u6743\u9650\u7BA1\u7406" }),
1341
- /* @__PURE__ */ jsx4("button", { type: "button", className: "underline disabled:opacity-50", disabled: busy, onClick: onCheck, children: "\u6211\u5DF2\u5904\u7406\uFF0C\u91CD\u65B0\u6838\u9A8C" })
1217
+ result.mode === "manual" && manualURL && /* @__PURE__ */ jsx3("a", { className: "block underline", href: manualURL, target: "_blank", rel: "noopener noreferrer", children: "\u6253\u5F00\u98DE\u4E66\u6743\u9650\u7BA1\u7406" }),
1218
+ /* @__PURE__ */ jsx3("button", { type: "button", className: "underline disabled:opacity-50", disabled: busy, onClick: onCheck, children: "\u6211\u5DF2\u5904\u7406\uFF0C\u91CD\u65B0\u6838\u9A8C" })
1342
1219
  ] });
1343
1220
  }
1344
1221
 
1345
1222
  // src/components/FeishuPermissionStatus.tsx
1346
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1347
- function FeishuPermissionStatus({ permissions, template }) {
1223
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1224
+ function FeishuPermissionStatus({ permissions, template, expanded = false, hideScopes = false }) {
1348
1225
  if (!template && !permissions.some((item) => item.app_status)) return null;
1349
1226
  const listed = template ? permissions.filter((item) => item.template) : permissions;
1350
1227
  const missingApp = listed.filter((item) => item.app_status === "missing");
1351
1228
  const missingUser = listed.filter((item) => item.identity === "user" && item.app_status === "granted" && item.user_status === "not_granted");
1352
1229
  const unknown = listed.filter((item) => !item.app_status || item.app_status === "unknown");
1353
- return /* @__PURE__ */ jsxs5("details", { className: "rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4 text-sm", children: [
1354
- /* @__PURE__ */ jsxs5("summary", { className: "cursor-pointer", children: [
1230
+ return /* @__PURE__ */ jsxs3("details", { open: expanded || void 0, className: "rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4 text-sm", children: [
1231
+ /* @__PURE__ */ jsxs3("summary", { className: "cursor-pointer", children: [
1355
1232
  template ? "\u98DE\u4E66\u5B98\u65B9\u63A8\u8350\u6743\u9650" : "\u98DE\u4E66\u6743\u9650\u72B6\u6001",
1356
1233
  " \xB7 ",
1357
1234
  missingApp.length,
@@ -1360,14 +1237,14 @@ function FeishuPermissionStatus({ permissions, template }) {
1360
1237
  " \u9879\u5F85\u672C\u4EBA\u6388\u6743",
1361
1238
  unknown.length ? ` \xB7 ${unknown.length} \u9879\u5F85\u6838\u9A8C` : ""
1362
1239
  ] }),
1363
- /* @__PURE__ */ jsx5("p", { className: "mt-3 text-xs opacity-70", children: "\u4F01\u4E1A\u51B3\u5B9A\u54EA\u4E9B\u6743\u9650\u514D\u5BA1\u3001\u54EA\u4E9B\u9700\u8981\u5BA1\u6279\u3002\u5E94\u7528\u5DF2\u5F00\u901A\u548C\u672C\u4EBA\u5DF2\u6388\u6743\u5206\u522B\u6838\u9A8C\uFF1B\u5F85\u6838\u9A8C\u4E0D\u4EE3\u8868\u4F01\u4E1A\u62D2\u7EDD\u3002\u672A\u5F00\u901A\u9879\u76EE\u4E0D\u5F71\u54CD\u5176\u4ED6\u5DF2\u83B7\u6388\u6743\u7684\u64CD\u4F5C\u3002" }),
1364
- /* @__PURE__ */ jsx5("div", { className: "mt-3 max-h-72 space-y-3 overflow-y-auto", children: listed.map((item) => /* @__PURE__ */ jsxs5("div", { className: "text-xs", children: [
1365
- /* @__PURE__ */ jsxs5("p", { children: [
1240
+ /* @__PURE__ */ jsx4("p", { className: "mt-3 text-xs opacity-70", children: "\u4F01\u4E1A\u51B3\u5B9A\u54EA\u4E9B\u6743\u9650\u514D\u5BA1\u3001\u54EA\u4E9B\u9700\u8981\u5BA1\u6279\u3002\u5E94\u7528\u5DF2\u5F00\u901A\u548C\u672C\u4EBA\u5DF2\u6388\u6743\u5206\u522B\u6838\u9A8C\uFF1B\u5F85\u6838\u9A8C\u4E0D\u4EE3\u8868\u4F01\u4E1A\u62D2\u7EDD\u3002\u672A\u5F00\u901A\u9879\u76EE\u4E0D\u5F71\u54CD\u5176\u4ED6\u5DF2\u83B7\u6388\u6743\u7684\u64CD\u4F5C\u3002" }),
1241
+ /* @__PURE__ */ jsx4("div", { className: "mt-3 max-h-72 space-y-3 overflow-y-auto", children: listed.map((item) => /* @__PURE__ */ jsxs3("div", { className: "text-xs", children: [
1242
+ /* @__PURE__ */ jsxs3("p", { children: [
1366
1243
  item.category_name ? `${item.category_name} \xB7 ` : "",
1367
1244
  item.name
1368
1245
  ] }),
1369
- item.name !== item.scope && /* @__PURE__ */ jsx5("p", { className: "break-all opacity-70", children: item.scope }),
1370
- /* @__PURE__ */ jsxs5("p", { children: [
1246
+ !hideScopes && item.name !== item.scope && /* @__PURE__ */ jsx4("p", { className: "break-all opacity-70", children: item.scope }),
1247
+ /* @__PURE__ */ jsxs3("p", { children: [
1371
1248
  item.app_status === "granted" ? "\u5E94\u7528\u5DF2\u5F00\u901A" : item.app_status === "missing" ? "\u5E94\u7528\u672A\u5F00\u901A\uFF0C\u8BF7\u5728\u98DE\u4E66\u786E\u8BA4\u4F01\u4E1A\u5BA1\u6279\u6216\u53D1\u5E03\u8981\u6C42" : "\u5E94\u7528\u5F00\u901A\u60C5\u51B5\u5F85\u6838\u9A8C",
1372
1249
  item.identity === "user" ? item.user_status === "granted" ? "\uFF1B\u672C\u4EBA\u5DF2\u6388\u6743" : "\uFF1B\u672C\u4EBA\u5C1A\u672A\u6388\u6743" : ""
1373
1250
  ] })
@@ -1376,7 +1253,7 @@ function FeishuPermissionStatus({ permissions, template }) {
1376
1253
  }
1377
1254
 
1378
1255
  // src/components/ConnectorRuntimeDiagnostics.tsx
1379
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1256
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
1380
1257
  var channelLabels = {
1381
1258
  "channel.connecting": "\u5F00\u59CB\u8FDE\u63A5\u98DE\u4E66",
1382
1259
  "channel.connected": "\u98DE\u4E66\u8FDE\u63A5\u5DF2\u5EFA\u7ACB",
@@ -1402,92 +1279,108 @@ var time = (value) => value > 0 ? new Date(value).toLocaleString() : "\u6682\u65
1402
1279
  var channelLabel = (value) => channelLabels[value] ?? (value ? "\u5C1A\u672A\u8BC6\u522B\u7684\u901A\u9053\u8BB0\u5F55" : "\u5C1A\u65E0\u901A\u9053\u8BB0\u5F55");
1403
1280
  var deliveryLabel = (value) => deliveryLabels[value] ?? "\u5C1A\u672A\u8BC6\u522B\u7684\u6295\u9012\u72B6\u6001";
1404
1281
  function ConnectorRuntimeDiagnostics({ runtime }) {
1405
- return /* @__PURE__ */ jsxs6("section", { "aria-label": "\u6D88\u606F\u63A5\u6536\u4E0E\u6295\u9012\u8BB0\u5F55", className: "space-y-3 rounded-lg border p-3 text-xs", children: [
1406
- /* @__PURE__ */ jsx6("p", { className: "font-medium", children: "\u6D88\u606F\u63A5\u6536\u4E0E\u6295\u9012\u8BB0\u5F55" }),
1407
- /* @__PURE__ */ jsxs6("p", { children: [
1282
+ if ("last_sync_at_ms" in runtime) return /* @__PURE__ */ jsxs4("section", { "aria-label": "\u90AE\u7BB1\u540C\u6B65\u8BB0\u5F55", className: "space-y-3 rounded-lg border p-3 text-xs", children: [
1283
+ /* @__PURE__ */ jsx5("p", { className: "font-medium", children: "\u90AE\u7BB1\u540C\u6B65\u8BB0\u5F55" }),
1284
+ /* @__PURE__ */ jsxs4("p", { children: [
1285
+ "\u6700\u8FD1\u540C\u6B65\u65F6\u95F4\uFF1A",
1286
+ time(runtime.last_sync_at_ms)
1287
+ ] }),
1288
+ /* @__PURE__ */ jsxs4("p", { children: [
1289
+ "\u8FDE\u7EED\u540C\u6B65\u5931\u8D25\u6B21\u6570\uFF1A",
1290
+ runtime.consecutive_failures
1291
+ ] }),
1292
+ runtime.next_retry_at_ms > 0 && /* @__PURE__ */ jsxs4("p", { children: [
1293
+ "\u4E0B\u6B21\u91CD\u8BD5\u65F6\u95F4\uFF1A",
1294
+ time(runtime.next_retry_at_ms)
1295
+ ] }),
1296
+ /* @__PURE__ */ jsx5("p", { children: "\u4EE5\u4E0A\u662F SuperWork \u4FDD\u5B58\u7684\u90AE\u7BB1\u540C\u6B65\u8BB0\u5F55\uFF0C\u4E0D\u80FD\u636E\u6B64\u786E\u8BA4\u6D88\u606F\u5DF2\u9001\u8FBE\u52A9\u624B\u3002" })
1297
+ ] });
1298
+ return /* @__PURE__ */ jsxs4("section", { "aria-label": "\u6D88\u606F\u63A5\u6536\u4E0E\u6295\u9012\u8BB0\u5F55", className: "space-y-3 rounded-lg border p-3 text-xs", children: [
1299
+ /* @__PURE__ */ jsx5("p", { className: "font-medium", children: "\u6D88\u606F\u63A5\u6536\u4E0E\u6295\u9012\u8BB0\u5F55" }),
1300
+ /* @__PURE__ */ jsxs4("p", { children: [
1408
1301
  "\u901A\u9053\u6700\u8FD1\u8BB0\u5F55\uFF1A",
1409
1302
  channelLabel(runtime.channel_state)
1410
1303
  ] }),
1411
- /* @__PURE__ */ jsxs6("p", { children: [
1304
+ /* @__PURE__ */ jsxs4("p", { children: [
1412
1305
  "\u6700\u8FD1\u6536\u5230\u4E8B\u4EF6\uFF1A",
1413
1306
  time(runtime.last_event_at_ms)
1414
1307
  ] }),
1415
- /* @__PURE__ */ jsx6("p", { children: "\u4EE5\u4E0B\u662F SuperWork \u4FDD\u5B58\u7684\u8BB0\u5F55\uFF1B\u6CA1\u6709\u6295\u9012\u8BB0\u5F55\u65F6\uFF0C\u5C1A\u4E0D\u80FD\u786E\u8BA4\u6D88\u606F\u5DF2\u9001\u8FBE\u52A9\u624B\u3002" }),
1416
- /* @__PURE__ */ jsxs6("details", { children: [
1417
- /* @__PURE__ */ jsxs6("summary", { className: "cursor-pointer", children: [
1308
+ /* @__PURE__ */ jsx5("p", { children: "\u4EE5\u4E0B\u662F SuperWork \u4FDD\u5B58\u7684\u8BB0\u5F55\uFF1B\u6CA1\u6709\u6295\u9012\u8BB0\u5F55\u65F6\uFF0C\u5C1A\u4E0D\u80FD\u786E\u8BA4\u6D88\u606F\u5DF2\u9001\u8FBE\u52A9\u624B\u3002" }),
1309
+ /* @__PURE__ */ jsxs4("details", { children: [
1310
+ /* @__PURE__ */ jsxs4("summary", { className: "cursor-pointer", children: [
1418
1311
  "\u63A5\u6536\u901A\u9053\u8BB0\u5F55\uFF08",
1419
1312
  runtime.channel_events.length,
1420
1313
  "\uFF09"
1421
1314
  ] }),
1422
- runtime.channel_events.length ? /* @__PURE__ */ jsx6("ol", { className: "space-y-2 pt-2", children: runtime.channel_events.map((event) => /* @__PURE__ */ jsxs6("li", { className: "space-y-1", children: [
1423
- /* @__PURE__ */ jsxs6("p", { children: [
1315
+ runtime.channel_events.length ? /* @__PURE__ */ jsx5("ol", { className: "space-y-2 pt-2", children: runtime.channel_events.map((event) => /* @__PURE__ */ jsxs4("li", { className: "space-y-1", children: [
1316
+ /* @__PURE__ */ jsxs4("p", { children: [
1424
1317
  channelLabel(event.type),
1425
1318
  " \xB7 ",
1426
1319
  time(event.at_ms)
1427
1320
  ] }),
1428
- /* @__PURE__ */ jsxs6("p", { className: "break-all", children: [
1321
+ /* @__PURE__ */ jsxs4("p", { className: "break-all", children: [
1429
1322
  "\u6392\u67E5\u7F16\u53F7\uFF1A",
1430
1323
  event.trace_id
1431
1324
  ] })
1432
- ] }, event.trace_id)) }) : /* @__PURE__ */ jsx6("p", { children: "\u6682\u65E0\u63A5\u6536\u901A\u9053\u8BB0\u5F55\u3002" })
1325
+ ] }, event.trace_id)) }) : /* @__PURE__ */ jsx5("p", { children: "\u6682\u65E0\u63A5\u6536\u901A\u9053\u8BB0\u5F55\u3002" })
1433
1326
  ] }),
1434
- /* @__PURE__ */ jsxs6("details", { children: [
1435
- /* @__PURE__ */ jsxs6("summary", { className: "cursor-pointer", children: [
1327
+ /* @__PURE__ */ jsxs4("details", { children: [
1328
+ /* @__PURE__ */ jsxs4("summary", { className: "cursor-pointer", children: [
1436
1329
  "\u6D88\u606F\u6295\u9012\u8BB0\u5F55\uFF08",
1437
1330
  runtime.deliveries.length,
1438
1331
  "\uFF09"
1439
1332
  ] }),
1440
- runtime.deliveries.length ? /* @__PURE__ */ jsx6("ol", { className: "space-y-2 pt-2", children: runtime.deliveries.map((delivery) => /* @__PURE__ */ jsxs6("li", { className: "space-y-1", children: [
1441
- /* @__PURE__ */ jsxs6("p", { children: [
1333
+ runtime.deliveries.length ? /* @__PURE__ */ jsx5("ol", { className: "space-y-2 pt-2", children: runtime.deliveries.map((delivery) => /* @__PURE__ */ jsxs4("li", { className: "space-y-1", children: [
1334
+ /* @__PURE__ */ jsxs4("p", { children: [
1442
1335
  deliveryLabel(delivery.status),
1443
1336
  " \xB7 \u5DF2\u5C1D\u8BD5 ",
1444
1337
  delivery.attempt,
1445
1338
  " \u6B21"
1446
1339
  ] }),
1447
- /* @__PURE__ */ jsxs6("p", { className: "break-all", children: [
1340
+ /* @__PURE__ */ jsxs4("p", { className: "break-all", children: [
1448
1341
  "\u6295\u9012\u7F16\u53F7\uFF1A",
1449
1342
  delivery.delivery_id
1450
1343
  ] }),
1451
- /* @__PURE__ */ jsxs6("p", { children: [
1344
+ /* @__PURE__ */ jsxs4("p", { children: [
1452
1345
  "\u521B\u5EFA\u65F6\u95F4\uFF1A",
1453
1346
  time(delivery.created_at_ms)
1454
1347
  ] }),
1455
- ["ready", "retry_wait", "waiting_condition"].includes(delivery.status) && delivery.next_at_ms > 0 && /* @__PURE__ */ jsxs6("p", { children: [
1348
+ ["ready", "retry_wait", "waiting_condition"].includes(delivery.status) && delivery.next_at_ms > 0 && /* @__PURE__ */ jsxs4("p", { children: [
1456
1349
  "\u4E0B\u6B21\u5904\u7406\u65F6\u95F4\uFF1A",
1457
1350
  time(delivery.next_at_ms)
1458
1351
  ] })
1459
- ] }, delivery.delivery_id)) }) : /* @__PURE__ */ jsx6("p", { children: "\u6682\u65E0\u6D88\u606F\u6295\u9012\u8BB0\u5F55\u3002" })
1352
+ ] }, delivery.delivery_id)) }) : /* @__PURE__ */ jsx5("p", { children: "\u6682\u65E0\u6D88\u606F\u6295\u9012\u8BB0\u5F55\u3002" })
1460
1353
  ] }),
1461
- /* @__PURE__ */ jsxs6("details", { children: [
1462
- /* @__PURE__ */ jsxs6("summary", { className: "cursor-pointer", children: [
1354
+ /* @__PURE__ */ jsxs4("details", { children: [
1355
+ /* @__PURE__ */ jsxs4("summary", { className: "cursor-pointer", children: [
1463
1356
  "\u9010\u6B21\u6295\u9012\u5C1D\u8BD5\uFF08",
1464
1357
  runtime.delivery_attempts.length,
1465
1358
  "\uFF09"
1466
1359
  ] }),
1467
- runtime.delivery_attempts.length ? /* @__PURE__ */ jsx6("ol", { className: "space-y-2 pt-2", children: runtime.delivery_attempts.map((attempt) => /* @__PURE__ */ jsxs6("li", { className: "space-y-1", children: [
1468
- /* @__PURE__ */ jsxs6("p", { children: [
1360
+ runtime.delivery_attempts.length ? /* @__PURE__ */ jsx5("ol", { className: "space-y-2 pt-2", children: runtime.delivery_attempts.map((attempt) => /* @__PURE__ */ jsxs4("li", { className: "space-y-1", children: [
1361
+ /* @__PURE__ */ jsxs4("p", { children: [
1469
1362
  "\u7B2C ",
1470
1363
  attempt.attempt,
1471
1364
  " \u6B21 \xB7 ",
1472
1365
  deliveryLabel(attempt.status)
1473
1366
  ] }),
1474
- /* @__PURE__ */ jsxs6("p", { className: "break-all", children: [
1367
+ /* @__PURE__ */ jsxs4("p", { className: "break-all", children: [
1475
1368
  "\u6295\u9012\u7F16\u53F7\uFF1A",
1476
1369
  attempt.delivery_id
1477
1370
  ] }),
1478
- /* @__PURE__ */ jsxs6("p", { children: [
1371
+ /* @__PURE__ */ jsxs4("p", { children: [
1479
1372
  "\u5F00\u59CB\uFF1A",
1480
1373
  time(attempt.started_at_ms),
1481
1374
  "\uFF1B\u7ED3\u675F\uFF1A",
1482
1375
  time(attempt.finished_at_ms)
1483
1376
  ] })
1484
- ] }, attempt.id)) }) : /* @__PURE__ */ jsx6("p", { children: "\u6682\u65E0\u6295\u9012\u5C1D\u8BD5\u8BB0\u5F55\u3002" })
1377
+ ] }, attempt.id)) }) : /* @__PURE__ */ jsx5("p", { children: "\u6682\u65E0\u6295\u9012\u5C1D\u8BD5\u8BB0\u5F55\u3002" })
1485
1378
  ] })
1486
1379
  ] });
1487
1380
  }
1488
1381
 
1489
1382
  // src/components/DeviceConnection.tsx
1490
- import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1383
+ import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
1491
1384
  var statusLabels = {
1492
1385
  available: "\u53EF\u7528",
1493
1386
  not_selected: "\u672A\u9009\u62E9",
@@ -1534,7 +1427,13 @@ function authorizationURL(value) {
1534
1427
  return null;
1535
1428
  }
1536
1429
  }
1537
- function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = false, onDisable, initialPage = "connection", authorizationCapabilities, autoAuthorize = false }) {
1430
+ function permissionNoticeKey(name, connection, permissions) {
1431
+ const scopes = JSON.stringify([...new Set(permissions.map((item) => JSON.stringify([item.identity, item.scope])))].sort());
1432
+ let hash = 2166136261;
1433
+ for (let index = 0; index < scopes.length; index++) hash = Math.imul(hash ^ scopes.charCodeAt(index), 16777619);
1434
+ return `blade-connector-notice:${name}:${JSON.stringify([connection.connection_id ?? "", connection.app_id ?? ""])}:${(hash >>> 0).toString(16)}`;
1435
+ }
1436
+ function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = false, onDisable, initialPage = "connection", authorizationCapabilities, autoAuthorize = false, detail }) {
1538
1437
  const [view, setView] = useState(null);
1539
1438
  const [selected, setSelected] = useState([]);
1540
1439
  const [page, setPage] = useState(initialPage);
@@ -1552,6 +1451,13 @@ function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = fa
1552
1451
  const linking = useRef(false);
1553
1452
  const newConnection = useRef(false);
1554
1453
  function accept(value) {
1454
+ if (value.permissions && !value.permissions.some((item) => item.app_status === "missing")) {
1455
+ try {
1456
+ const prefix = `blade-connector-notice:${detail?.name ?? "connector.builtin.feishu"}:`;
1457
+ for (const key of Object.keys(localStorage)) if (key.startsWith(prefix)) localStorage.removeItem(key);
1458
+ } catch {
1459
+ }
1460
+ }
1555
1461
  setView(value);
1556
1462
  const activationKnown = typeof value.activation_pending === "boolean";
1557
1463
  if (activationKnown) {
@@ -1797,90 +1703,248 @@ function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = fa
1797
1703
  void run("finish", { capabilities: target.capabilities, enable: target.enable });
1798
1704
  };
1799
1705
  const preserveDisabled = Boolean(view?.app_id && view.enabled === false && !newConnection.current);
1800
- const back = /* @__PURE__ */ jsx7("button", { type: "button", className: "text-xs underline opacity-70", disabled: busy, onClick: () => setPage(view?.app_id ? "connection" : "select"), children: "\u8FD4\u56DE\u98DE\u4E66" });
1801
- return /* @__PURE__ */ jsxs7("section", { "aria-label": "\u98DE\u4E66\u6388\u6743", "aria-busy": busy, className: "space-y-5 py-3 text-left", children: [
1802
- /* @__PURE__ */ jsxs7("div", { children: [
1803
- /* @__PURE__ */ jsx7("h3", { className: "text-lg font-medium", children: page === "manage" ? "\u7BA1\u7406\u98DE\u4E66\u8FDE\u63A5" : page === "help" ? "\u8FDE\u63A5\u5E2E\u52A9" : page === "select" ? "\u8FDE\u63A5\u98DE\u4E66" : "\u98DE\u4E66" }),
1804
- /* @__PURE__ */ jsx7("p", { className: "mt-1 text-xs opacity-70", children: "\u6309\u98DE\u4E66\u5B98\u65B9\u63A8\u8350\u6743\u9650\u8FDE\u63A5\uFF0C\u5177\u4F53\u5F00\u901A\u7ED3\u679C\u7531\u4F01\u4E1A\u89C4\u5219\u548C\u672C\u4EBA\u6388\u6743\u51B3\u5B9A\u3002" })
1706
+ const back = /* @__PURE__ */ jsx6("button", { type: "button", className: "text-xs underline opacity-70", disabled: busy, onClick: () => setPage(view?.app_id ? "connection" : "select"), children: "\u8FD4\u56DE\u98DE\u4E66" });
1707
+ const authorizationContent = /* @__PURE__ */ jsx6(Fragment, { children: (autoAuthorize || authorizationCapabilities?.length) && busy && !waiting && !error && !view?.error ? /* @__PURE__ */ jsx6("output", { className: "block text-sm", children: "\u6B63\u5728\u5904\u7406\u98DE\u4E66\u6388\u6743\u2026" }) : waiting ? /* @__PURE__ */ jsxs5("div", { className: "space-y-4 rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-5 text-center", children: [
1708
+ /* @__PURE__ */ jsx6("h4", { className: "font-medium", children: view?.phase === "app" ? "\u5728\u98DE\u4E66\u9009\u62E9\u6216\u521B\u5EFA\u5E94\u7528" : view?.phase === "permissions" ? "\u5728\u98DE\u4E66\u786E\u8BA4\u5E76\u5F00\u901A\u6743\u9650" : "\u8BF7\u5728\u98DE\u4E66\u786E\u8BA4\u672C\u6B21\u6388\u6743" }),
1709
+ /* @__PURE__ */ jsx6("p", { className: "text-xs opacity-70", children: view?.current_step?.message || "\u5B8C\u6210\u5F53\u524D\u6B65\u9AA4\u540E\u81EA\u52A8\u7EE7\u7EED\uFF0C\u5DF2\u6709\u80FD\u529B\u59CB\u7EC8\u4FDD\u7559\u3002" }),
1710
+ url ? /* @__PURE__ */ jsxs5(Fragment, { children: [
1711
+ new TextEncoder().encode(url).length <= 2200 ? /* @__PURE__ */ jsx6(QRCodeSVG, { value: url, size: 180, marginSize: 4, title: "\u98DE\u4E66\u6388\u6743\u4E8C\u7EF4\u7801", className: "mx-auto rounded-lg bg-white" }) : /* @__PURE__ */ jsx6("p", { className: "text-xs opacity-70", children: "\u6388\u6743\u9879\u76EE\u8F83\u591A\uFF0C\u8BF7\u6253\u5F00\u98DE\u4E66\u6388\u6743\u9875\u9762\u7EE7\u7EED\u3002" }),
1712
+ /* @__PURE__ */ jsx6("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: "block text-sm underline", children: "\u6253\u5F00\u98DE\u4E66\u6388\u6743\u9875\u9762" })
1713
+ ] }) : verifying ? /* @__PURE__ */ jsx6("output", { className: "block text-sm", children: view?.error ? "\u6838\u9A8C\u6682\u672A\u5B8C\u6210\uFF0C\u8BF7\u70B9\u51FB\u201C\u6211\u5DF2\u5B8C\u6210\u6388\u6743\u201D\u91CD\u8BD5\u3002" : "\u6B63\u5728\u6838\u9A8C\u6388\u6743\u7ED3\u679C\uFF0C\u8BF7\u7A0D\u5019\u3002" }) : /* @__PURE__ */ jsx6("p", { role: "alert", className: "text-sm", children: "\u5F53\u524D\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F\u6216\u65E0\u6CD5\u9A8C\u8BC1\uFF0C\u8BF7\u91CD\u8BD5\u672C\u6B21\u6388\u6743\u3002" }),
1714
+ view?.expires_at && /* @__PURE__ */ jsxs5("p", { className: "text-xs opacity-70", children: [
1715
+ "\u6709\u6548\u81F3 ",
1716
+ new Date(view.expires_at * 1e3).toLocaleTimeString()
1717
+ ] }),
1718
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap justify-center gap-3", children: [
1719
+ /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => void run("poll", view?.attempt_id ? { attempt_id: view.attempt_id } : {}), children: busy ? "\u6B63\u5728\u786E\u8BA4\u2026" : "\u6211\u5DF2\u5B8C\u6210\u6388\u6743" }),
1720
+ /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => void run("cancel", view?.attempt_id ? { attempt_id: view.attempt_id } : {}), children: "\u6682\u65F6\u53D6\u6D88" }),
1721
+ !url && !verifying && /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: retryCurrent, children: "\u91CD\u8BD5\u672C\u6B21\u6388\u6743" })
1805
1722
  ] }),
1806
- notice && /* @__PURE__ */ jsx7("output", { className: "block rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-sm", children: notice }),
1807
- error && /* @__PURE__ */ jsx7("p", { role: "alert", className: "rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-sm", children: error }),
1808
- view?.error && /* @__PURE__ */ jsxs7("div", { role: "alert", className: "space-y-1 rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-sm", children: [
1809
- /* @__PURE__ */ jsx7("p", { children: view.error.message }),
1810
- view.error.next_action && /* @__PURE__ */ jsx7("p", { children: view.error.next_action }),
1811
- !waiting && view.app_id && /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap gap-3", children: [
1812
- /* @__PURE__ */ jsx7("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: retryCurrent, children: "\u91CD\u8BD5\u5F53\u524D\u6388\u6743" }),
1813
- /* @__PURE__ */ jsx7("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: finishExisting, children: "\u5148\u4F7F\u7528\u5DF2\u5F00\u901A\u80FD\u529B\uFF0C\u5176\u4ED6\u7A0D\u540E\u5904\u7406" })
1723
+ view?.phase === "permissions" && /* @__PURE__ */ jsx6("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: finishExisting, children: "\u5148\u4F7F\u7528\u5DF2\u5F00\u901A\u80FD\u529B\uFF0C\u5176\u4ED6\u7A0D\u540E\u5904\u7406" })
1724
+ ] }) : view && page === "select" ? /* @__PURE__ */ jsxs5(Fragment, { children: [
1725
+ view.app_id ? back : /* @__PURE__ */ jsx6("p", { className: "text-sm", children: "\u9996\u6B21\u8FDE\u63A5\u9700\u8981\u626B\u7801\u4E24\u6B21\uFF1A\u5148\u5173\u8054\u98DE\u4E66\u5E94\u7528\uFF0C\u518D\u786E\u8BA4\u672C\u4EBA\u6388\u6743\u3002\u9009\u5DF2\u6709\u5E94\u7528\u65F6\u7B2C\u4E8C\u6B21\u4E5F\u4E0D\u80FD\u7701\uFF0C\u98DE\u4E66\u8981\u6C42\u4F60\u672C\u4EBA\u540C\u610F\uFF0C\u52A9\u624B\u624D\u80FD\u8BFB\u53D6\u4F60\u7684\u6D88\u606F\u3002" }),
1726
+ /* @__PURE__ */ jsx6(FeishuCapabilitySelection, { capabilities, permissions: view.permissions, operations: view.operations, domains: view.domains, selected, onChange: setSelected, disabled: busy }),
1727
+ view.catalog_unavailable && /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => void refresh(), children: "\u91CD\u65B0\u8BFB\u53D6\u5DE5\u4F5C\u80FD\u529B" }),
1728
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-3 border-t border-[color-mix(in_srgb,currentColor_18%,transparent)] pt-4", children: [
1729
+ /* @__PURE__ */ jsx6("p", { className: "text-xs opacity-70", children: "\u6743\u9650\u7531\u98DE\u4E66\u5B98\u65B9\u9875\u9762\u7EDF\u4E00\u9009\u62E9\uFF0C\u5DF2\u6709\u6388\u6743\u7EE7\u7EED\u4FDD\u7559\u3002" }),
1730
+ /* @__PURE__ */ jsx6("button", { type: "button", className: `${button} border-blue-600 bg-blue-600 text-white`, disabled: busy || Boolean(view.app_id) && !selected.length, onClick: () => start(), children: busy ? "\u6B63\u5728\u51C6\u5907\u6388\u6743\u2026" : view.app_id ? preserveDisabled ? "\u8865\u5145\u6388\u6743\u5E76\u4FDD\u5B58" : "\u524D\u5F80\u98DE\u4E66\u6388\u6743" : "\u8FDE\u63A5\u98DE\u4E66" })
1731
+ ] }),
1732
+ preserveDisabled && /* @__PURE__ */ jsx6("p", { className: "text-xs", children: "\u6B64\u52A9\u624B\u5F53\u524D\u505C\u7528\uFF0C\u65B0\u589E\u6388\u6743\u4E0D\u4F1A\u81EA\u52A8\u542F\u7528\u3002\u9700\u8981\u65F6\u53EF\u5728\u7BA1\u7406\u8FDE\u63A5\u4E2D\u91CD\u65B0\u542F\u7528\u3002" })
1733
+ ] }) : null });
1734
+ const diagnosticContent = view && /* @__PURE__ */ jsxs5(Fragment, { children: [
1735
+ " ",
1736
+ /* @__PURE__ */ jsx6("p", { className: "text-sm", children: "\u53EA\u5904\u7406\u672A\u5B8C\u6210\u7684\u9879\u76EE\uFF0C\u5DF2\u7ECF\u5F00\u901A\u7684\u80FD\u529B\u4E0D\u9700\u8981\u91CD\u65B0\u7533\u8BF7\u3002" }),
1737
+ pending.map((item) => /* @__PURE__ */ jsxs5("div", { className: "rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-sm", children: [
1738
+ /* @__PURE__ */ jsx6("p", { children: item.name }),
1739
+ /* @__PURE__ */ jsxs5("p", { className: "text-xs", children: [
1740
+ item.reason || item.next_action || statusLabels[item.status],
1741
+ item.actor ? ` \xB7 \u7531${item.actor}\u5904\u7406` : ""
1814
1742
  ] })
1743
+ ] }, item.id)),
1744
+ /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => void run("check"), children: "\u91CD\u65B0\u68C0\u67E5\u8FDE\u63A5" }),
1745
+ view.app_id && /* @__PURE__ */ jsx6("a", { className: "block text-xs underline", href: `https://open.feishu.cn/app/${encodeURIComponent(view.app_id)}/auth`, target: "_blank", rel: "noopener noreferrer", children: "\u5728\u98DE\u4E66\u67E5\u770B\u6743\u9650\u3001\u53D1\u5E03\u4E0E\u53EF\u7528\u8303\u56F4" }),
1746
+ /* @__PURE__ */ jsxs5("details", { className: "rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-xs", children: [
1747
+ /* @__PURE__ */ jsx6("summary", { className: "cursor-pointer", children: "\u9AD8\u7EA7\u6392\u67E5\u4FE1\u606F" }),
1748
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-3 pt-3", children: [
1749
+ /* @__PURE__ */ jsxs5("p", { children: [
1750
+ "\u8FDE\u63A5\u7F16\u53F7\uFF1A",
1751
+ view.connection_id || "\u5C1A\u672A\u521B\u5EFA"
1752
+ ] }),
1753
+ /* @__PURE__ */ jsxs5("p", { children: [
1754
+ "\u6392\u67E5\u7F16\u53F7\uFF1A",
1755
+ view.error?.trace_id || view.trace_id || "\u6682\u65E0\u8BB0\u5F55"
1756
+ ] }),
1757
+ /* @__PURE__ */ jsx6("p", { children: "\u8BB0\u5F55\u4E0D\u5305\u542B\u51ED\u636E\u4E0E\u6D88\u606F\u6B63\u6587\u3002" }),
1758
+ view.steps?.length ? /* @__PURE__ */ jsx6("ol", { className: "space-y-2", children: view.steps.map((step, index) => /* @__PURE__ */ jsxs5("li", { children: [
1759
+ stateLabels[step.state] ?? step.state,
1760
+ "\uFF1A",
1761
+ step.message
1762
+ ] }, `${step.id}:${index}`)) }) : null,
1763
+ diagnostics && /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => void inspect(), children: "\u8BFB\u53D6\u6392\u67E5\u8BB0\u5F55" }),
1764
+ diagnosticView?.runtime && /* @__PURE__ */ jsx6(ConnectorRuntimeDiagnostics, { runtime: diagnosticView.runtime }),
1765
+ diagnosticView && /* @__PURE__ */ jsx6("ol", { className: "space-y-3", children: diagnosticView.audit_events.map((event, index) => /* @__PURE__ */ jsxs5("li", { children: [
1766
+ event.message ?? auditLabels[event.type ?? ""] ?? "\u8FDE\u63A5\u72B6\u6001\u8BB0\u5F55",
1767
+ event.code && /* @__PURE__ */ jsxs5("p", { children: [
1768
+ "\u539F\u56E0\u7F16\u53F7\uFF1A",
1769
+ event.code
1770
+ ] }),
1771
+ event.platform_code && /* @__PURE__ */ jsxs5("p", { children: [
1772
+ "\u98DE\u4E66\u9519\u8BEF\u7801\uFF1A",
1773
+ event.platform_code
1774
+ ] }),
1775
+ event.platform_request_id && /* @__PURE__ */ jsxs5("p", { children: [
1776
+ "\u98DE\u4E66\u8BF7\u6C42\u7F16\u53F7\uFF1A",
1777
+ event.platform_request_id
1778
+ ] }),
1779
+ event.trace_id && /* @__PURE__ */ jsxs5("p", { children: [
1780
+ "\u6392\u67E5\u7F16\u53F7\uFF1A",
1781
+ event.trace_id
1782
+ ] })
1783
+ ] }, event.id ?? index)) })
1784
+ ] })
1785
+ ] })
1786
+ ] });
1787
+ if (detail) {
1788
+ const hasConnection = Boolean(view?.app_id);
1789
+ const needsAttention = hasConnection && Boolean(view?.permissions?.some((item) => item.app_status === "missing") || view?.error || pendingPermissions.length || failedUser.length || view?.activation_pending || view?.enabled === false);
1790
+ const disable = async () => {
1791
+ if (inFlight.current) return;
1792
+ inFlight.current = true;
1793
+ setBusy(true);
1794
+ try {
1795
+ await callbacks.current.onDisable?.();
1796
+ const value = await callbacks.current.read();
1797
+ if (live.current) accept(value);
1798
+ await changed();
1799
+ } finally {
1800
+ inFlight.current = false;
1801
+ if (live.current) setBusy(false);
1802
+ }
1803
+ };
1804
+ const missingApp = (view?.permissions ?? []).filter((item) => item.app_status === "missing");
1805
+ const permissionActions = /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-center gap-3", children: [
1806
+ view?.app_id && /* @__PURE__ */ jsx6("a", { className: `${button} inline-flex items-center`, href: `https://open.feishu.cn/app/${encodeURIComponent(view.app_id)}/auth`, target: "_blank", rel: "noopener noreferrer", children: "\u6253\u5F00\u98DE\u4E66\u6743\u9650\u7BA1\u7406" }),
1807
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "min-h-10 text-xs underline disabled:opacity-50", disabled: busy, onClick: () => void run("check"), children: "\u6211\u5DF2\u5904\u7406\uFF0C\u91CD\u65B0\u6838\u9A8C" })
1808
+ ] });
1809
+ const actions = [
1810
+ { id: "check", description: "\u68C0\u67E5\u6700\u65B0\u6743\u9650\u5F00\u901A\u60C5\u51B5", label: "\u91CD\u65B0\u6838\u9A8C\u6743\u9650", run: () => run("check") },
1811
+ { id: "permissions", description: "\u67E5\u770B\u5168\u90E8\u6743\u9650\u53CA\u5F00\u901A\u60C5\u51B5", label: "\u98DE\u4E66\u5B98\u65B9\u63A8\u8350\u6743\u9650", page: /* @__PURE__ */ jsxs5("div", { className: "space-y-4", children: [
1812
+ /* @__PURE__ */ jsx6(FeishuPermissionStatus, { permissions: view?.permissions ?? [], template: view?.permission_template, expanded: true, hideScopes: true }),
1813
+ permissionActions,
1814
+ /* @__PURE__ */ jsx6(ConnectorAuthorizationProgress, { result: view?.authorization_result, onCheck: () => void run("check"), busy }),
1815
+ pendingPermissions.length > 0 && /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => start(pendingPermissions.map((item) => item.id)), children: "\u7EE7\u7EED\u5F00\u901A\u672A\u5B8C\u6210\u7684\u6743\u9650" }),
1816
+ failedUser.length > 0 && /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => start(failedUser.map((item) => item.id)), children: "\u4EC5\u8865\u5145\u672A\u5B8C\u6210\u7684\u672C\u4EBA\u6388\u6743" }),
1817
+ view?.activation_pending && active.length > 0 && /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: finishExisting, children: "\u5148\u4F7F\u7528\u5DF2\u5F00\u901A\u80FD\u529B\uFF0C\u5176\u4ED6\u7A0D\u540E\u5904\u7406" }),
1818
+ /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => {
1819
+ setPage("select");
1820
+ start();
1821
+ }, children: "\u8865\u5145\u6388\u6743" })
1822
+ ] }) },
1823
+ ...hasConnection ? [{ id: "disable", description: "\u53EA\u5F71\u54CD\u6B64\u52A9\u624B\uFF0CSW \u4E2D\u7684\u6388\u6743\u548C\u6536\u6D88\u606F\u4FDD\u7559", label: view?.enabled === false ? "\u91CD\u65B0\u542F\u7528" : "\u5728\u6B64\u52A9\u624B\u4E2D\u505C\u7528", run: view?.enabled === false ? () => run("finish", { capabilities: view.selected_capabilities ?? selected, enable: true }) : disable, disabled: !onDisable && view?.enabled !== false, confirmation: { title: view?.enabled === false ? "\u91CD\u65B0\u542F\u7528\u98DE\u4E66\uFF1F" : "\u5728\u6B64\u52A9\u624B\u4E2D\u505C\u7528\u98DE\u4E66\uFF1F", description: "\u53EA\u5F71\u54CD\u6B64\u52A9\u624B\u4F7F\u7528\u98DE\u4E66\uFF0CSuperWork \u4E2D\u7684\u6388\u6743\u548C\u6D88\u606F\u63A5\u6536\u4FDD\u7559\u3002" } }] : [],
1824
+ { id: "diagnostics", description: "\u8BCA\u65AD\u4FE1\u606F\u3001\u6700\u8FD1\u4E8B\u4EF6\u548C\u65E5\u5FD7", label: "\u9047\u5230\u95EE\u9898\uFF1F", run: inspect, page: /* @__PURE__ */ jsxs5("div", { className: "space-y-4", children: [
1825
+ diagnosticContent,
1826
+ bindDelivery && view && canReceive(view) && subscription !== "paused" && /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => void run("bind"), children: "\u66F4\u65B0\u52A9\u624B\u63A5\u6536\u5730\u5740" })
1827
+ ] }) },
1828
+ { id: "help", description: "\u67E5\u770B\u8FDE\u63A5\u548C\u4F7F\u7528\u8BF4\u660E", label: "\u4F7F\u7528\u5E2E\u52A9", page: /* @__PURE__ */ jsxs5("div", { className: "space-y-3", children: [
1829
+ /* @__PURE__ */ jsx6("p", { children: "\u53EF\u4EE5\u8BA9\u52A9\u624B\u6536\u53D1\u6D88\u606F\u3001\u67E5\u770B\u65E5\u7A0B\u548C\u6587\u6863\u3002\u672A\u5F00\u901A\u7684\u6743\u9650\u4F1A\u5728\u7528\u5230\u65F6\u63D0\u793A\u4F60\u5904\u7406\u3002" }),
1830
+ /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => {
1831
+ setPage("select");
1832
+ start();
1833
+ }, children: "\u8865\u5145\u6388\u6743" })
1834
+ ] }) },
1835
+ ...view?.connection_id ? [{ id: "remove", description: "\u6E05\u9664 SW \u4E2D\u7684\u51ED\u636E\u5E76\u505C\u6B62\u6536\u6D88\u606F", label: "\u79FB\u9664\u8FDE\u63A5\u5E76\u91CD\u65B0\u8FDE\u63A5", danger: true, confirmation: { title: "\u786E\u8BA4\u79FB\u9664\u5F53\u524D\u98DE\u4E66\u8FDE\u63A5\uFF1F", description: "SuperWork \u4E2D\u6B64\u8FDE\u63A5\u7684\u51ED\u636E\u5C06\u88AB\u79FB\u9664\uFF0C\u6D88\u606F\u63A5\u6536\u548C\u8F6C\u53D1\u5C06\u505C\u6B62\uFF0C\u5176\u4ED6\u4F9D\u8D56\u6B64\u8FDE\u63A5\u7684\u52A9\u624B\u4E5F\u4F1A\u53D7\u5F71\u54CD\u3002\u5386\u53F2\u6D88\u606F\u4E0E\u6392\u67E5\u65E5\u5FD7\u4F1A\u4FDD\u7559\uFF0C\u98DE\u4E66\u540E\u53F0\u5E94\u7528\u4E0D\u4F1A\u5220\u9664\u3002" }, run: () => removeConnection(view.connection_id) }] : [],
1836
+ ...detail.actions ?? []
1837
+ ];
1838
+ return /* @__PURE__ */ jsxs5(
1839
+ ConnectorDetail,
1840
+ {
1841
+ title: detail.title,
1842
+ icon: detail.icon,
1843
+ account: view?.label || "\u8FDE\u63A5\u540E\uFF0C\u52A9\u624B\u53EF\u4EE5\u5E2E\u4F60\u5904\u7406\u6D88\u606F\u3001\u65E5\u7A0B\u548C\u6587\u6863\u3002",
1844
+ connected: hasConnection && !waiting && page !== "select" && !view?.activation_pending,
1845
+ status: needsAttention ? "attention" : hasConnection ? "connected" : "disconnected",
1846
+ statusLabel: view?.enabled === false && hasConnection ? "\u5DF2\u505C\u7528" : void 0,
1847
+ busy,
1848
+ actions,
1849
+ noticeStorageKey: view && missingApp.length ? permissionNoticeKey(detail.name ?? "connector.builtin.feishu", view, missingApp) : void 0,
1850
+ noticeTitle: view?.enabled === false ? "\u5DF2\u5728\u6B64\u52A9\u624B\u4E2D\u505C\u7528" : missingApp.length ? `\u6709 ${missingApp.length} \u9879\u6743\u9650\u9700\u8981\u7BA1\u7406\u5458\u5728\u98DE\u4E66\u5F00\u901A` : "\u6709\u6388\u6743\u4E8B\u9879\u9700\u8981\u5904\u7406",
1851
+ noticeCollapsedTitle: view?.enabled === false ? "\u5DF2\u5728\u6B64\u52A9\u624B\u4E2D\u505C\u7528" : missingApp.length ? `${missingApp.length} \u9879\u6743\u9650\u5F85\u7BA1\u7406\u5458\u5F00\u901A` : "\u6709\u6388\u6743\u4E8B\u9879\u9700\u8981\u5904\u7406",
1852
+ notice: hasConnection && needsAttention && !waiting ? /* @__PURE__ */ jsxs5(Fragment, { children: [
1853
+ /* @__PURE__ */ jsx6("p", { children: view?.error?.message || "\u4E0D\u5F71\u54CD\u5DF2\u5F00\u901A\u7684\u529F\u80FD\uFF0C\u7528\u5230\u76F8\u5173\u64CD\u4F5C\u65F6\u52A9\u624B\u4F1A\u63D0\u793A\u4F60\u5904\u7406\u3002" }),
1854
+ view?.error?.next_action && /* @__PURE__ */ jsx6("p", { children: view.error.next_action }),
1855
+ permissionActions,
1856
+ missingApp.length > 0 && /* @__PURE__ */ jsxs5("details", { className: "text-xs opacity-70", children: [
1857
+ /* @__PURE__ */ jsx6("summary", { className: "cursor-pointer", children: "\u67E5\u770B\u662F\u54EA\u4E9B\u6743\u9650" }),
1858
+ /* @__PURE__ */ jsx6("ul", { className: "mt-2 space-y-1", children: missingApp.map((item) => /* @__PURE__ */ jsx6("li", { className: "break-all", children: item.name || item.scope }, `${item.identity}:${item.scope}`)) })
1859
+ ] })
1860
+ ] }) : void 0,
1861
+ connection: /* @__PURE__ */ jsxs5(Fragment, { children: [
1862
+ !view && /* @__PURE__ */ jsxs5(Fragment, { children: [
1863
+ /* @__PURE__ */ jsx6("output", { children: error || "\u6B63\u5728\u8BFB\u53D6\u98DE\u4E66\u8FDE\u63A5\u2026" }),
1864
+ error && /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => void refresh(), children: "\u91CD\u65B0\u8BFB\u53D6\u8FDE\u63A5" })
1865
+ ] }),
1866
+ page === "select" && !waiting ? /* @__PURE__ */ jsxs5("div", { className: "space-y-4 rounded-[20px] border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-5", children: [
1867
+ /* @__PURE__ */ jsx6("h3", { className: "text-base font-medium", children: "\u8FDE\u63A5\u98DE\u4E66" }),
1868
+ authorizationContent
1869
+ ] }) : authorizationContent
1870
+ ] }),
1871
+ tabs: [{ id: "rules", label: "\u4F7F\u7528\u89C4\u5219", content: detail.rules }, ...bindDelivery ? [{ id: "push", label: "\u6D88\u606F\u63A8\u9001", content: /* @__PURE__ */ jsxs5("div", { className: "settings-surface space-y-4 rounded-[22px] p-5", style: { background: "var(--settings-surface, hsl(var(--muted)))" }, children: [
1872
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-4", children: [
1873
+ /* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
1874
+ /* @__PURE__ */ jsx6("p", { className: "font-medium", children: "\u5411\u52A9\u624B\u63A8\u9001\u98DE\u4E66\u6D88\u606F" }),
1875
+ /* @__PURE__ */ jsx6("p", { className: "mt-1 text-xs opacity-70", children: "\u6682\u505C\u540E SW \u4ECD\u63A5\u6536\u5E76\u4FDD\u5B58\u6D88\u606F\uFF0C\u53EA\u662F\u4E0D\u8F6C\u7ED9\u52A9\u624B\u3002" })
1876
+ ] }),
1877
+ /* @__PURE__ */ jsx6(Switch, { "aria-label": "\u5411\u52A9\u624B\u63A8\u9001", checked: subscription === "enabled", disabled: busy, onCheckedChange: (checked) => void run(checked ? subscription === "paused" ? "resume" : "bind" : "pause"), className: "relative inline-flex h-6 w-11 shrink-0 items-center rounded-full bg-[color-mix(in_srgb,currentColor_20%,transparent)] transition-colors after:absolute after:-inset-y-2 after:-inset-x-1 data-[state=checked]:bg-[var(--color-accent,hsl(var(--primary)))] disabled:opacity-50", thumbClassName: "pointer-events-none block size-5 translate-x-0.5 rounded-full bg-white shadow-sm transition-transform data-[state=checked]:translate-x-[22px]" })
1878
+ ] }),
1879
+ detail.pushFrequency,
1880
+ detail.onOpenPush && /* @__PURE__ */ jsx6("button", { type: "button", className: "block min-h-10 text-xs underline", onClick: detail.onOpenPush, children: "\u524D\u5F80\u63A8\u9001\u63A5\u53E3" })
1881
+ ] }) }] : [], ...detail.preferences ? [{ id: "preferences", label: "\u52A9\u624B\u504F\u597D", content: detail.preferences }] : []],
1882
+ children: [
1883
+ notice && /* @__PURE__ */ jsx6("output", { className: "block text-xs", children: notice }),
1884
+ error && /* @__PURE__ */ jsx6("p", { role: "alert", children: error })
1885
+ ]
1886
+ },
1887
+ waiting ? "waiting" : page === "select" ? "select" : "details"
1888
+ );
1889
+ }
1890
+ return /* @__PURE__ */ jsxs5("section", { "aria-label": "\u98DE\u4E66\u6388\u6743", "aria-busy": busy, className: "space-y-5 py-3 text-left", children: [
1891
+ /* @__PURE__ */ jsxs5("div", { children: [
1892
+ /* @__PURE__ */ jsx6("h3", { className: "text-lg font-medium", children: page === "manage" ? "\u7BA1\u7406\u98DE\u4E66\u8FDE\u63A5" : page === "help" ? "\u8FDE\u63A5\u5E2E\u52A9" : page === "select" ? "\u8FDE\u63A5\u98DE\u4E66" : "\u98DE\u4E66" }),
1893
+ /* @__PURE__ */ jsx6("p", { className: "mt-1 text-xs opacity-70", children: "\u6309\u98DE\u4E66\u5B98\u65B9\u63A8\u8350\u6743\u9650\u8FDE\u63A5\uFF0C\u5177\u4F53\u5F00\u901A\u7ED3\u679C\u7531\u4F01\u4E1A\u89C4\u5219\u548C\u672C\u4EBA\u6388\u6743\u51B3\u5B9A\u3002" })
1815
1894
  ] }),
1816
- view && !waiting && matchesRequestedAuthorization(view) && /* @__PURE__ */ jsx7(ConnectorAuthorizationProgress, { result: view.authorization_result, onCheck: () => void run("check"), busy }),
1817
- view && !waiting && page !== "help" && /* @__PURE__ */ jsx7(FeishuPermissionStatus, { permissions: view.permissions ?? [], template: view.permission_template }),
1818
- !view && !error && /* @__PURE__ */ jsx7("output", { className: "block text-sm", children: "\u6B63\u5728\u8BFB\u53D6\u98DE\u4E66\u8FDE\u63A5\u2026" }),
1819
- !view && error && /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void refresh(), children: "\u91CD\u65B0\u8BFB\u53D6\u8FDE\u63A5" }),
1820
- (autoAuthorize || authorizationCapabilities?.length) && busy && !waiting && !error && !view?.error ? /* @__PURE__ */ jsx7("output", { className: "block text-sm", children: "\u6B63\u5728\u5904\u7406\u98DE\u4E66\u6388\u6743\u2026" }) : waiting ? /* @__PURE__ */ jsxs7("div", { className: "space-y-4 rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-5 text-center", children: [
1821
- /* @__PURE__ */ jsx7("h4", { className: "font-medium", children: view?.phase === "app" ? "\u5728\u98DE\u4E66\u9009\u62E9\u6216\u521B\u5EFA\u5E94\u7528" : view?.phase === "permissions" ? "\u5728\u98DE\u4E66\u786E\u8BA4\u5E76\u5F00\u901A\u6743\u9650" : "\u8BF7\u5728\u98DE\u4E66\u786E\u8BA4\u672C\u6B21\u6388\u6743" }),
1822
- /* @__PURE__ */ jsx7("p", { className: "text-xs opacity-70", children: view?.current_step?.message || "\u5B8C\u6210\u5F53\u524D\u6B65\u9AA4\u540E\u81EA\u52A8\u7EE7\u7EED\uFF0C\u5DF2\u6709\u80FD\u529B\u59CB\u7EC8\u4FDD\u7559\u3002" }),
1823
- url ? /* @__PURE__ */ jsxs7(Fragment, { children: [
1824
- new TextEncoder().encode(url).length <= 2200 ? /* @__PURE__ */ jsx7(QRCodeSVG, { value: url, size: 180, marginSize: 4, title: "\u98DE\u4E66\u6388\u6743\u4E8C\u7EF4\u7801", className: "mx-auto rounded-lg bg-white" }) : /* @__PURE__ */ jsx7("p", { className: "text-xs opacity-70", children: "\u6388\u6743\u9879\u76EE\u8F83\u591A\uFF0C\u8BF7\u6253\u5F00\u98DE\u4E66\u6388\u6743\u9875\u9762\u7EE7\u7EED\u3002" }),
1825
- /* @__PURE__ */ jsx7("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: "block text-sm underline", children: "\u6253\u5F00\u98DE\u4E66\u6388\u6743\u9875\u9762" })
1826
- ] }) : verifying ? /* @__PURE__ */ jsx7("output", { className: "block text-sm", children: view?.error ? "\u6838\u9A8C\u6682\u672A\u5B8C\u6210\uFF0C\u8BF7\u70B9\u51FB\u201C\u6211\u5DF2\u5B8C\u6210\u6388\u6743\u201D\u91CD\u8BD5\u3002" : "\u6B63\u5728\u6838\u9A8C\u6388\u6743\u7ED3\u679C\uFF0C\u8BF7\u7A0D\u5019\u3002" }) : /* @__PURE__ */ jsx7("p", { role: "alert", className: "text-sm", children: "\u5F53\u524D\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F\u6216\u65E0\u6CD5\u9A8C\u8BC1\uFF0C\u8BF7\u91CD\u8BD5\u672C\u6B21\u6388\u6743\u3002" }),
1827
- view?.expires_at && /* @__PURE__ */ jsxs7("p", { className: "text-xs opacity-70", children: [
1828
- "\u6709\u6548\u81F3 ",
1829
- new Date(view.expires_at * 1e3).toLocaleTimeString()
1830
- ] }),
1831
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap justify-center gap-3", children: [
1832
- /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void run("poll", view?.attempt_id ? { attempt_id: view.attempt_id } : {}), children: busy ? "\u6B63\u5728\u786E\u8BA4\u2026" : "\u6211\u5DF2\u5B8C\u6210\u6388\u6743" }),
1833
- /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void run("cancel", view?.attempt_id ? { attempt_id: view.attempt_id } : {}), children: "\u6682\u65F6\u53D6\u6D88" }),
1834
- !url && !verifying && /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: retryCurrent, children: "\u91CD\u8BD5\u672C\u6B21\u6388\u6743" })
1835
- ] }),
1836
- view?.phase === "permissions" && /* @__PURE__ */ jsx7("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: finishExisting, children: "\u5148\u4F7F\u7528\u5DF2\u5F00\u901A\u80FD\u529B\uFF0C\u5176\u4ED6\u7A0D\u540E\u5904\u7406" })
1837
- ] }) : view && page === "select" ? /* @__PURE__ */ jsxs7(Fragment, { children: [
1838
- view.app_id ? back : /* @__PURE__ */ jsx7("p", { className: "text-sm", children: "\u9996\u6B21\u8FDE\u63A5\u9700\u8981\u626B\u7801\u4E24\u6B21\uFF1A\u5148\u5173\u8054\u98DE\u4E66\u5E94\u7528\uFF0C\u518D\u786E\u8BA4\u672C\u4EBA\u6388\u6743\u3002\u9009\u5DF2\u6709\u5E94\u7528\u65F6\u7B2C\u4E8C\u6B21\u4E5F\u4E0D\u80FD\u7701\uFF0C\u98DE\u4E66\u8981\u6C42\u4F60\u672C\u4EBA\u540C\u610F\uFF0C\u52A9\u624B\u624D\u80FD\u8BFB\u53D6\u4F60\u7684\u6D88\u606F\u3002" }),
1839
- /* @__PURE__ */ jsx7(FeishuCapabilitySelection, { capabilities, permissions: view.permissions, operations: view.operations, domains: view.domains, selected, onChange: setSelected, disabled: busy }),
1840
- view.catalog_unavailable && /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void refresh(), children: "\u91CD\u65B0\u8BFB\u53D6\u5DE5\u4F5C\u80FD\u529B" }),
1841
- /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between gap-3 border-t border-[color-mix(in_srgb,currentColor_18%,transparent)] pt-4", children: [
1842
- /* @__PURE__ */ jsx7("p", { className: "text-xs opacity-70", children: "\u6743\u9650\u7531\u98DE\u4E66\u5B98\u65B9\u9875\u9762\u7EDF\u4E00\u9009\u62E9\uFF0C\u5DF2\u6709\u6388\u6743\u7EE7\u7EED\u4FDD\u7559\u3002" }),
1843
- /* @__PURE__ */ jsx7("button", { type: "button", className: `${button} border-blue-600 bg-blue-600 text-white`, disabled: busy || Boolean(view.app_id) && !selected.length, onClick: () => start(), children: busy ? "\u6B63\u5728\u51C6\u5907\u6388\u6743\u2026" : view.app_id ? preserveDisabled ? "\u8865\u5145\u6388\u6743\u5E76\u4FDD\u5B58" : "\u524D\u5F80\u98DE\u4E66\u6388\u6743" : "\u8FDE\u63A5\u98DE\u4E66" })
1844
- ] }),
1845
- preserveDisabled && /* @__PURE__ */ jsx7("p", { className: "text-xs", children: "\u6B64\u52A9\u624B\u5F53\u524D\u505C\u7528\uFF0C\u65B0\u589E\u6388\u6743\u4E0D\u4F1A\u81EA\u52A8\u542F\u7528\u3002\u9700\u8981\u65F6\u53EF\u5728\u7BA1\u7406\u8FDE\u63A5\u4E2D\u91CD\u65B0\u542F\u7528\u3002" })
1846
- ] }) : view && page === "connection" ? /* @__PURE__ */ jsxs7(Fragment, { children: [
1847
- /* @__PURE__ */ jsxs7("div", { className: "rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4", children: [
1848
- /* @__PURE__ */ jsxs7("p", { className: "font-medium", children: [
1895
+ notice && /* @__PURE__ */ jsx6("output", { className: "block rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-sm", children: notice }),
1896
+ error && /* @__PURE__ */ jsx6("p", { role: "alert", className: "rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-sm", children: error }),
1897
+ view?.error && /* @__PURE__ */ jsxs5("div", { role: "alert", className: "space-y-1 rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-sm", children: [
1898
+ /* @__PURE__ */ jsx6("p", { children: view.error.message }),
1899
+ view.error.next_action && /* @__PURE__ */ jsx6("p", { children: view.error.next_action }),
1900
+ !waiting && view.app_id && /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap gap-3", children: [
1901
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: retryCurrent, children: "\u91CD\u8BD5\u5F53\u524D\u6388\u6743" }),
1902
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: finishExisting, children: "\u5148\u4F7F\u7528\u5DF2\u5F00\u901A\u80FD\u529B\uFF0C\u5176\u4ED6\u7A0D\u540E\u5904\u7406" })
1903
+ ] })
1904
+ ] }),
1905
+ view && !waiting && matchesRequestedAuthorization(view) && /* @__PURE__ */ jsx6(ConnectorAuthorizationProgress, { result: view.authorization_result, onCheck: () => void run("check"), busy }),
1906
+ view && !waiting && page !== "help" && /* @__PURE__ */ jsx6(FeishuPermissionStatus, { permissions: view.permissions ?? [], template: view.permission_template }),
1907
+ !view && !error && /* @__PURE__ */ jsx6("output", { className: "block text-sm", children: "\u6B63\u5728\u8BFB\u53D6\u98DE\u4E66\u8FDE\u63A5\u2026" }),
1908
+ !view && error && /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => void refresh(), children: "\u91CD\u65B0\u8BFB\u53D6\u8FDE\u63A5" }),
1909
+ authorizationContent,
1910
+ view && !waiting && page === "connection" ? /* @__PURE__ */ jsxs5(Fragment, { children: [
1911
+ /* @__PURE__ */ jsxs5("div", { className: "rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4", children: [
1912
+ /* @__PURE__ */ jsxs5("p", { className: "font-medium", children: [
1849
1913
  view.activation_pending === true ? "\u8FDE\u63A5\u5C1A\u672A\u5B8C\u6210" : view.enabled === false && view.app_id ? "\u5DF2\u5728\u6B64\u52A9\u624B\u4E2D\u505C\u7528" : active.length ? "\u98DE\u4E66\u5DF2\u53EF\u4EE5\u4F7F\u7528" : "\u8FD8\u6709\u9879\u76EE\u9700\u8981\u5904\u7406",
1850
1914
  view.label ? ` \xB7 ${view.label}` : ""
1851
1915
  ] }),
1852
- /* @__PURE__ */ jsx7("p", { className: "mt-1 text-xs opacity-70", children: view.activation_pending === true ? "\u5B8C\u6210\u6388\u6743\u540E\u5373\u53EF\u5F00\u59CB\u4F7F\u7528" : view.enabled === false ? "\u5DF2\u6709\u6388\u6743\u4E0E SuperWork \u63A5\u6536\u8BBE\u7F6E\u4FDD\u7559\u3002" : "\u53EF\u4EE5\u8BA9\u52A9\u624B\u5904\u7406\u5DF2\u5F00\u901A\u7684\u98DE\u4E66\u5DE5\u4F5C\u3002" })
1916
+ /* @__PURE__ */ jsx6("p", { className: "mt-1 text-xs opacity-70", children: view.activation_pending === true ? "\u5B8C\u6210\u6388\u6743\u540E\u5373\u53EF\u5F00\u59CB\u4F7F\u7528" : view.enabled === false ? "\u5DF2\u6709\u6388\u6743\u4E0E SuperWork \u63A5\u6536\u8BBE\u7F6E\u4FDD\u7559\u3002" : "\u53EF\u4EE5\u8BA9\u52A9\u624B\u5904\u7406\u5DF2\u5F00\u901A\u7684\u98DE\u4E66\u5DE5\u4F5C\u3002" })
1853
1917
  ] }),
1854
- view.activation_pending === true && active.length > 0 && /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: finishExisting, children: "\u5148\u4F7F\u7528\u5DF2\u5F00\u901A\u80FD\u529B\uFF0C\u5176\u4ED6\u7A0D\u540E\u5904\u7406" }),
1855
- pending.length > 0 && /* @__PURE__ */ jsxs7("div", { className: "space-y-2 rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4 text-sm", children: [
1856
- /* @__PURE__ */ jsxs7("p", { children: [
1918
+ view.activation_pending === true && active.length > 0 && /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: finishExisting, children: "\u5148\u4F7F\u7528\u5DF2\u5F00\u901A\u80FD\u529B\uFF0C\u5176\u4ED6\u7A0D\u540E\u5904\u7406" }),
1919
+ pending.length > 0 && /* @__PURE__ */ jsxs5("div", { className: "space-y-2 rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4 text-sm", children: [
1920
+ /* @__PURE__ */ jsxs5("p", { children: [
1857
1921
  pending.length,
1858
1922
  " \u9879\u5C1A\u672A\u5B8C\u6210\uFF0C\u5176\u4ED6\u5DF2\u5F00\u901A\u80FD\u529B\u7EE7\u7EED\u4FDD\u7559\u3002"
1859
1923
  ] }),
1860
- /* @__PURE__ */ jsxs7("details", { className: "text-xs", children: [
1861
- /* @__PURE__ */ jsx7("summary", { className: "cursor-pointer", children: "\u67E5\u770B\u672A\u5B8C\u6210\u9879\u76EE" }),
1862
- /* @__PURE__ */ jsx7("div", { className: "mt-2 max-h-60 space-y-2 overflow-y-auto", children: pending.map((item) => /* @__PURE__ */ jsxs7("p", { children: [
1924
+ /* @__PURE__ */ jsxs5("details", { className: "text-xs", children: [
1925
+ /* @__PURE__ */ jsx6("summary", { className: "cursor-pointer", children: "\u67E5\u770B\u672A\u5B8C\u6210\u9879\u76EE" }),
1926
+ /* @__PURE__ */ jsx6("div", { className: "mt-2 max-h-60 space-y-2 overflow-y-auto", children: pending.map((item) => /* @__PURE__ */ jsxs5("p", { children: [
1863
1927
  item.name,
1864
1928
  "\uFF1A",
1865
1929
  item.reason || item.next_action || statusLabels[item.status]
1866
1930
  ] }, item.id)) })
1867
1931
  ] }),
1868
- receptionNeedsTest && /* @__PURE__ */ jsx7("p", { className: "text-xs", children: "\u63A5\u6536\u6743\u9650\u5DF2\u7ECF\u751F\u6548\uFF0C\u4ECD\u9700\u5411\u673A\u5668\u4EBA\u53D1\u9001\u6D4B\u8BD5\u6D88\u606F\u4EE5\u786E\u8BA4\u5B9E\u9645\u63A5\u6536\u3002" }),
1869
- pendingPermissions.length > 0 && /* @__PURE__ */ jsx7("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: () => start(pendingPermissions.map((item) => item.id)), children: "\u7EE7\u7EED\u5F00\u901A\u672A\u5B8C\u6210\u7684\u6743\u9650" }),
1870
- failedUser.length > 0 && /* @__PURE__ */ jsx7("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: () => start(failedUser.map((item) => item.id)), children: "\u4EC5\u8865\u5145\u672A\u5B8C\u6210\u7684\u672C\u4EBA\u6388\u6743" })
1932
+ receptionNeedsTest && /* @__PURE__ */ jsx6("p", { className: "text-xs", children: "\u63A5\u6536\u6743\u9650\u5DF2\u7ECF\u751F\u6548\uFF0C\u4ECD\u9700\u5411\u673A\u5668\u4EBA\u53D1\u9001\u6D4B\u8BD5\u6D88\u606F\u4EE5\u786E\u8BA4\u5B9E\u9645\u63A5\u6536\u3002" }),
1933
+ pendingPermissions.length > 0 && /* @__PURE__ */ jsx6("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: () => start(pendingPermissions.map((item) => item.id)), children: "\u7EE7\u7EED\u5F00\u901A\u672A\u5B8C\u6210\u7684\u6743\u9650" }),
1934
+ failedUser.length > 0 && /* @__PURE__ */ jsx6("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: () => start(failedUser.map((item) => item.id)), children: "\u4EC5\u8865\u5145\u672A\u5B8C\u6210\u7684\u672C\u4EBA\u6388\u6743" })
1871
1935
  ] }),
1872
- /* @__PURE__ */ jsxs7("dl", { className: "divide-y divide-[color-mix(in_srgb,currentColor_18%,transparent)] rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] px-4 text-sm", children: [
1873
- /* @__PURE__ */ jsxs7("div", { className: "flex justify-between gap-3 py-4", children: [
1874
- /* @__PURE__ */ jsx7("dt", { children: "\u53D1\u9001\u6D88\u606F" }),
1875
- /* @__PURE__ */ jsx7("dd", { children: "\u673A\u5668\u4EBA\u8EAB\u4EFD" })
1936
+ /* @__PURE__ */ jsxs5("dl", { className: "divide-y divide-[color-mix(in_srgb,currentColor_18%,transparent)] rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] px-4 text-sm", children: [
1937
+ /* @__PURE__ */ jsxs5("div", { className: "flex justify-between gap-3 py-4", children: [
1938
+ /* @__PURE__ */ jsx6("dt", { children: "\u53D1\u9001\u6D88\u606F" }),
1939
+ /* @__PURE__ */ jsx6("dd", { children: "\u673A\u5668\u4EBA\u8EAB\u4EFD" })
1876
1940
  ] }),
1877
- /* @__PURE__ */ jsxs7("div", { className: "flex justify-between gap-3 py-4", children: [
1878
- /* @__PURE__ */ jsx7("dt", { children: "\u63A5\u6536\u98DE\u4E66\u6D88\u606F" }),
1879
- /* @__PURE__ */ jsx7("dd", { children: subscription === "enabled" ? "\u5DF2\u63A5\u5165\u52A9\u624B" : subscription === "paused" ? "\u5411\u52A9\u624B\u63A8\u9001\u5DF2\u6682\u505C" : "\u5C1A\u672A\u63A5\u5165\u52A9\u624B" })
1941
+ /* @__PURE__ */ jsxs5("div", { className: "flex justify-between gap-3 py-4", children: [
1942
+ /* @__PURE__ */ jsx6("dt", { children: "\u63A5\u6536\u98DE\u4E66\u6D88\u606F" }),
1943
+ /* @__PURE__ */ jsx6("dd", { children: subscription === "enabled" ? "\u5DF2\u63A5\u5165\u52A9\u624B" : subscription === "paused" ? "\u5411\u52A9\u624B\u63A8\u9001\u5DF2\u6682\u505C" : "\u5C1A\u672A\u63A5\u5165\u52A9\u624B" })
1880
1944
  ] }),
1881
- /* @__PURE__ */ jsxs7("div", { className: "flex justify-between gap-3 py-4", children: [
1882
- /* @__PURE__ */ jsx7("dt", { children: "\u5DF2\u5F00\u901A\u7684\u5DE5\u4F5C\u80FD\u529B" }),
1883
- /* @__PURE__ */ jsxs7("dd", { children: [
1945
+ /* @__PURE__ */ jsxs5("div", { className: "flex justify-between gap-3 py-4", children: [
1946
+ /* @__PURE__ */ jsx6("dt", { children: "\u5DF2\u5F00\u901A\u7684\u5DE5\u4F5C\u80FD\u529B" }),
1947
+ /* @__PURE__ */ jsxs5("dd", { children: [
1884
1948
  categories.length,
1885
1949
  " \u7C7B \xB7 ",
1886
1950
  active.length,
@@ -1888,24 +1952,24 @@ function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = fa
1888
1952
  ] })
1889
1953
  ] })
1890
1954
  ] }),
1891
- /* @__PURE__ */ jsx7("div", { className: "flex flex-wrap gap-2", children: categories.map((name) => /* @__PURE__ */ jsx7("span", { className: "rounded-md border border-[color-mix(in_srgb,currentColor_18%,transparent)] px-2 py-1 text-xs", children: name }, name)) }),
1892
- /* @__PURE__ */ jsxs7("details", { className: "text-sm", children: [
1893
- /* @__PURE__ */ jsx7("summary", { className: "cursor-pointer", children: "\u67E5\u770B\u6743\u9650\u4E0E\u80FD\u529B\u72B6\u6001" }),
1894
- /* @__PURE__ */ jsx7(FeishuCapabilitySelection, { capabilities, permissions: view.permissions, operations: view.operations, domains: view.domains, selected, onChange: setSelected, disabled: busy })
1955
+ /* @__PURE__ */ jsx6("div", { className: "flex flex-wrap gap-2", children: categories.map((name) => /* @__PURE__ */ jsx6("span", { className: "rounded-md border border-[color-mix(in_srgb,currentColor_18%,transparent)] px-2 py-1 text-xs", children: name }, name)) }),
1956
+ /* @__PURE__ */ jsxs5("details", { className: "text-sm", children: [
1957
+ /* @__PURE__ */ jsx6("summary", { className: "cursor-pointer", children: "\u67E5\u770B\u6743\u9650\u4E0E\u80FD\u529B\u72B6\u6001" }),
1958
+ /* @__PURE__ */ jsx6(FeishuCapabilitySelection, { capabilities, permissions: view.permissions, operations: view.operations, domains: view.domains, selected, onChange: setSelected, disabled: busy })
1895
1959
  ] }),
1896
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap gap-3 border-t border-[color-mix(in_srgb,currentColor_18%,transparent)] pt-4", children: [
1897
- /* @__PURE__ */ jsx7("button", { type: "button", className: `${button} bg-blue-600 text-white`, disabled: busy, onClick: () => void addCapabilities(), children: busy ? "\u6B63\u5728\u68C0\u67E5\u2026" : "\u8865\u5145\u6388\u6743" }),
1898
- /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => setPage("manage"), children: "\u7BA1\u7406\u8FDE\u63A5" })
1960
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap gap-3 border-t border-[color-mix(in_srgb,currentColor_18%,transparent)] pt-4", children: [
1961
+ /* @__PURE__ */ jsx6("button", { type: "button", className: `${button} bg-blue-600 text-white`, disabled: busy, onClick: () => void addCapabilities(), children: busy ? "\u6B63\u5728\u68C0\u67E5\u2026" : "\u8865\u5145\u6388\u6743" }),
1962
+ /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => setPage("manage"), children: "\u7BA1\u7406\u8FDE\u63A5" })
1899
1963
  ] })
1900
- ] }) : view && page === "manage" ? /* @__PURE__ */ jsxs7(Fragment, { children: [
1964
+ ] }) : view && page === "manage" ? /* @__PURE__ */ jsxs5(Fragment, { children: [
1901
1965
  back,
1902
- /* @__PURE__ */ jsxs7("div", { className: "space-y-5 divide-y divide-[color-mix(in_srgb,currentColor_18%,transparent)] rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4 text-sm", children: [
1903
- /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between gap-4", children: [
1904
- /* @__PURE__ */ jsxs7("div", { children: [
1905
- /* @__PURE__ */ jsx7("p", { children: "\u5728\u6B64\u52A9\u624B\u4E2D\u4F7F\u7528\u98DE\u4E66" }),
1906
- /* @__PURE__ */ jsx7("p", { className: "mt-1 text-xs opacity-70", children: "\u505C\u7528\u53EA\u5F71\u54CD\u6B64\u52A9\u624B\uFF0CSuperWork \u6388\u6743\u548C\u6D88\u606F\u63A5\u6536\u4FDD\u7559\u3002" })
1966
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-5 divide-y divide-[color-mix(in_srgb,currentColor_18%,transparent)] rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4 text-sm", children: [
1967
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-4", children: [
1968
+ /* @__PURE__ */ jsxs5("div", { children: [
1969
+ /* @__PURE__ */ jsx6("p", { children: "\u5728\u6B64\u52A9\u624B\u4E2D\u4F7F\u7528\u98DE\u4E66" }),
1970
+ /* @__PURE__ */ jsx6("p", { className: "mt-1 text-xs opacity-70", children: "\u505C\u7528\u53EA\u5F71\u54CD\u6B64\u52A9\u624B\uFF0CSuperWork \u6388\u6743\u548C\u6D88\u606F\u63A5\u6536\u4FDD\u7559\u3002" })
1907
1971
  ] }),
1908
- view.enabled === false ? /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void run("finish", { capabilities: view.selected_capabilities ?? selected, enable: true }), children: "\u91CD\u65B0\u542F\u7528" }) : onDisable ? /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: async () => {
1972
+ view.enabled === false ? /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => void run("finish", { capabilities: view.selected_capabilities ?? selected, enable: true }), children: "\u91CD\u65B0\u542F\u7528" }) : onDisable ? /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: async () => {
1909
1973
  if (inFlight.current) return;
1910
1974
  inFlight.current = true;
1911
1975
  setBusy(true);
@@ -1920,94 +1984,45 @@ function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = fa
1920
1984
  inFlight.current = false;
1921
1985
  if (live.current) setBusy(false);
1922
1986
  }
1923
- }, children: "\u505C\u7528\u6B64\u52A9\u624B\u8FDE\u63A5" }) : /* @__PURE__ */ jsx7("span", { className: "text-xs", children: "\u5DF2\u542F\u7528" })
1987
+ }, children: "\u505C\u7528\u6B64\u52A9\u624B\u8FDE\u63A5" }) : /* @__PURE__ */ jsx6("span", { className: "text-xs", children: "\u5DF2\u542F\u7528" })
1924
1988
  ] }),
1925
- /* @__PURE__ */ jsxs7("div", { className: "space-y-2 pt-4", children: [
1926
- /* @__PURE__ */ jsx7("p", { children: "\u5411\u52A9\u624B\u63A8\u9001\u98DE\u4E66\u6D88\u606F" }),
1927
- /* @__PURE__ */ jsx7("p", { className: "text-xs opacity-70", children: "\u4E0E\u6B64\u52A9\u624B\u4F7F\u7528\u6743\u9650\u5206\u522B\u7BA1\u7406\uFF1B\u6682\u505C\u63A8\u9001\u4ECD\u4FDD\u7559 SuperWork \u4E2D\u7684\u6388\u6743\u548C\u6D88\u606F\u63A5\u6536\u3002" }),
1928
- ["enabled", "paused"].includes(subscription) && /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void run(subscription === "paused" ? "resume" : "pause"), children: subscription === "paused" ? "\u6062\u590D\u5411\u52A9\u624B\u63A8\u9001" : "\u6682\u505C\u5411\u52A9\u624B\u63A8\u9001" }),
1929
- bindDelivery && canReceive(view) && subscription !== "paused" && /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void run("bind"), children: subscription === "enabled" ? "\u66F4\u65B0\u52A9\u624B\u63A5\u6536\u5730\u5740" : "\u91CD\u65B0\u63A5\u5165\u52A9\u624B\u6D88\u606F" }),
1930
- receptionNeedsTest && /* @__PURE__ */ jsx7("p", { className: "text-xs", children: "\u63A5\u6536\u6743\u9650\u5DF2\u6838\u9A8C\uFF0C\u4E8B\u4EF6\u8BA2\u9605\u5C1A\u5F85\u6D4B\u8BD5\u3002\u8BF7\u5411\u673A\u5668\u4EBA\u53D1\u9001\u6D4B\u8BD5\u6D88\u606F\u540E\u5728\u8FDE\u63A5\u5E2E\u52A9\u4E2D\u67E5\u770B\u8BB0\u5F55\u3002" })
1989
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-2 pt-4", children: [
1990
+ /* @__PURE__ */ jsx6("p", { children: "\u5411\u52A9\u624B\u63A8\u9001\u98DE\u4E66\u6D88\u606F" }),
1991
+ /* @__PURE__ */ jsx6("p", { className: "text-xs opacity-70", children: "\u4E0E\u6B64\u52A9\u624B\u4F7F\u7528\u6743\u9650\u5206\u522B\u7BA1\u7406\uFF1B\u6682\u505C\u63A8\u9001\u4ECD\u4FDD\u7559 SuperWork \u4E2D\u7684\u6388\u6743\u548C\u6D88\u606F\u63A5\u6536\u3002" }),
1992
+ ["enabled", "paused"].includes(subscription) && /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => void run(subscription === "paused" ? "resume" : "pause"), children: subscription === "paused" ? "\u6062\u590D\u5411\u52A9\u624B\u63A8\u9001" : "\u6682\u505C\u5411\u52A9\u624B\u63A8\u9001" }),
1993
+ bindDelivery && canReceive(view) && subscription !== "paused" && /* @__PURE__ */ jsx6("button", { type: "button", className: button, disabled: busy, onClick: () => void run("bind"), children: subscription === "enabled" ? "\u66F4\u65B0\u52A9\u624B\u63A5\u6536\u5730\u5740" : "\u91CD\u65B0\u63A5\u5165\u52A9\u624B\u6D88\u606F" }),
1994
+ receptionNeedsTest && /* @__PURE__ */ jsx6("p", { className: "text-xs", children: "\u63A5\u6536\u6743\u9650\u5DF2\u6838\u9A8C\uFF0C\u4E8B\u4EF6\u8BA2\u9605\u5C1A\u5F85\u6D4B\u8BD5\u3002\u8BF7\u5411\u673A\u5668\u4EBA\u53D1\u9001\u6D4B\u8BD5\u6D88\u606F\u540E\u5728\u8FDE\u63A5\u5E2E\u52A9\u4E2D\u67E5\u770B\u8BB0\u5F55\u3002" })
1931
1995
  ] }),
1932
- /* @__PURE__ */ jsxs7("div", { className: "pt-4", children: [
1933
- /* @__PURE__ */ jsx7("p", { children: view.label || "\u98DE\u4E66\u8D26\u53F7" }),
1934
- /* @__PURE__ */ jsx7("p", { className: "text-xs opacity-70", children: "\u5DF2\u5F00\u901A\u80FD\u529B\u4E0E\u65B0\u589E\u6388\u6743\u5747\u53D7\u98DE\u4E66\u5E94\u7528\u53EF\u7528\u8303\u56F4\u548C\u6570\u636E\u6743\u9650\u9650\u5236\u3002" }),
1935
- /* @__PURE__ */ jsx7("button", { type: "button", className: "mt-2 text-xs underline", disabled: busy, onClick: () => void addCapabilities(), children: "\u67E5\u770B\u4E0E\u6DFB\u52A0\u5DE5\u4F5C\u80FD\u529B" })
1996
+ /* @__PURE__ */ jsxs5("div", { className: "pt-4", children: [
1997
+ /* @__PURE__ */ jsx6("p", { children: view.label || "\u98DE\u4E66\u8D26\u53F7" }),
1998
+ /* @__PURE__ */ jsx6("p", { className: "text-xs opacity-70", children: "\u5DF2\u5F00\u901A\u80FD\u529B\u4E0E\u65B0\u589E\u6388\u6743\u5747\u53D7\u98DE\u4E66\u5E94\u7528\u53EF\u7528\u8303\u56F4\u548C\u6570\u636E\u6743\u9650\u9650\u5236\u3002" }),
1999
+ /* @__PURE__ */ jsx6("button", { type: "button", className: "mt-2 text-xs underline", disabled: busy, onClick: () => void addCapabilities(), children: "\u67E5\u770B\u4E0E\u6DFB\u52A0\u5DE5\u4F5C\u80FD\u529B" })
1936
2000
  ] })
1937
2001
  ] }),
1938
- view.connection_id && /* @__PURE__ */ jsxs7("div", { className: "space-y-3 rounded-xl border border-red-600/30 p-4 text-sm", children: [
1939
- /* @__PURE__ */ jsx7("p", { className: "font-medium", children: "\u79FB\u9664\u65E7\u8FDE\u63A5\uFF0C\u91CD\u65B0\u5F00\u59CB" }),
1940
- /* @__PURE__ */ jsx7("p", { className: "text-xs opacity-70", children: "\u8FD9\u4F1A\u79FB\u9664 SuperWork \u4E2D\u6B64\u8FDE\u63A5\u7684\u51ED\u636E\u5E76\u505C\u6B62\u63A5\u6536\u548C\u8F6C\u53D1\u6D88\u606F\uFF0C\u5176\u4ED6\u4F9D\u8D56\u6B64\u8FDE\u63A5\u7684\u52A9\u624B\u4E5F\u4F1A\u53D7\u5230\u5F71\u54CD\u3002\u5386\u53F2\u6D88\u606F\u4E0E\u6392\u67E5\u65E5\u5FD7\u4FDD\u7559\uFF0C\u98DE\u4E66\u540E\u53F0\u5E94\u7528\u4E0D\u4F1A\u5220\u9664\u3002" }),
1941
- /* @__PURE__ */ jsxs7(AlertDialog, { open: removingConnectionID !== null, onOpenChange: (open) => {
2002
+ view.connection_id && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 rounded-xl border border-red-600/30 p-4 text-sm", children: [
2003
+ /* @__PURE__ */ jsx6("p", { className: "font-medium", children: "\u79FB\u9664\u65E7\u8FDE\u63A5\uFF0C\u91CD\u65B0\u5F00\u59CB" }),
2004
+ /* @__PURE__ */ jsx6("p", { className: "text-xs opacity-70", children: "\u8FD9\u4F1A\u79FB\u9664 SuperWork \u4E2D\u6B64\u8FDE\u63A5\u7684\u51ED\u636E\u5E76\u505C\u6B62\u63A5\u6536\u548C\u8F6C\u53D1\u6D88\u606F\uFF0C\u5176\u4ED6\u4F9D\u8D56\u6B64\u8FDE\u63A5\u7684\u52A9\u624B\u4E5F\u4F1A\u53D7\u5230\u5F71\u54CD\u3002\u5386\u53F2\u6D88\u606F\u4E0E\u6392\u67E5\u65E5\u5FD7\u4FDD\u7559\uFF0C\u98DE\u4E66\u540E\u53F0\u5E94\u7528\u4E0D\u4F1A\u5220\u9664\u3002" }),
2005
+ /* @__PURE__ */ jsxs5(AlertDialog, { open: removingConnectionID !== null, onOpenChange: (open) => {
1942
2006
  if (!open) setRemovingConnectionID(null);
1943
2007
  }, children: [
1944
- /* @__PURE__ */ jsx7(AlertDialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx7("button", { type: "button", className: `${button} border-red-600/40 text-red-600`, disabled: busy, onClick: () => setRemovingConnectionID(view.connection_id ?? null), children: "\u79FB\u9664\u8FDE\u63A5\u5E76\u91CD\u65B0\u8FDE\u63A5" }) }),
1945
- /* @__PURE__ */ jsxs7(AlertDialogContent, { className: "z-[60] w-[calc(100%_-_32px)] max-w-md p-5 sm:max-w-md", overlayClassName: "z-[60] bg-black/40", style: { backgroundColor: "var(--color-canvas, hsl(var(--popover, 0 0% 100%)))", color: "var(--color-copy, hsl(var(--foreground, 0 0% 10%)))" }, children: [
1946
- /* @__PURE__ */ jsx7(AlertDialogTitle, { children: "\u786E\u8BA4\u79FB\u9664\u5F53\u524D\u98DE\u4E66\u8FDE\u63A5\uFF1F" }),
1947
- /* @__PURE__ */ jsx7(AlertDialogDescription, { children: "SuperWork \u4E2D\u6B64\u8FDE\u63A5\u7684\u51ED\u636E\u5C06\u88AB\u79FB\u9664\uFF0C\u6D88\u606F\u63A5\u6536\u548C\u8F6C\u53D1\u5C06\u505C\u6B62\uFF0C\u5176\u4ED6\u4F9D\u8D56\u6B64\u8FDE\u63A5\u7684\u52A9\u624B\u4E5F\u4F1A\u53D7\u5F71\u54CD\u3002\u5386\u53F2\u6D88\u606F\u4E0E\u6392\u67E5\u65E5\u5FD7\u4F1A\u4FDD\u7559\uFF0C\u98DE\u4E66\u540E\u53F0\u5E94\u7528\u4E0D\u4F1A\u5220\u9664\u3002\u79FB\u9664\u540E\uFF0C\u7531\u4F60\u518D\u6B21\u70B9\u51FB\u201C\u8FDE\u63A5\u98DE\u4E66\u201D\u83B7\u53D6\u65B0\u4E8C\u7EF4\u7801\u3002" }),
1948
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap justify-end gap-3", children: [
1949
- /* @__PURE__ */ jsx7(AlertDialogCancel, { asChild: true, children: /* @__PURE__ */ jsx7("button", { type: "button", className: button, children: "\u53D6\u6D88" }) }),
1950
- /* @__PURE__ */ jsx7(AlertDialogAction, { asChild: true, children: /* @__PURE__ */ jsx7("button", { type: "button", className: `${button} border-red-600 bg-red-600 text-white`, onClick: () => {
2008
+ /* @__PURE__ */ jsx6(AlertDialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx6("button", { type: "button", className: `${button} border-red-600/40 text-red-600`, disabled: busy, onClick: () => setRemovingConnectionID(view.connection_id ?? null), children: "\u79FB\u9664\u8FDE\u63A5\u5E76\u91CD\u65B0\u8FDE\u63A5" }) }),
2009
+ /* @__PURE__ */ jsxs5(AlertDialogContent, { className: "z-[60] w-[calc(100%_-_32px)] max-w-md p-5 sm:max-w-md", overlayClassName: "z-[60] bg-black/40", style: { backgroundColor: "var(--color-canvas, hsl(var(--popover, 0 0% 100%)))", color: "var(--color-copy, hsl(var(--foreground, 0 0% 10%)))" }, children: [
2010
+ /* @__PURE__ */ jsx6(AlertDialogTitle, { children: "\u786E\u8BA4\u79FB\u9664\u5F53\u524D\u98DE\u4E66\u8FDE\u63A5\uFF1F" }),
2011
+ /* @__PURE__ */ jsx6(AlertDialogDescription, { children: "SuperWork \u4E2D\u6B64\u8FDE\u63A5\u7684\u51ED\u636E\u5C06\u88AB\u79FB\u9664\uFF0C\u6D88\u606F\u63A5\u6536\u548C\u8F6C\u53D1\u5C06\u505C\u6B62\uFF0C\u5176\u4ED6\u4F9D\u8D56\u6B64\u8FDE\u63A5\u7684\u52A9\u624B\u4E5F\u4F1A\u53D7\u5F71\u54CD\u3002\u5386\u53F2\u6D88\u606F\u4E0E\u6392\u67E5\u65E5\u5FD7\u4F1A\u4FDD\u7559\uFF0C\u98DE\u4E66\u540E\u53F0\u5E94\u7528\u4E0D\u4F1A\u5220\u9664\u3002\u79FB\u9664\u540E\uFF0C\u7531\u4F60\u518D\u6B21\u70B9\u51FB\u201C\u8FDE\u63A5\u98DE\u4E66\u201D\u83B7\u53D6\u65B0\u4E8C\u7EF4\u7801\u3002" }),
2012
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap justify-end gap-3", children: [
2013
+ /* @__PURE__ */ jsx6(AlertDialogCancel, { asChild: true, children: /* @__PURE__ */ jsx6("button", { type: "button", className: button, children: "\u53D6\u6D88" }) }),
2014
+ /* @__PURE__ */ jsx6(AlertDialogAction, { asChild: true, children: /* @__PURE__ */ jsx6("button", { type: "button", className: `${button} border-red-600 bg-red-600 text-white`, onClick: () => {
1951
2015
  if (removingConnectionID) void removeConnection(removingConnectionID);
1952
2016
  }, children: "\u786E\u8BA4\u79FB\u9664\u8FDE\u63A5" }) })
1953
2017
  ] })
1954
2018
  ] })
1955
2019
  ] })
1956
2020
  ] })
1957
- ] }) : view && page === "help" ? /* @__PURE__ */ jsxs7(Fragment, { children: [
2021
+ ] }) : view && page === "help" ? /* @__PURE__ */ jsxs5(Fragment, { children: [
1958
2022
  back,
1959
- /* @__PURE__ */ jsx7("p", { className: "text-sm", children: "\u53EA\u5904\u7406\u672A\u5B8C\u6210\u7684\u9879\u76EE\uFF0C\u5DF2\u7ECF\u5F00\u901A\u7684\u80FD\u529B\u4E0D\u9700\u8981\u91CD\u65B0\u7533\u8BF7\u3002" }),
1960
- pending.map((item) => /* @__PURE__ */ jsxs7("div", { className: "rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-sm", children: [
1961
- /* @__PURE__ */ jsx7("p", { children: item.name }),
1962
- /* @__PURE__ */ jsxs7("p", { className: "text-xs", children: [
1963
- item.reason || item.next_action || statusLabels[item.status],
1964
- item.actor ? ` \xB7 \u7531${item.actor}\u5904\u7406` : ""
1965
- ] })
1966
- ] }, item.id)),
1967
- /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void run("check"), children: "\u91CD\u65B0\u68C0\u67E5\u8FDE\u63A5" }),
1968
- view.app_id && /* @__PURE__ */ jsx7("a", { className: "block text-xs underline", href: `https://open.feishu.cn/app/${encodeURIComponent(view.app_id)}/auth`, target: "_blank", rel: "noopener noreferrer", children: "\u5728\u98DE\u4E66\u67E5\u770B\u6743\u9650\u3001\u53D1\u5E03\u4E0E\u53EF\u7528\u8303\u56F4" }),
1969
- /* @__PURE__ */ jsxs7("details", { className: "rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-xs", children: [
1970
- /* @__PURE__ */ jsx7("summary", { className: "cursor-pointer", children: "\u9AD8\u7EA7\u6392\u67E5\u4FE1\u606F" }),
1971
- /* @__PURE__ */ jsxs7("div", { className: "space-y-3 pt-3", children: [
1972
- /* @__PURE__ */ jsxs7("p", { children: [
1973
- "\u8FDE\u63A5\u7F16\u53F7\uFF1A",
1974
- view.connection_id || "\u5C1A\u672A\u521B\u5EFA"
1975
- ] }),
1976
- /* @__PURE__ */ jsxs7("p", { children: [
1977
- "\u6392\u67E5\u7F16\u53F7\uFF1A",
1978
- view.error?.trace_id || view.trace_id || "\u6682\u65E0\u8BB0\u5F55"
1979
- ] }),
1980
- /* @__PURE__ */ jsx7("p", { children: "\u8BB0\u5F55\u4E0D\u5305\u542B\u51ED\u636E\u4E0E\u6D88\u606F\u6B63\u6587\u3002" }),
1981
- view.steps?.length ? /* @__PURE__ */ jsx7("ol", { className: "space-y-2", children: view.steps.map((step, index) => /* @__PURE__ */ jsxs7("li", { children: [
1982
- stateLabels[step.state] ?? step.state,
1983
- "\uFF1A",
1984
- step.message
1985
- ] }, `${step.id}:${index}`)) }) : null,
1986
- diagnostics && /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void inspect(), children: "\u8BFB\u53D6\u6392\u67E5\u8BB0\u5F55" }),
1987
- diagnosticView?.runtime && /* @__PURE__ */ jsx7(ConnectorRuntimeDiagnostics, { runtime: diagnosticView.runtime }),
1988
- diagnosticView && /* @__PURE__ */ jsx7("ol", { className: "space-y-3", children: diagnosticView.audit_events.map((event, index) => /* @__PURE__ */ jsxs7("li", { children: [
1989
- event.message ?? auditLabels[event.type ?? ""] ?? "\u8FDE\u63A5\u72B6\u6001\u8BB0\u5F55",
1990
- event.code && /* @__PURE__ */ jsxs7("p", { children: [
1991
- "\u539F\u56E0\u7F16\u53F7\uFF1A",
1992
- event.code
1993
- ] }),
1994
- event.platform_code && /* @__PURE__ */ jsxs7("p", { children: [
1995
- "\u98DE\u4E66\u9519\u8BEF\u7801\uFF1A",
1996
- event.platform_code
1997
- ] }),
1998
- event.platform_request_id && /* @__PURE__ */ jsxs7("p", { children: [
1999
- "\u98DE\u4E66\u8BF7\u6C42\u7F16\u53F7\uFF1A",
2000
- event.platform_request_id
2001
- ] }),
2002
- event.trace_id && /* @__PURE__ */ jsxs7("p", { children: [
2003
- "\u6392\u67E5\u7F16\u53F7\uFF1A",
2004
- event.trace_id
2005
- ] })
2006
- ] }, event.id ?? index)) })
2007
- ] })
2008
- ] })
2023
+ diagnosticContent
2009
2024
  ] }) : null,
2010
- !waiting && page !== "help" && /* @__PURE__ */ jsx7("button", { type: "button", className: "text-xs underline opacity-70", disabled: busy, onClick: () => setPage("help"), children: "\u9047\u5230\u95EE\u9898\uFF1F" })
2025
+ !waiting && page !== "help" && /* @__PURE__ */ jsx6("button", { type: "button", className: "text-xs underline opacity-70", disabled: busy, onClick: () => setPage("help"), children: "\u9047\u5230\u95EE\u9898\uFF1F" })
2011
2026
  ] });
2012
2027
  }
2013
2028
 
@@ -2015,7 +2030,7 @@ function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = fa
2015
2030
  import { useEffect as useEffect2, useId, useRef as useRef2, useState as useState2 } from "react";
2016
2031
 
2017
2032
  // ../ui/src/components/badge.tsx
2018
- import { jsx as jsx8 } from "react/jsx-runtime";
2033
+ import { jsx as jsx7 } from "react/jsx-runtime";
2019
2034
  var badgeVariants = cva(
2020
2035
  "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
2021
2036
  {
@@ -2041,7 +2056,7 @@ function Badge({
2041
2056
  ...props
2042
2057
  }) {
2043
2058
  const Comp = asChild ? dist_exports.Root : "span";
2044
- return /* @__PURE__ */ jsx8(
2059
+ return /* @__PURE__ */ jsx7(
2045
2060
  Comp,
2046
2061
  {
2047
2062
  "data-slot": "badge",
@@ -2053,9 +2068,9 @@ function Badge({
2053
2068
  }
2054
2069
 
2055
2070
  // ../ui/src/components/input.tsx
2056
- import { jsx as jsx9 } from "react/jsx-runtime";
2071
+ import { jsx as jsx8 } from "react/jsx-runtime";
2057
2072
  function Input({ className, type, ...props }) {
2058
- return /* @__PURE__ */ jsx9(
2073
+ return /* @__PURE__ */ jsx8(
2059
2074
  "input",
2060
2075
  {
2061
2076
  type,
@@ -2070,13 +2085,13 @@ function Input({ className, type, ...props }) {
2070
2085
  }
2071
2086
 
2072
2087
  // ../ui/src/components/label.tsx
2073
- import { jsx as jsx10 } from "react/jsx-runtime";
2088
+ import { jsx as jsx9 } from "react/jsx-runtime";
2074
2089
  function Label({
2075
2090
  className,
2076
2091
  ...props
2077
2092
  }) {
2078
- return /* @__PURE__ */ jsx10(
2079
- dist_exports3.Root,
2093
+ return /* @__PURE__ */ jsx9(
2094
+ dist_exports2.Root,
2080
2095
  {
2081
2096
  "data-slot": "label",
2082
2097
  className: cn(
@@ -2089,15 +2104,15 @@ function Label({
2089
2104
  }
2090
2105
 
2091
2106
  // ../ui/src/components/separator.tsx
2092
- import { jsx as jsx11 } from "react/jsx-runtime";
2107
+ import { jsx as jsx10 } from "react/jsx-runtime";
2093
2108
  function Separator({
2094
2109
  className,
2095
2110
  orientation = "horizontal",
2096
2111
  decorative = true,
2097
2112
  ...props
2098
2113
  }) {
2099
- return /* @__PURE__ */ jsx11(
2100
- dist_exports4.Root,
2114
+ return /* @__PURE__ */ jsx10(
2115
+ dist_exports3.Root,
2101
2116
  {
2102
2117
  "data-slot": "separator",
2103
2118
  decorative,
@@ -2112,15 +2127,16 @@ function Separator({
2112
2127
  }
2113
2128
 
2114
2129
  // src/components/ManagedConnection.tsx
2115
- import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
2130
+ import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
2116
2131
  var field = "h-10 focus-visible:ring-1 focus-visible:ring-foreground/30 focus-visible:border-foreground/70";
2117
2132
  var deliveryFailure = (reason) => `\u90AE\u7BB1\u5DF2\u8FDE\u63A5\uFF0C\u63A5\u5165\u52A9\u624B\u6D88\u606F\u672A\u5B8C\u6210${reason ? `\uFF1A${reason}` : "\uFF0C\u53EF\u70B9\u51FB\u91CD\u8BD5\u3002"}`;
2118
- function ManagedConnection({ read, act, onChanged, bindDelivery, onDisable }) {
2133
+ function ManagedConnection({ read, act, onChanged, bindDelivery, onDisable, detail, diagnostics }) {
2119
2134
  const [view, setView] = useState2(null);
2120
2135
  const [busy, setBusy] = useState2(true);
2121
2136
  const [failure, setFailure] = useState2("");
2122
2137
  const [email, setEmail] = useState2("");
2123
2138
  const [code, setCode] = useState2("");
2139
+ const [diagnosticView, setDiagnosticView] = useState2(null);
2124
2140
  const [editing, setEditing] = useState2(false);
2125
2141
  const formId = useId();
2126
2142
  const callbacks = useRef2({ read, act, onChanged, onDisable });
@@ -2164,6 +2180,7 @@ function ManagedConnection({ read, act, onChanged, bindDelivery, onDisable }) {
2164
2180
  setFailure(deliveryFailure(next.error.message));
2165
2181
  return;
2166
2182
  }
2183
+ if (next.connection_id !== view?.connection_id) setDiagnosticView(null);
2167
2184
  setView(next);
2168
2185
  if (next.error) setFailure(next.error.message);
2169
2186
  else if (action === "credentials" && next.connected) {
@@ -2196,94 +2213,173 @@ function ManagedConnection({ read, act, onChanged, bindDelivery, onDisable }) {
2196
2213
  const showForm = view && (!view.connected || editing);
2197
2214
  const brand = view?.provider === "netease-mail" ? "\u7F51\u6613\u90AE\u7BB1" : "QQ \u90AE\u7BB1";
2198
2215
  const paused = view?.subscription_state === "paused";
2199
- return /* @__PURE__ */ jsxs8("section", { "aria-label": "\u8FDE\u63A5\u90AE\u7BB1", "aria-busy": busy, className: "managed-mail-connection min-w-0 space-y-5 text-left text-sm text-foreground", children: [
2200
- view ? /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between gap-3", children: [
2201
- /* @__PURE__ */ jsx12("p", { className: "min-w-0 break-all text-xs text-muted-foreground", children: view.connected ? view.label : "\u8FDE\u63A5\u540E\uFF0C\u52A9\u624B\u53EF\u4EE5\u5E2E\u4F60\u5904\u7406\u90AE\u4EF6\u3002" }),
2202
- /* @__PURE__ */ jsx12(Badge, { className: "shrink-0", variant: view.connected ? "secondary" : "outline", children: paused ? "\u63A8\u9001\u5DF2\u6682\u505C" : view.connected ? "\u5DF2\u8FDE\u63A5" : "\u672A\u8FDE\u63A5" })
2203
- ] }) : busy && /* @__PURE__ */ jsx12("output", { className: "text-muted-foreground", children: "\u6B63\u5728\u8BFB\u53D6\u90AE\u7BB1\u72B6\u6001\u2026" }),
2204
- failure && /* @__PURE__ */ jsx12("p", { role: "alert", className: "break-words rounded-lg border border-destructive/20 bg-destructive/10 px-3 py-2.5 text-sm text-destructive", children: failure }),
2205
- showForm && /* @__PURE__ */ jsxs8("form", { className: "space-y-4", "aria-label": `\u8FDE\u63A5${brand}`, onSubmit: (event) => {
2206
- event.preventDefault();
2207
- void perform("credentials");
2208
- }, children: [
2209
- /* @__PURE__ */ jsxs8("div", { className: "space-y-2", children: [
2210
- /* @__PURE__ */ jsx12(Label, { htmlFor: `${formId}-email`, children: "\u90AE\u7BB1\u5730\u5740" }),
2211
- /* @__PURE__ */ jsx12(Input, { className: field, id: `${formId}-email`, type: "email", autoComplete: "username", placeholder: view.provider === "netease-mail" ? "\u4F8B\u5982 name@163.com" : "\u4F8B\u5982 name@qq.com", maxLength: 254, required: true, disabled: busy, value: email, onChange: (event) => setEmail(event.target.value) })
2212
- ] }),
2213
- /* @__PURE__ */ jsxs8("div", { className: "space-y-2", children: [
2214
- /* @__PURE__ */ jsx12(Label, { htmlFor: `${formId}-code`, children: "\u6388\u6743\u7801" }),
2215
- /* @__PURE__ */ jsx12(Input, { className: field, id: `${formId}-code`, type: "password", autoComplete: "off", placeholder: "\u586B\u5199\u90AE\u7BB1\u63D0\u4F9B\u7684\u6388\u6743\u7801", "aria-describedby": `${formId}-help`, maxLength: 256, required: true, disabled: busy, value: code, onChange: (event) => setCode(event.target.value) }),
2216
- /* @__PURE__ */ jsxs8("div", { id: `${formId}-help`, className: "rounded-lg bg-muted/50 px-3 py-2.5 text-xs leading-relaxed text-muted-foreground", children: [
2217
- /* @__PURE__ */ jsx12("p", { className: "mb-1 font-medium text-foreground", children: "\u5982\u4F55\u83B7\u53D6\u6388\u6743\u7801" }),
2218
- /* @__PURE__ */ jsxs8("ol", { className: "list-decimal space-y-1 pl-4", children: [
2219
- /* @__PURE__ */ jsxs8("li", { children: [
2220
- "\u5728\u7F51\u9875\u7248",
2221
- brand,
2222
- "\u4E2D\u6253\u5F00\u201C\u8BBE\u7F6E\u201D\u3002"
2223
- ] }),
2224
- /* @__PURE__ */ jsx12("li", { children: view.provider === "netease-mail" ? "\u8FDB\u5165\u201CPOP3/SMTP/IMAP\u201D\uFF0C\u5F00\u542F IMAP/SMTP \u670D\u52A1\u3002" : "\u8FDB\u5165\u201C\u8D26\u53F7\u201D\uFF0C\u5F00\u542F IMAP/SMTP \u670D\u52A1\u3002" }),
2225
- /* @__PURE__ */ jsx12("li", { children: "\u6309\u90AE\u7BB1\u63D0\u793A\u751F\u6210\u6388\u6743\u7801\uFF0C\u590D\u5236\u5230\u4E0A\u65B9\u3002" })
2226
- ] })
2216
+ const connectionForm = showForm && /* @__PURE__ */ jsxs6("form", { className: "space-y-4", "aria-label": `\u8FDE\u63A5${brand}`, onSubmit: (event) => {
2217
+ event.preventDefault();
2218
+ void perform("credentials");
2219
+ }, children: [
2220
+ /* @__PURE__ */ jsxs6("div", { className: "space-y-2", children: [
2221
+ /* @__PURE__ */ jsx11(Label, { htmlFor: `${formId}-email`, children: "\u90AE\u7BB1\u5730\u5740" }),
2222
+ /* @__PURE__ */ jsx11(Input, { className: field, id: `${formId}-email`, type: "email", autoComplete: "username", placeholder: view.provider === "netease-mail" ? "\u4F8B\u5982 name@163.com" : "\u4F8B\u5982 name@qq.com", maxLength: 254, required: true, disabled: busy, value: email, onChange: (event) => setEmail(event.target.value) })
2223
+ ] }),
2224
+ /* @__PURE__ */ jsxs6("div", { className: "space-y-2", children: [
2225
+ /* @__PURE__ */ jsx11(Label, { htmlFor: `${formId}-code`, children: "\u6388\u6743\u7801" }),
2226
+ /* @__PURE__ */ jsx11(Input, { className: field, id: `${formId}-code`, type: "password", autoComplete: "off", placeholder: "\u586B\u5199\u90AE\u7BB1\u63D0\u4F9B\u7684\u6388\u6743\u7801", "aria-describedby": `${formId}-help`, maxLength: 256, required: true, disabled: busy, value: code, onChange: (event) => setCode(event.target.value) }),
2227
+ /* @__PURE__ */ jsxs6("details", { id: `${formId}-help`, className: "rounded-lg bg-[hsl(var(--muted)/0.5)] px-3 py-2.5 text-xs leading-relaxed text-muted-foreground", children: [
2228
+ /* @__PURE__ */ jsx11("summary", { className: "min-h-8 cursor-pointer font-medium text-foreground", children: "\u5982\u4F55\u83B7\u53D6\u6388\u6743\u7801" }),
2229
+ /* @__PURE__ */ jsxs6("ol", { className: "list-decimal space-y-1 pl-4", children: [
2230
+ /* @__PURE__ */ jsxs6("li", { children: [
2231
+ "\u5728\u7F51\u9875\u7248",
2232
+ brand,
2233
+ "\u4E2D\u6253\u5F00\u201C\u8BBE\u7F6E\u201D\u3002"
2234
+ ] }),
2235
+ /* @__PURE__ */ jsx11("li", { children: view.provider === "netease-mail" ? "\u8FDB\u5165\u201CPOP3/SMTP/IMAP\u201D\uFF0C\u5F00\u542F IMAP/SMTP \u670D\u52A1\u3002" : "\u8FDB\u5165\u201C\u8D26\u53F7\u201D\uFF0C\u5F00\u542F IMAP/SMTP \u670D\u52A1\u3002" }),
2236
+ /* @__PURE__ */ jsx11("li", { children: "\u6309\u90AE\u7BB1\u63D0\u793A\u751F\u6210\u6388\u6743\u7801\uFF0C\u590D\u5236\u5230\u4E0A\u65B9\u3002" })
2227
2237
  ] })
2228
- ] }),
2229
- /* @__PURE__ */ jsxs8("div", { className: "space-y-2", children: [
2230
- /* @__PURE__ */ jsx12(Button, { className: "w-full", type: "submit", disabled: busy || !email.trim() || !code.trim(), children: busy ? /* @__PURE__ */ jsxs8(Fragment2, { children: [
2231
- /* @__PURE__ */ jsx12(LoaderCircle, { className: "animate-spin" }),
2232
- "\u6B63\u5728\u8FDE\u63A5\u2026"
2233
- ] }) : "\u8FDE\u63A5\u90AE\u7BB1" }),
2234
- editing && /* @__PURE__ */ jsx12(Button, { className: "w-full", variant: "ghost", type: "button", disabled: busy, onClick: () => {
2235
- setCode("");
2236
- setEditing(false);
2237
- setFailure("");
2238
- }, children: "\u53D6\u6D88" })
2239
2238
  ] })
2240
2239
  ] }),
2241
- view?.connected && !editing && /* @__PURE__ */ jsxs8(Fragment2, { children: [
2242
- !view.enabled && /* @__PURE__ */ jsxs8("div", { className: "space-y-2 rounded-lg border border-border p-3", children: [
2243
- /* @__PURE__ */ jsx12("p", { className: "text-xs text-muted-foreground", children: "\u90AE\u7BB1\u5DF2\u8FDE\u63A5\uFF0C\u542F\u7528\u540E\u53EF\u5728\u5BF9\u8BDD\u4E2D\u4F7F\u7528\u3002" }),
2244
- /* @__PURE__ */ jsx12(Button, { type: "button", disabled: busy, onClick: () => {
2240
+ /* @__PURE__ */ jsxs6("div", { className: "space-y-2", children: [
2241
+ /* @__PURE__ */ jsx11(Button, { className: "w-full", type: "submit", disabled: busy || !email.trim() || !code.trim(), children: busy ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
2242
+ /* @__PURE__ */ jsx11(LoaderCircle, { className: "animate-spin" }),
2243
+ "\u6B63\u5728\u8FDE\u63A5\u2026"
2244
+ ] }) : "\u8FDE\u63A5\u90AE\u7BB1" }),
2245
+ editing && /* @__PURE__ */ jsx11(Button, { className: "w-full", variant: "ghost", type: "button", disabled: busy, onClick: () => {
2246
+ setCode("");
2247
+ setEditing(false);
2248
+ setFailure("");
2249
+ }, children: "\u53D6\u6D88" })
2250
+ ] })
2251
+ ] });
2252
+ if (detail) {
2253
+ const actions = [
2254
+ ...view?.connected ? [{ id: "edit", description: "\u91CD\u65B0\u586B\u5199\u90AE\u7BB1\u5730\u5740\u548C\u6388\u6743\u7801", label: "\u66F4\u6362\u8D26\u53F7", confirmation: { title: "\u66F4\u6362\u8D26\u53F7\uFF1F", description: "\u5C06\u6253\u5F00\u8FDE\u63A5\u8868\u5355\u3002\u4FDD\u5B58\u65B0\u8D26\u53F7\u524D\uFF0C\u5F53\u524D\u8FDE\u63A5\u4FDD\u6301\u4E0D\u53D8\uFF1B\u66F4\u6362\u540E\u4F7F\u7528\u89C4\u5219\u4FDD\u7559\u3002" }, run: () => {
2255
+ setEmail(view.label || "");
2256
+ setFailure("");
2257
+ setEditing(true);
2258
+ } }] : [],
2259
+ { id: "check", description: "\u68C0\u67E5\u5F53\u524D\u8D26\u53F7\u7684\u8FDE\u63A5\u72B6\u6001", label: "\u91CD\u65B0\u6838\u9A8C", run: () => perform("check") },
2260
+ ...view?.connected && onDisable ? [{ id: "disable", description: "\u53EA\u5F71\u54CD\u6B64\u52A9\u624B\uFF0CSW \u4E2D\u7684\u6388\u6743\u548C\u6536\u6D88\u606F\u4FDD\u7559", label: view.enabled ? "\u5728\u6B64\u52A9\u624B\u4E2D\u505C\u7528" : "\u91CD\u65B0\u542F\u7528", confirmation: { title: view.enabled ? "\u5728\u6B64\u52A9\u624B\u4E2D\u505C\u7528\u90AE\u7BB1\uFF1F" : "\u91CD\u65B0\u542F\u7528\u90AE\u7BB1\uFF1F", description: "\u6B64\u64CD\u4F5C\u53EA\u5F71\u54CD\u52A9\u624B\u4F7F\u7528\u90AE\u7BB1\uFF0CSuperWork \u4E2D\u7684\u6388\u6743\u548C\u6D88\u606F\u63A5\u6536\u4FDD\u7559\u3002" }, run: () => perform(view.enabled ? "disable" : "finish") }] : [],
2261
+ { id: "diagnostics", description: "\u8BCA\u65AD\u4FE1\u606F\u548C\u6700\u8FD1\u9519\u8BEF", label: "\u9047\u5230\u95EE\u9898\uFF1F", run: async () => {
2262
+ if (view?.connection_id && diagnostics) {
2263
+ const next = await diagnostics();
2264
+ if (alive.current) setDiagnosticView(next);
2265
+ }
2266
+ }, page: /* @__PURE__ */ jsxs6("div", { className: "space-y-3", children: [
2267
+ /* @__PURE__ */ jsxs6("p", { children: [
2268
+ "\u8D26\u53F7\uFF1A",
2269
+ view?.label || "\u5C1A\u672A\u8FDE\u63A5"
2270
+ ] }),
2271
+ /* @__PURE__ */ jsxs6("p", { children: [
2272
+ "\u6392\u67E5\u7F16\u53F7\uFF1A",
2273
+ view?.error?.trace_id || view?.trace_id || "\u6682\u65E0\u8BB0\u5F55"
2274
+ ] }),
2275
+ view?.error && /* @__PURE__ */ jsx11("p", { children: view.error.message }),
2276
+ diagnosticView?.runtime && /* @__PURE__ */ jsx11(ConnectorRuntimeDiagnostics, { runtime: diagnosticView.runtime }),
2277
+ diagnosticView?.audit_events.map((event, index) => /* @__PURE__ */ jsx11("p", { children: event.message || "\u8FDE\u63A5\u72B6\u6001\u8BB0\u5F55" }, event.id ?? index)),
2278
+ bindDelivery && view?.connected && !paused && /* @__PURE__ */ jsx11(Button, { disabled: busy, onClick: () => void perform("bind"), children: "\u66F4\u65B0\u52A9\u624B\u63A5\u6536\u5730\u5740" })
2279
+ ] }) },
2280
+ { id: "help", description: "\u67E5\u770B\u8FDE\u63A5\u548C\u4F7F\u7528\u8BF4\u660E", label: "\u4F7F\u7528\u5E2E\u52A9", page: /* @__PURE__ */ jsx11("p", { children: "\u53EF\u4EE5\u8BA9\u52A9\u624B\u641C\u7D22\u3001\u9605\u8BFB\u548C\u6574\u7406\u90AE\u4EF6\u3002\u53D1\u9001\u90AE\u4EF6\u65F6\u4F1A\u9075\u5B88\u4F60\u8BBE\u7F6E\u7684\u4F7F\u7528\u89C4\u5219\u3002" }) },
2281
+ ...view?.connection_id ? [{ id: "remove", description: "\u6E05\u9664 SW \u4E2D\u7684\u51ED\u636E\u5E76\u505C\u6B62\u6536\u6D88\u606F", label: "\u79FB\u9664\u90AE\u7BB1\u8FDE\u63A5", danger: true, confirmation: { title: "\u79FB\u9664\u90AE\u7BB1\u8FDE\u63A5\uFF1F", description: "\u79FB\u9664\u540E\u5C06\u505C\u6B62\u63A5\u6536\u548C\u63A8\u9001\uFF0C\u5E76\u6E05\u9664\u5DF2\u4FDD\u5B58\u7684\u90AE\u7BB1\u5730\u5740\u548C\u6388\u6743\u7801\u3002\u5DF2\u6709\u6D88\u606F\u548C\u6587\u4EF6\u4FDD\u7559\u3002\u5176\u4ED6\u4F9D\u8D56\u6B64\u8FDE\u63A5\u7684\u52A9\u624B\u4E5F\u4F1A\u53D7\u5F71\u54CD\u3002" }, run: () => perform("remove") }] : [],
2282
+ ...detail.actions ?? []
2283
+ ];
2284
+ return /* @__PURE__ */ jsxs6("div", { className: "managed-mail-connection", children: [
2285
+ /* @__PURE__ */ jsx11(
2286
+ ConnectorDetail,
2287
+ {
2288
+ title: detail.title,
2289
+ icon: detail.icon,
2290
+ account: view?.label || "\u8FDE\u63A5\u540E\uFF0C\u52A9\u624B\u53EF\u4EE5\u5E2E\u4F60\u5904\u7406\u90AE\u4EF6\u3002",
2291
+ connected: Boolean(view?.connected),
2292
+ status: failure || view?.connected && !view.enabled ? "attention" : view?.connected ? "connected" : "disconnected",
2293
+ statusLabel: view?.connected && !view.enabled ? "\u5DF2\u505C\u7528" : void 0,
2294
+ busy,
2295
+ actions,
2296
+ connection: !view ? /* @__PURE__ */ jsx11("output", { children: busy ? "\u6B63\u5728\u8BFB\u53D6\u90AE\u7BB1\u72B6\u6001\u2026" : "\u8FDE\u63A5\u72B6\u6001\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u91CD\u65B0\u6838\u9A8C\u3002" }) : !view.connected ? /* @__PURE__ */ jsxs6("div", { className: "rounded-[20px] border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-5", children: [
2297
+ /* @__PURE__ */ jsxs6("h3", { className: "mb-4 text-base font-medium", children: [
2298
+ "\u8FDE\u63A5",
2299
+ brand
2300
+ ] }),
2301
+ connectionForm
2302
+ ] }) : void 0,
2303
+ noticeTitle: "\u90AE\u7BB1\u9700\u8981\u5904\u7406",
2304
+ notice: failure || (view?.connected && !view.enabled ? "\u5DF2\u5728\u6B64\u52A9\u624B\u4E2D\u505C\u7528\uFF0C\u6388\u6743\u548C\u6D88\u606F\u63A5\u6536\u4ECD\u7136\u4FDD\u7559\u3002" : void 0),
2305
+ tabs: [{ id: "rules", label: "\u4F7F\u7528\u89C4\u5219", content: detail.rules }, ...bindDelivery ? [{ id: "push", label: "\u65B0\u90AE\u4EF6\u63A8\u9001", content: /* @__PURE__ */ jsxs6("div", { className: "space-y-4 rounded-xl bg-[hsl(var(--muted)/0.3)] p-4", children: [
2306
+ /* @__PURE__ */ jsx11("p", { children: "\u65B0\u90AE\u4EF6\u4F1A\u63A8\u9001\u7ED9\u52A9\u624B\uFF0C\u7531\u52A9\u624B\u5224\u65AD\u662F\u5426\u9700\u8981\u63D0\u9192\u4F60\u3002" }),
2307
+ /* @__PURE__ */ jsx11(Button, { disabled: busy, onClick: () => void perform(paused ? "resume" : view?.delivery_bound ? "pause" : "bind"), children: paused ? "\u6062\u590D\u63A8\u9001" : view?.delivery_bound ? "\u6682\u505C\u63A8\u9001" : "\u63A5\u5165\u52A9\u624B\u6D88\u606F" }),
2308
+ detail.pushFrequency,
2309
+ detail.onOpenPush && /* @__PURE__ */ jsx11("button", { type: "button", className: "block min-h-10 text-xs underline", onClick: detail.onOpenPush, children: "\u524D\u5F80\u63A8\u9001\u63A5\u53E3" })
2310
+ ] }) }] : []]
2311
+ }
2312
+ ),
2313
+ /* @__PURE__ */ jsx11(Dialog, { open: Boolean(editing && view?.connected), onOpenChange: (open) => {
2314
+ if (!open && !busy) {
2315
+ setCode("");
2316
+ setEditing(false);
2317
+ }
2318
+ }, children: /* @__PURE__ */ jsxs6(DialogContent, { "aria-describedby": void 0, className: "managed-mail-connection max-h-[85dvh] overflow-y-auto", onEscapeKeyDown: (event) => {
2319
+ if (busy) event.preventDefault();
2320
+ }, onInteractOutside: (event) => {
2321
+ if (busy) event.preventDefault();
2322
+ }, children: [
2323
+ /* @__PURE__ */ jsx11(DialogTitle, { children: "\u66F4\u6362\u90AE\u7BB1\u8D26\u53F7" }),
2324
+ /* @__PURE__ */ jsx11("p", { className: "text-sm", children: "\u4FDD\u5B58\u540E\u65E7\u8D26\u53F7\u7684\u8FDE\u63A5\u4F1A\u88AB\u66FF\u6362\uFF0C\u4F7F\u7528\u89C4\u5219\u4FDD\u7559\u3002" }),
2325
+ failure && /* @__PURE__ */ jsx11("p", { role: "alert", children: failure }),
2326
+ connectionForm
2327
+ ] }) })
2328
+ ] });
2329
+ }
2330
+ return /* @__PURE__ */ jsxs6("section", { "aria-label": "\u8FDE\u63A5\u90AE\u7BB1", "aria-busy": busy, className: "managed-mail-connection min-w-0 space-y-5 text-left text-sm text-foreground", children: [
2331
+ view ? /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-3", children: [
2332
+ /* @__PURE__ */ jsx11("p", { className: "min-w-0 break-all text-xs text-muted-foreground", children: view.connected ? view.label : "\u8FDE\u63A5\u540E\uFF0C\u52A9\u624B\u53EF\u4EE5\u5E2E\u4F60\u5904\u7406\u90AE\u4EF6\u3002" }),
2333
+ /* @__PURE__ */ jsx11(Badge, { className: "shrink-0", variant: view.connected ? "secondary" : "outline", children: paused ? "\u63A8\u9001\u5DF2\u6682\u505C" : view.connected ? "\u5DF2\u8FDE\u63A5" : "\u672A\u8FDE\u63A5" })
2334
+ ] }) : busy && /* @__PURE__ */ jsx11("output", { className: "text-muted-foreground", children: "\u6B63\u5728\u8BFB\u53D6\u90AE\u7BB1\u72B6\u6001\u2026" }),
2335
+ failure && /* @__PURE__ */ jsx11("p", { role: "alert", className: "break-words rounded-lg border border-destructive/20 bg-destructive/10 px-3 py-2.5 text-sm text-destructive", children: failure }),
2336
+ connectionForm,
2337
+ view?.connected && !editing && /* @__PURE__ */ jsxs6(Fragment2, { children: [
2338
+ !view.enabled && /* @__PURE__ */ jsxs6("div", { className: "space-y-2 rounded-lg border border-border p-3", children: [
2339
+ /* @__PURE__ */ jsx11("p", { className: "text-xs text-muted-foreground", children: "\u90AE\u7BB1\u5DF2\u8FDE\u63A5\uFF0C\u542F\u7528\u540E\u53EF\u5728\u5BF9\u8BDD\u4E2D\u4F7F\u7528\u3002" }),
2340
+ /* @__PURE__ */ jsx11(Button, { type: "button", disabled: busy, onClick: () => {
2245
2341
  void perform("finish");
2246
2342
  }, children: "\u542F\u7528\u90AE\u7BB1" })
2247
2343
  ] }),
2248
- bindDelivery && /* @__PURE__ */ jsxs8("div", { className: "space-y-3 rounded-xl border border-border bg-muted/30 p-4", "aria-label": "\u52A9\u624B\u6D88\u606F", children: [
2249
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between gap-2", children: [
2250
- /* @__PURE__ */ jsx12("h4", { className: "font-medium", children: "\u52A9\u624B\u6D88\u606F" }),
2251
- /* @__PURE__ */ jsx12("span", { className: "text-xs text-muted-foreground", children: paused ? "\u5411\u52A9\u624B\u63A8\u9001\u5DF2\u6682\u505C" : view.delivery_bound ? "\u5DF2\u63A5\u5165\u52A9\u624B\u6D88\u606F" : "\u5C1A\u672A\u63A5\u5165" })
2344
+ bindDelivery && /* @__PURE__ */ jsxs6("div", { className: "space-y-3 rounded-xl border border-border bg-[hsl(var(--muted)/0.3)] p-4", "aria-label": "\u52A9\u624B\u6D88\u606F", children: [
2345
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-2", children: [
2346
+ /* @__PURE__ */ jsx11("h4", { className: "font-medium", children: "\u52A9\u624B\u6D88\u606F" }),
2347
+ /* @__PURE__ */ jsx11("span", { className: "text-xs text-muted-foreground", children: paused ? "\u5411\u52A9\u624B\u63A8\u9001\u5DF2\u6682\u505C" : view.delivery_bound ? "\u5DF2\u63A5\u5165\u52A9\u624B\u6D88\u606F" : "\u5C1A\u672A\u63A5\u5165" })
2252
2348
  ] }),
2253
- /* @__PURE__ */ jsx12("p", { className: "text-xs leading-relaxed text-muted-foreground", children: "\u65B0\u90AE\u4EF6\u4F1A\u63A8\u9001\u7ED9\u52A9\u624B\uFF0C\u7531\u52A9\u624B\u5224\u65AD\u662F\u5426\u9700\u8981\u63D0\u9192\u4F60" }),
2254
- /* @__PURE__ */ jsxs8(Button, { className: "w-full", variant: view.delivery_bound && !paused ? "outline" : "default", type: "button", disabled: busy, onClick: () => {
2349
+ /* @__PURE__ */ jsx11("p", { className: "text-xs leading-relaxed text-muted-foreground", children: "\u65B0\u90AE\u4EF6\u4F1A\u63A8\u9001\u7ED9\u52A9\u624B\uFF0C\u7531\u52A9\u624B\u5224\u65AD\u662F\u5426\u9700\u8981\u63D0\u9192\u4F60" }),
2350
+ /* @__PURE__ */ jsxs6(Button, { className: "w-full", variant: view.delivery_bound && !paused ? "outline" : "default", type: "button", disabled: busy, onClick: () => {
2255
2351
  void perform(paused ? "resume" : view.delivery_bound ? "pause" : "bind");
2256
2352
  }, children: [
2257
- busy && /* @__PURE__ */ jsx12(LoaderCircle, { className: "animate-spin" }),
2353
+ busy && /* @__PURE__ */ jsx11(LoaderCircle, { className: "animate-spin" }),
2258
2354
  paused ? "\u6062\u590D\u63A8\u9001" : view.delivery_bound ? "\u6682\u505C\u63A8\u9001" : "\u63A5\u5165\u52A9\u624B\u6D88\u606F"
2259
2355
  ] })
2260
2356
  ] })
2261
2357
  ] }),
2262
- !editing && /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center justify-between gap-1 text-muted-foreground", children: [
2263
- view?.connected && /* @__PURE__ */ jsx12(Button, { type: "button", variant: "ghost", size: "xs", disabled: busy, onClick: () => {
2358
+ !editing && /* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-center justify-between gap-1 text-muted-foreground", children: [
2359
+ view?.connected && /* @__PURE__ */ jsx11(Button, { type: "button", variant: "ghost", size: "xs", disabled: busy, onClick: () => {
2264
2360
  setEmail(view.label || "");
2265
2361
  setFailure("");
2266
2362
  setEditing(true);
2267
2363
  }, children: "\u91CD\u65B0\u8FDE\u63A5\u90AE\u7BB1" }),
2268
- /* @__PURE__ */ jsx12(Button, { type: "button", variant: "ghost", size: "xs", disabled: busy, onClick: () => {
2364
+ /* @__PURE__ */ jsx11(Button, { type: "button", variant: "ghost", size: "xs", disabled: busy, onClick: () => {
2269
2365
  void perform("refresh");
2270
2366
  }, children: "\u5237\u65B0\u72B6\u6001" }),
2271
- onDisable && view?.enabled && /* @__PURE__ */ jsx12(Button, { type: "button", variant: "ghost", size: "xs", disabled: busy, onClick: () => {
2367
+ onDisable && view?.enabled && /* @__PURE__ */ jsx11(Button, { type: "button", variant: "ghost", size: "xs", disabled: busy, onClick: () => {
2272
2368
  void perform("disable");
2273
2369
  }, children: "\u505C\u7528\u6B64\u8FDE\u63A5" })
2274
2370
  ] }),
2275
- view?.connection_id && !editing && /* @__PURE__ */ jsxs8("div", { className: "space-y-3", children: [
2276
- /* @__PURE__ */ jsx12(Separator, {}),
2277
- /* @__PURE__ */ jsxs8(AlertDialog, { children: [
2278
- /* @__PURE__ */ jsx12(AlertDialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx12(Button, { type: "button", variant: "destructive", size: "sm", disabled: busy, children: "\u79FB\u9664\u90AE\u7BB1\u8FDE\u63A5" }) }),
2279
- /* @__PURE__ */ jsxs8(AlertDialogContent, { className: "managed-mail-connection", children: [
2280
- /* @__PURE__ */ jsxs8(AlertDialogHeader, { children: [
2281
- /* @__PURE__ */ jsx12(AlertDialogTitle, { children: "\u79FB\u9664\u90AE\u7BB1\u8FDE\u63A5\uFF1F" }),
2282
- /* @__PURE__ */ jsx12(AlertDialogDescription, { children: "\u79FB\u9664\u540E\u5C06\u505C\u6B62\u63A5\u6536\u548C\u63A8\u9001\uFF0C\u5E76\u6E05\u9664\u5DF2\u4FDD\u5B58\u7684\u90AE\u7BB1\u5730\u5740\u548C\u6388\u6743\u7801\u3002\u5DF2\u6709\u6D88\u606F\u548C\u6587\u4EF6\u4FDD\u7559\u3002" })
2371
+ view?.connection_id && !editing && /* @__PURE__ */ jsxs6("div", { className: "space-y-3", children: [
2372
+ /* @__PURE__ */ jsx11(Separator, {}),
2373
+ /* @__PURE__ */ jsxs6(AlertDialog, { children: [
2374
+ /* @__PURE__ */ jsx11(AlertDialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx11(Button, { type: "button", variant: "destructive", size: "sm", disabled: busy, children: "\u79FB\u9664\u90AE\u7BB1\u8FDE\u63A5" }) }),
2375
+ /* @__PURE__ */ jsxs6(AlertDialogContent, { className: "managed-mail-connection", children: [
2376
+ /* @__PURE__ */ jsxs6(AlertDialogHeader, { children: [
2377
+ /* @__PURE__ */ jsx11(AlertDialogTitle, { children: "\u79FB\u9664\u90AE\u7BB1\u8FDE\u63A5\uFF1F" }),
2378
+ /* @__PURE__ */ jsx11(AlertDialogDescription, { children: "\u79FB\u9664\u540E\u5C06\u505C\u6B62\u63A5\u6536\u548C\u63A8\u9001\uFF0C\u5E76\u6E05\u9664\u5DF2\u4FDD\u5B58\u7684\u90AE\u7BB1\u5730\u5740\u548C\u6388\u6743\u7801\u3002\u5DF2\u6709\u6D88\u606F\u548C\u6587\u4EF6\u4FDD\u7559\u3002" })
2283
2379
  ] }),
2284
- /* @__PURE__ */ jsxs8(AlertDialogFooter, { children: [
2285
- /* @__PURE__ */ jsx12(AlertDialogCancel, { type: "button", children: "\u53D6\u6D88" }),
2286
- /* @__PURE__ */ jsx12(AlertDialogAction, { type: "button", variant: "destructive", onClick: () => {
2380
+ /* @__PURE__ */ jsxs6(AlertDialogFooter, { children: [
2381
+ /* @__PURE__ */ jsx11(AlertDialogCancel, { type: "button", children: "\u53D6\u6D88" }),
2382
+ /* @__PURE__ */ jsx11(AlertDialogAction, { type: "button", variant: "destructive", onClick: () => {
2287
2383
  void perform("remove");
2288
2384
  }, children: "\u786E\u8BA4\u79FB\u9664" })
2289
2385
  ] })
@@ -2294,9 +2390,9 @@ function ManagedConnection({ read, act, onChanged, bindDelivery, onDisable }) {
2294
2390
  }
2295
2391
 
2296
2392
  // src/components/ConnectorConnection.tsx
2297
- import { jsx as jsx13 } from "react/jsx-runtime";
2393
+ import { jsx as jsx12 } from "react/jsx-runtime";
2298
2394
  function ConnectorConnection({ type, ...props }) {
2299
- return type === "managed" ? /* @__PURE__ */ jsx13(ManagedConnection, { ...props }) : /* @__PURE__ */ jsx13(DeviceConnection, { ...props });
2395
+ return type === "managed" ? /* @__PURE__ */ jsx12(ManagedConnection, { ...props }) : /* @__PURE__ */ jsx12(DeviceConnection, { ...props });
2300
2396
  }
2301
2397
 
2302
2398
  export {
@@ -2317,4 +2413,4 @@ qrcode.react/lib/esm/index.js:
2317
2413
  * SPDX-License-Identifier: ISC
2318
2414
  *)
2319
2415
  */
2320
- //# sourceMappingURL=chunk-WO2VCQ5N.js.map
2416
+ //# sourceMappingURL=chunk-FH5HA3GW.js.map