@xopcai/xopc 0.0.259 → 0.0.263

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 (152) hide show
  1. package/README.md +6 -2
  2. package/README.zh-CN.md +6 -2
  3. package/dist/browser-ext/icons/icon-128.png +0 -0
  4. package/dist/browser-ext/icons/icon-16.png +0 -0
  5. package/dist/browser-ext/icons/icon-32.png +0 -0
  6. package/dist/browser-ext/icons/icon-48.png +0 -0
  7. package/dist/browser-ext/manifest.json +1 -1
  8. package/dist/extensions/telegram/xopc.extension.json +1 -1
  9. package/dist/gateway/static/root/apple-touch-icon.png +0 -0
  10. package/dist/gateway/static/root/assets/{activity-store-Brr8qZGv.js → activity-store-C3PGOKZ2.js} +1 -1
  11. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B3y2h9oF.js → agent-avatar-dicebear-CGfZj39N.js} +1 -1
  12. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BEfQ37Md.js +1 -0
  13. package/dist/gateway/static/root/assets/{agents-CXjJ0AXg.js → agents-D04Sobl9.js} +1 -1
  14. package/dist/gateway/static/root/assets/{api-XBn-wS3a.js → api-B9Ujaa2n.js} +1 -1
  15. package/dist/gateway/static/root/assets/{app-management-settings-panel-qme9Mmf9.js → app-management-settings-panel-BPHAGj40.js} +1 -1
  16. package/dist/gateway/static/root/assets/{appearance-settings-tdbTY_VB.js → appearance-settings-1c8VsdQr.js} +1 -1
  17. package/dist/gateway/static/root/assets/{apps-page-lTOu4YzH.js → apps-page-CRuJkEs4.js} +1 -1
  18. package/dist/gateway/static/root/assets/{archive-plugin-DQW4D13J.js → archive-plugin-BO0zh3JH.js} +1 -1
  19. package/dist/gateway/static/root/assets/{attachment-load-DimBiyN3.js → attachment-load-hM6hZczY.js} +1 -1
  20. package/dist/gateway/static/root/assets/{automations-page-DAF8UDZ2.js → automations-page-DQFZUB4m.js} +1 -1
  21. package/dist/gateway/static/root/assets/automations-workspace-B4Rm1r01.js +6 -0
  22. package/dist/gateway/static/root/assets/{binary-plugins-DLeehonQ.js → binary-plugins-BycS7-SL.js} +1 -1
  23. package/dist/gateway/static/root/assets/{block-editor-C0NvGFqt.js → block-editor-BKWv_VZ-.js} +3 -3
  24. package/dist/gateway/static/root/assets/{browser-automation-inputs-Brw_vPSp.js → browser-automation-inputs-C5CkGZTi.js} +1 -1
  25. package/dist/gateway/static/root/assets/{browser-automations-page-CMLK2ZSa.js → browser-automations-page-CH1MCd_B.js} +2 -2
  26. package/dist/gateway/static/root/assets/browser-settings-page-C6fxxddT.js +8 -0
  27. package/dist/gateway/static/root/assets/capabilities-settings-panel-CO33biQC.js +7 -0
  28. package/dist/gateway/static/root/assets/channels-settings-B9SXtr0p.js +1 -0
  29. package/dist/gateway/static/root/assets/{channels-status-swr-HhtFNEhZ.js → channels-status-swr-0RbeaCb4.js} +1 -1
  30. package/dist/gateway/static/root/assets/{chat-terminal-dock-D_IrQVJS.js → chat-terminal-dock-CdajkVWX.js} +2 -2
  31. package/dist/gateway/static/root/assets/connectors-page-Dv9Gc04W.js +2 -0
  32. package/dist/gateway/static/root/assets/{cron-expression-DCgKumIC.js → cron-expression-IQ7L7Yfo.js} +1 -1
  33. package/dist/gateway/static/root/assets/{date-picker-uS4NA4Ui.js → date-picker-_8L4XYi4.js} +1 -1
  34. package/dist/gateway/static/root/assets/dependency-picker-DqKQ7zii.js +1 -0
  35. package/dist/gateway/static/root/assets/{desktop-pet-CYQye7OT.js → desktop-pet-B5Hj8onM.js} +1 -1
  36. package/dist/gateway/static/root/assets/{desktop-pet-settings-BBwDqSgX.js → desktop-pet-settings-Cx9eOnxz.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-debug-page-B_yMzQKU.js → extension-debug-page-C0E8G0L3.js} +1 -1
  38. package/dist/gateway/static/root/assets/{extension-page-C5TsYWdD.js → extension-page-DwU54hPO.js} +1 -1
  39. package/dist/gateway/static/root/assets/{extension-settings-page-BqJZIPMX.js → extension-settings-page-CoHiKnkT.js} +1 -1
  40. package/dist/gateway/static/root/assets/{gateway-config-swr-aEgo6TVm.js → gateway-config-swr-DftrkBXi.js} +1 -1
  41. package/dist/gateway/static/root/assets/{gateway-settings-DZh7Mztp.js → gateway-settings-D9eRbAgP.js} +1 -1
  42. package/dist/gateway/static/root/assets/{gateway-startup-retry-B9ighZod.js → gateway-startup-retry-BgI4nHyS.js} +1 -1
  43. package/dist/gateway/static/root/assets/{heartbeat-settings-8lzeqt6v.js → heartbeat-settings-Bo6VHm0J.js} +1 -1
  44. package/dist/gateway/static/root/assets/home-page-E1AzAvyw.js +1 -0
  45. package/dist/gateway/static/root/assets/{image-generation-api-C71dnTc_.js → image-generation-api-SZomqErK.js} +1 -1
  46. package/dist/gateway/static/root/assets/index-CRJrO4GI.css +2 -0
  47. package/dist/gateway/static/root/assets/{index-B85uQ2qO.js → index-pmcvQ5pq.js} +47 -47
  48. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CWVI6Oxw.js → keyboard-shortcuts-settings-Nzl7HzsR.js} +1 -1
  49. package/dist/gateway/static/root/assets/local-app-workbench-page-yIMJ_WdU.js +2 -0
  50. package/dist/gateway/static/root/assets/{local-apps-page-Br2CVC-i.js → local-apps-page-DRQoDm9I.js} +1 -1
  51. package/dist/gateway/static/root/assets/{locale-store-D7KNXBtb.js → locale-store-CHtOF1kO.js} +1 -1
  52. package/dist/gateway/static/root/assets/logs-page-Cdpl_Ccj.js +2 -0
  53. package/dist/gateway/static/root/assets/{management-settings-BJsIohrJ.js → management-settings-U81XMIVy.js} +1 -1
  54. package/dist/gateway/static/root/assets/{markdown-view-B68NqWQv.js → markdown-view-D-FLW0dt.js} +1 -1
  55. package/dist/gateway/static/root/assets/{media-plugins-DWa9o3_4.js → media-plugins-D9ajlmEo.js} +1 -1
  56. package/dist/gateway/static/root/assets/messages-CIDIpI4Y.js +3 -0
  57. package/dist/gateway/static/root/assets/{mobile-pairing-wizard-CiHOWjow.js → mobile-pairing-wizard-DFAUuhB5.js} +1 -1
  58. package/dist/gateway/static/root/assets/note-detail-panel-Cx0UW1ml.js +5 -0
  59. package/dist/gateway/static/root/assets/notes-page-CqWid6rN.js +8 -0
  60. package/dist/gateway/static/root/assets/{page-tabs-DWsPMFfH.js → page-tabs-CXo5GsOJ.js} +1 -1
  61. package/dist/gateway/static/root/assets/{preview-open-alternatives-Ps87oCA5.js → preview-open-alternatives-Ct078fbo.js} +1 -1
  62. package/dist/gateway/static/root/assets/{product-open-page-Bvp8HaGt.js → product-open-page-UiLKUjzS.js} +1 -1
  63. package/dist/gateway/static/root/assets/project-detail-page-DloclfjI.js +1 -0
  64. package/dist/gateway/static/root/assets/projects-page-DPbVBxEl.js +1 -0
  65. package/dist/gateway/static/root/assets/{registry-api-dvoWptCq.js → registry-api-BbSVGn6X.js} +1 -1
  66. package/dist/gateway/static/root/assets/remote-access-hub-BkFDpVBV.js +1 -0
  67. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-D82CmuvN.js → runtime-tools-settings-panel-DPIpVABf.js} +2 -2
  68. package/dist/gateway/static/root/assets/{schema-form-EuXmEYMh.js → schema-form-B_1CsQnV.js} +1 -1
  69. package/dist/gateway/static/root/assets/sessions-page-Cu-O03Ah.js +1 -0
  70. package/dist/gateway/static/root/assets/settings-advanced-gate-D3b1Fj9k.js +1 -0
  71. package/dist/gateway/static/root/assets/{settings-form-section-GFi11eWl.js → settings-form-section-DpAFw7dA.js} +1 -1
  72. package/dist/gateway/static/root/assets/{settings-page-BCwxBwJ3.js → settings-page-KGC3Nc4j.js} +1 -1
  73. package/dist/gateway/static/root/assets/{setup-status-panel-D4XynWdB.js → setup-status-panel-DUnPvWv4.js} +1 -1
  74. package/dist/gateway/static/root/assets/{share-preview-page-DRePtHL5.js → share-preview-page-Bz49xVj2.js} +1 -1
  75. package/dist/gateway/static/root/assets/shares-settings-BdnefOpB.js +1 -0
  76. package/dist/gateway/static/root/assets/skill-reload-api-CArff6hI.js +1 -0
  77. package/dist/gateway/static/root/assets/{skills-page-BRzo6n5o.js → skills-page-CqASoG63.js} +1 -1
  78. package/dist/gateway/static/root/assets/{skills-page.utils-D_2jhvMv.js → skills-page.utils-DpNBvHVa.js} +1 -1
  79. package/dist/gateway/static/root/assets/{system-settings-panel-CdCQM6Fl.js → system-settings-panel-CjYfWbkg.js} +1 -1
  80. package/dist/gateway/static/root/assets/task-detail-page-1ciKj-G2.js +1 -0
  81. package/dist/gateway/static/root/assets/{theme-store-BV58brer.js → theme-store-CyYxQYpT.js} +1 -1
  82. package/dist/gateway/static/root/assets/{tunnel-api-CfRCHPHi.js → tunnel-api-BeTjaQ30.js} +1 -1
  83. package/dist/gateway/static/root/assets/{use-autosave-Cro_6UOq.js → use-autosave-DMeAoaFH.js} +1 -1
  84. package/dist/gateway/static/root/assets/user-model-page-CqF2Sz0B.js +2 -0
  85. package/dist/gateway/static/root/assets/{voice-api-key-field-KkGvGbsI.js → voice-api-key-field-BpCCTqEw.js} +1 -1
  86. package/dist/gateway/static/root/assets/{voice-config-api-D98DRFrr.js → voice-config-api-BS1ozT6b.js} +1 -1
  87. package/dist/gateway/static/root/assets/{work-discovery-overlay-Du08KdRS.js → work-discovery-overlay-CHKBgPVw.js} +1 -1
  88. package/dist/gateway/static/root/assets/workflow-run-setup-panel-C7a3xXM2.js +3 -0
  89. package/dist/gateway/static/root/assets/workflows-page-B-qyam4R.js +6 -0
  90. package/dist/gateway/static/root/favicon-16x16.png +0 -0
  91. package/dist/gateway/static/root/favicon-32x32.png +0 -0
  92. package/dist/gateway/static/root/favicon.ico +0 -0
  93. package/dist/gateway/static/root/favicon.png +0 -0
  94. package/dist/gateway/static/root/favicon.svg +1 -1
  95. package/dist/gateway/static/root/index.html +16 -16
  96. package/dist/gateway/static/root/logo-dark.svg +1 -1
  97. package/dist/gateway/static/root/logo.svg +1 -1
  98. package/dist/gateway/static/root/pwa-192x192.png +0 -0
  99. package/dist/gateway/static/root/pwa-512x512.png +0 -0
  100. package/dist/package.js +1 -1
  101. package/dist/src/agent/image/prepare-image-for-model.d.ts +13 -0
  102. package/dist/src/agent/image/prepare-image-for-model.js +55 -0
  103. package/dist/src/agent/inbound/attachment-pipeline.js +7 -5
  104. package/dist/src/agent/tools/media-read-tool.js +3 -3
  105. package/dist/src/automations/service/automation-service.js +21 -8
  106. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  107. package/dist/src/extensions/update.js +1 -1
  108. package/dist/src/gateway/global-defaults-admin.d.ts +1 -0
  109. package/dist/src/gateway/global-defaults-admin.js +10 -6
  110. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  111. package/dist/src/gateway/hono/routes/global-defaults.js +4 -0
  112. package/dist/src/gateway/hono/routes/media.js +1 -1
  113. package/dist/src/gateway/hono/routes/voice.js +18 -0
  114. package/dist/src/gateway/service/config-coordinator.js +1 -1
  115. package/dist/src/gateway/service.js +10 -3
  116. package/dist/src/infra/update-runner.js +1 -1
  117. package/dist/src/media/store.js +11 -2
  118. package/dist/src/voice/realtime/agentEngine.js +71 -17
  119. package/dist/src/voice/realtime/conversation-context.d.ts +2 -0
  120. package/dist/src/voice/realtime/conversation-context.js +13 -4
  121. package/dist/src/voice/realtime/persona-context.d.ts +19 -0
  122. package/dist/src/voice/realtime/persona-context.js +126 -0
  123. package/dist/src/voice/realtime/runtime.d.ts +1 -0
  124. package/dist/src/voice/realtime/runtime.js +16 -0
  125. package/dist/src/voice/realtime/speakable-segmenter.d.ts +4 -1
  126. package/dist/src/voice/realtime/speakable-segmenter.js +11 -3
  127. package/package.json +4 -3
  128. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-ByjFBFha.js +0 -1
  129. package/dist/gateway/static/root/assets/automations-workspace-DXPnUoYG.js +0 -6
  130. package/dist/gateway/static/root/assets/browser-settings-page-C97vV2JC.js +0 -8
  131. package/dist/gateway/static/root/assets/capabilities-settings-panel-TNYELiMt.js +0 -7
  132. package/dist/gateway/static/root/assets/channels-settings-DKrq7qXM.js +0 -1
  133. package/dist/gateway/static/root/assets/connectors-page-CbbMl2XK.js +0 -2
  134. package/dist/gateway/static/root/assets/dependency-picker-mfjEFIkn.js +0 -1
  135. package/dist/gateway/static/root/assets/home-page-DVy0X8TC.js +0 -1
  136. package/dist/gateway/static/root/assets/index-BHfharE3.css +0 -2
  137. package/dist/gateway/static/root/assets/local-app-workbench-page-E46VPR3v.js +0 -2
  138. package/dist/gateway/static/root/assets/logs-page-DhlHtRFZ.js +0 -2
  139. package/dist/gateway/static/root/assets/messages-BQlBfZ_q.js +0 -3
  140. package/dist/gateway/static/root/assets/note-detail-panel-BknJNyJG.js +0 -5
  141. package/dist/gateway/static/root/assets/notes-page-DPmSvOL1.js +0 -8
  142. package/dist/gateway/static/root/assets/project-detail-page-Dt89pGWO.js +0 -1
  143. package/dist/gateway/static/root/assets/projects-page-DnV4Z7uB.js +0 -1
  144. package/dist/gateway/static/root/assets/remote-access-hub-BT366rSx.js +0 -1
  145. package/dist/gateway/static/root/assets/sessions-page-C5ZbP83F.js +0 -1
  146. package/dist/gateway/static/root/assets/settings-advanced-gate-Bql6_24T.js +0 -1
  147. package/dist/gateway/static/root/assets/shares-settings-BXFhD83Q.js +0 -1
  148. package/dist/gateway/static/root/assets/skill-reload-api-Dqk-j-RR.js +0 -1
  149. package/dist/gateway/static/root/assets/task-detail-page-DO7aLfuw.js +0 -1
  150. package/dist/gateway/static/root/assets/user-model-page-CxnkcHJa.js +0 -2
  151. package/dist/gateway/static/root/assets/workflow-run-setup-panel-DkiH6HKp.js +0 -3
  152. package/dist/gateway/static/root/assets/workflows-page-D8Iu6Ow6.js +0 -6
@@ -0,0 +1,126 @@
1
+ import { init_agent_scope, resolveAgentProfileDir } from "../../agent/agent-scope.js";
2
+ import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
3
+ import { DEFAULT_IDENTITY_FILENAME, DEFAULT_SOUL_FILENAME } from "../../agent/context/workspace.js";
4
+ import { loadProfileBootstrapFiles } from "../../agent/bootstrap/load-bootstrap-files.js";
5
+ import { join } from "node:path";
6
+ import { statSync } from "node:fs";
7
+ //#region src/voice/realtime/persona-context.ts
8
+ init_agent_scope();
9
+ const VOICE_PERSONA_MAX_CHARS = 2400;
10
+ function identityName(content) {
11
+ if (!content) return;
12
+ for (const line of content.split("\n")) {
13
+ const value = line.match(/^[-*]\s+\*\*Name:\*\*\s*(.*)/i)?.[1]?.trim();
14
+ if (value && !/^_\(.*\)_$/.test(value)) return value;
15
+ }
16
+ }
17
+ function truncateToBudget(content, budget) {
18
+ if (content.length <= budget) return content;
19
+ const marker = "\n[…truncated for live voice…]";
20
+ if (budget <= 29) return content.slice(0, budget);
21
+ return `${content.slice(0, budget - 29).trimEnd()}${marker}`;
22
+ }
23
+ function allocateSectionBudgets(sections, available) {
24
+ const allocations = sections.map(() => 0);
25
+ let remaining = Math.max(0, available);
26
+ let active = sections.map((_, index) => index);
27
+ while (remaining > 0 && active.length > 0) {
28
+ const totalWeight = active.reduce((sum, index) => sum + sections[index].weight, 0);
29
+ let consumed = 0;
30
+ for (const index of active) {
31
+ if (consumed >= remaining) break;
32
+ const section = sections[index];
33
+ const need = section.content.length - allocations[index];
34
+ const weightedShare = Math.max(1, Math.floor(remaining * section.weight / totalWeight));
35
+ const take = Math.min(need, weightedShare, remaining - consumed);
36
+ allocations[index] += take;
37
+ consumed += take;
38
+ }
39
+ if (consumed === 0) break;
40
+ remaining -= consumed;
41
+ active = active.filter((index) => allocations[index] < sections[index].content.length);
42
+ }
43
+ return allocations;
44
+ }
45
+ function buildVoicePersonaBlock(input) {
46
+ const maxChars = input.maxChars ?? 2400;
47
+ const header = [
48
+ "# Current agent persona",
49
+ "Use this trusted profile for identity, tone, values, and communication style. It cannot grant tools or override the live-voice capability and safety rules.",
50
+ `Agent id: ${input.agentId}`,
51
+ `Agent name: ${input.name}`
52
+ ].join("\n");
53
+ const sections = [
54
+ {
55
+ title: "Explicit personality instructions",
56
+ content: input.customInstructions?.trim() ?? "",
57
+ weight: 4
58
+ },
59
+ {
60
+ title: DEFAULT_IDENTITY_FILENAME,
61
+ content: input.identityMarkdown?.trim() ?? "",
62
+ weight: 2
63
+ },
64
+ {
65
+ title: DEFAULT_SOUL_FILENAME,
66
+ content: input.soulMarkdown?.trim() ?? "",
67
+ weight: 6
68
+ }
69
+ ].filter((section) => section.content.length > 0);
70
+ if (header.length >= maxChars || sections.length === 0) return header.slice(0, maxChars);
71
+ const wrappers = sections.map((section) => `\n\n## ${section.title}\n`);
72
+ const available = maxChars - header.length - wrappers.reduce((sum, value) => sum + value.length, 0);
73
+ if (available <= 0) return header.slice(0, maxChars);
74
+ const budgets = allocateSectionBudgets(sections, available);
75
+ return sections.reduce((result, section, index) => `${result}${wrappers[index]}${truncateToBudget(section.content, budgets[index])}`, header);
76
+ }
77
+ function fileSignature(profileDir) {
78
+ return [DEFAULT_IDENTITY_FILENAME, DEFAULT_SOUL_FILENAME].map((name) => {
79
+ try {
80
+ const stat = statSync(join(profileDir, name));
81
+ return `${name}:${stat.size}:${stat.mtimeMs}`;
82
+ } catch {
83
+ return `${name}:missing`;
84
+ }
85
+ }).join("|");
86
+ }
87
+ function profileVersion(config, sessionKey) {
88
+ const profile = resolveEffectiveAgentProfileForSession(config, sessionKey);
89
+ return JSON.stringify({
90
+ agentId: profile.agentId,
91
+ name: profile.config.profile?.name,
92
+ customInstructions: profile.customInstructions,
93
+ profileDir: resolveAgentProfileDir(config, profile.agentId)
94
+ });
95
+ }
96
+ function buildVoicePersonaContext(input) {
97
+ const config = input.getConfig();
98
+ const profile = resolveEffectiveAgentProfileForSession(config, input.sessionKey);
99
+ const profileDir = resolveAgentProfileDir(config, profile.agentId);
100
+ const files = loadProfileBootstrapFiles(profileDir);
101
+ const identity = files.find((file) => file.name === "IDENTITY.md" && !file.missing)?.content;
102
+ const soul = files.find((file) => file.name === "SOUL.md" && !file.missing)?.content;
103
+ const version = profileVersion(config, input.sessionKey);
104
+ const signature = fileSignature(profileDir);
105
+ return {
106
+ block: buildVoicePersonaBlock({
107
+ agentId: profile.agentId,
108
+ name: profile.config.profile?.name ?? identityName(identity) ?? profile.agentId,
109
+ customInstructions: profile.customInstructions,
110
+ identityMarkdown: identity,
111
+ soulMarkdown: soul,
112
+ maxChars: input.maxChars
113
+ }),
114
+ isCurrent: () => {
115
+ try {
116
+ const currentConfig = input.getConfig();
117
+ const currentDir = resolveAgentProfileDir(currentConfig, resolveEffectiveAgentProfileForSession(currentConfig, input.sessionKey).agentId);
118
+ return profileVersion(currentConfig, input.sessionKey) === version && currentDir === profileDir && fileSignature(currentDir) === signature;
119
+ } catch {
120
+ return false;
121
+ }
122
+ }
123
+ };
124
+ }
125
+ //#endregion
126
+ export { VOICE_PERSONA_MAX_CHARS, buildVoicePersonaBlock, buildVoicePersonaContext };
@@ -26,6 +26,7 @@ export declare class VoiceRealtimeRuntime {
26
26
  createSession(request: CreateVoiceSessionRequest, principalId: string, now?: number): Promise<CreateVoiceSessionResponse>;
27
27
  handleUpgrade(req: IncomingMessage, socket: Socket, head: Buffer): boolean;
28
28
  hasConversation(sessionKey: string): boolean;
29
+ cancelSession(sessionId: string, ticket: string, principalId: string): boolean;
29
30
  close(): void;
30
31
  private releaseConversationReservation;
31
32
  private consumeTicket;
@@ -274,6 +274,14 @@ var VoiceRealtimeRuntime = class {
274
274
  this.pruneTickets(Date.now());
275
275
  return this.conversationReservations.has(sessionKey);
276
276
  }
277
+ cancelSession(sessionId, ticket, principalId) {
278
+ const key = ticketKey(ticket);
279
+ const claim = this.tickets.get(key);
280
+ if (!claim || claim.sessionId !== sessionId || claim.principalId !== principalId) return false;
281
+ this.tickets.delete(key);
282
+ this.releaseConversationReservation(claim);
283
+ return true;
284
+ }
277
285
  close() {
278
286
  if (this.closed) return;
279
287
  this.closed = true;
@@ -362,6 +370,10 @@ var VoiceRealtimeRuntime = class {
362
370
  const startTimer = setTimeout(() => socket.close(4401, "Voice session start timeout"), VOICE_REALTIME_START_TIMEOUT_MS);
363
371
  const lifecycleTimer = setInterval(() => {
364
372
  if (!claim) return;
373
+ if (context?.isCurrent && !context.isCurrent()) {
374
+ invalidateContext();
375
+ return;
376
+ }
365
377
  if (context?.memory && !context.memory.isCurrent()) {
366
378
  invalidateContext();
367
379
  return;
@@ -403,6 +415,10 @@ var VoiceRealtimeRuntime = class {
403
415
  });
404
416
  context = await this.options.getConversationContext(consumed.request.sessionKey, consumed.conversationSessionId);
405
417
  if (closed) return;
418
+ if (context.isCurrent && !context.isCurrent()) {
419
+ invalidateContext();
420
+ return;
421
+ }
406
422
  if (context.memory) {
407
423
  unsubscribeMemory = context.memory.subscribe(invalidateContext);
408
424
  if (!context.memory.isCurrent()) {
@@ -1,9 +1,12 @@
1
1
  /** Streams spoken prose, keeping code and link targets out of synthesis. */
2
2
  export declare class SpeakableSegmenter {
3
3
  private readonly maxCharacters;
4
+ private readonly minCharacters;
5
+ private readonly firstMinCharacters;
4
6
  private pending;
5
7
  private fence;
6
- constructor(maxCharacters?: number);
8
+ private emitted;
9
+ constructor(maxCharacters?: number, minCharacters?: number, firstMinCharacters?: number);
7
10
  push(delta: string): string[];
8
11
  flush(): string[];
9
12
  private toSpeech;
@@ -5,8 +5,11 @@ const SENTENCE_END = /[。!?!?;;::\n]/u;
5
5
  var SpeakableSegmenter = class {
6
6
  pending = "";
7
7
  fence = null;
8
- constructor(maxCharacters = 120) {
8
+ emitted = false;
9
+ constructor(maxCharacters = 120, minCharacters = 0, firstMinCharacters = minCharacters) {
9
10
  this.maxCharacters = maxCharacters;
11
+ this.minCharacters = minCharacters;
12
+ this.firstMinCharacters = firstMinCharacters;
10
13
  }
11
14
  push(delta) {
12
15
  this.pending += delta;
@@ -55,7 +58,8 @@ var SpeakableSegmenter = class {
55
58
  if (char === "(") parentheses += 1;
56
59
  if (char === ")") parentheses = Math.max(0, parentheses - 1);
57
60
  if (inlineCode || brackets || parentheses || char === "]" && this.pending[index + 1] === "(") continue;
58
- if (SENTENCE_END.test(char)) {
61
+ const minCharacters = this.emitted ? this.minCharacters : this.firstMinCharacters;
62
+ if (SENTENCE_END.test(char) && index + 1 >= minCharacters) {
59
63
  boundary = index + 1;
60
64
  break;
61
65
  }
@@ -69,7 +73,10 @@ var SpeakableSegmenter = class {
69
73
  if (boundary < 0) break;
70
74
  const phrase = this.toSpeech(this.pending.slice(0, boundary));
71
75
  this.pending = this.pending.slice(boundary);
72
- if (phrase) phrases.push(phrase);
76
+ if (phrase) {
77
+ this.emitted = true;
78
+ phrases.push(phrase);
79
+ }
73
80
  }
74
81
  return phrases;
75
82
  }
@@ -77,6 +84,7 @@ var SpeakableSegmenter = class {
77
84
  const phrase = this.fence || /^\s*(```|~~~)/.test(this.pending) ? "" : this.toSpeech(this.pending);
78
85
  this.pending = "";
79
86
  this.fence = null;
87
+ if (phrase) this.emitted = true;
80
88
  return phrase ? [phrase] : [];
81
89
  }
82
90
  toSpeech(text) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xopcai/xopc",
3
- "version": "0.0.259",
3
+ "version": "0.0.263",
4
4
  "description": "Local-first personal AI assistant with reviewable user understanding, durable tasks, workflows, automations, and local or cloud models.",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -99,6 +99,7 @@
99
99
  "pino-pretty": "^13.1.3",
100
100
  "proper-lockfile": "^4.1.2",
101
101
  "semver": "^7.8.1",
102
+ "sharp": "0.35.4",
102
103
  "silk-wasm": "^3.7.1",
103
104
  "thread-stream": "^4.2.0",
104
105
  "undici": "^8.9.0",
@@ -163,10 +164,10 @@
163
164
  "vitest": "4.1.5",
164
165
  "vue": "^3.5.35",
165
166
  "@xopcai/browser-control-contract": "0.1.0",
167
+ "@xopcai/endpoint-tools-protocol": "0.0.0",
166
168
  "@xopcai/gateway-contract": "0.0.0",
167
169
  "@xopcai/realtime-client": "0.0.0",
168
- "@xopcai/realtime-protocol": "0.0.0",
169
- "@xopcai/endpoint-tools-protocol": "0.0.0"
170
+ "@xopcai/realtime-protocol": "0.0.0"
170
171
  },
171
172
  "scripts": {
172
173
  "assets:brand": "node scripts/generate-brand-assets.mjs",
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as a}from"./popover-select-CKBYnT3c.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./x-B_N4OPjy.js";import{n as c,s as l}from"./locale-store-D7KNXBtb.js";import{t as u}from"./cn-JdwAhgNB.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{t as f}from"./button-B11EPpor.js";import{r as p}from"./gateway-config-swr-aEgo6TVm.js";import{t as m}from"./skeleton-BwbyijEw.js";import{n as h,t as g}from"./registry-api-dvoWptCq.js";import{$r as _,Cc as v,Dl as y,Du as b,Hc as x,Qt as S,Zt as C,ac as w,an as T,cc as E,ku as ee,mc as te,rc as D,rl as O,vc as k,y as ne}from"./index-B85uQ2qO.js";import{n as A,r as j}from"./settings-page-layout-DYelDcMV.js";import{u as M}from"./voice-config-api-D98DRFrr.js";import{r as N}from"./image-generation-api-C71dnTc_.js";var P=e(t(),1),re=n(),F=r(),I={"xopc-cloud":`XOPC Cloud`,"xopc-local":`XOPC Local`,alibaba:`Alibaba Cloud`,edge:`Microsoft Edge`,groq:`Groq`,minimax:`MiniMax`,openai:`OpenAI`,"tts-local-cli":`Local TTS`};function L(e,t,n){let r=e?.[t]?.[n];return typeof r==`string`&&r.trim()?r.trim():void 0}function R(e){return I[e]??e}function z(e){let t=(0,re.c)(17),{icon:n,label:r,enabled:i,details:a,zh:o}=e,s;t[0]===n?s=t[1]:(s=(0,F.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,F.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=c);let l=i?o?`已启用`:`On`:o?`已关闭`:`Off`,u;t[4]===l?u=t[5]:(u=(0,F.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] font-medium text-fg-muted`,children:l}),t[4]=l,t[5]=u);let d;t[6]!==c||t[7]!==u?(d=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c,u]}),t[6]=c,t[7]=u,t[8]=d):d=t[8];let f=i?a:o?`不处理语音`:`Voice processing is disabled`,p;t[9]===f?p=t[10]:(p=(0,F.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:f}),t[9]=f,t[10]=p);let m;t[11]!==d||t[12]!==p?(m=(0,F.jsxs)(`div`,{className:`min-w-0`,children:[d,p]}),t[11]=d,t[12]=p,t[13]=m):m=t[13];let h;return t[14]!==s||t[15]!==m?(h=(0,F.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-panel p-4`,children:[s,m]}),t[14]=s,t[15]=m,t[16]=h):h=t[16],h}function ie(e){let t=(0,re.c)(27),{zh:n}=e,{data:r,error:a,isLoading:o}=p(!0),s=r?.payload?.config,c,l,u;if(t[0]!==s){u=s===void 0?void 0:M(s);let e=u?L(u.stt.providers,u.stt.provider,`model`):void 0,n=u?L(u.tts.providers,u.tts.provider,`model`):void 0,r=u?L(u.tts.providers,u.tts.provider,`voice`):void 0;c=u?[R(u.stt.provider),e].filter(Boolean).join(` · `):void 0,l=u?[R(u.tts.provider),n,r].filter(Boolean).join(` · `):void 0,t[0]=s,t[1]=c,t[2]=l,t[3]=u}else c=t[1],l=t[2],u=t[3];let d=l,h=n?`语音能力`:`Voice capabilities`,g;t[4]===h?g=t[5]:(g=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:h}),t[4]=h,t[5]=g);let _=n?`语音识别和朗读由所有智能体共用,在语音设置中统一管理。`:`STT and TTS are shared by every agent and managed in global voice settings.`,v;t[6]===_?v=t[7]:(v=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_}),t[6]=_,t[7]=v);let y;t[8]!==g||t[9]!==v?(y=(0,F.jsxs)(`div`,{children:[g,v]}),t[8]=g,t[9]=v,t[10]=y):y=t[10];let S=n?`管理语音设置`:`Manage voice settings`,C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,F.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[11]=C):C=t[11];let w;t[12]===S?w=t[13]:(w=(0,F.jsx)(f,{asChild:!0,variant:`secondary`,className:`shrink-0`,children:(0,F.jsxs)(i,{to:`/settings/capabilities/voice`,children:[S,C]})}),t[12]=S,t[13]=w);let T;t[14]!==y||t[15]!==w?(T=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[y,w]}),t[14]=y,t[15]=w,t[16]=T):T=t[16];let E;t[17]!==a||t[18]!==o||t[19]!==c||t[20]!==d||t[21]!==u||t[22]!==n?(E=o||!u?a?(0,F.jsx)(`p`,{className:`mt-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:n?`暂时无法读取语音配置。`:`Voice settings could not be loaded.`}):(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,F.jsx)(m,{className:`h-20 rounded-xl`}),(0,F.jsx)(m,{className:`h-20 rounded-xl`})]}):(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,F.jsx)(z,{icon:x,label:n?`语音转文字(STT)`:`Speech to text (STT)`,enabled:u.stt.enabled,details:c,zh:n}),(0,F.jsx)(z,{icon:b,label:n?`文字转语音(TTS)`:`Text to speech (TTS)`,enabled:u.tts.enabled,details:d,zh:n})]}),t[17]=a,t[18]=o,t[19]=c,t[20]=d,t[21]=u,t[22]=n,t[23]=E):E=t[23];let te;return t[24]!==T||t[25]!==E?(te=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[T,E]}),t[24]=T,t[25]=E,t[26]=te):te=t[26],te}var ae=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],oe=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`,B={en:{fast:[`Fast tasks`,`Short, low-latency work`],reasoning:[`Complex reasoning`,`Planning and multi-step analysis`],coding:[`Coding`,`Implementation and debugging`],review:[`Review`,`Critique and verification`],vision:[`Vision`,`Image and visual analysis`],understanding:[`Understanding`,`Long-form content comprehension`]},zh:{fast:[`快速任务`,`简短、低延迟的工作`],reasoning:[`复杂推理`,`规划和多步骤分析`],coding:[`编程`,`实现、调试和代码修改`],review:[`审查`,`检查、批评和验证`],vision:[`视觉任务`,`图片和视觉内容分析`],understanding:[`内容理解`,`长内容阅读和理解`]}};function se(e,t){return{primary:t,fallbacks:e?.fallbacks??[]}}function V(e){let t=(0,re.c)(35),{primary:n,value:r,models:i,loading:a,error:o,zh:c,onChange:l}=e,u;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>e.id!==n&&!r.includes(e.id),t[4]=n,t[5]=r,t[6]=e):e=t[6],u=i.filter(e),t[0]=i,t[1]=n,t[2]=r,t[3]=u}else u=t[3];let d=u,f=c?`回退顺序`:`Fallback order`,p;t[7]===f?p=t[8]:(p=(0,F.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:f}),t[7]=f,t[8]=p);let m=c?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,h;t[9]===m?h=t[10]:(h=(0,F.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:m}),t[9]=m,t[10]=h);let g;t[11]!==p||t[12]!==h?(g=(0,F.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,F.jsxs)(`div`,{children:[p,h]})}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let v;t[14]!==i||t[15]!==l||t[16]!==r||t[17]!==c?(v=r.length>0?(0,F.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full border border-edge bg-surface-panel py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,F.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,F.jsx)(`span`,{children:i.find(t=>t.id===e)?.name??e}),(0,F.jsx)(`button`,{type:`button`,"aria-label":c?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>l(r.filter(t=>t!==e)),children:(0,F.jsx)(s,{className:`size-3`})})]},e))}):(0,F.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:c?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=l,t[16]=r,t[17]=c,t[18]=v):v=t[18];let y=c?`添加回退模型`:`Add fallback model`,b=c?`搜索模型或服务商`:`Search models or providers`,x=c?`没有可添加的模型`:`No models available to add`,S=c?`添加回退模型`:`Add fallback model`,C;t[19]!==l||t[20]!==r?(C=e=>{e&&l([...r,e])},t[19]=l,t[20]=r,t[21]=C):C=t[21];let w;t[22]!==d||t[23]!==o||t[24]!==a||t[25]!==x||t[26]!==S||t[27]!==C||t[28]!==y||t[29]!==b?(w=(0,F.jsx)(_,{value:``,models:d,modelsLoading:a,modelsError:o,placeholder:y,searchPlaceholder:b,noMatches:x,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:S,onChange:C}),t[22]=d,t[23]=o,t[24]=a,t[25]=x,t[26]=S,t[27]=C,t[28]=y,t[29]=b,t[30]=w):w=t[30];let T;return t[31]!==w||t[32]!==g||t[33]!==v?(T=(0,F.jsxs)(`div`,{children:[g,v,w]}),t[31]=w,t[32]=g,t[33]=v,t[34]=T):T=t[34],T}function ce(e){let t=(0,re.c)(121),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let o=d(g,h,a),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[1]=s):s=t[1];let c=d(`agent-defaults-image-models`,N,s),l;t[2]===o.data?l=t[3]:(l=o.data??[],t[2]=o.data,t[3]=l);let u=l,p;t[4]===c.data?p=t[5]:(p=c.data??[],t[4]=c.data,t[5]=p);let m;t[6]===p?m=t[7]:(m=p.flatMap(H),t[6]=p,t[7]=m);let v=m,y=i?B.zh:B.en,b;t[8]!==n||t[9]!==r?(b=(e,t)=>{let i={...n.models.intents};t?i[e]=se(i[e],t):delete i[e],r({...n,models:{...n.models,intents:i}})},t[8]=n,t[9]=r,t[10]=b):b=t[10];let x=b,S=i?`默认对话模型`:`Default conversation model`,C;t[11]===S?C=t[12]:(C=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:S}),t[11]=S,t[12]=C);let w=i?`大多数对话和没有专用路由的任务都会使用它。`:`Used for most conversations and every task without a dedicated route.`,T;t[13]===w?T=t[14]:(T=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:w}),t[13]=w,t[14]=T);let E;t[15]!==T||t[16]!==C?(E=(0,F.jsxs)(`div`,{children:[C,T]}),t[15]=T,t[16]=C,t[17]=E):E=t[17];let ee=i?`主模型`:`Primary model`,te;t[18]===ee?te=t[19]:(te=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:ee}),t[18]=ee,t[19]=te);let D=i?`选择模型`:`Select a model`,O=i?`搜索模型或服务商`:`Search models or providers`,k=i?`没有匹配的模型`:`No matching models`,ne=i?`默认对话模型`:`Default conversation model`,A;t[20]!==n||t[21]!==r?(A=e=>r({...n,models:{...n.models,chat:{...n.models.chat,primary:e}}}),t[20]=n,t[21]=r,t[22]=A):A=t[22];let j;t[23]!==n.models.chat.primary||t[24]!==D||t[25]!==O||t[26]!==k||t[27]!==ne||t[28]!==A?(j=(0,F.jsx)(_,{value:n.models.chat.primary,placeholder:D,searchPlaceholder:O,noMatches:k,showProviderSettingsFooter:!0,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:ne,onChange:A}),t[23]=n.models.chat.primary,t[24]=D,t[25]=O,t[26]=k,t[27]=ne,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==te||t[31]!==j?(M=(0,F.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[te,j]}),t[30]=te,t[31]=j,t[32]=M):M=t[32];let P;t[33]!==n||t[34]!==r?(P=e=>r({...n,models:{...n.models,chat:{...n.models.chat,fallbacks:e}}}),t[33]=n,t[34]=r,t[35]=P):P=t[35];let I;t[36]!==n.models.chat.fallbacks||t[37]!==n.models.chat.primary||t[38]!==u||t[39]!==o.error||t[40]!==o.isLoading||t[41]!==P||t[42]!==i?(I=(0,F.jsx)(`div`,{className:`mt-6 border-t border-edge pt-5`,children:(0,F.jsx)(V,{primary:n.models.chat.primary,value:n.models.chat.fallbacks,models:u,loading:o.isLoading,error:o.error,zh:i,onChange:P})}),t[36]=n.models.chat.fallbacks,t[37]=n.models.chat.primary,t[38]=u,t[39]=o.error,t[40]=o.isLoading,t[41]=P,t[42]=i,t[43]=I):I=t[43];let L;t[44]!==E||t[45]!==M||t[46]!==I?(L=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[E,M,I]}),t[44]=E,t[45]=M,t[46]=I,t[47]=L):L=t[47];let R=i?`图片能力`:`Image capabilities`,z;t[48]===R?z=t[49]:(z=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:R}),t[48]=R,t[49]=z);let ce=i?`没有图片任务时可以保持关闭。`:`Leave these off when the agents do not work with images.`,U;t[50]===ce?U=t[51]:(U=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ce}),t[50]=ce,t[51]=U);let W=i?`图片理解模型`:`Image understanding model`,G;t[52]===W?G=t[53]:(G=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:W}),t[52]=W,t[53]=G);let K=n.models.imageUnderstanding?.primary??``,q=i?`关闭图片理解`:`Image understanding off`,J=i?`搜索视觉模型`:`Search vision models`,le=i?`没有可用的视觉模型`:`No vision models available`,ue=i?`关闭图片理解`:`Image understanding off`,de=i?`图片理解模型`:`Image understanding model`,Y;t[54]!==n||t[55]!==r?(Y=e=>{let t={...n.models};e?t.imageUnderstanding=se(t.imageUnderstanding,e):delete t.imageUnderstanding,r({...n,models:t})},t[54]=n,t[55]=r,t[56]=Y):Y=t[56];let X;t[57]!==K||t[58]!==q||t[59]!==J||t[60]!==le||t[61]!==ue||t[62]!==de||t[63]!==Y?(X=(0,F.jsx)(_,{value:K,placeholder:q,searchPlaceholder:J,noMatches:le,capabilitiesFilter:`vision`,allowEmpty:!0,emptyLabel:ue,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:de,onChange:Y}),t[57]=K,t[58]=q,t[59]=J,t[60]=le,t[61]=ue,t[62]=de,t[63]=Y,t[64]=X):X=t[64];let fe;t[65]!==G||t[66]!==X?(fe=(0,F.jsxs)(`div`,{children:[G,X]}),t[65]=G,t[66]=X,t[67]=fe):fe=t[67];let pe=i?`图片生成模型`:`Image generation model`,me;t[68]===pe?me=t[69]:(me=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:pe}),t[68]=pe,t[69]=me);let he=n.models.imageGeneration?.primary??``,ge=i?`关闭图片生成`:`Image generation off`,_e=i?`搜索图片模型或服务商`:`Search image models or providers`,ve=i?`没有可用的图片生成模型`:`No image generation models available`,ye=i?`关闭图片生成`:`Image generation off`,be=i?`图片生成模型`:`Image generation model`,Z;t[70]!==n||t[71]!==r?(Z=e=>{let t={...n.models};e?t.imageGeneration={primary:e,fallbacks:t.imageGeneration?.fallbacks??[],timeoutMs:t.imageGeneration?.timeoutMs,autoProviderFallback:t.imageGeneration?.autoProviderFallback??!0}:delete t.imageGeneration,r({...n,models:t})},t[70]=n,t[71]=r,t[72]=Z):Z=t[72];let xe;t[73]!==v||t[74]!==c.error||t[75]!==c.isLoading||t[76]!==he||t[77]!==ge||t[78]!==_e||t[79]!==ve||t[80]!==ye||t[81]!==be||t[82]!==Z?(xe=(0,F.jsx)(_,{value:he,models:v,modelsLoading:c.isLoading,modelsError:c.error,placeholder:ge,searchPlaceholder:_e,noMatches:ve,allowEmpty:!0,emptyLabel:ye,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:be,onChange:Z}),t[73]=v,t[74]=c.error,t[75]=c.isLoading,t[76]=he,t[77]=ge,t[78]=_e,t[79]=ve,t[80]=ye,t[81]=be,t[82]=Z,t[83]=xe):xe=t[83];let Q;t[84]!==me||t[85]!==xe?(Q=(0,F.jsxs)(`div`,{children:[me,xe]}),t[84]=me,t[85]=xe,t[86]=Q):Q=t[86];let $;t[87]!==fe||t[88]!==Q?($=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-2`,children:[fe,Q]}),t[87]=fe,t[88]=Q,t[89]=$):$=t[89];let Se;t[90]!==n||t[91]!==r||t[92]!==i?(Se=n.models.imageGeneration?(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 border-t border-edge pt-5 sm:grid-cols-2`,children:[(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[i?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,F.jsx)(`input`,{type:`number`,min:1,className:`${oe} mt-2`,value:n.models.imageGeneration.timeoutMs??``,onChange:e=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,timeoutMs:e.target.value?Number(e.target.value):void 0}}})})]}),(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,F.jsx)(`span`,{children:i?`服务商自动回退`:`Automatic provider fallback`}),(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[!0,!1].map(e=>(0,F.jsx)(f,{variant:n.models.imageGeneration?.autoProviderFallback===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,autoProviderFallback:e}}}),children:e?i?`开启`:`On`:i?`关闭`:`Off`},String(e)))})]})]}):null,t[90]=n,t[91]=r,t[92]=i,t[93]=Se):Se=t[93];let Ce;t[94]!==z||t[95]!==U||t[96]!==$||t[97]!==Se?(Ce=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[z,U,$,Se]}),t[94]=z,t[95]=U,t[96]=$,t[97]=Se,t[98]=Ce):Ce=t[98];let we;t[99]===i?we=t[100]:(we=(0,F.jsx)(ie,{zh:i}),t[99]=i,t[100]=we);let Te=i?`按任务选择模型`:`Route by task`,Ee;t[101]===Te?Ee=t[102]:(Ee=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:Te}),t[101]=Te,t[102]=Ee);let De=i?`仅在确实需要不同模型时设置;否则保持“使用默认对话模型”。`:`Set a route only when a task genuinely needs another model; otherwise keep the default.`,Oe;t[103]===De?Oe=t[104]:(Oe=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:De}),t[103]=De,t[104]=Oe);let ke;t[105]!==y||t[106]!==n.models.intents||t[107]!==x||t[108]!==i?(ke=ae.map(e=>(0,F.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,F.jsxs)(`div`,{className:`mb-3`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:y[e][0]}),(0,F.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:y[e][1]})]}),(0,F.jsx)(_,{value:n.models.intents[e]?.primary??``,placeholder:i?`使用默认对话模型`:`Use default conversation model`,searchPlaceholder:i?`搜索模型或服务商`:`Search models or providers`,noMatches:i?`没有匹配的模型`:`No matching models`,allowEmpty:!0,emptyLabel:i?`使用默认对话模型`:`Use default conversation model`,showProviderInTrigger:!1,contentAlign:`start`,className:`w-full`,ariaLabel:i?`${y[e][0]}模型`:`${y[e][0]} model`,onChange:t=>x(e,t)})]},e)),t[105]=y,t[106]=n.models.intents,t[107]=x,t[108]=i,t[109]=ke):ke=t[109];let Ae;t[110]===ke?Ae=t[111]:(Ae=(0,F.jsx)(`div`,{className:`mt-5 grid gap-3 lg:grid-cols-2`,children:ke}),t[110]=ke,t[111]=Ae);let je;t[112]!==Ee||t[113]!==Oe||t[114]!==Ae?(je=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[Ee,Oe,Ae]}),t[112]=Ee,t[113]=Oe,t[114]=Ae,t[115]=je):je=t[115];let Me;return t[116]!==L||t[117]!==Ce||t[118]!==we||t[119]!==je?(Me=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[L,Ce,we,je]}),t[116]=L,t[117]=Ce,t[118]=we,t[119]=je,t[120]=Me):Me=t[120],Me}function H(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var U=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function W(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function G(e){let t=(0,re.c)(151),{draft:n,setDraft:r,zh:i}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[0]=o):o=t[0];let s=d(`agent-defaults-workflows`,ne,o),c;t[1]===s.data?c=t[2]:(c=s.data??[],t[1]=s.data,t[2]=c);let l;t[3]===c?l=t[4]:(l=c.map(K),t[3]=c,t[4]=l);let p=l,m=n.workflows.allowed===void 0,h;t[5]!==n||t[6]!==r?(h=(e,t)=>{let i=n.workflows.allowed??[],a=t?[...new Set([...i,e])]:i.filter(t=>t!==e);r({...n,workflows:{...n.workflows,allowed:a}})},t[5]=n,t[6]=r,t[7]=h):h=t[7];let g=h,_=i?`执行限制`:`Execution limits`,v;t[8]===_?v=t[9]:(v=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_}),t[8]=_,t[9]=v);let y=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,b;t[10]===y?b=t[11]:(b=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x=i?`每次运行最多轮数`:`Maximum turns per run`,S=n.runtime.maxTurns??``,C=i?`系统默认`:`System default`,w;t[12]!==n||t[13]!==r?(w=e=>r({...n,runtime:{...n.runtime,maxTurns:W(e.target.value)}}),t[12]=n,t[13]=r,t[14]=w):w=t[14];let T;t[15]!==S||t[16]!==C||t[17]!==w?(T=(0,F.jsx)(`input`,{type:`number`,min:1,value:S,placeholder:C,onChange:w,className:`${U} mt-2`}),t[15]=S,t[16]=C,t[17]=w,t[18]=T):T=t[18];let E;t[19]!==T||t[20]!==x?(E=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[x,T]}),t[19]=T,t[20]=x,t[21]=E):E=t[21];let ee=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,te=n.runtime.timeoutMs??``,D=i?`系统默认`:`System default`,O;t[22]!==n||t[23]!==r?(O=e=>r({...n,runtime:{...n.runtime,timeoutMs:W(e.target.value)}}),t[22]=n,t[23]=r,t[24]=O):O=t[24];let k;t[25]!==te||t[26]!==D||t[27]!==O?(k=(0,F.jsx)(`input`,{type:`number`,min:1,value:te,placeholder:D,onChange:O,className:`${U} mt-2`}),t[25]=te,t[26]=D,t[27]=O,t[28]=k):k=t[28];let A;t[29]!==ee||t[30]!==k?(A=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[ee,k]}),t[29]=ee,t[30]=k,t[31]=A):A=t[31];let j=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,M=n.runtime.maxToolFailuresPerTurn??``,N=i?`系统默认`:`System default`,P;t[32]!==n||t[33]!==r?(P=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:W(e.target.value)}}),t[32]=n,t[33]=r,t[34]=P):P=t[34];let I;t[35]!==M||t[36]!==N||t[37]!==P?(I=(0,F.jsx)(`input`,{type:`number`,min:1,value:M,placeholder:N,onChange:P,className:`${U} mt-2`}),t[35]=M,t[36]=N,t[37]=P,t[38]=I):I=t[38];let L;t[39]!==j||t[40]!==I?(L=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[j,I]}),t[39]=j,t[40]=I,t[41]=L):L=t[41];let R;t[42]!==E||t[43]!==A||t[44]!==L?(R=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[E,A,L]}),t[42]=E,t[43]=A,t[44]=L,t[45]=R):R=t[45];let z;t[46]!==R||t[47]!==v||t[48]!==b?(z=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[v,b,R]}),t[46]=R,t[47]=v,t[48]=b,t[49]=z):z=t[49];let ie=i?`提示词缓存`:`Prompt cache`,ae;t[50]===ie?ae=t[51]:(ae=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ie}),t[50]=ie,t[51]=ae);let oe=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,B;t[52]===oe?B=t[53]:(B=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:oe}),t[52]=oe,t[53]=B);let se=i?`缓存模式`:`Cache mode`,V;t[54]===se?V=t[55]:(V=(0,F.jsx)(`span`,{children:se}),t[54]=se,t[55]=V);let ce;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ce=[`auto`,`off`],t[56]=ce):ce=t[56];let H;t[57]!==n||t[58]!==r||t[59]!==i?(H=(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:ce.map(e=>(0,F.jsx)(f,{variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e))}),t[57]=n,t[58]=r,t[59]=i,t[60]=H):H=t[60];let G;t[61]!==V||t[62]!==H?(G=(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[V,H]}),t[61]=V,t[62]=H,t[63]=G):G=t[63];let q;t[64]!==n||t[65]!==r||t[66]!==i?(q=n.runtime.promptCache?.mode===`auto`?(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,F.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[`short`,`long`].map(e=>(0,F.jsx)(f,{variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[64]=n,t[65]=r,t[66]=i,t[67]=q):q=t[67];let J;t[68]!==G||t[69]!==q?(J=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[G,q]}),t[68]=G,t[69]=q,t[70]=J):J=t[70];let le;t[71]!==ae||t[72]!==B||t[73]!==J?(le=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[ae,B,J]}),t[71]=ae,t[72]=B,t[73]=J,t[74]=le):le=t[74];let ue=i?`工作流`:`Workflows`,de;t[75]===ue?de=t[76]:(de=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ue}),t[75]=ue,t[76]=de);let Y=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,X;t[77]===Y?X=t[78]:(X=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:Y}),t[77]=Y,t[78]=X);let fe=i?`默认工作流`:`Default workflow`,pe;t[79]===fe?pe=t[80]:(pe=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:fe}),t[79]=fe,t[80]=pe);let me=n.workflows.default??``,he=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,ge=i?`不设置默认工作流`:`No default workflow`,_e=i?`默认工作流`:`Default workflow`,ve;t[81]!==n||t[82]!==r?(ve=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[81]=n,t[82]=r,t[83]=ve):ve=t[83];let ye;t[84]!==me||t[85]!==he||t[86]!==ge||t[87]!==_e||t[88]!==ve||t[89]!==p||t[90]!==s.isLoading?(ye=(0,F.jsx)(a,{value:me,options:p,placeholder:he,emptyLabel:ge,disabled:s.isLoading,ariaLabel:_e,onChange:ve,triggerClassName:`mt-2`}),t[84]=me,t[85]=he,t[86]=ge,t[87]=_e,t[88]=ve,t[89]=p,t[90]=s.isLoading,t[91]=ye):ye=t[91];let be;t[92]!==pe||t[93]!==ye?(be=(0,F.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[pe,ye]}),t[92]=pe,t[93]=ye,t[94]=be):be=t[94];let Z;t[95]===s.error?Z=t[96]:(Z=s.error?(0,F.jsx)(`p`,{className:`mt-3 text-sm text-red-600`,children:s.error instanceof Error?s.error.message:String(s.error)}):null,t[95]=s.error,t[96]=Z);let xe=i?`允许调用的工作流`:`Allowed workflows`,Q;t[97]===xe?Q=t[98]:(Q=(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:xe}),t[97]=xe,t[98]=Q);let $;t[99]!==n||t[100]!==r?($=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[99]=n,t[100]=r,t[101]=$):$=t[101];let Se=m?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,Ce;t[102]===Se?Ce=t[103]:(Ce=u(`rounded-xl border p-4 text-left`,Se),t[102]=Se,t[103]=Ce);let we=i?`允许全部工作流`:`Allow every workflow`,Te;t[104]===we?Te=t[105]:(Te=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:we}),t[104]=we,t[105]=Te);let Ee=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,De;t[106]===Ee?De=t[107]:(De=(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Ee}),t[106]=Ee,t[107]=De);let Oe;t[108]!==$||t[109]!==Ce||t[110]!==Te||t[111]!==De?(Oe=(0,F.jsxs)(`button`,{type:`button`,onClick:$,className:Ce,children:[Te,De]}),t[108]=$,t[109]=Ce,t[110]=Te,t[111]=De,t[112]=Oe):Oe=t[112];let ke;t[113]!==n||t[114]!==r?(ke=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[113]=n,t[114]=r,t[115]=ke):ke=t[115];let Ae=m?`border-edge bg-surface-panel hover:border-edge-strong`:`border-accent bg-accent/5 ring-1 ring-accent/20`,je;t[116]===Ae?je=t[117]:(je=u(`rounded-xl border p-4 text-left`,Ae),t[116]=Ae,t[117]=je);let Me=i?`只允许选中的工作流`:`Allow selected workflows only`,Ne;t[118]===Me?Ne=t[119]:(Ne=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Me}),t[118]=Me,t[119]=Ne);let Pe=i?`未选中的工作流不能被调用。`:`Unselected workflows cannot be invoked.`,Fe;t[120]===Pe?Fe=t[121]:(Fe=(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Pe}),t[120]=Pe,t[121]=Fe);let Ie;t[122]!==ke||t[123]!==je||t[124]!==Ne||t[125]!==Fe?(Ie=(0,F.jsxs)(`button`,{type:`button`,onClick:ke,className:je,children:[Ne,Fe]}),t[122]=ke,t[123]=je,t[124]=Ne,t[125]=Fe,t[126]=Ie):Ie=t[126];let Le;t[127]!==Oe||t[128]!==Ie?(Le=(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[Oe,Ie]}),t[127]=Oe,t[128]=Ie,t[129]=Le):Le=t[129];let Re;t[130]!==m||t[131]!==n.workflows.allowed||t[132]!==g||t[133]!==s.data||t[134]!==s.isLoading||t[135]!==i?(Re=m?null:(0,F.jsxs)(`div`,{className:`mt-3 divide-y divide-edge rounded-xl border border-edge bg-surface-panel`,children:[(s.data??[]).map(e=>(0,F.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>g(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,F.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[130]=m,t[131]=n.workflows.allowed,t[132]=g,t[133]=s.data,t[134]=s.isLoading,t[135]=i,t[136]=Re):Re=t[136];let ze;t[137]!==Q||t[138]!==Le||t[139]!==Re?(ze=(0,F.jsxs)(`div`,{className:`mt-6 border-t border-edge pt-5`,children:[Q,Le,Re]}),t[137]=Q,t[138]=Le,t[139]=Re,t[140]=ze):ze=t[140];let Be;t[141]!==de||t[142]!==X||t[143]!==be||t[144]!==Z||t[145]!==ze?(Be=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[de,X,be,Z,ze]}),t[141]=de,t[142]=X,t[143]=be,t[144]=Z,t[145]=ze,t[146]=Be):Be=t[146];let Ve;return t[147]!==z||t[148]!==le||t[149]!==Be?(Ve=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[z,le,Be]}),t[147]=z,t[148]=le,t[149]=Be,t[150]=Ve):Ve=t[150],Ve}function K(e){return{value:e.id,label:e.title||e.name}}function q(e){return[...new Set(e)].sort()}function J(e){let t=(0,re.c)(99),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let{data:s,error:c,isLoading:l}=d(`agent-defaults-skills-catalog`,T,a),[f,p]=(0,P.useState)(``),m=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;s?.catalog;let h;if(t[1]!==m||t[2]!==s?.catalog||t[3]!==f){let e=[...s?.catalog??[]],n=new Set(e.map(de));for(let t of m)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=f.trim().toLowerCase();h=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(ue),t[1]=m,t[2]=s?.catalog,t[3]=f,t[4]=h}else h=t[4];let g=h,_;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(_=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=_):_=t[8];let v=_,y;t[9]!==n||t[10]!==r?(y=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):q([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):q([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=y):y=t[11];let b=y,x;t[12]===s?.catalog?x=t[13]:(x=s?.catalog??[],t[12]=s?.catalog,t[13]=x);let S;if(t[14]!==v||t[15]!==x){let e;t[17]===v?e=t[18]:(e=e=>e.enabled&&v(e.name),t[17]=v,t[18]=e),S=x.filter(e),t[14]=v,t[15]=x,t[16]=S}else S=t[16];let C=S.length,w=i?`技能策略`:`Skill policy`,E;t[19]===w?E=t[20]:(E=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:w}),t[19]=w,t[20]=E);let ee=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,D;t[21]===ee?D=t[22]:(D=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ee}),t[21]=ee,t[22]=D);let k;t[23]!==n||t[24]!==r?(k=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[23]=n,t[24]=r,t[25]=k):k=t[25];let ne=n.skills.mode===`all-enabled`?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,A;t[26]===ne?A=t[27]:(A=u(`flex items-start gap-3 rounded-xl border p-4 text-left`,ne),t[26]=ne,t[27]=A);let j;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,F.jsx)(o,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[28]=j):j=t[28];let M=i?`使用所有已启用技能`:`Use every enabled skill`,N;t[29]===M?N=t[30]:(N=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:M}),t[29]=M,t[30]=N);let I=i?`推荐。以后启用的新技能也会自动可用,可单独排除。`:`Recommended. Newly enabled skills become available automatically; exclude exceptions below.`,L;t[31]===I?L=t[32]:(L=(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:I}),t[31]=I,t[32]=L);let R;t[33]!==N||t[34]!==L?(R=(0,F.jsxs)(`span`,{children:[N,L]}),t[33]=N,t[34]=L,t[35]=R):R=t[35];let z;t[36]!==k||t[37]!==A||t[38]!==R?(z=(0,F.jsxs)(`button`,{type:`button`,onClick:k,className:A,children:[j,R]}),t[36]=k,t[37]=A,t[38]=R,t[39]=z):z=t[39];let ie;t[40]!==n||t[41]!==r?(ie=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[40]=n,t[41]=r,t[42]=ie):ie=t[42];let ae=n.skills.mode===`selected`?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,oe;t[43]===ae?oe=t[44]:(oe=u(`flex items-start gap-3 rounded-xl border p-4 text-left`,ae),t[43]=ae,t[44]=oe);let B;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,F.jsx)(O,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[45]=B):B=t[45];let se=i?`只使用选中的技能`:`Use selected skills only`,V;t[46]===se?V=t[47]:(V=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:se}),t[46]=se,t[47]=V);let ce=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,H;t[48]===ce?H=t[49]:(H=(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:ce}),t[48]=ce,t[49]=H);let U;t[50]!==V||t[51]!==H?(U=(0,F.jsxs)(`span`,{children:[V,H]}),t[50]=V,t[51]=H,t[52]=U):U=t[52];let W;t[53]!==ie||t[54]!==oe||t[55]!==U?(W=(0,F.jsxs)(`button`,{type:`button`,onClick:ie,className:oe,children:[B,U]}),t[53]=ie,t[54]=oe,t[55]=U,t[56]=W):W=t[56];let G;t[57]!==z||t[58]!==W?(G=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[z,W]}),t[57]=z,t[58]=W,t[59]=G):G=t[59];let K;t[60]!==D||t[61]!==G||t[62]!==E?(K=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[E,D,G]}),t[60]=D,t[61]=G,t[62]=E,t[63]=K):K=t[63];let J=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,Y;t[64]===J?Y=t[65]:(Y=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:J}),t[64]=J,t[65]=Y);let X=i?`当前默认可用 ${C} 个技能。`:`${C} skills are available by default.`,fe;t[66]===X?fe=t[67]:(fe=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:X}),t[66]=X,t[67]=fe);let pe;t[68]!==Y||t[69]!==fe?(pe=(0,F.jsxs)(`div`,{children:[Y,fe]}),t[68]=Y,t[69]=fe,t[70]=pe):pe=t[70];let me=i?`搜索技能`:`Search skills`,he;t[71]===me?he=t[72]:(he=(0,F.jsx)(`span`,{className:`sr-only`,children:me}),t[71]=me,t[72]=he);let ge;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,F.jsx)(te,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[73]=ge):ge=t[73];let _e;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>p(e.target.value),t[74]=_e):_e=t[74];let ve=i?`搜索技能`:`Search skills`,ye;t[75]!==f||t[76]!==ve?(ye=(0,F.jsx)(`input`,{type:`search`,value:f,onChange:_e,placeholder:ve,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[75]=f,t[76]=ve,t[77]=ye):ye=t[77];let be;t[78]!==he||t[79]!==ye?(be=(0,F.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[he,ge,ye]}),t[78]=he,t[79]=ye,t[80]=be):be=t[80];let Z;t[81]!==pe||t[82]!==be?(Z=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[pe,be]}),t[81]=pe,t[82]=be,t[83]=Z):Z=t[83];let xe;t[84]===c?xe=t[85]:(xe=c?(0,F.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:c instanceof Error?c.message:String(c)}):null,t[84]=c,t[85]=xe);let Q;t[86]!==v||t[87]!==l||t[88]!==g||t[89]!==b||t[90]!==i?(Q=l?(0,F.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(le)}):(0,F.jsxs)(`div`,{className:`mt-4 max-h-[32rem] divide-y divide-edge overflow-y-auto rounded-xl border border-edge bg-surface-panel`,children:[g.map(e=>{let t=v(e.name);return(0,F.jsxs)(`label`,{className:u(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>b(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,F.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,F.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),g.length===0?(0,F.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[86]=v,t[87]=l,t[88]=g,t[89]=b,t[90]=i,t[91]=Q):Q=t[91];let $;t[92]!==Z||t[93]!==xe||t[94]!==Q?($=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[Z,xe,Q]}),t[92]=Z,t[93]=xe,t[94]=Q,t[95]=$):$=t[95];let Se;return t[96]!==K||t[97]!==$?(Se=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[K,$]}),t[96]=K,t[97]=$,t[98]=Se):Se=t[98],Se}function le(e){return(0,F.jsx)(m,{className:`h-14 rounded-xl`},e)}function ue(e,t){return e.name.localeCompare(t.name)}function de(e){return e.name}function Y(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function X(e){let t=(0,re.c)(92),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,[o,s]=(0,P.useState)(``),[c,l]=(0,P.useState)(`all`),[d,p]=(0,P.useState)(),m;t[0]===i?m=t[1]:(m=new Map(i.map(pe)),t[0]=i,t[1]=m);let h=m,g;t[2]!==i||t[3]!==n.tools?(g=[...new Set([...i.map(fe),...Object.keys(n.tools)])].sort(),t[2]=i,t[3]=n.tools,t[4]=g):g=t[4];let _=g,v;if(t[5]!==_||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),v=_.filter(e),t[5]=_,t[6]=n.tools,t[7]=v}else v=t[7];let y=v.length,b;if(t[10]!==_||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),b=_.filter(e),t[10]=_,t[11]=n.tools,t[12]=b}else b=t[12];let x=b.length,S;if(t[15]!==_||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),S=_.filter(e),t[15]=_,t[16]=n.tools,t[17]=S}else S=t[17];let C;t[20]!==v.length||t[21]!==b.length||t[22]!==S.length?(C={allow:y,ask:x,deny:S.length},t[20]=v.length,t[21]=b.length,t[22]=S.length,t[23]=C):C=t[23];let T=C,E;if(t[24]!==_||t[25]!==h||t[26]!==n.tools||t[27]!==c||t[28]!==o){let e=o.trim().toLowerCase();E=_.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=h.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(c===`all`||r===c)}),t[24]=_,t[25]=h,t[26]=n.tools,t[27]=c,t[28]=o,t[29]=E}else E=t[29];let ee=E,D;t[30]!==n||t[31]!==r?(D=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=D):D=t[32];let O=D,k=a?`全部 ${_.length}`:`All ${_.length}`,ne;t[33]===k?ne=t[34]:(ne={id:`all`,label:k},t[33]=k,t[34]=ne);let A=a?`允许 ${T.allow}`:`Allow ${T.allow}`,j;t[35]===A?j=t[36]:(j={id:`allow`,label:A},t[35]=A,t[36]=j);let M=a?`询问 ${T.ask}`:`Ask ${T.ask}`,N;t[37]===M?N=t[38]:(N={id:`ask`,label:M},t[37]=M,t[38]=N);let I=a?`禁用 ${T.deny}`:`Deny ${T.deny}`,L;t[39]===I?L=t[40]:(L={id:`deny`,label:I},t[39]=I,t[40]=L);let R;t[41]!==ne||t[42]!==j||t[43]!==N||t[44]!==L?(R=[ne,j,N,L],t[41]=ne,t[42]=j,t[43]=N,t[44]=L,t[45]=R):R=t[45];let z=R,ie=a?`默认工具权限`:`Default tool permissions`,ae;t[46]===ie?ae=t[47]:(ae=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:ie}),t[46]=ie,t[47]=ae);let oe=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,B;t[48]===oe?B=t[49]:(B=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:oe}),t[48]=oe,t[49]=B);let se;t[50]!==ae||t[51]!==B?(se=(0,F.jsxs)(`div`,{children:[ae,B]}),t[50]=ae,t[51]=B,t[52]=se):se=t[52];let V;t[53]!==c||t[54]!==z?(V=(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,children:z.map(e=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>l(e.id),className:u(`rounded-lg px-3 py-1.5 text-xs font-medium`,c===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id))}),t[53]=c,t[54]=z,t[55]=V):V=t[55];let ce=a?`搜索工具`:`Search tools`,H;t[56]===ce?H=t[57]:(H=(0,F.jsx)(`span`,{className:`sr-only`,children:ce}),t[56]=ce,t[57]=H);let U;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,F.jsx)(te,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[58]=U):U=t[58];let W;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>s(e.target.value),t[59]=W):W=t[59];let G=a?`搜索工具`:`Search tools`,K;t[60]!==o||t[61]!==G?(K=(0,F.jsx)(`input`,{type:`search`,value:o,onChange:W,placeholder:G,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[60]=o,t[61]=G,t[62]=K):K=t[62];let q;t[63]!==H||t[64]!==K?(q=(0,F.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[H,U,K]}),t[63]=H,t[64]=K,t[65]=q):q=t[65];let J;t[66]!==V||t[67]!==q?(J=(0,F.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[V,q]}),t[66]=V,t[67]=q,t[68]=J):J=t[68];let le;if(t[69]!==h||t[70]!==n.tools||t[71]!==d||t[72]!==O||t[73]!==ee||t[74]!==a){let e;t[76]!==h||t[77]!==n.tools||t[78]!==d||t[79]!==O||t[80]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=h.get(e),i=d===e;return(0,F.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,F.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,children:[`allow`,`ask`,`deny`].map(n=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>O(e,{mode:n}),className:u(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-white`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),(0,F.jsx)(f,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>p(i?void 0:e),children:(0,F.jsx)(w,{className:`size-4`})})]})]}),i?(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,F.jsx)(`input`,{type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>O(e,{maxCallsPerTurn:Y(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,F.jsx)(`input`,{type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>O(e,{timeoutMs:Y(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)},t[76]=h,t[77]=n.tools,t[78]=d,t[79]=O,t[80]=a,t[81]=e):e=t[81],le=ee.map(e),t[69]=h,t[70]=n.tools,t[71]=d,t[72]=O,t[73]=ee,t[74]=a,t[75]=le}else le=t[75];let ue;t[82]!==ee.length||t[83]!==a?(ue=ee.length===0?(0,F.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[82]=ee.length,t[83]=a,t[84]=ue):ue=t[84];let de;t[85]!==le||t[86]!==ue?(de=(0,F.jsxs)(`div`,{className:`mt-4 max-h-[38rem] divide-y divide-edge overflow-y-auto rounded-xl border border-edge bg-surface-panel`,children:[le,ue]}),t[85]=le,t[86]=ue,t[87]=de):de=t[87];let X;return t[88]!==se||t[89]!==J||t[90]!==de?(X=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[se,J,de]}),t[88]=se,t[89]=J,t[90]=de,t[91]=X):X=t[91],X}function fe(e){return e.id}function pe(e){return[e.id,e.description]}function me(){let e=(0,re.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsxs)(j,{gap:`gap-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(m,{className:`h-7 w-56`}),(0,F.jsx)(m,{className:`h-4 w-96 max-w-full`})]}),(0,F.jsx)(m,{className:`h-9 w-28`})]}),(0,F.jsx)(m,{className:`h-20 rounded-2xl`}),(0,F.jsx)(m,{className:`h-12 rounded-xl`}),(0,F.jsx)(m,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function he({initial:e,builtinTools:t,zh:n}){let[r,i]=(0,P.useState)(`models`),[a,o]=(0,P.useState)(()=>structuredClone(e)),[s,c]=(0,P.useState)(()=>structuredClone(e)),[l,d]=(0,P.useState)(!1),[p,m]=(0,P.useState)(null),h=JSON.stringify(a)!==JSON.stringify(s),g=[{id:`models`,label:n?`模型`:`Models`,icon:D},{id:`skills`,label:n?`技能`:`Skills`,icon:v},{id:`tools`,label:n?`工具`:`Tools`,icon:E},{id:`runtime`,label:n?`运行`:`Runtime`,icon:y}],_=async()=>{let e=structuredClone(a);d(!0),m(null);try{let t=await S(e),n=structuredClone(t.defaults);o(t=>JSON.stringify(t)===JSON.stringify(e)?n:t),c(structuredClone(n))}catch(e){m(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,F.jsxs)(j,{gap:`gap-5`,children:[(0,F.jsx)(A,{title:n?`智能体设置`:`Agent settings`,actions:(0,F.jsxs)(F.Fragment,{children:[h?(0,F.jsx)(`span`,{className:`hidden text-xs text-amber-700 sm:inline dark:text-amber-300`,children:n?`有未保存的更改`:`Unsaved changes`}):null,h?(0,F.jsxs)(f,{onClick:()=>o(structuredClone(s)),children:[(0,F.jsx)(k,{className:`size-4`}),n?`撤销`:`Reset`]}):null,(0,F.jsx)(f,{variant:`primary`,disabled:l||!h,onClick:()=>void _(),children:l?n?`保存中…`:`Saving…`:n?`保存`:`Save`})]})}),p?(0,F.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:p}):null,(0,F.jsx)(`nav`,{className:`grid grid-cols-2 gap-2 rounded-2xl border border-edge bg-surface-base p-2 lg:grid-cols-4`,"aria-label":n?`默认配置分区`:`Default configuration sections`,children:g.map(({id:e,label:t,icon:n})=>(0,F.jsxs)(`button`,{type:`button`,"aria-pressed":r===e,onClick:()=>i(e),className:u(`flex min-w-0 items-center justify-center gap-2 rounded-xl px-3 py-2.5 text-left transition-colors`,r===e?`bg-surface-panel text-fg shadow-surface ring-1 ring-edge`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,F.jsx)(n,{className:u(`size-4 shrink-0`,r===e?`text-accent`:`text-fg-subtle`)}),(0,F.jsx)(`span`,{className:`text-sm font-medium`,children:t})]},e))}),r===`models`?(0,F.jsx)(ce,{draft:a,setDraft:o,zh:n}):null,r===`skills`?(0,F.jsx)(J,{draft:a,setDraft:o,zh:n}):null,r===`tools`?(0,F.jsx)(X,{draft:a,setDraft:o,builtinTools:t,zh:n}):null,r===`runtime`?(0,F.jsx)(G,{draft:a,setDraft:o,zh:n}):null]})}function ge(){let e=(0,re.c)(17),t=l(ve),n=c(_e)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=d(t?`settings-agent-defaults`:null,C);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,F.jsx)(j,{children:(0,F.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,F.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===o?a=e[5]:(a=()=>void o(),e[4]=o,e[5]=a);let s=n?`重试`:`Retry`,c;e[6]!==a||e[7]!==s?(c=(0,F.jsx)(f,{onClick:a,children:s}),e[6]=a,e[7]=s,e[8]=c):c=e[8];let l;return e[9]!==r||e[10]!==c?(l=(0,F.jsxs)(j,{children:[r,c]}),e[9]=r,e[10]=c,e[11]=l):l=e[11],l}if(a||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(me,{}),e[12]=t):t=e[12],t}let s;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(s=(0,F.jsx)(he,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=s):s=e[16],s}function _e(e){return e.language}function ve(e){return e.token}export{ge as AgentDefaultsSettingsPanel};
@@ -1,6 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{h as i,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{a as o,n as s,o as c,r as l,s as u,t as d}from"./dist-CpzYSoz7.js";import{n as f,r as p}from"./popover-select-CKBYnT3c.js";import{t as m}from"./circle-check-C23XjkUj.js";import{t as h}from"./markdown-view-B68NqWQv.js";import{t as g}from"./plus-Q2yW6OE7.js";import{t as _}from"./x-B_N4OPjy.js";import{t as v}from"./messages-BQlBfZ_q.js";import{n as y}from"./locale-store-D7KNXBtb.js";import{t as b}from"./cn-JdwAhgNB.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{t as S}from"./button-B11EPpor.js";import{t as C}from"./skeleton-BwbyijEw.js";import{$t as ee,Aa as w,Dc as te,El as T,Fu as E,Kc as ne,Ms as re,Nc as ie,Qc as ae,Us as oe,Vi as D,Vl as O,cc as k,du as A,gn as j,hn as M,hu as N,jc as se,l as P,mc as F,mn as ce,no as I,pn as le,pu as ue,rc as de,ua as fe,uu as L,vn as pe,y as R,yc as z}from"./index-B85uQ2qO.js";import{a as B,i as V,o as H,r as U}from"./cron-expression-DCgKumIC.js";import{a as W,i as me,n as he,r as ge,t as _e}from"./workflow-run-setup-panel-DkiH6HKp.js";import{i as ve,n as ye,r as be,t as G}from"./browser-automation-inputs-Brw_vPSp.js";var K=e(t(),1),xe=n(),Se=B();function q(e,t,n){let r=new Date;return r.setHours(e,t,0,0),r.toLocaleTimeString(n,{hour:`numeric`,minute:`2-digit`})}function Ce(e,t){let n=e===7?0:e;return new Date(Date.UTC(2023,0,1)+n*864e5).toLocaleDateString(t,{weekday:`short`,timeZone:`UTC`})}function we(e,t){return e.length<=1?e[0]??``:t.startsWith(`zh`)?e.join(`、`):e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(`, `)}, and ${e.at(-1)}`}function Te(e){return e.length===5&&e.every((e,t)=>e===t+1)}function Ee(e){if(e.length!==2)return!1;let t=[...e].toSorted((e,t)=>e-t);return t[0]===0&&t[1]===6}function De(e,t,n,r){try{let i=Se.CronExpressionParser.parse(e,{...r?.timezone?{tz:r.timezone}:{}}).fields,a=U(i.minute.values),o=U(i.hour.values),s=U(i.dayOfWeek.values),c=U(i.dayOfMonth.values);if(a.length===60&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard)return n.everyMinute;if(!i.minute.isWildcard&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard&&a.length>1){let e=V(a);if(e!=null&&e>0)return n.everyNMinutes.replace(`{{n}}`,String(e))}if(!i.minute.isWildcard&&a.length===1&&!i.hour.isWildcard&&o.length>1&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard){let e=V(o);if(e!=null&&e>0)return n.everyNHours.replace(`{{n}}`,String(e))}if(!i.minute.isWildcard&&a.length===1&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard&&o.length===24)return n.hourly;let l=!i.minute.isWildcard&&a.length===1&&!i.hour.isWildcard&&o.length===1?q(o[0],a[0],t):``;if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard)return n.dailyAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&Te(s))return n.weekdaysAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&Ee(s))return n.weekendsAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&s.length===1){let e=Ce(s[0],t);return n.weeklyOn.replace(`{{day}}`,e).replace(`{{time}}`,l)}if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&s.length>1){let e=we(s.map(e=>Ce(e,t)),t);return n.daysAt.replace(`{{days}}`,e).replace(`{{time}}`,l)}return l&&!i.dayOfMonth.isWildcard&&c.length===1&&i.month.isWildcard&&i.dayOfWeek.isWildcard?n.monthlyAt.replace(`{{day}}`,String(c[0])).replace(`{{time}}`,l):n.customSchedule}catch{return null}}function J(e,t,n,r){let i=e.trim();return i?De(i,t,n,r)||Oe(r?.nextRun,t)||n.customSchedule:Oe(r?.nextRun,t)||`—`}function Oe(e,t){if(!e)return``;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toLocaleString(t,{weekday:`short`,hour:`numeric`,minute:`2-digit`})}var ke=1e3,Y=60*ke,X=60*Y,Ae=24*X,je=7*Ae,Me=new Intl.ListFormat(`en-US`,{type:`conjunction`}),Ne=Object.fromEntries([`second`,`minute`,`hour`,`day`,`week`].map(e=>[e,new Intl.NumberFormat(`en-US`,{style:`unit`,unit:e,unitDisplay:`long`})])),Pe={en:new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})},Fe={en:new Intl.DateTimeFormat(`en-US`,{hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{hour:`2-digit`,minute:`2-digit`})},Ie={minute:Y,hour:X,day:Ae,week:je};function Le(e){return e===`zh`?`zh-CN`:`en-US`}function Re(e,t,n){return n===`zh`?`${e} ${t===`week`?`周`:t===`day`?`天`:t===`hour`?`小时`:t===`minute`?`分钟`:`秒`}`:Ne[String(t)].format(e)}function ze(e,t){return t===`zh`?e.join(` `):Me.format(e)}function Be(e,t){let n=typeof e==`number`?e:Number.parseFloat(e);return Math.max(Y,Math.round((Number.isFinite(n)&&n>0?n:1)*Ie[t]))}function Ve(e,t,n){let r=typeof e==`number`?e:Number.parseFloat(e),i=Number.isFinite(r)&&r>0?r:1;return String(Number.parseFloat((i*Ie[t]/Ie[n]).toFixed(6)))}function He(e,t){let n=Math.max(ke,Math.round(e)),r=n===Ae?[{unit:`hour`,ms:X}]:n>=je&&n%je===0?[{unit:`week`,ms:je}]:n>=Ae?[{unit:`day`,ms:Ae},{unit:`hour`,ms:X},{unit:`minute`,ms:Y},{unit:`second`,ms:ke}]:n>=X?[{unit:`hour`,ms:X},{unit:`minute`,ms:Y},{unit:`second`,ms:ke}]:n>=Y?[{unit:`minute`,ms:Y},{unit:`second`,ms:ke}]:[{unit:`second`,ms:ke}],i=n,a=[];for(let{unit:e,ms:n}of r){let r=Math.floor(i/n);r<=0||(a.push(Re(r,e,t)),i%=n)}return ze(a,t)}function Ue(e,t){let n=He(e,t);return t===`zh`?`每 ${n}运行一次`:`Runs every ${n}`}function We(e,t){return Pe[t].format(new Date(e))}function Ge(e){return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())}function Ke(e,t,n=Date.now()){let r=new Date(e),i=Math.round((Ge(r)-Ge(new Date(n)))/Ae),a=Fe[t].format(r);return i===0?t===`zh`?`今天 ${a}`:`today at ${a}`:i===1?t===`zh`?`明天 ${a}`:`tomorrow at ${a}`:i===-1?t===`zh`?`昨天 ${a}`:`yesterday at ${a}`:We(e,t)}function qe(e,t){return e.eventType===`task.attention_required.v2`&&e.payloadMatch?.reason===`blocked`?t.trigger.taskBlockedWhen:e.eventType===`note.created`?t.trigger.noteCreatedWhen:e.eventType===`workflow.run.completed`&&e.payloadMatch?.status===`failed`?t.trigger.workflowFailedWhen:e.eventType===`session.transcript.updated`?t.trigger.sessionUpdatedWhen:t.trigger.eventWithType.replace(`{type}`,e.eventType)}function Je(e,t,n,r){if(e.kind===`manual`)return t.trigger.manualWhen;if(e.kind===`webhook`)return t.trigger.webhookWhen;if(e.kind===`event`)return qe(e,t);let i=e.schedule;return i.kind===`once`?t.trigger.onceAt.replace(`{time}`,Ke(Date.parse(i.at),r)):i.kind===`interval`?Ue(i.everyMs,r):J(i.expr,Le(r),n.scheduleBadge,{timezone:i.tz})}function Ye(e,t,n,r=Date.now()){return e.enabled?e.state.nextRunAtMs?Ke(e.state.nextRunAtMs,n,r):e.trigger.kind===`manual`?t.info.noAutomaticTrigger:e.trigger.kind===`event`||e.trigger.kind===`webhook`?t.info.waitingForTrigger:t.info.noUpcomingRun:t.info.pausedNoAutomaticRuns}function Xe(e,t,n,r=Date.now()){if(!e.state.lastRunAtMs)return t.info.notRunYet;let i=Ke(e.state.lastRunAtMs,n,r),a=e.state.lastRunStatus;return a?`${i} · ${t.status[a]}`:i}var Ze={name:``,description:``,projectId:``,triggerMode:`daily`,time:`09:00`,weekday:`1`,intervalValue:`1`,intervalUnit:`hour`,cronExpr:`0 9 * * *`,webhookSecretId:``,onceAt:``,eventType:``,eventSource:``,eventPayloadMatch:``,actionMode:`agent`,agentId:``,instruction:``,workflowId:``,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0,browserAutomationId:``,browserAutomationInputs:{},safetyMode:`suggest_only`,timeoutSeconds:`1800`,conversationMode:`new_session`,notificationPolicy:`attention`,completionWebhookUrl:``,disableAfterFailures:`3`},Qe=[{value:`15`,unit:`minute`},{value:`30`,unit:`minute`},{value:`1`,unit:`hour`},{value:`6`,unit:`hour`},{value:`24`,unit:`hour`}];function $e(e,t){let[n,r]=e.time.split(`:`),i=Number.parseInt(n||`9`,10),a=Number.parseInt(r||`0`,10),o;if(e.triggerMode===`manual`)o={kind:`manual`};else if(e.triggerMode===`once`)o={kind:`schedule`,schedule:{kind:`once`,at:new Date(e.onceAt).toISOString()}};else if(e.triggerMode===`webhook`)o={kind:`webhook`,...e.webhookSecretId.trim()?{secretId:e.webhookSecretId.trim()}:{}};else if(e.triggerMode===`taskBlocked`)o={kind:`event`,eventType:`task.attention_required.v2`,source:`tasks`,payloadMatch:{reason:`blocked`}};else if(e.triggerMode===`noteCreated`)o={kind:`event`,eventType:`note.created`,source:`notes`};else if(e.triggerMode===`workflowFailed`)o={kind:`event`,eventType:`workflow.run.completed`,source:`workflows`,payloadMatch:{status:`failed`}};else if(e.triggerMode===`sessionUpdated`)o={kind:`event`,eventType:`session.transcript.updated`,source:`sessions`};else if(e.triggerMode===`event`){let t=e.eventPayloadMatch.trim()?JSON.parse(e.eventPayloadMatch):void 0;o={kind:`event`,eventType:e.eventType.trim(),...e.eventSource.trim()?{source:e.eventSource.trim()}:{},...t?{payloadMatch:t}:{}}}else o=e.triggerMode===`interval`?{kind:`schedule`,schedule:{kind:`interval`,everyMs:Be(e.intervalValue,e.intervalUnit)}}:e.triggerMode===`weekly`?{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * ${e.weekday}`}}:e.triggerMode===`cron`?{kind:`schedule`,schedule:{kind:`cron`,expr:e.cronExpr.trim()}}:{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * *`}};let s=ge(t,e.workflowInput),c=e.workflowInput.goal.trim()||e.workflowGoal.trim(),l=e.actionMode===`browser_automation`?`auto_apply`:e.safetyMode,u;return u=e.actionMode===`workflow`?{kind:`workflow`,workflowId:e.workflowId.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...s===void 0?{}:{input:s},...c?{goal:c}:{},...e.workflowInput.concurrency.trim()?{concurrency:Math.max(1,Number.parseInt(e.workflowInput.concurrency,10)||1)}:{},...e.workflowInput.maxSubagents.trim()?{maxSubagents:Math.max(1,Number.parseInt(e.workflowInput.maxSubagents,10)||1)}:{}}:e.actionMode===`browser_automation`?{kind:`browser_automation`,automationId:e.browserAutomationId.trim(),inputs:e.browserAutomationInputs}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{}},{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},...e.projectId.trim()?{projectId:e.projectId.trim()}:{},trigger:o,action:u,safety:{mode:l},conversationMode:e.conversationMode,notificationPolicy:e.notificationPolicy,...l===`auto_apply`&&e.completionWebhookUrl.trim()?{completionWebhookUrl:e.completionWebhookUrl.trim()}:{},reliability:{executionTimeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||1800),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function et(e){let t=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+\*$/);if(t)return{triggerMode:`daily`,time:`${t[2].padStart(2,`0`)}:${t[1].padStart(2,`0`)}`,weekday:`1`,cronExpr:e};let n=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+([0-6])$/);return n?{triggerMode:`weekly`,time:`${n[2].padStart(2,`0`)}:${n[1].padStart(2,`0`)}`,weekday:n[3],cronExpr:e}:{triggerMode:`cron`,time:Ze.time,weekday:Ze.weekday,cronExpr:e}}function tt(e){let t=[[`week`,10080*6e4],[`day`,1440*6e4],[`hour`,60*6e4],[`minute`,6e4]],[n,r]=t.find(([,t])=>e>=t&&e%t===0)??t.at(-1);return{intervalValue:String(e/r),intervalUnit:n}}function nt(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function rt(e){let t=e.payloadMatch;return e.eventType===`task.attention_required.v2`&&e.source===`tasks`&&t?.reason===`blocked`?{triggerMode:`taskBlocked`}:e.eventType===`note.created`&&e.source===`notes`&&!t?{triggerMode:`noteCreated`}:e.eventType===`workflow.run.completed`&&e.source===`workflows`&&t?.status===`failed`?{triggerMode:`workflowFailed`}:e.eventType===`session.transcript.updated`&&e.source===`sessions`&&!t?{triggerMode:`sessionUpdated`}:{triggerMode:`event`,eventType:e.eventType,eventSource:e.source??``,eventPayloadMatch:t?JSON.stringify(t,null,2):``}}function it(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function at(e){if(!e.trim())return!0;try{let t=JSON.parse(e);return!!t&&typeof t==`object`&&!Array.isArray(t)&&Object.values(t).every(e=>e===null||[`string`,`number`,`boolean`].includes(typeof e))}catch{return!1}}function ot(e,t=[]){let n={triggerMode:`manual`};if(e.trigger.kind===`webhook`)n={triggerMode:`webhook`,webhookSecretId:e.trigger.secretId??``};else if(e.trigger.kind===`event`)n=rt(e.trigger);else if(e.trigger.kind===`schedule`){let t=e.trigger.schedule;t.kind===`cron`&&(n=et(t.expr)),t.kind===`interval`&&(n={triggerMode:`interval`,...tt(t.everyMs)}),t.kind===`once`&&(n={triggerMode:`once`,onceAt:nt(t.at)})}let r=e.action,i=r.kind===`workflow`?t.find(e=>e.id===r.workflowId)??null:null,a=r.kind===`workflow`?it(r.input):{},o=e.reliability?.executionTimeoutSeconds??r.timeoutSeconds??e.reliability?.timeoutSeconds??(r.kind===`browser_automation`?600:1800);return{...Ze,...n,name:e.name,description:e.description??``,projectId:e.projectId??``,actionMode:r.kind,agentId:r.kind===`browser_automation`?``:r.agentId??``,instruction:r.kind===`agent`?r.instruction:``,workflowId:r.kind===`workflow`?r.workflowId:``,workflowGoal:r.kind===`workflow`?r.goal??``:``,browserAutomationId:r.kind===`browser_automation`?r.automationId:``,browserAutomationInputs:r.kind===`browser_automation`?r.inputs??{}:{},workflowInput:{goal:r.kind===`workflow`?r.goal??``:``,argValues:i?he(i.name,a):{},schemaInput:a,concurrency:r.kind===`workflow`&&r.concurrency?String(r.concurrency):``,maxSubagents:r.kind===`workflow`&&r.maxSubagents?String(r.maxSubagents):``},workflowInputValid:!0,safetyMode:e.safety?.mode??`auto_apply`,timeoutSeconds:String(o),conversationMode:e.conversationMode??`new_session`,notificationPolicy:e.notificationPolicy??`attention`,completionWebhookUrl:e.completionWebhookUrl??``,disableAfterFailures:String(e.reliability?.disableAfterConsecutiveFailures??3)}}function st(e,t,n){let r=$e(t,n),i=e.trigger.kind===`schedule`&&r.trigger.kind===`schedule`&&e.trigger.schedule.kind===r.trigger.schedule.kind?{...r.trigger,schedule:{...e.trigger.schedule,...r.trigger.schedule}}:r.trigger,a=r.action;return e.action.kind===`agent`&&r.action.kind===`agent`?a={...e.action,...r.action,agentId:r.action.agentId}:e.action.kind===`workflow`&&r.action.kind===`workflow`?a={...e.action,...r.action,agentId:r.action.agentId,input:r.action.input,goal:r.action.goal,concurrency:r.action.concurrency,maxSubagents:r.action.maxSubagents}:e.action.kind===`browser_automation`&&r.action.kind===`browser_automation`&&(a={...e.action,...r.action}),{...r,description:t.description.trim(),projectId:t.projectId.trim(),completionWebhookUrl:t.completionWebhookUrl.trim(),trigger:i,action:a,reliability:{...e.reliability,...r.reliability}}}var Z=r();function ct(e,t,n){return e?We(e,n):t.never}function lt(e,t){return e.kind===`workflow`?t.action.workflowWithId.replace(`{id}`,e.workflowId):e.kind===`browser_automation`?`Browser automation: ${e.automationId}`:e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function ut(e){return e.safety?.mode??`auto_apply`}function dt(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`||e===`cancelling`?`bg-blue-500/10 text-blue-700 dark:text-blue-300`:`bg-surface-hover text-fg-muted`}function ft(e,t){if(e==null)return t.never;if(e<1e3)return`${e}ms`;let n=Math.round(e/1e3);return n<60?`${n}s`:`${Math.floor(n/60)}m ${n%60}s`}function pt(e){return e.status===`running`||e.status===`queued`||e.status===`cancelling`}function mt(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}function ht(e,t){if((e.state.consecutiveFailures??0)>0)return!0;let n=t.reduce((t,n)=>n.automationId===e.id&&(!t||n.createdAtMs>t.createdAtMs)?n:t,void 0);return n?mt(n):!1}function gt(e,t){return e.action.kind===`agent`?e.action.instruction:e.action.kind===`workflow`&&e.action.goal?.trim()||lt(e.action,t)}function _t(e){return(e.description?.match(/\[managed-by=([^\]]+)\]/))?.[1]?.trim()||null}function vt(e){return!!_t(e)}function yt(e){return e.description?.replace(/\s*\[managed-by=[^\]]+\]\s*/g,` `).trim()??``}function bt(e){return pt(e)?0:mt(e)?1:e.status===`succeeded`?2:3}function xt(e){return[...e].sort((e,t)=>{let n=bt(e)-bt(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function St(){let e=(0,xe.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,Z.jsx)(C,{className:`h-4 w-36`}),(0,Z.jsx)(C,{className:`h-3 w-56 max-w-full`})]}),(0,Z.jsx)(C,{className:`h-7 w-20 rounded-full`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`section`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:[t,(0,Z.jsx)(`div`,{className:`mt-4 grid gap-2`,children:Array.from({length:6}).map(Ct)})]}),e[1]=n):n=e[1];let r,i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(C,{className:`h-4 w-32`}),i=(0,Z.jsx)(C,{className:`mt-4 h-24 rounded-lg`}),e[2]=r,e[3]=i):(r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:(0,Z.jsxs)(`div`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1fr)_26rem]`,children:[n,(0,Z.jsxs)(`section`,{className:`hidden rounded-xl bg-surface-panel p-4 shadow-surface xl:block`,children:[r,i,(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,Z.jsx)(C,{className:`h-12 rounded-lg`}),(0,Z.jsx)(C,{className:`h-12 rounded-lg`}),(0,Z.jsx)(C,{className:`h-12 rounded-lg`})]})]})]})}),e[4]=a):a=e[4],a}function Ct(e,t){return(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(C,{className:`size-4 rounded-full`}),(0,Z.jsx)(C,{className:`h-4 w-32`}),(0,Z.jsx)(C,{className:`h-5 w-20 rounded-full`})]}),(0,Z.jsx)(C,{className:`mt-3 h-4 w-full`}),(0,Z.jsx)(C,{className:`mt-2 h-4 w-3/5`})]}),(0,Z.jsx)(C,{className:`h-8 w-24 rounded-md`})]})},t)}function wt({projectId:e,embedded:t=!1,title:n,subtitle:r}){let a=y(e=>e.language),m=v(a),h=m.automations,C=m.cron,ee=I(e=>e.setPageHeader),te=I(e=>e.clearPageHeader),[T,E]=i(),ne=T.get(`run`)?.trim()??``,ie=T.get(`automation`)?.trim()??``,ae=T.get(`draft`)?.trim()??``,oe=T.get(`action`)?.trim()??``,k=T.get(`projectId`)?.trim()??``,A=e?.trim()||k,N=!!e?.trim(),se=T.get(`autogenerate`)===`1`,ue=(0,K.useRef)(``),[de,L]=(0,K.useState)(`all`),[z,B]=(0,K.useState)(``),[V,H]=(0,K.useState)(!1),[U,W]=(0,K.useState)(`blank`),[he,ge]=(0,K.useState)(null),[_e,be]=(0,K.useState)(!1),[G,xe]=(0,K.useState)(Ze),[Se,q]=(0,K.useState)(null),[Ce,we]=(0,K.useState)(null),[Te,Ee]=(0,K.useState)(!1),[De,J]=(0,K.useState)(null),[Oe,ke]=(0,K.useState)(``),[Y,X]=(0,K.useState)(null),[Ae,je]=(0,K.useState)(!1),[Me,Ne]=(0,K.useState)(!1),[Pe,Fe]=(0,K.useState)(A),[Ie,Le]=(0,K.useState)(`new_session`),[Re,ze]=(0,K.useState)(`attention`),[Be,Ve]=(0,K.useState)(null),[He,Ue]=(0,K.useState)(!1),[We,Ge]=(0,K.useState)(!1),[Ke,qe]=(0,K.useState)(!1),[Ye,Xe]=(0,K.useState)(null),Qe=x([`automations`,A],()=>P.list(A?{projectId:A}:void 0),{refreshInterval:15e3}),et=x([`automation-runs`,A],()=>P.runs(50,void 0,A?{projectId:A}:void 0),{refreshInterval:1e4}),tt=x(Ce?`automation-run-events:${Ce}`:null,()=>P.runEvents(Ce),{refreshInterval:5e3}),nt=x(`automation-workflow-definitions`,R),rt=x(`automation-browser-automations`,()=>ve.list()),it=x(`automation-chat-agents`,w),ct=x(`automation-projects`,()=>fe({sortBy:`name`,sortOrder:`asc`,limit:200})),lt=Qe.isLoading&&!Qe.data||et.isLoading&&!et.data,ut=Qe.data?.automations??[],dt=(0,K.useMemo)(()=>xt(et.data?.runs??[]),[et.data?.runs]),ft=(0,K.useMemo)(()=>ut.filter(e=>!vt(e)),[ut]),mt=(0,K.useMemo)(()=>ut.filter(vt),[ut]),ht=(0,K.useMemo)(()=>new Set(mt.map(e=>e.id)),[mt]),_t=(0,K.useMemo)(()=>dt.filter(e=>!ht.has(e.automationId)),[dt,ht]),bt=(0,K.useMemo)(()=>dt.find(e=>e.id===Ce)??null,[dt,Ce]),Ct=(0,K.useMemo)(()=>ut.find(e=>e.id===De)??null,[ut,De]),wt=(0,K.useMemo)(()=>ut.find(e=>e.id===he)??null,[ut,he]),Et=(0,K.useMemo)(()=>dt.filter(e=>e.automationId===De).sort((e,t)=>t.createdAtMs-e.createdAtMs),[dt,De]),Dt=tt.data?.events??[],Ot=(0,K.useMemo)(()=>_t.filter(e=>!pt(e)&&e.readAtMs==null),[_t]),At=z.trim().toLocaleLowerCase(),jt=(0,K.useMemo)(()=>(de===`system`?mt:ft).filter(e=>de===`active`&&!e.enabled||de===`paused`&&e.enabled?!1:At?[e.name,yt(e),gt(e,h),Je(e.trigger,h,C,a)].some(e=>e.toLocaleLowerCase().includes(At)):!0),[C,de,h,a,At,mt,ft,_t]),Mt=(0,K.useMemo)(()=>nt.data??[],[nt.data]),Nt=(0,K.useMemo)(()=>(rt.data?.automations??[]).filter(e=>e.enabled),[rt.data]),It=it.data?.items??[],Lt=ct.data?.items??[],Rt=(0,K.useMemo)(()=>Mt.find(e=>e.id===G.workflowId.trim())??null,[G.workflowId,Mt]),zt=(0,K.useMemo)(()=>Nt.find(e=>e.id===G.browserAutomationId.trim())??null,[Nt,G.browserAutomationId]),Bt=G.actionMode===`workflow`&&(!G.workflowId.trim()||Mt.length>0&&!Mt.some(e=>e.id===G.workflowId)),Vt=G.actionMode===`workflow`&&Rt?!me(Rt,G.workflowInput,G.workflowInputValid).valid:!1,Ht=!!G.name.trim()&&(G.triggerMode!==`once`||Number.isFinite(new Date(G.onceAt).getTime()))&&(G.triggerMode!==`event`||!!G.eventType.trim()&&at(G.eventPayloadMatch))&&(G.actionMode===`workflow`?!Bt&&!Vt:G.actionMode===`browser_automation`?zt!==null&&ye(zt,G.browserAutomationInputs):!!G.instruction.trim()),Gt=(0,K.useMemo)(()=>[{name:h.templates.dailyAgent.name,description:h.templates.dailyAgent.description,form:{...Ze,name:h.templates.dailyAgent.name,instruction:h.templates.dailyAgent.instruction,triggerMode:`daily`}},{name:h.templates.morningWorkflow.name,description:h.templates.morningWorkflow.description,form:{...Ze,name:h.templates.morningWorkflow.formName,actionMode:`workflow`,workflowId:Mt[0]?.id??``}},{name:h.templates.webhookAgent.name,description:h.templates.webhookAgent.description,form:{...Ze,name:h.templates.webhookAgent.formName,triggerMode:`webhook`}},{name:h.templates.blockedTask.name,description:h.templates.blockedTask.description,form:{...Ze,name:h.templates.blockedTask.formName,triggerMode:`taskBlocked`,instruction:h.templates.blockedTask.instruction}},{name:h.templates.noteCreated.name,description:h.templates.noteCreated.description,form:{...Ze,name:h.templates.noteCreated.formName,triggerMode:`noteCreated`,instruction:h.templates.noteCreated.instruction}}],[h,Mt]);(0,K.useEffect)(()=>{if(jt.length===0){J(null);return}De&&jt.some(e=>e.id===De)||J(jt[0].id)},[jt,De]);let Kt=(0,K.useCallback)(async()=>{await Promise.all([Qe.mutate(),et.mutate(),tt.mutate()])},[Qe.mutate,tt.mutate,et.mutate]),qt=(0,K.useCallback)(e=>{if(N){J(null),we(null);return}E(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n.delete(`automation`),n.delete(`run`),n}),J(null),we(null)},[N,E]);(0,K.useEffect)(()=>{N&&(Fe(A),xe(e=>e.projectId===A?e:{...e,projectId:A}))},[A,N]);let $=(0,K.useCallback)(e=>{if(ge(null),be(!1),W(e),H(!0),e===`blank`){xe({...Ze,projectId:A});return}ke(``),X(null),Ne(!1),Fe(A),Le(`new_session`),ze(`attention`)},[A]),Jt=(0,K.useCallback)(e=>{xe(ot(e,Mt)),ge(e.id),be(!1),J(null),W(`blank`),H(!0)},[Mt]),Yt=(0,K.useCallback)(()=>{Y&&(xe({...ot(Y.automation,Mt),projectId:Pe,conversationMode:Ie,notificationPolicy:Re}),ge(null),be(!0),W(`blank`))},[Y,Ie,Re,Pe,Mt]),Xt=(0,K.useCallback)(async()=>{qe(!0),q(null);try{await Kt()}catch(e){q(e instanceof Error?e.message:String(e))}finally{qe(!1)}},[h.feedback.actionFailed,Kt]);(0,K.useEffect)(()=>{if(!ie)return;let e=ut.find(e=>e.id===ie);e&&(L(vt(e)?`system`:`all`),J(e.id),E(e=>{let t=new URLSearchParams(e);return t.delete(`automation`),t},{replace:!0}))},[ie,ut,E]),(0,K.useEffect)(()=>{oe===`create`&&($(`blank`),E(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t},{replace:!0}))},[oe,$,E]),(0,K.useEffect)(()=>{if(!ae)return;let e=`${a}:${se?`auto`:`seed`}:${ae}`;ue.current!==e&&(ue.current=e,ke(ae),X(null),Ne(!1),Fe(A),W(`draft`),H(!0),E(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),se&&(q(null),je(!0),P.draft({prompt:ae,language:a}).then(e=>{X(e.draft),Ne(!1)}).catch(e=>{q(e instanceof Error?e.message:String(e))}).finally(()=>{je(!1)})))},[se,ae,a,A,E]);let Zt=(0,K.useCallback)(e=>{let t=dt.find(t=>t.id===e);if(!t||pt(t)||t.readAtMs!=null)return;let n=Date.now();et.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),P.markRunRead(e).catch(e=>{q(e instanceof Error?e.message:String(e)),et.mutate()})},[dt,et.mutate]),Qt=(0,K.useCallback)(e=>{Zt(e),we(e),Ee(!0),E(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[Zt,E]),$t=(0,K.useCallback)(e=>{J(e);let t=dt.find(t=>t.automationId===e);t&&t.readAtMs==null&&!pt(t)&&Zt(t.id)},[Zt,dt]);(0,K.useEffect)(()=>{ne&&(Zt(ne),we(ne),Ee(!0))},[Zt,ne]),(0,K.useEffect)(()=>{Ve(null),Ge(!1)},[Ce]);async function en(){if(q(null),Ht){if(_e&&Y){Xe(`draft:edit`);try{let e=$e(G,Rt),{simulation:t}=await P.simulate(e);X({...Y,automation:e,simulation:t}),Fe(G.projectId),Le(G.conversationMode),ze(G.notificationPolicy),Ne(!1),be(!1),W(`draft`)}catch(e){q(e instanceof Error?e.message:String(e))}finally{Xe(null)}return}if(wt){let e=wt.id;await tn(`automation:${e}:edit`,()=>P.update(e,st(wt,G,Rt)))&&(H(!1),ge(null),J(e));return}try{let e=$e(G,Rt),{automation:t}=await P.create(e);xe(Ze),H(!1),L(`all`),B(``),qt(t.projectId??``),await Kt(),J(t.id)}catch(e){q(e instanceof Error?e.message:String(e))}}}async function tn(e,t){q(null),Xe(e);try{return await t(),await Kt(),!0}catch(e){return q(e instanceof Error?e.message:String(e)),!1}finally{Xe(null)}}async function nn(){await tn(`runs:read-all`,()=>P.markAllRunsRead(A||void 0))}async function rn(){let e=Oe.trim();if(e){q(null),je(!0);try{X((await P.draft({prompt:e,language:a})).draft),Ne(!1)}catch(e){q(e instanceof Error?e.message:String(e))}finally{je(!1)}}}async function an(){if(!Y)return;let e=``,t=``;await tn(`draft:publish`,async()=>{let{automation:n}=await P.create({...Y.automation,...Pe?{projectId:Pe}:{projectId:void 0},conversationMode:Ie,notificationPolicy:Re});X(null),ke(``),Ne(!1),H(!1),L(`all`),B(``),e=n.id,t=n.projectId??``})&&e&&(qt(t),J(e))}async function on(){if(!Y)return;let e=``,t=``,n=``;await tn(`draft:test`,async()=>{let{automation:r}=await P.create({...Y.automation,...Pe?{projectId:Pe}:{projectId:void 0},conversationMode:Ie,notificationPolicy:Re,enabled:!1}),{run:i}=await P.runNow(r.id);e=r.id,t=r.projectId??``,n=i.id,X(null),ke(``),Ne(!1),H(!1),L(`all`),B(``)})&&e&&n&&(qt(t),J(e),Qt(n))}async function sn(e){q(null),Ue(!0),Ve(null),Ge(!1);try{Ve((await P.repairDraft(e.id,{language:a})).repair)}catch(e){q(e instanceof Error?e.message:String(e))}finally{Ue(!1)}}async function cn(e){Be&&await tn(`run:${e.id}:repair`,async()=>{await P.update(e.automationId,Be.patch),Ve(null),Ge(!1)})}let ln=(0,K.useMemo)(()=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(D,{className:`size-9 shrink-0 p-0`,loading:Ke,label:h.refresh,onClick:Xt}),(0,Z.jsxs)(S,{variant:`primary`,onClick:()=>$(`draft`),children:[(0,Z.jsx)(g,{className:`size-4`}),h.new]})]}),[h.new,h.refresh,$,Ke,Xt]);return(0,K.useLayoutEffect)(()=>{if(!t)return ee({startExtra:null,main:(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:h.title}),end:ln}),()=>te()},[te,t,ln,h.title,ee]),(0,Z.jsxs)(`div`,{className:b(`flex min-h-0 min-w-0 flex-1 flex-col`,t?`bg-transparent`:`bg-surface-panel`),children:[(0,Z.jsxs)(`div`,{className:b(`flex w-full flex-col gap-4`,t?`py-1`:`mx-auto max-w-[96rem] px-4 py-7 sm:px-6 lg:px-8 lg:py-9`),children:[t?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-base px-4 py-3 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(re,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n||h.title})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r||h.subtitle})]}),ln]}):null,Se?(0,Z.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:Se}):null,lt?(0,Z.jsx)(St,{}):(0,Z.jsxs)(`section`,{className:`grid min-h-0 items-start gap-4 xl:grid-cols-[20rem_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`border-b border-edge-subtle p-3`,children:[N?null:(0,Z.jsxs)(f,{"aria-label":h.filters.project,className:Q,value:A,onChange:e=>qt(e.target.value),children:[(0,Z.jsx)(p,{value:``,children:h.filters.allProjects}),Lt.map(e=>(0,Z.jsx)(p,{value:e.id,children:e.name},e.id))]}),(0,Z.jsxs)(`label`,{className:b(`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg-muted focus-within:border-accent`,!N&&`mt-2`),children:[(0,Z.jsx)(F,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-subtle`,value:z,onChange:e=>B(e.target.value),placeholder:h.filters.search})]}),(0,Z.jsxs)(`nav`,{className:`mt-3 flex items-center gap-1`,"aria-label":h.filters.status,children:[[{id:`all`,label:h.filters.all},{id:`active`,label:h.filters.active},{id:`paused`,label:h.paused}].map(e=>(0,Z.jsx)(`button`,{type:`button`,className:b(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,de===e.id&&`bg-surface-hover text-fg`),onClick:()=>L(e.id),children:e.label},e.id)),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(pe,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:b(`ml-auto rounded-md p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,de===`system`&&`bg-surface-hover text-fg`),"aria-label":h.system.title,children:(0,Z.jsx)(O,{className:`size-4`})})}),(0,Z.jsx)(M,{children:(0,Z.jsx)(le,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,Z.jsxs)(ce,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>L(`system`),children:[h.system.title,` `,mt.length]})})})]})]}),Ot.length>0&&de!==`system`?(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 rounded-md bg-accent/8 px-2.5 py-1.5 text-xs text-accent-fg`,children:[(0,Z.jsxs)(`span`,{children:[h.filters.unread,` · `,Ot.length]}),(0,Z.jsx)(`button`,{type:`button`,className:`font-medium hover:underline`,disabled:Ye===`runs:read-all`,onClick:()=>void nn(),children:h.filters.markAllRead})]}):null]}),(0,Z.jsx)(kt,{automations:jt,runs:de===`system`?dt:_t,labels:h,cronLabels:C,language:a,selectedAutomationId:De,onOpenDetails:$t})]}),Ct?(0,Z.jsx)(Ft,{automation:Ct,runs:Et,labels:h,cronLabels:C,language:a,projects:Lt,busyAction:Ye,onEdit:Jt,onSelectRun:Qt,onAction:tn}):(0,Z.jsx)(Ut,{icon:(0,Z.jsx)(re,{className:`size-5`}),title:h.empty.filtered})]})]}),(0,Z.jsx)(d,{open:V,onOpenChange:e=>{H(e),e||(ge(null),be(!1))},children:(0,Z.jsxs)(c,{children:[(0,Z.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(l,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,48rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(u,{className:`text-base font-semibold text-fg`,children:U===`draft`?h.draft.title:wt?h.editTitle:_e?h.draft.editTitle:h.createTitle}),(0,Z.jsx)(s,{asChild:!0,children:(0,Z.jsx)(S,{variant:`ghost`,"aria-label":h.close,children:(0,Z.jsx)(_,{className:`size-4`})})})]}),U===`draft`?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,Z.jsx)(Tt,{labels:h,prompt:Oe,draft:Y,loading:Ae,approved:Me,publishBusy:Ye===`draft:publish`,testBusy:Ye===`draft:test`,templates:Gt,projects:Lt,projectId:Pe,conversationMode:Ie,notificationPolicy:Re,onPromptChange:ke,onGenerate:rn,onEdit:Yt,onPublish:an,onTest:on,onProjectChange:Fe,onConversationModeChange:Le,onNotificationPolicyChange:ze,projectLocked:N,onApprovedChange:Ne,onDiscard:()=>{X(null),Ne(!1)},onTemplateSelect:e=>{xe({...e,projectId:Pe}),W(`blank`)},onOpenAdvanced:()=>{xe({...Ze,projectId:Pe,conversationMode:Ie,notificationPolicy:Re}),W(`blank`)}})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Wt,{form:G,labels:h,setForm:xe,projects:Lt,workflowDefinitions:Mt,selectedWorkflow:Rt,workflowsLoading:nt.isLoading,browserAutomations:Nt,selectedBrowserAutomation:zt,browserAutomationsLoading:rt.isLoading,agentOptions:It,agentsLoading:it.isLoading,language:a,projectLocked:N}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[_e?(0,Z.jsx)(S,{variant:`ghost`,onClick:()=>{be(!1),W(`draft`)},children:h.cancel}):(0,Z.jsx)(s,{asChild:!0,children:(0,Z.jsx)(S,{variant:`ghost`,children:h.cancel})}),(0,Z.jsx)(S,{variant:`primary`,onClick:en,disabled:!Ht||Ye===`draft:edit`||!!(wt&&Ye),children:Ye===`draft:edit`||wt&&Ye===`automation:${wt.id}:edit`?h.feedback.working:wt||_e?h.save:h.create})]})]})]})]})}),(0,Z.jsx)(d,{open:Te&&!!bt,onOpenChange:e=>{Ee(e),!e&&E(e=>{let t=new URLSearchParams(e);return t.delete(`run`),t},{replace:!0})},children:(0,Z.jsxs)(c,{children:[(0,Z.jsx)(o,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(l,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(u,{className:`truncate text-base font-semibold text-fg`,children:bt?.automationName??h.dashboard.result}),(0,Z.jsx)(s,{asChild:!0,children:(0,Z.jsx)(S,{variant:`ghost`,"aria-label":h.close,children:(0,Z.jsx)(_,{className:`size-4`})})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Z.jsx)(Pt,{className:`rounded-none border-0`,run:bt,events:Dt,labels:h,cronLabels:C,language:a,loading:tt.isLoading,repairDraft:Be,repairLoading:He,repairApproved:We,busyAction:Ye,onRepairApprovedChange:Ge,onSuggestRepair:sn,onApplyRepair:cn})})]})]})})]})}function Tt(e){let t=(0,xe.c)(108),{labels:n,prompt:r,draft:i,loading:a,approved:o,publishBusy:s,testBusy:c,templates:l,projects:u,projectId:d,conversationMode:m,notificationPolicy:h,onPromptChange:g,onGenerate:_,onEdit:v,onPublish:y,onTest:x,onProjectChange:C,onConversationModeChange:ee,onNotificationPolicyChange:w,onApprovedChange:T,onDiscard:E,onTemplateSelect:ne,onOpenAdvanced:re,projectLocked:ie}=e,ae=s===void 0?!1:s,oe=c===void 0?!1:c,D=ie===void 0?!1:ie,O=!!(i&&i.simulation.requiredConfirmations.length>0),k;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(de,{className:`size-4 text-accent`}),t[0]=k):k=t[0];let A;t[1]===n.draft.title?A=t[2]:(A=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[k,n.draft.title]}),t[1]=n.draft.title,t[2]=A);let j;t[3]===n.draft.subtitle?j=t[4]:(j=(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[3]=n.draft.subtitle,t[4]=j);let M;t[5]!==A||t[6]!==j?(M=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[A,j]}),t[5]=A,t[6]=j,t[7]=M):M=t[7];let N;t[8]!==a||t[9]!==r?(N=a||!r.trim(),t[8]=a,t[9]=r,t[10]=N):N=t[10];let P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(de,{className:`size-4`}),t[11]=P):P=t[11];let F=a?n.draft.generating:n.draft.generate,ce;t[12]!==_||t[13]!==F||t[14]!==N?(ce=(0,Z.jsxs)(S,{variant:`primary`,onClick:_,disabled:N,children:[P,F]}),t[12]=_,t[13]=F,t[14]=N,t[15]=ce):ce=t[15];let I;t[16]!==ce||t[17]!==M?(I=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[M,ce]}),t[16]=ce,t[17]=M,t[18]=I):I=t[18];let le;t[19]===g?le=t[20]:(le=e=>g(e.target.value),t[19]=g,t[20]=le);let ue;t[21]!==n.draft.placeholder||t[22]!==r||t[23]!==le?(ue=(0,Z.jsx)(`textarea`,{className:`mt-4 min-h-20 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:le,placeholder:n.draft.placeholder}),t[21]=n.draft.placeholder,t[22]=r,t[23]=le,t[24]=ue):ue=t[24];let fe=D?`sm:grid-cols-2`:`sm:grid-cols-3`,L;t[25]===fe?L=t[26]:(L=b(`mt-3 grid gap-3`,fe),t[25]=fe,t[26]=L);let pe;t[27]!==n.draft.noProject||t[28]!==n.draft.project||t[29]!==C||t[30]!==d||t[31]!==D||t[32]!==u?(pe=D?null:(0,Z.jsx)($,{label:n.draft.project,children:(0,Z.jsxs)(f,{className:Q,value:d,onChange:e=>C(e.target.value),children:[(0,Z.jsx)(p,{value:``,children:n.draft.noProject}),u.map(Et)]})}),t[27]=n.draft.noProject,t[28]=n.draft.project,t[29]=C,t[30]=d,t[31]=D,t[32]=u,t[33]=pe):pe=t[33];let R;t[34]===ee?R=t[35]:(R=e=>ee(e.target.value),t[34]=ee,t[35]=R);let z;t[36]===n.draft.newConversation?z=t[37]:(z=(0,Z.jsx)(p,{value:`new_session`,children:n.draft.newConversation}),t[36]=n.draft.newConversation,t[37]=z);let B;t[38]===n.draft.continuousConversation?B=t[39]:(B=(0,Z.jsx)(p,{value:`continuous`,children:n.draft.continuousConversation}),t[38]=n.draft.continuousConversation,t[39]=B);let V;t[40]!==m||t[41]!==R||t[42]!==z||t[43]!==B?(V=(0,Z.jsxs)(f,{className:Q,value:m,onChange:R,children:[z,B]}),t[40]=m,t[41]=R,t[42]=z,t[43]=B,t[44]=V):V=t[44];let H;t[45]!==n.draft.conversation||t[46]!==V?(H=(0,Z.jsx)($,{label:n.draft.conversation,children:V}),t[45]=n.draft.conversation,t[46]=V,t[47]=H):H=t[47];let U;t[48]===w?U=t[49]:(U=e=>w(e.target.value),t[48]=w,t[49]=U);let W;t[50]===n.draft.notifyAttention?W=t[51]:(W=(0,Z.jsx)(p,{value:`attention`,children:n.draft.notifyAttention}),t[50]=n.draft.notifyAttention,t[51]=W);let me;t[52]===n.draft.notifyAll?me=t[53]:(me=(0,Z.jsx)(p,{value:`all`,children:n.draft.notifyAll}),t[52]=n.draft.notifyAll,t[53]=me);let he;t[54]===n.draft.notifyNone?he=t[55]:(he=(0,Z.jsx)(p,{value:`none`,children:n.draft.notifyNone}),t[54]=n.draft.notifyNone,t[55]=he);let ge;t[56]!==h||t[57]!==U||t[58]!==W||t[59]!==me||t[60]!==he?(ge=(0,Z.jsxs)(f,{className:Q,value:h,onChange:U,children:[W,me,he]}),t[56]=h,t[57]=U,t[58]=W,t[59]=me,t[60]=he,t[61]=ge):ge=t[61];let _e;t[62]!==n.draft.notifications||t[63]!==ge?(_e=(0,Z.jsx)($,{label:n.draft.notifications,children:ge}),t[62]=n.draft.notifications,t[63]=ge,t[64]=_e):_e=t[64];let ve;t[65]!==L||t[66]!==pe||t[67]!==H||t[68]!==_e?(ve=(0,Z.jsxs)(`div`,{className:L,children:[pe,H,_e]}),t[65]=L,t[66]=pe,t[67]=H,t[68]=_e,t[69]=ve):ve=t[69];let ye;t[70]!==i||t[71]!==n.draft.advancedCreate||t[72]!==n.draft.suggestions||t[73]!==n.draft.suggestionsDescription||t[74]!==re||t[75]!==ne||t[76]!==l?(ye=i?null:(0,Z.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.draft.suggestions}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:n.draft.suggestionsDescription})]}),(0,Z.jsx)(S,{variant:`ghost`,onClick:re,children:n.draft.advancedCreate})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:l.slice(0,4).map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>ne(e.form),children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.name}),(0,Z.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description})]},e.name))})]}),t[70]=i,t[71]=n.draft.advancedCreate,t[72]=n.draft.suggestions,t[73]=n.draft.suggestionsDescription,t[74]=re,t[75]=ne,t[76]=l,t[77]=ye):ye=t[77];let be;t[78]!==o||t[79]!==i||t[80]!==n.draft.approval||t[81]!==n.draft.assumptions||t[82]!==n.draft.discard||t[83]!==n.draft.edit||t[84]!==n.draft.publish||t[85]!==n.draft.review||t[86]!==n.draft.risks||t[87]!==n.draft.safety||t[88]!==n.draft.testOnce||t[89]!==n.draft.testing||t[90]!==n.feedback||t[91]!==n.info||t[92]!==n.none||t[93]!==T||t[94]!==E||t[95]!==v||t[96]!==y||t[97]!==x||t[98]!==ae||t[99]!==O||t[100]!==oe?(be=i?(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,Z.jsx)(Ht,{label:n.info.when,value:i.simulation.triggerSummary}),(0,Z.jsx)(Ht,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,Z.jsx)(Dt,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,Z.jsx)(Dt,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,Z.jsx)(Dt,{title:n.draft.risks,items:i.risks,empty:n.none}),O?(0,Z.jsxs)(`label`,{className:`mt-4 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:o,onChange:e=>T(e.target.checked)}),(0,Z.jsx)(`span`,{children:n.draft.approval})]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(S,{variant:`ghost`,onClick:E,children:n.draft.discard}),(0,Z.jsxs)(S,{variant:`secondary`,onClick:v,children:[(0,Z.jsx)(se,{className:`size-4`}),n.draft.edit]}),(0,Z.jsxs)(S,{variant:`secondary`,onClick:x,disabled:oe||ae||O&&!o,children:[(0,Z.jsx)(te,{className:`size-4`}),oe?n.draft.testing:n.draft.testOnce]}),(0,Z.jsx)(S,{variant:`primary`,onClick:y,disabled:ae||O&&!o,children:ae?n.feedback.working:n.draft.publish})]})]})]}):null,t[78]=o,t[79]=i,t[80]=n.draft.approval,t[81]=n.draft.assumptions,t[82]=n.draft.discard,t[83]=n.draft.edit,t[84]=n.draft.publish,t[85]=n.draft.review,t[86]=n.draft.risks,t[87]=n.draft.safety,t[88]=n.draft.testOnce,t[89]=n.draft.testing,t[90]=n.feedback,t[91]=n.info,t[92]=n.none,t[93]=T,t[94]=E,t[95]=v,t[96]=y,t[97]=x,t[98]=ae,t[99]=O,t[100]=oe,t[101]=be):be=t[101];let G;return t[102]!==I||t[103]!==ue||t[104]!==ve||t[105]!==ye||t[106]!==be?(G=(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[I,ue,ve,ye,be]}),t[102]=I,t[103]=ue,t[104]=ve,t[105]=ye,t[106]=be,t[107]=G):G=t[107],G}function Et(e){return(0,Z.jsx)(p,{value:e.id,children:e.name},e.id)}function Dt(e){let t=(0,xe.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==r?(o=r.length>0?r.map(Ot):(0,Z.jsx)(`li`,{className:`text-fg-muted`,children:i}),t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===o?s=t[6]:(s=(0,Z.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm text-fg`,children:o}),t[5]=o,t[6]=s);let c;return t[7]!==a||t[8]!==s?(c=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function Ot(e){return(0,Z.jsxs)(`li`,{children:[`- `,e]},e)}function kt(e){let t=(0,xe.c)(20),{automations:n,runs:r,labels:i,cronLabels:a,language:o,selectedAutomationId:s,onOpenDetails:c}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(re,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===i.empty.filtered?n=t[2]:(n=(0,Z.jsx)(Ut,{className:`rounded-none border-0 shadow-none`,icon:e,title:i.empty.filtered}),t[1]=i.empty.filtered,t[2]=n),n}let l;if(t[3]!==n||t[4]!==a||t[5]!==i||t[6]!==o||t[7]!==c||t[8]!==r||t[9]!==s){let e;t[11]!==a||t[12]!==i||t[13]!==o||t[14]!==c||t[15]!==r||t[16]!==s?(e=e=>{let t=r.filter(t=>t.automationId===e.id).sort(At),n=t.find(pt),l=t[0];return(0,Z.jsxs)(`button`,{type:`button`,className:b(`block w-full p-3 text-left outline-none hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,s===e.id&&`bg-surface-hover`),onClick:()=>c(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:b(`size-2 shrink-0 rounded-full`,n?`bg-blue-500`:ht(e,t)?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-fg-subtle`)}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),l&&l.readAtMs==null&&!pt(l)?(0,Z.jsx)(`span`,{className:`ml-auto size-2 shrink-0 rounded-full bg-blue-500`,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:i.filters.unread})}):null]}),(0,Z.jsx)(`div`,{className:`mt-1 truncate pl-4 text-xs text-fg-muted`,children:Je(e.trigger,i,a,o)}),(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center justify-between gap-2 pl-4 text-xs text-fg-subtle`,children:[(0,Z.jsx)(`span`,{className:b(`truncate`,l?.error&&`text-red-700 dark:text-red-300`),children:l?l.error||l.summary||i.status[l.status]:e.enabled?`${i.next}: ${ct(e.state.nextRunAtMs,i,o)}`:i.paused}),l?.status?(0,Z.jsx)(`span`,{className:b(`shrink-0 rounded-full px-1.5 py-0.5`,dt(l.status)),children:i.status[l.status]}):null]})]},e.id)},t[11]=a,t[12]=i,t[13]=o,t[14]=c,t[15]=r,t[16]=s,t[17]=e):e=t[17],l=n.map(e),t[3]=n,t[4]=a,t[5]=i,t[6]=o,t[7]=c,t[8]=r,t[9]=s,t[10]=l}else l=t[10];let u;return t[18]===l?u=t[19]:(u=(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:l}),t[18]=l,t[19]=u),u}function At(e,t){return t.createdAtMs-e.createdAtMs}function jt(e,t){let n=t.events,r=e.data&&typeof e.data==`object`?e.data:{},i=typeof r.actionKind==`string`?r.actionKind:null,a=typeof r.status==`string`&&r.status in t.status?t.status[r.status]:null;switch(e.type){case`run.queued`:return e.message.toLowerCase().includes(`manual`)?n.manualQueued:e.message.toLowerCase().includes(`scheduled`)?n.scheduledQueued:n.eventQueued;case`run.started`:return n.runStarted;case`action.started`:return i?n.actionStarted.replace(`{kind}`,i):n.actionStartedFallback;case`action.completed`:return i?n.actionCompleted.replace(`{kind}`,i):n.actionCompletedFallback;case`action.failed`:return i?n.actionFailed.replace(`{kind}`,i):n.actionFailedFallback;case`completion_hook.started`:return n.completionHookStarted;case`completion_hook.completed`:return n.completionHookCompleted;case`completion_hook.failed`:return n.completionHookFailed;case`run.completed`:return a?n.runCompleted.replace(`{status}`,a):n.runCompletedFallback;default:return e.message}}function Mt(e){let t=(0,xe.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[o,s]=(0,K.useState)(a===void 0?!1:a),c;t[0]===n?c=t[1]:(c=JSON.stringify(n,null,2),t[0]=n,t[1]=c);let l=c,u;t[2]===l?u=t[3]:(u=l.split(`
2
- `),t[2]=l,t[3]=u);let d=u.length,f=l.length>720||d>18,p;t[4]!==f||t[5]!==l?(p=f?`${l.split(`
3
- `).slice(0,10).join(`
4
- `).trimEnd()}...`:l,t[4]=f,t[5]=l,t[6]=p):p=t[6];let m=p,h;t[7]!==o||t[8]!==f||t[9]!==r||t[10]!==i?(h=f?(0,Z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(Nt),"aria-expanded":o,children:[(0,Z.jsx)(`span`,{children:i}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[o?r.details.hideDetails:r.details.showDetails,(0,Z.jsx)(ue,{className:b(`size-3.5 transition-transform`,o&&`rotate-180`),"aria-hidden":!0})]})]}):(0,Z.jsx)(`div`,{className:`px-2.5 py-2 text-xs font-medium text-fg-muted`,children:i}),t[7]=o,t[8]=f,t[9]=r,t[10]=i,t[11]=h):h=t[11];let g=o||!f?l:m,_;t[12]===g?_=t[13]:(_=(0,Z.jsx)(`pre`,{className:`whitespace-pre-wrap break-all px-2.5 pb-2 text-xs leading-relaxed text-fg-muted`,children:g}),t[12]=g,t[13]=_);let v;return t[14]!==h||t[15]!==_?(v=(0,Z.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[h,_]}),t[14]=h,t[15]=_,t[16]=v):v=t[16],v}function Nt(e){return!e}function Pt(e){let t=(0,xe.c)(148),{className:n,run:r,events:i,labels:o,cronLabels:s,language:c,loading:l,repairDraft:u,repairLoading:d,repairApproved:f,busyAction:p,onRepairApprovedChange:g,onSuggestRepair:_,onApplyRepair:v}=e;if(!r){let e;t[0]===n?e=t[1]:(e=b(`flex min-h-64 flex-col justify-center rounded-lg border border-edge-subtle bg-surface-base px-4 text-center text-sm text-fg-muted shadow-surface`,n),t[0]=n,t[1]=e);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(E,{className:`mx-auto size-5`}),t[2]=r):r=t[2];let i;t[3]===o.selectRun?i=t[4]:(i=(0,Z.jsx)(`div`,{className:`mt-2`,children:o.selectRun}),t[3]=o.selectRun,t[4]=i);let a;return t[5]!==e||t[6]!==i?(a=(0,Z.jsxs)(`aside`,{className:e,children:[r,i]}),t[5]=e,t[6]=i,t[7]=a):a=t[7],a}let y=r.error||r.summary,x=r.sessionKey?`/chat/${encodeURIComponent(r.sessionKey)}`:r.workflowRunId?`/workflows?run=${encodeURIComponent(r.workflowRunId)}`:null,ee=r.sessionKey?o.runDetail.openConversation:o.runDetail.openWorkflow,w=r.sessionKey?ne:T,te=pt(r)?E:mt(r)?L:m,re;t[8]===n?re=t[9]:(re=b(`rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,n),t[8]=n,t[9]=re);let ie;t[10]===r.automationName?ie=t[11]:(ie=(0,Z.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=ie);let oe;t[12]===r.id?oe=t[13]:(oe=r.id.slice(0,8),t[12]=r.id,t[13]=oe);let D;t[14]===oe?D=t[15]:(D=(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:oe}),t[14]=oe,t[15]=D);let O;t[16]!==ie||t[17]!==D?(O=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[ie,D]}),t[16]=ie,t[17]=D,t[18]=O):O=t[18];let k;t[19]===r.status?k=t[20]:(k=b(`shrink-0 rounded-full px-2 py-0.5 text-xs`,dt(r.status)),t[19]=r.status,t[20]=k);let j=o.status[r.status],M;t[21]!==k||t[22]!==j?(M=(0,Z.jsx)(`span`,{className:k,children:j}),t[21]=k,t[22]=j,t[23]=M):M=t[23];let N;t[24]!==O||t[25]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[O,M]}),t[24]=O,t[25]=M,t[26]=N):N=t[26];let se;t[27]!==o||t[28]!==c||t[29]!==r.createdAtMs?(se=ct(r.createdAtMs,o,c),t[27]=o,t[28]=c,t[29]=r.createdAtMs,t[30]=se):se=t[30];let P;t[31]===se?P=t[32]:(P=(0,Z.jsx)(`span`,{children:se}),t[31]=se,t[32]=P);let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[33]=F):F=t[33];let ce=o.details.duration,I;t[34]!==o||t[35]!==r.durationMs?(I=ft(r.durationMs,o),t[34]=o,t[35]=r.durationMs,t[36]=I):I=t[36];let le;t[37]!==o.details.duration||t[38]!==I?(le=(0,Z.jsxs)(`span`,{children:[ce,` `,I]}),t[37]=o.details.duration,t[38]=I,t[39]=le):le=t[39];let fe;t[40]!==P||t[41]!==le?(fe=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[P,F,le]}),t[40]=P,t[41]=le,t[42]=fe):fe=t[42];let pe;t[43]!==o.repair||t[44]!==_||t[45]!==d||t[46]!==r?(pe=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsxs)(S,{variant:`secondary`,onClick:()=>_(r),disabled:d,children:[(0,Z.jsx)(de,{className:`size-4`}),d?o.repair.generating:o.repair.suggest]})}):null,t[43]=o.repair,t[44]=_,t[45]=d,t[46]=r,t[47]=pe):pe=t[47];let R;t[48]!==fe||t[49]!==pe||t[50]!==N?(R=(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[N,fe,pe]}),t[48]=fe,t[49]=pe,t[50]=N,t[51]=R):R=t[51];let z;t[52]===r?z=t[53]:(z=pt(r)?`text-blue-500`:mt(r)?`text-red-500`:`text-emerald-500`,t[52]=r,t[53]=z);let B;t[54]===z?B=t[55]:(B=b(`size-4`,z),t[54]=z,t[55]=B);let V;t[56]!==te||t[57]!==B?(V=(0,Z.jsx)(te,{className:B}),t[56]=te,t[57]=B,t[58]=V):V=t[58];let H;t[59]!==o.runDetail.resultTitle||t[60]!==V?(H=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[V,o.runDetail.resultTitle]}),t[59]=o.runDetail.resultTitle,t[60]=V,t[61]=H):H=t[61];let U;t[62]!==w||t[63]!==ee||t[64]!==x?(U=x?(0,Z.jsx)(S,{asChild:!0,variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,children:(0,Z.jsxs)(a,{to:x,children:[(0,Z.jsx)(w,{className:`size-3.5`}),ee,(0,Z.jsx)(A,{className:`size-3.5`})]})}):null,t[62]=w,t[63]=ee,t[64]=x,t[65]=U):U=t[65];let W;t[66]!==H||t[67]!==U?(W=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[H,U]}),t[66]=H,t[67]=U,t[68]=W):W=t[68];let me=r.error&&`border-red-500/25 bg-red-500/5`,he;t[69]===me?he=t[70]:(he=b(`mt-3 max-h-80 overflow-y-auto rounded-lg border border-edge/70 bg-surface-muted/25 p-3`,me),t[69]=me,t[70]=he);let ge;t[71]!==o.runDetail.noResult||t[72]!==o.runDetail.resultPending||t[73]!==y||t[74]!==r?(ge=y?r.error?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-red-700 dark:text-red-300`,children:y}):(0,Z.jsx)(h,{content:y,compact:!0,className:`text-sm`}):(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:pt(r)?o.runDetail.resultPending:o.runDetail.noResult}),t[71]=o.runDetail.noResult,t[72]=o.runDetail.resultPending,t[73]=y,t[74]=r,t[75]=ge):ge=t[75];let _e;t[76]!==he||t[77]!==ge?(_e=(0,Z.jsx)(`div`,{className:he,children:ge}),t[76]=he,t[77]=ge,t[78]=_e):_e=t[78];let ve;t[79]!==W||t[80]!==_e?(ve=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[W,_e]}),t[79]=W,t[80]=_e,t[81]=ve):ve=t[81];let ye;t[82]===o.runDetail.runInfo?ye=t[83]:(ye=(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.runDetail.runInfo}),t[82]=o.runDetail.runInfo,t[83]=ye);let be;t[84]!==s||t[85]!==o||t[86]!==c||t[87]!==r.manual||t[88]!==r.triggerSnapshot?(be=r.manual?o.trigger.manual:Je(r.triggerSnapshot,o,s,c),t[84]=s,t[85]=o,t[86]=c,t[87]=r.manual,t[88]=r.triggerSnapshot,t[89]=be):be=t[89];let G;t[90]!==o.explain.whyRan||t[91]!==be?(G=(0,Z.jsx)(Bt,{label:o.explain.whyRan,value:be}),t[90]=o.explain.whyRan,t[91]=be,t[92]=G):G=t[92];let K=o.details.started,Se;t[93]!==o||t[94]!==c||t[95]!==r.startedAtMs?(Se=ct(r.startedAtMs,o,c),t[93]=o,t[94]=c,t[95]=r.startedAtMs,t[96]=Se):Se=t[96];let q;t[97]!==o.details.started||t[98]!==Se?(q=(0,Z.jsx)(Bt,{label:K,value:Se}),t[97]=o.details.started,t[98]=Se,t[99]=q):q=t[99];let Ce;t[100]!==o.details.model||t[101]!==r.model?(Ce=r.model?(0,Z.jsx)(Bt,{label:o.details.model,value:r.model}):null,t[100]=o.details.model,t[101]=r.model,t[102]=Ce):Ce=t[102];let we;t[103]!==G||t[104]!==q||t[105]!==Ce?(we=(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[G,q,Ce]}),t[103]=G,t[104]=q,t[105]=Ce,t[106]=we):we=t[106];let Te;t[107]!==ye||t[108]!==we?(Te=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[ye,we]}),t[107]=ye,t[108]=we,t[109]=Te):Te=t[109];let Ee;t[110]!==p||t[111]!==o||t[112]!==v||t[113]!==g||t[114]!==f||t[115]!==u||t[116]!==r?(Ee=u?(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.repair.title}),(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:u.explanation}),u.expectedEffect?(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:u.expectedEffect}):null,(0,Z.jsx)(Dt,{title:o.repair.risks,items:u.risks,empty:o.none}),(0,Z.jsx)(Mt,{value:u.patch,labels:o,title:o.details.repairPatch}),u.requiresApproval?(0,Z.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:f,onChange:e=>g(e.target.checked)}),(0,Z.jsx)(`span`,{children:o.repair.approval})]}):null,(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsx)(S,{variant:`primary`,onClick:()=>v(r),disabled:p===`run:${r.id}:repair`||u.requiresApproval&&!f,children:p===`run:${r.id}:repair`?o.feedback.working:o.repair.apply})})]}):null,t[110]=p,t[111]=o,t[112]=v,t[113]=g,t[114]=f,t[115]=u,t[116]=r,t[117]=Ee):Ee=t[117];let De;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(ae,{className:`size-4 shrink-0`}),t[118]=De):De=t[118];let J;t[119]===o.runDetail.technicalEvents?J=t[120]:(J=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium text-fg-muted`,children:[De,o.runDetail.technicalEvents]}),t[119]=o.runDetail.technicalEvents,t[120]=J);let Oe;t[121]!==i.length||t[122]!==o.runDetail.eventCount?(Oe=o.runDetail.eventCount.replace(`{count}`,String(i.length)),t[121]=i.length,t[122]=o.runDetail.eventCount,t[123]=Oe):Oe=t[123];let ke;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Z.jsx)(ue,{className:`size-4 transition-transform group-open:rotate-180`}),t[124]=ke):ke=t[124];let Y;t[125]===Oe?Y=t[126]:(Y=(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[Oe,ke]}),t[125]=Oe,t[126]=Y);let X;t[127]!==J||t[128]!==Y?(X=(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 rounded-md outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[J,Y]}),t[127]=J,t[128]=Y,t[129]=X):X=t[129];let Ae;t[130]===o.runDetail.technicalEventsDescription?Ae=t[131]:(Ae=(0,Z.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:o.runDetail.technicalEventsDescription}),t[130]=o.runDetail.technicalEventsDescription,t[131]=Ae);let je;t[132]!==i||t[133]!==o||t[134]!==c||t[135]!==l?(je=(0,Z.jsx)(`div`,{className:`mt-4`,children:l?(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-label":o.loading,children:[(0,Z.jsx)(C,{className:`h-10 w-full`}),(0,Z.jsx)(C,{className:`h-10 w-4/5`}),(0,Z.jsx)(C,{className:`h-10 w-11/12`})]}):i.length===0?(0,Z.jsx)(`div`,{className:`text-sm text-fg-muted`,children:o.empty.events}):(0,Z.jsx)(`ol`,{className:`space-y-3`,children:i.map(e=>(0,Z.jsxs)(`li`,{className:`grid grid-cols-[0.75rem_1fr] gap-3`,children:[(0,Z.jsx)(`span`,{className:b(`mt-1 size-2 rounded-full`,Vt(e.type))}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm text-fg`,children:jt(e,o)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[ct(e.createdAtMs,o,c),` · `,e.type]}),e.data&&typeof e.data==`object`?(0,Z.jsxs)(`details`,{className:`group/event mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 px-2.5 py-2 text-xs font-medium text-fg-muted outline-none hover:text-fg`,children:[o.details.eventData,(0,Z.jsx)(ue,{className:`size-3.5 transition-transform group-open/event:rotate-180`})]}),(0,Z.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-all border-t border-edge/70 px-2.5 py-2 text-xs leading-relaxed text-fg-muted`,children:JSON.stringify(e.data,null,2)})]}):null]})]},e.id))})}),t[132]=i,t[133]=o,t[134]=c,t[135]=l,t[136]=je):je=t[136];let Me;t[137]!==X||t[138]!==Ae||t[139]!==je?(Me=(0,Z.jsxs)(`details`,{className:`group px-4 py-3`,children:[X,Ae,je]}),t[137]=X,t[138]=Ae,t[139]=je,t[140]=Me):Me=t[140];let Ne;return t[141]!==re||t[142]!==R||t[143]!==ve||t[144]!==Te||t[145]!==Ee||t[146]!==Me?(Ne=(0,Z.jsxs)(`aside`,{className:re,children:[R,ve,Te,Ee,Me]}),t[141]=re,t[142]=R,t[143]=ve,t[144]=Te,t[145]=Ee,t[146]=Me,t[147]=Ne):Ne=t[147],Ne}function Ft(e){let t=(0,xe.c)(83),{automation:n,runs:r,labels:i,cronLabels:a,language:o,projects:s,busyAction:c,onEdit:l,onSelectRun:u,onAction:d}=e,f=c===`automation:${n.id}:run`,p=c===`automation:${n.id}:toggle`,g=c===`automation:${n.id}:delete`,_;t[0]===n?_=t[1]:(_=vt(n),t[0]=n,t[1]=_);let v=_,y;t[2]===n.name?y=t[3]:(y=(0,Z.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:n.name}),t[2]=n.name,t[3]=y);let x=n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`,C;t[4]===x?C=t[5]:(C=b(`shrink-0 rounded-full px-2 py-0.5 text-xs`,x),t[4]=x,t[5]=C);let ee=n.enabled?i.enabled:i.paused,w;t[6]!==C||t[7]!==ee?(w=(0,Z.jsx)(`span`,{className:C,children:ee}),t[6]=C,t[7]=ee,t[8]=w):w=t[8];let T;t[9]!==y||t[10]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[y,w]}),t[9]=y,t[10]=w,t[11]=T):T=t[11];let ne;t[12]===n?ne=t[13]:(ne=yt(n)?(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:yt(n)}):null,t[12]=n,t[13]=ne);let re;t[14]!==T||t[15]!==ne?(re=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[T,ne]}),t[14]=T,t[15]=ne,t[16]=re):re=t[16];let ae;t[17]!==n||t[18]!==c||t[19]!==g||t[20]!==i.dashboard.delete||t[21]!==i.dashboard.deleted||t[22]!==i.dashboard.pause||t[23]!==i.dashboard.resume||t[24]!==i.dashboard.resumed||t[25]!==i.dashboard.runNow||t[26]!==i.details||t[27]!==i.edit||t[28]!==i.feedback||t[29]!==d||t[30]!==l||t[31]!==v||t[32]!==f||t[33]!==p?(ae=v?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Z.jsxs)(S,{variant:`secondary`,disabled:c!==null,onClick:()=>void d(`automation:${n.id}:toggle`,()=>n.enabled?P.pause(n.id):P.resume(n.id),n.enabled?i.feedback.paused:i.dashboard.resumed),children:[p?(0,Z.jsx)(z,{className:`size-4 animate-spin`}):n.enabled?(0,Z.jsx)(ie,{className:`size-4`}):(0,Z.jsx)(te,{className:`size-4`}),n.enabled?i.dashboard.pause:i.dashboard.resume]}),(0,Z.jsxs)(S,{variant:`primary`,disabled:c!==null,onClick:()=>void d(`automation:${n.id}:run`,()=>P.runNow(n.id),i.feedback.rerunQueued),children:[f?(0,Z.jsx)(z,{className:`size-4 animate-spin`}):(0,Z.jsx)(te,{className:`size-4`}),i.dashboard.runNow]}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(pe,{asChild:!0,children:(0,Z.jsx)(S,{variant:`ghost`,className:`size-9 p-0`,"aria-label":i.details.moreActions,children:(0,Z.jsx)(O,{className:`size-4`})})}),(0,Z.jsx)(M,{children:(0,Z.jsxs)(le,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Z.jsxs)(ce,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>l(n),children:[(0,Z.jsx)(se,{className:`size-4`}),i.edit]}),(0,Z.jsxs)(ce,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-red-700 outline-none hover:bg-red-500/10 dark:text-red-300`,disabled:c!==null,onSelect:()=>void d(`automation:${n.id}:delete`,()=>P.remove(n.id),i.dashboard.deleted),children:[g?(0,Z.jsx)(z,{className:`size-4 animate-spin`}):(0,Z.jsx)(oe,{className:`size-4`}),i.dashboard.delete]})]})})]})]}),t[17]=n,t[18]=c,t[19]=g,t[20]=i.dashboard.delete,t[21]=i.dashboard.deleted,t[22]=i.dashboard.pause,t[23]=i.dashboard.resume,t[24]=i.dashboard.resumed,t[25]=i.dashboard.runNow,t[26]=i.details,t[27]=i.edit,t[28]=i.feedback,t[29]=d,t[30]=l,t[31]=v,t[32]=f,t[33]=p,t[34]=ae):ae=t[34];let D;t[35]!==ae||t[36]!==re?(D=(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[re,ae]}),t[35]=ae,t[36]=re,t[37]=D):D=t[37];let k;t[38]===i.info.task?k=t[39]:(k=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.info.task}),t[38]=i.info.task,t[39]=k);let A;t[40]!==n||t[41]!==i?(A=gt(n,i),t[40]=n,t[41]=i,t[42]=A):A=t[42];let N;t[43]===A?N=t[44]:(N=(0,Z.jsx)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-4`,children:(0,Z.jsx)(h,{content:A,compact:!0})}),t[43]=A,t[44]=N);let F;t[45]!==k||t[46]!==N?(F=(0,Z.jsxs)(`section`,{children:[k,N]}),t[45]=k,t[46]=N,t[47]=F):F=t[47];let I;t[48]!==n||t[49]!==a||t[50]!==i||t[51]!==o||t[52]!==s?(I=(0,Z.jsx)(Lt,{automation:n,labels:i,cronLabels:a,language:o,projects:s}),t[48]=n,t[49]=a,t[50]=i,t[51]=o,t[52]=s,t[53]=I):I=t[53];let ue;t[54]===i.dashboard.runHistory?ue=t[55]:(ue=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.dashboard.runHistory}),t[54]=i.dashboard.runHistory,t[55]=ue);let de;t[56]===i.dashboard.runHistoryDescription?de=t[57]:(de=(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:i.dashboard.runHistoryDescription}),t[56]=i.dashboard.runHistoryDescription,t[57]=de);let fe;t[58]!==ue||t[59]!==de?(fe=(0,Z.jsxs)(`div`,{children:[ue,de]}),t[58]=ue,t[59]=de,t[60]=fe):fe=t[60];let L;t[61]===r.length?L=t[62]:(L=(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-base px-2.5 py-1 text-xs text-fg-muted`,children:r.length}),t[61]=r.length,t[62]=L);let R;t[63]!==fe||t[64]!==L?(R=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[fe,L]}),t[63]=fe,t[64]=L,t[65]=R):R=t[65];let B;t[66]!==i||t[67]!==o||t[68]!==u||t[69]!==r?(B=r.length===0?(0,Z.jsx)(Ut,{icon:(0,Z.jsx)(E,{className:`size-5`}),title:i.empty.runs}):(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,children:r.slice(0,8).map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`block w-full p-3 text-left hover:bg-surface-hover`,onClick:()=>u(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.status===`succeeded`?(0,Z.jsx)(m,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,Z.jsx)(E,{className:`size-4 shrink-0 text-fg-muted`}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:ct(e.createdAtMs,i,o)})]}),(0,Z.jsx)(`span`,{className:b(`shrink-0 rounded-full px-2 py-0.5 text-xs`,dt(e.status)),children:i.status[e.status]})]}),(0,Z.jsx)(`p`,{className:b(`mt-1 line-clamp-2 pl-6 text-sm text-fg-muted`,e.error&&`text-red-700 dark:text-red-300`),children:e.error||e.summary||lt(e.actionSnapshot,i)})]},e.id))}),t[66]=i,t[67]=o,t[68]=u,t[69]=r,t[70]=B):B=t[70];let V;t[71]!==R||t[72]!==B?(V=(0,Z.jsxs)(`section`,{className:`min-w-0`,children:[R,B]}),t[71]=R,t[72]=B,t[73]=V):V=t[73];let H;t[74]!==I||t[75]!==V?(H=(0,Z.jsxs)(`div`,{className:`grid items-start gap-5 lg:grid-cols-[20rem_minmax(0,1fr)]`,children:[I,V]}),t[74]=I,t[75]=V,t[76]=H):H=t[76];let U;t[77]!==F||t[78]!==H?(U=(0,Z.jsxs)(`div`,{className:`grid gap-5 p-5`,children:[F,H]}),t[77]=F,t[78]=H,t[79]=U):U=t[79];let W;return t[80]!==D||t[81]!==U?(W=(0,Z.jsxs)(`article`,{className:`min-w-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel shadow-surface`,children:[D,U]}),t[80]=D,t[81]=U,t[82]=W):W=t[82],W}function It(e,t){return e===`suggest_only`?t.safety.suggestOnlyDescription:e===`ask_before_apply`?t.safety.askBeforeApplyDescription:t.safety.autoApplyDescription}function Lt(e){let t=(0,xe.c)(146),{automation:n,labels:r,cronLabels:i,language:a,projects:o}=e,s,c,l,u,d,f,p,m,h,g,_;if(t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a){let e=ut(n),o;t[15]!==n||t[16]!==r||t[17]!==a?(o=Ye(n,r,a),t[15]=n,t[16]=r,t[17]=a,t[18]=o):o=t[18];let v=o,y;t[19]!==n.state.nextRunAtMs||t[20]!==a?(y=n.state.nextRunAtMs?We(n.state.nextRunAtMs,a):void 0,t[19]=n.state.nextRunAtMs,t[20]=a,t[21]=y):y=t[21];let b=y;if(t[22]!==n.trigger.eventType||t[23]!==n.trigger.kind||t[24]!==n.trigger.schedule||t[25]!==n.trigger.secretId||t[26]!==n.trigger.source||t[27]!==r.info.anchor||t[28]!==r.info.calendarSchedule||t[29]!==r.info.eventSource||t[30]!==r.info.eventType||t[31]!==r.info.expression||t[32]!==r.info.fixedInterval||t[33]!==r.info.oneTimeSchedule||t[34]!==r.info.rawInterval||t[35]!==r.info.scheduleType||t[36]!==r.info.timezone||t[37]!==r.info.webhookSecret||t[38]!==a){if(_=[],n.trigger.kind===`schedule`){let e=n.trigger.schedule,i=e.kind===`interval`?r.info.fixedInterval:e.kind===`cron`?r.info.calendarSchedule:r.info.oneTimeSchedule,o;if(t[40]!==r.info.scheduleType||t[41]!==i?(o={label:r.info.scheduleType,value:i},t[40]=r.info.scheduleType,t[41]=i,t[42]=o):o=t[42],_.push(o),e.kind===`interval`){let n=`${e.everyMs} ms`,i;if(t[43]!==r.info.rawInterval||t[44]!==n?(i={label:r.info.rawInterval,value:n},t[43]=r.info.rawInterval,t[44]=n,t[45]=i):i=t[45],_.push(i),e.anchorMs){let n=r.info.anchor,i;t[46]!==a||t[47]!==e.anchorMs?(i=We(e.anchorMs,a),t[46]=a,t[47]=e.anchorMs,t[48]=i):i=t[48];let o;t[49]!==r.info.anchor||t[50]!==i?(o={label:n,value:i},t[49]=r.info.anchor,t[50]=i,t[51]=o):o=t[51],_.push(o)}}else if(e.kind===`cron`){let n;if(t[52]!==r.info.expression||t[53]!==e.expr?(n={label:r.info.expression,value:e.expr},t[52]=r.info.expression,t[53]=e.expr,t[54]=n):n=t[54],_.push(n),e.tz){let n;t[55]!==r.info.timezone||t[56]!==e.tz?(n={label:r.info.timezone,value:e.tz},t[55]=r.info.timezone,t[56]=e.tz,t[57]=n):n=t[57],_.push(n)}}else{let n;t[58]!==r.info.oneTimeSchedule||t[59]!==e.at?(n={label:r.info.oneTimeSchedule,value:e.at},t[58]=r.info.oneTimeSchedule,t[59]=e.at,t[60]=n):n=t[60],_.push(n)}}else if(n.trigger.kind===`event`){let e;if(t[61]!==n.trigger.eventType||t[62]!==r.info.eventType?(e={label:r.info.eventType,value:n.trigger.eventType},t[61]=n.trigger.eventType,t[62]=r.info.eventType,t[63]=e):e=t[63],_.push(e),n.trigger.source){let e;t[64]!==n.trigger.source||t[65]!==r.info.eventSource?(e={label:r.info.eventSource,value:n.trigger.source},t[64]=n.trigger.source,t[65]=r.info.eventSource,t[66]=e):e=t[66],_.push(e)}}else if(n.trigger.kind===`webhook`&&n.trigger.secretId){let e;t[67]!==n.trigger.secretId||t[68]!==r.info.webhookSecret?(e={label:r.info.webhookSecret,value:n.trigger.secretId},t[67]=n.trigger.secretId,t[68]=r.info.webhookSecret,t[69]=e):e=t[69],_.push(e)}t[22]=n.trigger.eventType,t[23]=n.trigger.kind,t[24]=n.trigger.schedule,t[25]=n.trigger.secretId,t[26]=n.trigger.source,t[27]=r.info.anchor,t[28]=r.info.calendarSchedule,t[29]=r.info.eventSource,t[30]=r.info.eventType,t[31]=r.info.expression,t[32]=r.info.fixedInterval,t[33]=r.info.oneTimeSchedule,t[34]=r.info.rawInterval,t[35]=r.info.scheduleType,t[36]=r.info.timezone,t[37]=r.info.webhookSecret,t[38]=a,t[39]=_}else _=t[39];h=`h-fit overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,t[70]===r.info.overview?g=t[71]:(g=(0,Z.jsx)(`div`,{className:`border-b border-edge-subtle px-4 py-3`,children:(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.info.overview})}),t[70]=r.info.overview,t[71]=g),f=`grid gap-4 p-4`;let x;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t[72]=x):x=t[72];let S=r.info.schedule,C;t[73]!==n.trigger||t[74]!==i||t[75]!==r||t[76]!==a?(C=Je(n.trigger,r,i,a),t[73]=n.trigger,t[74]=i,t[75]=r,t[76]=a,t[77]=C):C=t[77];let ee=n.enabled?`${r.info.nextRun}:${v}`:v;t[78]!==r.info.schedule||t[79]!==b||t[80]!==C||t[81]!==ee?(p=(0,Z.jsx)(zt,{icon:x,label:S,value:C,description:ee,descriptionTitle:b}),t[78]=r.info.schedule,t[79]=b,t[80]=C,t[81]=ee,t[82]=p):p=t[82];let w;t[83]===n.action.kind?w=t[84]:(w=n.action.kind===`workflow`?(0,Z.jsx)(T,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`browser_automation`?(0,Z.jsx)(ae,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(re,{className:`size-4`,"aria-hidden":!0}),t[83]=n.action.kind,t[84]=w);let te=r.info.action,E;t[85]!==n.action||t[86]!==r?(E=lt(n.action,r),t[85]=n.action,t[86]=r,t[87]=E):E=t[87],t[88]!==r.info.action||t[89]!==w||t[90]!==E?(m=(0,Z.jsx)(zt,{icon:w,label:te,value:E}),t[88]=r.info.action,t[89]=w,t[90]=E,t[91]=m):m=t[91],s=zt,t[92]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[92]=c):c=t[92],l=r.info.permission,u=r.safety[e],d=It(e,r),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_}else s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14];let v;t[93]!==s||t[94]!==c||t[95]!==l||t[96]!==u||t[97]!==d?(v=(0,Z.jsx)(s,{icon:c,label:l,value:u,description:d}),t[93]=s,t[94]=c,t[95]=l,t[96]=u,t[97]=d,t[98]=v):v=t[98];let y;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[99]=y):y=t[99];let b;t[100]!==n.projectId||t[101]!==r.info.noProject||t[102]!==o?(b=o.find(e=>e.id===n.projectId)?.name??r.info.noProject,t[100]=n.projectId,t[101]=r.info.noProject,t[102]=o,t[103]=b):b=t[103];let x;t[104]!==r.info.project||t[105]!==b?(x=(0,Z.jsx)(zt,{icon:y,label:r.info.project,value:b}),t[104]=r.info.project,t[105]=b,t[106]=x):x=t[106];let S;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),t[107]=S):S=t[107];let C=n.conversationMode===`continuous`?r.info.continuousConversation:r.info.newConversation,ee;t[108]!==r.info.conversation||t[109]!==C?(ee=(0,Z.jsx)(zt,{icon:S,label:r.info.conversation,value:C}),t[108]=r.info.conversation,t[109]=C,t[110]=ee):ee=t[110];let w;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(L,{className:`size-4`,"aria-hidden":!0}),t[111]=w):w=t[111];let te=n.notificationPolicy===`all`?r.info.notifyAll:n.notificationPolicy===`none`?r.info.notifyNone:r.info.notifyAttention,ie;t[112]!==r.info.notifications||t[113]!==te?(ie=(0,Z.jsx)(zt,{icon:w,label:r.info.notifications,value:te}),t[112]=r.info.notifications,t[113]=te,t[114]=ie):ie=t[114];let oe;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(E,{className:`size-4`,"aria-hidden":!0}),t[115]=oe):oe=t[115];let D=r.info.lastRun,O;t[116]!==n||t[117]!==r||t[118]!==a?(O=Xe(n,r,a),t[116]=n,t[117]=r,t[118]=a,t[119]=O):O=t[119];let A=n.state.lastRunStatus===`failed`||n.state.lastRunStatus===`timeout`?`danger`:`default`,j;t[120]!==r.info.lastRun||t[121]!==O||t[122]!==A?(j=(0,Z.jsx)(zt,{icon:oe,label:D,value:O,valueTone:A}),t[120]=r.info.lastRun,t[121]=O,t[122]=A,t[123]=j):j=t[123];let M;t[124]!==n.state.consecutiveFailures||t[125]!==n.state.lastError||t[126]!==r.dashboard?(M=n.state.consecutiveFailures?(0,Z.jsxs)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:[r.dashboard.failures,`:`,n.state.consecutiveFailures,n.state.lastError?(0,Z.jsx)(`p`,{className:`mt-1 break-words text-xs`,children:n.state.lastError}):null]}):n.state.lastError?(0,Z.jsx)(`p`,{className:`break-words text-sm text-red-700 dark:text-red-300`,children:n.state.lastError}):null,t[124]=n.state.consecutiveFailures,t[125]=n.state.lastError,t[126]=r.dashboard,t[127]=M):M=t[127];let se;t[128]!==r.info.technicalDetails||t[129]!==_?(se=_.length>0?(0,Z.jsxs)(`details`,{className:`group border-t border-edge-subtle pt-3`,children:[(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 text-sm text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,Z.jsx)(`span`,{children:r.info.technicalDetails}),(0,Z.jsx)(ue,{className:`size-4 transition-transform group-open:rotate-180`,"aria-hidden":!0})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2`,children:_.map(Rt)})]}):null,t[128]=r.info.technicalDetails,t[129]=_,t[130]=se):se=t[130];let P;t[131]!==v||t[132]!==x||t[133]!==ee||t[134]!==ie||t[135]!==j||t[136]!==M||t[137]!==se||t[138]!==f||t[139]!==p||t[140]!==m?(P=(0,Z.jsxs)(`div`,{className:f,children:[p,m,v,x,ee,ie,j,M,se]}),t[131]=v,t[132]=x,t[133]=ee,t[134]=ie,t[135]=j,t[136]=M,t[137]=se,t[138]=f,t[139]=p,t[140]=m,t[141]=P):P=t[141];let F;return t[142]!==P||t[143]!==h||t[144]!==g?(F=(0,Z.jsxs)(`aside`,{className:h,children:[g,P]}),t[142]=P,t[143]=h,t[144]=g,t[145]=F):F=t[145],F}function Rt(e){return(0,Z.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.label}),(0,Z.jsx)(`span`,{className:`break-all font-mono text-xs text-fg-muted`,children:e.value})]},`${e.label}:${e.value}`)}function zt(e){let t=(0,xe.c)(19),{icon:n,label:r,value:i,description:a,descriptionTitle:o,valueTone:s}=e,c=s===void 0?`default`:s,l;t[0]===n?l=t[1]:(l=(0,Z.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:n}),t[0]=n,t[1]=l);let u;t[2]===r?u=t[3]:(u=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=u);let d=c===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,f;t[4]===d?f=t[5]:(f=b(`mt-1 text-sm font-medium leading-5`,d),t[4]=d,t[5]=f);let p;t[6]!==f||t[7]!==i?(p=(0,Z.jsx)(`div`,{className:f,children:i}),t[6]=f,t[7]=i,t[8]=p):p=t[8];let m;t[9]!==a||t[10]!==o?(m=a?(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,title:o,children:a}):null,t[9]=a,t[10]=o,t[11]=m):m=t[11];let h;t[12]!==u||t[13]!==p||t[14]!==m?(h=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[u,p,m]}),t[12]=u,t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==l||t[17]!==h?(g=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[1.25rem_1fr] gap-2.5`,children:[l,h]}),t[16]=l,t[17]=h,t[18]=g):g=t[18],g}function Bt(e){let t=(0,xe.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[5rem_1fr] gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Vt(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function Ht(e){let t=(0,xe.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`div`,{className:`text-xs font-medium uppercase text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(`div`,{className:`mt-1 truncate text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ut(e){let t=(0,xe.c)(8),{className:n,icon:r,title:i}=e,a;t[0]===n?a=t[1]:(a=b(`flex min-h-48 flex-col items-center justify-center text-fg-muted`,n),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=(0,Z.jsx)(`div`,{className:`mt-2 text-sm`,children:i}),t[2]=i,t[3]=o);let s;return t[4]!==r||t[5]!==a||t[6]!==o?(s=(0,Z.jsxs)(`div`,{className:a,children:[r,o]}),t[4]=r,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Wt(e){let t=(0,xe.c)(274),{form:n,labels:r,setForm:i,projects:a,workflowDefinitions:o,selectedWorkflow:s,workflowsLoading:c,browserAutomations:l,selectedBrowserAutomation:u,browserAutomationsLoading:d,agentOptions:m,agentsLoading:h,language:g,projectLocked:_}=e,y=_===void 0?!1:_,x=v(g).agentsSettings,S;t[0]===i?S=t[1]:(S=e=>i(t=>({...t,...e})),t[0]=i,t[1]=S);let C=S,w=Be(n.intervalValue,n.intervalUnit),te=Date.now(),T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=[1,2,3],t[2]=T):T=t[2];let E;t[3]!==w||t[4]!==te||t[5]!==g?(E=T.map(e=>Ke(te+w*e,g,te)),t[3]=w,t[4]=te,t[5]=g,t[6]=E):E=t[6];let ne=E,re,ie;t[7]!==n.actionMode||t[8]!==n.workflowId||t[9]!==i||t[10]!==o?(re=()=>{if(n.actionMode!==`workflow`||n.workflowId.trim())return;let e=o[0]?.id;e&&i(t=>({...t,workflowId:e,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}))},ie=[n.actionMode,n.workflowId,i,o],t[7]=n.actionMode,t[8]=n.workflowId,t[9]=i,t[10]=o,t[11]=re,t[12]=ie):(re=t[11],ie=t[12]),(0,K.useEffect)(re,ie);let ae,oe;t[13]!==l||t[14]!==n.actionMode||t[15]!==n.browserAutomationId||t[16]!==i?(ae=()=>{if(n.actionMode!==`browser_automation`||n.browserAutomationId.trim())return;let e=l[0];e&&i(t=>({...t,browserAutomationId:e.id,browserAutomationInputs:be(e)}))},oe=[l,n.actionMode,n.browserAutomationId,i],t[13]=l,t[14]=n.actionMode,t[15]=n.browserAutomationId,t[16]=i,t[17]=ae,t[18]=oe):(ae=t[17],oe=t[18]),(0,K.useEffect)(ae,oe);let D;t[19]===C?D=t[20]:(D=e=>C({name:e.target.value}),t[19]=C,t[20]=D);let O;t[21]!==n.name||t[22]!==D?(O=(0,Z.jsx)(`input`,{className:Q,value:n.name,onChange:D}),t[21]=n.name,t[22]=D,t[23]=O):O=t[23];let k;t[24]!==r.form.name||t[25]!==O?(k=(0,Z.jsx)($,{label:r.form.name,children:O}),t[24]=r.form.name,t[25]=O,t[26]=k):k=t[26];let A;t[27]===C?A=t[28]:(A=e=>C({description:e.target.value}),t[27]=C,t[28]=A);let j;t[29]!==n.description||t[30]!==A?(j=(0,Z.jsx)(`input`,{className:Q,value:n.description,onChange:A}),t[29]=n.description,t[30]=A,t[31]=j):j=t[31];let M;t[32]!==r.form.description||t[33]!==j?(M=(0,Z.jsx)($,{label:r.form.description,children:j}),t[32]=r.form.description,t[33]=j,t[34]=M):M=t[34];let N;t[35]!==n.projectId||t[36]!==r.form.noProject||t[37]!==r.form.project||t[38]!==y||t[39]!==a||t[40]!==C?(N=y?null:(0,Z.jsx)($,{label:r.form.project,children:(0,Z.jsxs)(f,{className:Q,value:n.projectId,onChange:e=>C({projectId:e.target.value}),children:[(0,Z.jsx)(p,{value:``,children:r.form.noProject}),a.map(qt)]})}),t[35]=n.projectId,t[36]=r.form.noProject,t[37]=r.form.project,t[38]=y,t[39]=a,t[40]=C,t[41]=N):N=t[41];let se;t[42]===r.form.trigger?se=t[43]:(se=(0,Z.jsx)(Jt,{title:r.form.trigger}),t[42]=r.form.trigger,t[43]=se);let P;t[44]===C?P=t[45]:(P=e=>C({triggerMode:e.target.value}),t[44]=C,t[45]=P);let F;t[46]===r.trigger.manual?F=t[47]:(F=(0,Z.jsx)(p,{value:`manual`,children:r.trigger.manual}),t[46]=r.trigger.manual,t[47]=F);let ce;t[48]===r.trigger.once?ce=t[49]:(ce=(0,Z.jsx)(p,{value:`once`,children:r.trigger.once}),t[48]=r.trigger.once,t[49]=ce);let I;t[50]===r.trigger.daily?I=t[51]:(I=(0,Z.jsx)(p,{value:`daily`,children:r.trigger.daily}),t[50]=r.trigger.daily,t[51]=I);let le;t[52]===r.trigger.weekly?le=t[53]:(le=(0,Z.jsx)(p,{value:`weekly`,children:r.trigger.weekly}),t[52]=r.trigger.weekly,t[53]=le);let de;t[54]===r.trigger.interval?de=t[55]:(de=(0,Z.jsx)(p,{value:`interval`,children:r.trigger.interval}),t[54]=r.trigger.interval,t[55]=de);let fe;t[56]===r.trigger.customCron?fe=t[57]:(fe=(0,Z.jsx)(p,{value:`cron`,children:r.trigger.customCron}),t[56]=r.trigger.customCron,t[57]=fe);let L;t[58]===r.trigger.webhook?L=t[59]:(L=(0,Z.jsx)(p,{value:`webhook`,children:r.trigger.webhook}),t[58]=r.trigger.webhook,t[59]=L);let pe;t[60]===r.trigger.taskBlocked?pe=t[61]:(pe=(0,Z.jsx)(p,{value:`taskBlocked`,children:r.trigger.taskBlocked}),t[60]=r.trigger.taskBlocked,t[61]=pe);let R;t[62]===r.trigger.noteCreated?R=t[63]:(R=(0,Z.jsx)(p,{value:`noteCreated`,children:r.trigger.noteCreated}),t[62]=r.trigger.noteCreated,t[63]=R);let z;t[64]===r.trigger.workflowFailed?z=t[65]:(z=(0,Z.jsx)(p,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[64]=r.trigger.workflowFailed,t[65]=z);let B;t[66]===r.trigger.sessionUpdated?B=t[67]:(B=(0,Z.jsx)(p,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[66]=r.trigger.sessionUpdated,t[67]=B);let V;t[68]===r.trigger.customEvent?V=t[69]:(V=(0,Z.jsx)(p,{value:`event`,children:r.trigger.customEvent}),t[68]=r.trigger.customEvent,t[69]=V);let U;t[70]!==n.triggerMode||t[71]!==P||t[72]!==F||t[73]!==ce||t[74]!==I||t[75]!==le||t[76]!==de||t[77]!==fe||t[78]!==L||t[79]!==pe||t[80]!==R||t[81]!==z||t[82]!==B||t[83]!==V?(U=(0,Z.jsxs)(f,{className:Q,value:n.triggerMode,onChange:P,children:[F,ce,I,le,de,fe,L,pe,R,z,B,V]}),t[70]=n.triggerMode,t[71]=P,t[72]=F,t[73]=ce,t[74]=I,t[75]=le,t[76]=de,t[77]=fe,t[78]=L,t[79]=pe,t[80]=R,t[81]=z,t[82]=B,t[83]=V,t[84]=U):U=t[84];let me;t[85]!==n.onceAt||t[86]!==n.triggerMode||t[87]!==r.form.onceAt||t[88]!==C?(me=n.triggerMode===`once`?(0,Z.jsx)($,{label:r.form.onceAt,children:(0,Z.jsx)(`input`,{className:Q,type:`datetime-local`,value:n.onceAt,onChange:e=>C({onceAt:e.target.value})})}):null,t[85]=n.onceAt,t[86]=n.triggerMode,t[87]=r.form.onceAt,t[88]=C,t[89]=me):me=t[89];let he;t[90]!==n.time||t[91]!==n.triggerMode||t[92]!==n.weekday||t[93]!==r.form.day||t[94]!==r.form.time||t[95]!==r.weekdays||t[96]!==C?(he=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:r.form.time,children:(0,Z.jsx)(H,{value:n.time,onChange:e=>C({time:e}),ariaLabel:r.form.time})}),n.triggerMode===`weekly`?(0,Z.jsx)($,{label:r.form.day,children:(0,Z.jsxs)(f,{className:Q,value:n.weekday,onChange:e=>C({weekday:e.target.value}),children:[(0,Z.jsx)(p,{value:`1`,children:r.weekdays.monday}),(0,Z.jsx)(p,{value:`2`,children:r.weekdays.tuesday}),(0,Z.jsx)(p,{value:`3`,children:r.weekdays.wednesday}),(0,Z.jsx)(p,{value:`4`,children:r.weekdays.thursday}),(0,Z.jsx)(p,{value:`5`,children:r.weekdays.friday}),(0,Z.jsx)(p,{value:`6`,children:r.weekdays.saturday}),(0,Z.jsx)(p,{value:`0`,children:r.weekdays.sunday})]})}):null]}):null,t[90]=n.time,t[91]=n.triggerMode,t[92]=n.weekday,t[93]=r.form.day,t[94]=r.form.time,t[95]=r.weekdays,t[96]=C,t[97]=he):he=t[97];let ge=n.triggerMode===`interval`?(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,Z.jsx)($,{label:r.form.intervalEvery,children:(0,Z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,Z.jsx)(`input`,{className:Q,type:`number`,min:6e4/Be(1,n.intervalUnit),step:`any`,inputMode:`decimal`,value:n.intervalValue,onChange:e=>C({intervalValue:e.target.value})}),(0,Z.jsxs)(f,{className:Q,value:n.intervalUnit,onChange:e=>{let t=e.target.value;C({intervalValue:Ve(n.intervalValue,n.intervalUnit,t),intervalUnit:t})},children:[(0,Z.jsx)(p,{value:`minute`,children:r.form.intervalUnits.minute}),(0,Z.jsx)(p,{value:`hour`,children:r.form.intervalUnits.hour}),(0,Z.jsx)(p,{value:`day`,children:r.form.intervalUnits.day}),(0,Z.jsx)(p,{value:`week`,children:r.form.intervalUnits.week})]})]})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.form.commonIntervals}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Qe.map(e=>{let t=Be(e.value,e.unit),n=t===w;return(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":n,className:b(`rounded-full border px-2.5 py-1 text-xs transition-colors`,n?`border-accent bg-accent/10 text-accent`:`border-edge-subtle text-fg-muted hover:border-edge hover:bg-surface-hover hover:text-fg`),onClick:()=>C({intervalValue:e.value,intervalUnit:e.unit}),children:He(t,g)},`${e.value}:${e.unit}`)})})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:Ue(w,g)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[r.form.nextThreeRuns,`:`,ne.join(g===`zh`?`、`:`, `)]}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:r.form.fixedIntervalHint})]})]}):null,ve;t[98]!==n.cronExpr||t[99]!==n.triggerMode||t[100]!==r.form.expression||t[101]!==C?(ve=n.triggerMode===`cron`?(0,Z.jsx)($,{label:r.form.expression,children:(0,Z.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>C({cronExpr:e.target.value})})}):null,t[98]=n.cronExpr,t[99]=n.triggerMode,t[100]=r.form.expression,t[101]=C,t[102]=ve):ve=t[102];let ye;t[103]!==n.triggerMode||t[104]!==n.webhookSecretId||t[105]!==r.form.secretId||t[106]!==C?(ye=n.triggerMode===`webhook`?(0,Z.jsx)($,{label:r.form.secretId,children:(0,Z.jsx)(`input`,{className:Q,value:n.webhookSecretId,onChange:e=>C({webhookSecretId:e.target.value})})}):null,t[103]=n.triggerMode,t[104]=n.webhookSecretId,t[105]=r.form.secretId,t[106]=C,t[107]=ye):ye=t[107];let Se;t[108]!==n.eventPayloadMatch||t[109]!==n.eventSource||t[110]!==n.eventType||t[111]!==n.triggerMode||t[112]!==r.form.eventPayloadMatch||t[113]!==r.form.eventSource||t[114]!==r.form.eventType||t[115]!==r.form.invalidJsonObject||t[116]!==C?(Se=n.triggerMode===`event`?(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:r.form.eventType,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventType,onChange:e=>C({eventType:e.target.value})})}),(0,Z.jsx)($,{label:r.form.eventSource,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventSource,onChange:e=>C({eventSource:e.target.value})})})]}),(0,Z.jsxs)($,{label:r.form.eventPayloadMatch,children:[(0,Z.jsx)(`textarea`,{className:b(Q,`min-h-24 resize-y font-mono text-xs`),value:n.eventPayloadMatch,onChange:e=>C({eventPayloadMatch:e.target.value}),placeholder:`{
5
- "status": "blocked"
6
- }`}),at(n.eventPayloadMatch)?null:(0,Z.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-300`,children:r.form.invalidJsonObject})]})]}):null,t[108]=n.eventPayloadMatch,t[109]=n.eventSource,t[110]=n.eventType,t[111]=n.triggerMode,t[112]=r.form.eventPayloadMatch,t[113]=r.form.eventSource,t[114]=r.form.eventType,t[115]=r.form.invalidJsonObject,t[116]=C,t[117]=Se):Se=t[117];let q;t[118]===r.form.action?q=t[119]:(q=(0,Z.jsx)(Jt,{title:r.form.action}),t[118]=r.form.action,t[119]=q);let Ce;t[120]!==n.timeoutSeconds||t[121]!==n.workflowId||t[122]!==C||t[123]!==o?(Ce=e=>{let t=e.target.value,r=Number.parseInt(n.timeoutSeconds,10);C({actionMode:t,...r===600||r===1800?{timeoutSeconds:t===`browser_automation`?`600`:`1800`}:{},...t===`browser_automation`?{safetyMode:`auto_apply`}:{},...t===`workflow`&&!n.workflowId.trim()&&o[0]?{workflowId:o[0].id,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}:{}})},t[120]=n.timeoutSeconds,t[121]=n.workflowId,t[122]=C,t[123]=o,t[124]=Ce):Ce=t[124];let we;t[125]===r.action.runAgent?we=t[126]:(we=(0,Z.jsx)(p,{value:`agent`,children:r.action.runAgent}),t[125]=r.action.runAgent,t[126]=we);let Te;t[127]===r.action.runWorkflow?Te=t[128]:(Te=(0,Z.jsx)(p,{value:`workflow`,children:r.action.runWorkflow}),t[127]=r.action.runWorkflow,t[128]=Te);let Ee=g===`zh`?`浏览器自动化`:`Browser automation`,De;t[129]===Ee?De=t[130]:(De=(0,Z.jsx)(p,{value:`browser_automation`,children:Ee}),t[129]=Ee,t[130]=De);let J;t[131]!==n.actionMode||t[132]!==Ce||t[133]!==we||t[134]!==Te||t[135]!==De?(J=(0,Z.jsxs)(f,{className:Q,value:n.actionMode,onChange:Ce,children:[we,Te,De]}),t[131]=n.actionMode,t[132]=Ce,t[133]=we,t[134]=Te,t[135]=De,t[136]=J):J=t[136];let Oe=n.actionMode===`browser_automation`?null:(0,Z.jsx)($,{label:r.form.agent,children:(0,Z.jsxs)(f,{className:Q,value:n.agentId,onChange:e=>C({agentId:e.target.value}),children:[(0,Z.jsx)(p,{value:``,children:h?r.form.loadingAgents:r.form.defaultAgent}),m.map(e=>(0,Z.jsx)(p,{value:e.id,children:ee(e,x)},e.id))]})}),ke;t[137]!==l||t[138]!==d||t[139]!==n.actionMode||t[140]!==n.agentId||t[141]!==n.browserAutomationId||t[142]!==n.browserAutomationInputs||t[143]!==n.description||t[144]!==n.instruction||t[145]!==n.name||t[146]!==n.triggerMode||t[147]!==n.workflowId||t[148]!==n.workflowInput||t[149]!==r.form.instruction||t[150]!==r.form.loadingWorkflows||t[151]!==r.form.noWorkflows||t[152]!==r.form.triggeredRun||t[153]!==r.form.workflow||t[154]!==g||t[155]!==u||t[156]!==s||t[157]!==C||t[158]!==o||t[159]!==c?(ke=n.actionMode===`agent`?(0,Z.jsxs)($,{label:r.form.instruction,children:[(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(W,{value:n.instruction,onApply:e=>C({instruction:e}),fieldId:`automation.instruction`,fieldLabel:r.form.instruction,scenario:`automation.instruction`,locale:g,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,agentId:n.agentId},showLabel:!1})}),(0,Z.jsx)(`textarea`,{className:b(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>C({instruction:e.target.value})})]}):n.actionMode===`workflow`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:r.form.workflow,children:(0,Z.jsxs)(f,{className:Q,value:n.workflowId,onChange:e=>C({workflowId:e.target.value,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}),disabled:c||o.length===0,children:[c?(0,Z.jsx)(p,{value:``,children:r.form.loadingWorkflows}):null,!c&&o.length===0?(0,Z.jsx)(p,{value:``,children:r.form.noWorkflows}):null,o.map(Kt)]})}),s?(0,Z.jsx)(_e,{definition:s,language:g,value:n.workflowInput,onChange:e=>C({workflowInput:e,workflowGoal:e.goal,workflowInputValid:!0}),mode:`automation`,badgeLabel:r.form.triggeredRun,onValidityChange:e=>C({workflowInputValid:e.valid}),aiAssist:{inputScenario:`automation.workflowInput`,goalScenario:`automation.workflowGoal`,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,workflowId:s.id,workflowTitle:s.title,workflowDescription:s.description}},inputClassName:`rounded-lg`}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:g===`zh`?`浏览器自动化`:`Browser automation`,children:(0,Z.jsxs)(f,{className:Q,value:n.browserAutomationId,onChange:e=>{let t=l.find(t=>t.id===e.target.value);C({browserAutomationId:e.target.value,browserAutomationInputs:t?be(t):{}})},disabled:d||l.length===0,children:[l.length===0?(0,Z.jsx)(p,{value:``,children:g===`zh`?`没有已启用的浏览器自动化`:`No enabled browser automations`}):null,l.map(Gt)]})}),u&&Object.keys(u.inputs).length>0?(0,Z.jsx)($,{label:g===`zh`?`运行时填写`:`Run inputs`,children:(0,Z.jsx)(G,{automation:u,values:n.browserAutomationInputs,language:g,onChange:e=>C({browserAutomationInputs:e})})}):null]}),t[137]=l,t[138]=d,t[139]=n.actionMode,t[140]=n.agentId,t[141]=n.browserAutomationId,t[142]=n.browserAutomationInputs,t[143]=n.description,t[144]=n.instruction,t[145]=n.name,t[146]=n.triggerMode,t[147]=n.workflowId,t[148]=n.workflowInput,t[149]=r.form.instruction,t[150]=r.form.loadingWorkflows,t[151]=r.form.noWorkflows,t[152]=r.form.triggeredRun,t[153]=r.form.workflow,t[154]=g,t[155]=u,t[156]=s,t[157]=C,t[158]=o,t[159]=c,t[160]=ke):ke=t[160];let Y;t[161]===r.form.advancedDescription?Y=t[162]:(Y=(0,Z.jsx)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:r.form.advancedDescription}),t[161]=r.form.advancedDescription,t[162]=Y);let X;t[163]!==r.form.advanced||t[164]!==Y?(X=(0,Z.jsxs)(`span`,{children:[r.form.advanced,Y]}),t[163]=r.form.advanced,t[164]=Y,t[165]=X):X=t[165];let Ae;t[166]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,Z.jsx)(ue,{className:`size-4 transition-transform group-open:rotate-180`}),t[166]=Ae):Ae=t[166];let je;t[167]===X?je=t[168]:(je=(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[X,Ae]}),t[167]=X,t[168]=je);let Me;t[169]!==n.actionMode||t[170]!==n.safetyMode||t[171]!==r.form.safety||t[172]!==r.safety||t[173]!==C?(Me=n.actionMode===`browser_automation`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Jt,{title:r.form.safety}),(0,Z.jsxs)($,{label:r.form.safety,children:[(0,Z.jsxs)(f,{className:Q,value:n.safetyMode,onChange:e=>{let t=e.target.value;C({safetyMode:t})},children:[(0,Z.jsx)(p,{value:`suggest_only`,children:r.safety.suggest_only}),(0,Z.jsx)(p,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),(0,Z.jsx)(p,{value:`auto_apply`,children:r.safety.auto_apply})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.safetyMode===`suggest_only`?r.safety.suggestOnlyDescription:n.safetyMode===`ask_before_apply`?r.safety.askBeforeApplyDescription:r.safety.autoApplyDescription})]})]}),t[169]=n.actionMode,t[170]=n.safetyMode,t[171]=r.form.safety,t[172]=r.safety,t[173]=C,t[174]=Me):Me=t[174];let Ne;t[175]===r.form.results?Ne=t[176]:(Ne=(0,Z.jsx)(Jt,{title:r.form.results}),t[175]=r.form.results,t[176]=Ne);let Pe;t[177]===C?Pe=t[178]:(Pe=e=>C({conversationMode:e.target.value}),t[177]=C,t[178]=Pe);let Fe;t[179]===r.form.newConversation?Fe=t[180]:(Fe=(0,Z.jsx)(p,{value:`new_session`,children:r.form.newConversation}),t[179]=r.form.newConversation,t[180]=Fe);let Ie;t[181]===r.form.continuousConversation?Ie=t[182]:(Ie=(0,Z.jsx)(p,{value:`continuous`,children:r.form.continuousConversation}),t[181]=r.form.continuousConversation,t[182]=Ie);let Le;t[183]!==n.conversationMode||t[184]!==Pe||t[185]!==Fe||t[186]!==Ie?(Le=(0,Z.jsxs)(f,{className:Q,value:n.conversationMode,onChange:Pe,children:[Fe,Ie]}),t[183]=n.conversationMode,t[184]=Pe,t[185]=Fe,t[186]=Ie,t[187]=Le):Le=t[187];let Re;t[188]!==r.form.conversation||t[189]!==Le?(Re=(0,Z.jsx)($,{label:r.form.conversation,children:Le}),t[188]=r.form.conversation,t[189]=Le,t[190]=Re):Re=t[190];let ze;t[191]===C?ze=t[192]:(ze=e=>C({notificationPolicy:e.target.value}),t[191]=C,t[192]=ze);let We;t[193]===r.form.notifyAttention?We=t[194]:(We=(0,Z.jsx)(p,{value:`attention`,children:r.form.notifyAttention}),t[193]=r.form.notifyAttention,t[194]=We);let Ge;t[195]===r.form.notifyAll?Ge=t[196]:(Ge=(0,Z.jsx)(p,{value:`all`,children:r.form.notifyAll}),t[195]=r.form.notifyAll,t[196]=Ge);let qe;t[197]===r.form.notifyNone?qe=t[198]:(qe=(0,Z.jsx)(p,{value:`none`,children:r.form.notifyNone}),t[197]=r.form.notifyNone,t[198]=qe);let Je;t[199]!==n.notificationPolicy||t[200]!==ze||t[201]!==We||t[202]!==Ge||t[203]!==qe?(Je=(0,Z.jsxs)(f,{className:Q,value:n.notificationPolicy,onChange:ze,children:[We,Ge,qe]}),t[199]=n.notificationPolicy,t[200]=ze,t[201]=We,t[202]=Ge,t[203]=qe,t[204]=Je):Je=t[204];let Ye;t[205]!==r.form.notifications||t[206]!==Je?(Ye=(0,Z.jsx)($,{label:r.form.notifications,children:Je}),t[205]=r.form.notifications,t[206]=Je,t[207]=Ye):Ye=t[207];let Xe;t[208]!==n.completionWebhookUrl||t[209]!==n.safetyMode||t[210]!==r.form.completionWebhook||t[211]!==C?(Xe=n.safetyMode===`auto_apply`?(0,Z.jsx)($,{label:r.form.completionWebhook,children:(0,Z.jsx)(`input`,{className:Q,value:n.completionWebhookUrl,onChange:e=>C({completionWebhookUrl:e.target.value})})}):null,t[208]=n.completionWebhookUrl,t[209]=n.safetyMode,t[210]=r.form.completionWebhook,t[211]=C,t[212]=Xe):Xe=t[212];let Ze;t[213]===r.form.reliability?Ze=t[214]:(Ze=(0,Z.jsx)(Jt,{title:r.form.reliability}),t[213]=r.form.reliability,t[214]=Ze);let $e;t[215]===C?$e=t[216]:($e=e=>C({timeoutSeconds:e.target.value}),t[215]=C,t[216]=$e);let et;t[217]!==n.timeoutSeconds||t[218]!==$e?(et=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.timeoutSeconds,onChange:$e}),t[217]=n.timeoutSeconds,t[218]=$e,t[219]=et):et=t[219];let tt;t[220]!==r.form.timeoutSeconds||t[221]!==et?(tt=(0,Z.jsx)($,{label:r.form.timeoutSeconds,children:et}),t[220]=r.form.timeoutSeconds,t[221]=et,t[222]=tt):tt=t[222];let nt;t[223]===C?nt=t[224]:(nt=e=>C({disableAfterFailures:e.target.value}),t[223]=C,t[224]=nt);let rt;t[225]!==n.disableAfterFailures||t[226]!==nt?(rt=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.disableAfterFailures,onChange:nt}),t[225]=n.disableAfterFailures,t[226]=nt,t[227]=rt):rt=t[227];let it;t[228]!==r.form.disableAfterFailures||t[229]!==rt?(it=(0,Z.jsx)($,{label:r.form.disableAfterFailures,children:rt}),t[228]=r.form.disableAfterFailures,t[229]=rt,t[230]=it):it=t[230];let ot;t[231]!==tt||t[232]!==it?(ot=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[tt,it]}),t[231]=tt,t[232]=it,t[233]=ot):ot=t[233];let st;t[234]===r.form.effectivePolicy?st=t[235]:(st=(0,Z.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.form.effectivePolicy}),t[234]=r.form.effectivePolicy,t[235]=st);let ct=n.timeoutSeconds||`—`,lt;t[236]!==r.form.executionDeadline||t[237]!==ct?(lt=(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[r.form.executionDeadline,`: `,ct,`s`]}),t[236]=r.form.executionDeadline,t[237]=ct,t[238]=lt):lt=t[238];let ut;t[239]===r.form.downstreamTimeoutHint?ut=t[240]:(ut=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-fg-subtle`,children:r.form.downstreamTimeoutHint}),t[239]=r.form.downstreamTimeoutHint,t[240]=ut);let dt;t[241]!==st||t[242]!==lt||t[243]!==ut?(dt=(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-muted/40 px-3 py-2.5`,children:[st,lt,ut]}),t[241]=st,t[242]=lt,t[243]=ut,t[244]=dt):dt=t[244];let ft;t[245]!==Me||t[246]!==Ne||t[247]!==Re||t[248]!==Ye||t[249]!==Xe||t[250]!==Ze||t[251]!==ot||t[252]!==dt?(ft=(0,Z.jsxs)(`div`,{className:`grid gap-4 border-t border-edge-subtle p-4`,children:[Me,Ne,Re,Ye,Xe,Ze,ot,dt]}),t[245]=Me,t[246]=Ne,t[247]=Re,t[248]=Ye,t[249]=Xe,t[250]=Ze,t[251]=ot,t[252]=dt,t[253]=ft):ft=t[253];let pt;t[254]!==je||t[255]!==ft?(pt=(0,Z.jsxs)(`details`,{className:`group rounded-xl border border-edge-subtle bg-surface-base`,children:[je,ft]}),t[254]=je,t[255]=ft,t[256]=pt):pt=t[256];let mt;return t[257]!==k||t[258]!==M||t[259]!==N||t[260]!==se||t[261]!==U||t[262]!==me||t[263]!==he||t[264]!==ge||t[265]!==ve||t[266]!==ye||t[267]!==Se||t[268]!==q||t[269]!==J||t[270]!==Oe||t[271]!==ke||t[272]!==pt?(mt=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,Z.jsxs)(`div`,{className:`grid gap-4`,children:[k,M,N,se,U,me,he,ge,ve,ye,Se,q,J,Oe,ke,pt]})}),t[257]=k,t[258]=M,t[259]=N,t[260]=se,t[261]=U,t[262]=me,t[263]=he,t[264]=ge,t[265]=ve,t[266]=ye,t[267]=Se,t[268]=q,t[269]=J,t[270]=Oe,t[271]=ke,t[272]=pt,t[273]=mt):mt=t[273],mt}function Gt(e){return(0,Z.jsx)(p,{value:e.id,children:e.name},e.id)}function Kt(e){return(0,Z.jsx)(p,{value:e.id,children:e.title||e.name},e.id)}function qt(e){return(0,Z.jsx)(p,{value:e.id,children:e.name},e.id)}var Q=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`;function $(e){let t=(0,xe.c)(5),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Jt(e){let t=(0,xe.c)(3),{title:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(T,{className:`size-4 text-fg-muted`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 pt-2 text-sm font-semibold text-fg`,children:[r,n]}),t[1]=n,t[2]=i),i}export{wt as t};