@xopcai/xopc 0.0.299 → 0.0.302

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 (140) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-C-DSdak3.js → activity-store-DCi5rh4e.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BnrB5fWD.js → agent-avatar-dicebear-C0zP6W2B.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D0ITeUFb.js +1 -0
  6. package/dist/gateway/static/root/assets/{agents-DNxSNGao.js → agents-DcfWhk2S.js} +1 -1
  7. package/dist/gateway/static/root/assets/{api-DS4w0i5N.js → api-CAV9PN9i.js} +1 -1
  8. package/dist/gateway/static/root/assets/api-fPapljyb.js +1 -0
  9. package/dist/gateway/static/root/assets/app-management-settings-panel-U3yDRzKF.js +1 -0
  10. package/dist/gateway/static/root/assets/appearance-settings-ZFjV_opr.js +1 -0
  11. package/dist/gateway/static/root/assets/apps-page-FgMHY1Pr.js +1 -0
  12. package/dist/gateway/static/root/assets/{archive-plugin-CISHdvCz.js → archive-plugin-MaKWrpgC.js} +1 -1
  13. package/dist/gateway/static/root/assets/{attachment-load-c0q_Q6IQ.js → attachment-load-IfqbP2BN.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automations-page-BOiNdKcv.js → automations-page-CeI2NGSO.js} +1 -1
  15. package/dist/gateway/static/root/assets/automations-workspace-DxaiBwrD.js +6 -0
  16. package/dist/gateway/static/root/assets/{binary-plugins-BO1hALPX.js → binary-plugins-jvQ6FaBZ.js} +1 -1
  17. package/dist/gateway/static/root/assets/{block-editor-BWzZ4hDH.js → block-editor-B7U3qlB3.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-automation-inputs-DvwCwLOp.js → browser-automation-inputs-BGT0xoTv.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-automations-page-B8LfUUco.js → browser-automations-page-DvLAwoiQ.js} +1 -1
  20. package/dist/gateway/static/root/assets/browser-settings-page-CHrfg3BX.js +3 -0
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel-DpYDPk_o.js +8 -0
  22. package/dist/gateway/static/root/assets/{channels-settings-BBX7Gp4q.js → channels-settings-DMq-NBUQ.js} +1 -1
  23. package/dist/gateway/static/root/assets/{channels-status-swr-CgtFOwNh.js → channels-status-swr-C_icwbWj.js} +1 -1
  24. package/dist/gateway/static/root/assets/{chat-terminal-dock-CLYsf1w_.js → chat-terminal-dock-BtL71IOs.js} +1 -1
  25. package/dist/gateway/static/root/assets/computer-settings-page-Bu6ZJtmS.js +1 -0
  26. package/dist/gateway/static/root/assets/{connectors-page-BVUnp0UV.js → connectors-page-LsEiI9L5.js} +1 -1
  27. package/dist/gateway/static/root/assets/{cron-expression-DKSgHs4I.js → cron-expression-B25FHn4w.js} +1 -1
  28. package/dist/gateway/static/root/assets/{date-picker-DRTglPVS.js → date-picker-CzVHO7z9.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dependency-picker-_-7WsbTH.js → dependency-picker-BNugauiZ.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-CR7n2K67.js → desktop-pet-DTy_3-OY.js} +1 -1
  31. package/dist/gateway/static/root/assets/desktop-pet-settings-CXfnejTb.js +1 -0
  32. package/dist/gateway/static/root/assets/device-pairing-wizard-CxKwfncn.js +1 -0
  33. package/dist/gateway/static/root/assets/extension-debug-page-C3F7RiGW.js +1 -0
  34. package/dist/gateway/static/root/assets/{extension-page-EZC07dGv.js → extension-page-C0jhcCT_.js} +1 -1
  35. package/dist/gateway/static/root/assets/extension-settings-page-CNvJQkrr.js +1 -0
  36. package/dist/gateway/static/root/assets/figtree-latin-ext-wght-normal-DCwSJGxG.woff2 +0 -0
  37. package/dist/gateway/static/root/assets/figtree-latin-wght-normal-D_ZTVpCC.woff2 +0 -0
  38. package/dist/gateway/static/root/assets/{gateway-config-swr-B2xVR9gt.js → gateway-config-swr-D5AM8cyQ.js} +1 -1
  39. package/dist/gateway/static/root/assets/gateway-settings-CQTcIvlZ.js +1 -0
  40. package/dist/gateway/static/root/assets/{gateway-startup-retry-c7s8h7px.js → gateway-startup-retry-CSJWdnFs.js} +1 -1
  41. package/dist/gateway/static/root/assets/{heartbeat-settings-BAMr_vYa.js → heartbeat-settings-Cd1VJsHe.js} +1 -1
  42. package/dist/gateway/static/root/assets/{home-page-DG19Sjrn.js → home-page-B_uyfCGq.js} +1 -1
  43. package/dist/gateway/static/root/assets/{image-generation-api-DUjbV88R.js → image-generation-api-BNh604hw.js} +1 -1
  44. package/dist/gateway/static/root/assets/{imports-page-BaQmVh_d.js → imports-page-DXNfRmk9.js} +1 -1
  45. package/dist/gateway/static/root/assets/index-BAqVpc1H.css +1 -0
  46. package/dist/gateway/static/root/assets/index-hlU8MUEz.js +79 -0
  47. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-CgW5_XVP.js +1 -0
  48. package/dist/gateway/static/root/assets/{local-app-workbench-page-h48NEuKs.js → local-app-workbench-page-C4h3qDRL.js} +2 -2
  49. package/dist/gateway/static/root/assets/{local-apps-page-DFMrfoGF.js → local-apps-page-DyrFxW3G.js} +1 -1
  50. package/dist/gateway/static/root/assets/{locale-store-CwuCkjo7.js → locale-store-DLK05Y1a.js} +1 -1
  51. package/dist/gateway/static/root/assets/logs-page-Goy_QHfL.js +2 -0
  52. package/dist/gateway/static/root/assets/{management-settings-Dib_yIDQ.js → management-settings-DgQyGEpR.js} +1 -1
  53. package/dist/gateway/static/root/assets/{markdown-view-3YQc6QFV.js → markdown-view-B8maDRWh.js} +1 -1
  54. package/dist/gateway/static/root/assets/{media-plugins-DlZXjN6z.js → media-plugins-5DakFba_.js} +1 -1
  55. package/dist/gateway/static/root/assets/messages-C9h8SImu.js +3 -0
  56. package/dist/gateway/static/root/assets/note-detail-panel-lcZby9NY.js +5 -0
  57. package/dist/gateway/static/root/assets/notes-page-CDGPPI-W.js +8 -0
  58. package/dist/gateway/static/root/assets/{page-tabs-BLzm5EXm.js → page-tabs-DzJpglJJ.js} +1 -1
  59. package/dist/gateway/static/root/assets/{preview-open-alternatives-B6QLKIZy.js → preview-open-alternatives-Dj6LJsuQ.js} +1 -1
  60. package/dist/gateway/static/root/assets/{proactive-page-W_uN2_ie.js → proactive-page-CwudBdrQ.js} +1 -1
  61. package/dist/gateway/static/root/assets/{product-open-page-DLm3cUhY.js → product-open-page-CujZXOea.js} +1 -1
  62. package/dist/gateway/static/root/assets/project-detail-page-CyAf_sK-.js +1 -0
  63. package/dist/gateway/static/root/assets/{projects-page-DT7zmH0f.js → projects-page-BW5m_HhZ.js} +1 -1
  64. package/dist/gateway/static/root/assets/{registry-api-Cxx1-pCg.js → registry-api-BMFL4vis.js} +1 -1
  65. package/dist/gateway/static/root/assets/remote-access-hub-B4JgwB0s.js +1 -0
  66. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-DV554qyN.js +5 -0
  67. package/dist/gateway/static/root/assets/{schema-form-BTLg2fN1.js → schema-form-Bh2Er67B.js} +1 -1
  68. package/dist/gateway/static/root/assets/sessions-page-D5SmvlQ1.js +1 -0
  69. package/dist/gateway/static/root/assets/settings-advanced-gate-DDALROy_.js +1 -0
  70. package/dist/gateway/static/root/assets/settings-form-section-BsdM7P1d.js +1 -0
  71. package/dist/gateway/static/root/assets/{settings-page-BR9XJ0j9.js → settings-page-3yEAqoME.js} +1 -1
  72. package/dist/gateway/static/root/assets/settings-page-layout-X1x-2Cp9.js +1 -0
  73. package/dist/gateway/static/root/assets/{setup-status-panel-BSo76NwE.js → setup-status-panel-BOHNZ-S3.js} +1 -1
  74. package/dist/gateway/static/root/assets/{share-preview-page-Dx2IpPEp.js → share-preview-page-wV056nz2.js} +1 -1
  75. package/dist/gateway/static/root/assets/shares-settings-io4NzfJL.js +1 -0
  76. package/dist/gateway/static/root/assets/skill-reload-api-CERFaxLj.js +1 -0
  77. package/dist/gateway/static/root/assets/{skills-page-CaX9EQtn.js → skills-page-CtwUqvsE.js} +1 -1
  78. package/dist/gateway/static/root/assets/{skills-page.utils-CxWdcFKs.js → skills-page.utils-dHBD7YqU.js} +1 -1
  79. package/dist/gateway/static/root/assets/{system-settings-panel-BkiXkDSq.js → system-settings-panel-lItR5Kah.js} +1 -1
  80. package/dist/gateway/static/root/assets/task-detail-page-CCKc67a-.js +1 -0
  81. package/dist/gateway/static/root/assets/{theme-store-Dt7ob2wD.js → theme-store-KfFEGMlp.js} +1 -1
  82. package/dist/gateway/static/root/assets/tunnel-api-DPyLgmWw.js +1 -0
  83. package/dist/gateway/static/root/assets/{use-autosave-BHxjmV8l.js → use-autosave-DO50_g_S.js} +1 -1
  84. package/dist/gateway/static/root/assets/user-model-page-CcnGgH1n.js +2 -0
  85. package/dist/gateway/static/root/assets/{voice-api-key-field-BCNM-BaQ.js → voice-api-key-field-k7tWLXzM.js} +1 -1
  86. package/dist/gateway/static/root/assets/{voice-config-api-De1DTzxK.js → voice-config-api-bZqN8-UF.js} +1 -1
  87. package/dist/gateway/static/root/assets/{work-discovery-overlay-tig5sF-Q.js → work-discovery-overlay-BHI6gO_u.js} +1 -1
  88. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-OcS30LVZ.js → workflow-run-setup-panel-jEMtNIG8.js} +1 -1
  89. package/dist/gateway/static/root/assets/workflows-page-CX4bcAD-.js +6 -0
  90. package/dist/gateway/static/root/index.html +10 -10
  91. package/dist/package.js +1 -1
  92. package/dist/src/agent/service/process-direct-one-shot.js +1 -0
  93. package/dist/src/config/schema.js +1 -1
  94. package/dist/src/gateway/automation-agent-session.js +9 -2
  95. package/dist/src/gateway/heartbeat/service.js +2 -2
  96. package/dist/src/gateway/service/config-coordinator.js +1 -1
  97. package/dist/src/gateway/service/run-gateway-agent.js +2 -3
  98. package/dist/src/heartbeat/index.js +1 -1
  99. package/dist/src/notifications/plain-text.d.ts +1 -0
  100. package/dist/src/notifications/plain-text.js +14 -0
  101. package/dist/src/notifications/planner.js +2 -1
  102. package/dist/src/storage/sqlite/session-repository.js +21 -1
  103. package/dist/src/storage/sqlite/transcript-repository.js +11 -2
  104. package/dist/src/workflows/service/workflow-session-bridge.js +5 -1
  105. package/package.json +5 -5
  106. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CaA7l5Xv.js +0 -1
  107. package/dist/gateway/static/root/assets/api-BhJmc8E-.js +0 -1
  108. package/dist/gateway/static/root/assets/app-management-settings-panel-Dfrcz-vZ.js +0 -1
  109. package/dist/gateway/static/root/assets/appearance-settings-BLB_xmtb.js +0 -1
  110. package/dist/gateway/static/root/assets/apps-page-Bg-7fqIS.js +0 -1
  111. package/dist/gateway/static/root/assets/automations-workspace-DDdsNbjH.js +0 -6
  112. package/dist/gateway/static/root/assets/browser-settings-page-BtZbX85K.js +0 -3
  113. package/dist/gateway/static/root/assets/capabilities-settings-panel-mNpAFqTf.js +0 -8
  114. package/dist/gateway/static/root/assets/computer-model-settings-DYWcZu2X.js +0 -1
  115. package/dist/gateway/static/root/assets/computer-settings-page-B4pC7mRs.js +0 -1
  116. package/dist/gateway/static/root/assets/desktop-pet-settings-Bu7g83kd.js +0 -1
  117. package/dist/gateway/static/root/assets/device-pairing-wizard-D5z7BvaO.js +0 -1
  118. package/dist/gateway/static/root/assets/extension-debug-page-BI8pvu2u.js +0 -1
  119. package/dist/gateway/static/root/assets/extension-settings-page-DLYC6gVA.js +0 -1
  120. package/dist/gateway/static/root/assets/gateway-settings-C17LDur8.js +0 -1
  121. package/dist/gateway/static/root/assets/index-B7JCOaCc.js +0 -81
  122. package/dist/gateway/static/root/assets/index-Bt6a_Yxc.css +0 -2
  123. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-DfNQK_hR.js +0 -1
  124. package/dist/gateway/static/root/assets/logs-page-CD9MfQDD.js +0 -2
  125. package/dist/gateway/static/root/assets/messages-D6CRVWtT.js +0 -3
  126. package/dist/gateway/static/root/assets/note-detail-panel-CS0W3ESn.js +0 -5
  127. package/dist/gateway/static/root/assets/notes-page-BNMVGN6Y.js +0 -8
  128. package/dist/gateway/static/root/assets/project-detail-page-Gfze4S0P.js +0 -1
  129. package/dist/gateway/static/root/assets/remote-access-hub-CXQkXSU2.js +0 -1
  130. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-DHkNbhpP.js +0 -5
  131. package/dist/gateway/static/root/assets/sessions-page-CxTLRoxv.js +0 -1
  132. package/dist/gateway/static/root/assets/settings-advanced-gate-BgtDlDZh.js +0 -1
  133. package/dist/gateway/static/root/assets/settings-form-section-D9rWLTBX.js +0 -1
  134. package/dist/gateway/static/root/assets/settings-page-layout-CsUQKRq0.js +0 -1
  135. package/dist/gateway/static/root/assets/shares-settings-BMF0Bo06.js +0 -1
  136. package/dist/gateway/static/root/assets/skill-reload-api-DNBw3BJR.js +0 -1
  137. package/dist/gateway/static/root/assets/task-detail-page-UBuGZQkl.js +0 -1
  138. package/dist/gateway/static/root/assets/tunnel-api-CEXwG7vJ.js +0 -1
  139. package/dist/gateway/static/root/assets/user-model-page-Dvtr3CPj.js +0 -2
  140. package/dist/gateway/static/root/assets/workflows-page-AqlMn0Bx.js +0 -6
@@ -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{n as o,r as s}from"./popover-select-DldSX8GX.js";import{t as c}from"./circle-check-C23XjkUj.js";import{t as l}from"./markdown-view-3YQc6QFV.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./cn-JdwAhgNB.js";import{n as p}from"./locale-store-CwuCkjo7.js";import{t as m}from"./messages-D6CRVWtT.js";import{a as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BGTk37IG.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{t as S}from"./button-CGlRPNzi.js";import{t as C}from"./skeleton-BwbyijEw.js";import{An as w,Dn as T,Fu as ee,Ic as E,Jc as D,Jl as O,Lu as k,Mn as te,Mu as ne,Nu as A,On as j,So as M,Tc as N,Ua as P,Wc as F,Xc as I,Ys as L,bc as R,fl as z,ga as B,jc as re,kn as ie,l as V,lu as ae,oc as oe,pn as se,ra as ce,rd as le,y as ue,yl as H}from"./index-B7JCOaCc.js";import{a as de,i as U,o as fe,r as W}from"./cron-expression-DKSgHs4I.js";import{a as pe,i as me,n as he,r as G,t as ge}from"./workflow-run-setup-panel-OcS30LVZ.js";import{i as _e,n as ve,r as K,t as ye}from"./browser-automation-inputs-DvwCwLOp.js";var q=e(t(),1),be=n(),xe=de();function Se(e,t,n){let r=new Date;return r.setHours(e,t,0,0),r.toLocaleTimeString(n,{hour:`numeric`,minute:`2-digit`})}function J(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 Ce(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 we(e){return e.length===5&&e.every((e,t)=>e===t+1)}function Te(e){if(e.length!==2)return!1;let t=[...e].toSorted((e,t)=>e-t);return t[0]===0&&t[1]===6}function Ee(e,t,n,r){try{let i=xe.CronExpressionParser.parse(e,{...r?.timezone?{tz:r.timezone}:{}}).fields,a=W(i.minute.values),o=W(i.hour.values),s=W(i.dayOfWeek.values),c=W(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=U(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=U(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?Se(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&&we(s))return n.weekdaysAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&Te(s))return n.weekendsAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&s.length===1){let e=J(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=Ce(s.map(e=>J(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 De(e,t,n,r){let i=e.trim();return i?Ee(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):De(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=G(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}}}function ct(e){return[`reminder`,`brief`,`review`,`followUp`].map(t=>{let n=e.scenarios[t];return{...n,requiresProject:t===`followUp`,form:{...Ze,name:n.name,instruction:t===`reminder`?``:n.instruction,triggerMode:t===`reminder`?`once`:t===`review`?`weekly`:`daily`,time:t===`brief`?`08:30`:t===`review`?`17:00`:`09:00`,weekday:`5`,notificationPolicy:`all`}}})}var Z=r(),lt=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`;function ut(e){let t=(0,be.c)(99),{form:n,setForm:r,labels:i,projects:a,projectLocked:c,source:l,requiresProject:u}=e,d;t[0]===r?d=t[1]:(d=e=>r(t=>({...t,...e})),t[0]=r,t[1]=d);let f=d,p;t[2]!==i.experience.source||t[3]!==l?(p=(0,Z.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[i.experience.source,`: `,l]}),t[2]=i.experience.source,t[3]=l,t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=e=>f({name:e.target.value}),t[5]=f,t[6]=m);let h;t[7]!==n.name||t[8]!==m?(h=(0,Z.jsx)(`input`,{className:lt,value:n.name,onChange:m}),t[7]=n.name,t[8]=m,t[9]=h):h=t[9];let g;t[10]!==i.form.name||t[11]!==h?(g=(0,Z.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.name,h]}),t[10]=i.form.name,t[11]=h,t[12]=g):g=t[12];let _;t[13]===f?_=t[14]:(_=e=>f({instruction:e.target.value}),t[13]=f,t[14]=_);let v;t[15]!==n.instruction||t[16]!==_?(v=(0,Z.jsx)(`textarea`,{className:lt,rows:5,value:n.instruction,onChange:_}),t[15]=n.instruction,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==i.info.task||t[19]!==v?(y=(0,Z.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.info.task,v]}),t[18]=i.info.task,t[19]=v,t[20]=y):y=t[20];let b;t[21]!==n.projectId||t[22]!==i.form.noProject||t[23]!==i.form.project||t[24]!==c||t[25]!==a||t[26]!==f?(b=!c&&(0,Z.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.project,(0,Z.jsxs)(o,{className:lt,value:n.projectId,onChange:e=>f({projectId:e.target.value}),children:[(0,Z.jsx)(s,{value:``,children:i.form.noProject}),a.map(dt)]})]}),t[21]=n.projectId,t[22]=i.form.noProject,t[23]=i.form.project,t[24]=c,t[25]=a,t[26]=f,t[27]=b):b=t[27];let x;t[28]!==n.projectId||t[29]!==i.experience.projectRequired||t[30]!==u?(x=u&&!n.projectId?(0,Z.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:i.experience.projectRequired}):null,t[28]=n.projectId,t[29]=i.experience.projectRequired,t[30]=u,t[31]=x):x=t[31];let S;t[32]===f?S=t[33]:(S=e=>f({triggerMode:e.target.value}),t[32]=f,t[33]=S);let C;t[34]===i.trigger.once?C=t[35]:(C=(0,Z.jsx)(s,{value:`once`,children:i.trigger.once}),t[34]=i.trigger.once,t[35]=C);let w;t[36]===i.trigger.daily?w=t[37]:(w=(0,Z.jsx)(s,{value:`daily`,children:i.trigger.daily}),t[36]=i.trigger.daily,t[37]=w);let T;t[38]===i.trigger.weekly?T=t[39]:(T=(0,Z.jsx)(s,{value:`weekly`,children:i.trigger.weekly}),t[38]=i.trigger.weekly,t[39]=T);let ee;t[40]!==n.triggerMode||t[41]!==S||t[42]!==C||t[43]!==w||t[44]!==T?(ee=(0,Z.jsxs)(o,{className:lt,value:n.triggerMode,onChange:S,children:[C,w,T]}),t[40]=n.triggerMode,t[41]=S,t[42]=C,t[43]=w,t[44]=T,t[45]=ee):ee=t[45];let E;t[46]!==i.form.trigger||t[47]!==ee?(E=(0,Z.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.trigger,ee]}),t[46]=i.form.trigger,t[47]=ee,t[48]=E):E=t[48];let D;t[49]!==n.onceAt||t[50]!==n.time||t[51]!==n.triggerMode||t[52]!==i.form.onceAt||t[53]!==i.form.time||t[54]!==f?(D=n.triggerMode===`once`?(0,Z.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.onceAt,(0,Z.jsx)(`input`,{type:`datetime-local`,className:lt,value:n.onceAt,onChange:e=>f({onceAt:e.target.value})})]}):(0,Z.jsxs)(`div`,{className:`grid gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`span`,{children:i.form.time}),(0,Z.jsx)(fe,{value:n.time,onChange:e=>f({time:e}),ariaLabel:i.form.time})]}),t[49]=n.onceAt,t[50]=n.time,t[51]=n.triggerMode,t[52]=i.form.onceAt,t[53]=i.form.time,t[54]=f,t[55]=D):D=t[55];let O;t[56]!==n.triggerMode||t[57]!==n.weekday||t[58]!==i.form.day||t[59]!==i.weekdays||t[60]!==f?(O=n.triggerMode===`weekly`&&(0,Z.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.form.day,(0,Z.jsx)(o,{className:lt,value:n.weekday,onChange:e=>f({weekday:e.target.value}),children:[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map((e,t)=>(0,Z.jsx)(s,{value:String(t),children:i.weekdays[e]},e))})]}),t[56]=n.triggerMode,t[57]=n.weekday,t[58]=i.form.day,t[59]=i.weekdays,t[60]=f,t[61]=O):O=t[61];let k;t[62]!==E||t[63]!==D||t[64]!==O?(k=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[E,D,O]}),t[62]=E,t[63]=D,t[64]=O,t[65]=k):k=t[65];let te;t[66]!==n.onceAt||t[67]!==n.triggerMode||t[68]!==i.experience.futureTime?(te=n.triggerMode===`once`&&n.onceAt&&new Date(n.onceAt).getTime()<=Date.now()?(0,Z.jsx)(`p`,{role:`status`,className:`text-sm text-red-700 dark:text-red-300`,children:i.experience.futureTime}):null,t[66]=n.onceAt,t[67]=n.triggerMode,t[68]=i.experience.futureTime,t[69]=te):te=t[69];let ne;t[70]===i.experience.scheduleNote?ne=t[71]:(ne=(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.experience.scheduleNote}),t[70]=i.experience.scheduleNote,t[71]=ne);let A;t[72]===f?A=t[73]:(A=e=>f({notificationPolicy:e.target.value}),t[72]=f,t[73]=A);let j;t[74]===i.draft.notifyAll?j=t[75]:(j=(0,Z.jsx)(s,{value:`all`,children:i.draft.notifyAll}),t[74]=i.draft.notifyAll,t[75]=j);let M;t[76]===i.draft.notifyAttention?M=t[77]:(M=(0,Z.jsx)(s,{value:`attention`,children:i.draft.notifyAttention}),t[76]=i.draft.notifyAttention,t[77]=M);let N;t[78]===i.draft.notifyNone?N=t[79]:(N=(0,Z.jsx)(s,{value:`none`,children:i.draft.notifyNone}),t[78]=i.draft.notifyNone,t[79]=N);let P;t[80]!==n.notificationPolicy||t[81]!==A||t[82]!==j||t[83]!==M||t[84]!==N?(P=(0,Z.jsxs)(o,{className:lt,value:n.notificationPolicy,onChange:A,children:[j,M,N]}),t[80]=n.notificationPolicy,t[81]=A,t[82]=j,t[83]=M,t[84]=N,t[85]=P):P=t[85];let F;t[86]!==i.draft.notifications||t[87]!==P?(F=(0,Z.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i.draft.notifications,P]}),t[86]=i.draft.notifications,t[87]=P,t[88]=F):F=t[88];let I;return t[89]!==x||t[90]!==k||t[91]!==p||t[92]!==te||t[93]!==ne||t[94]!==F||t[95]!==g||t[96]!==y||t[97]!==b?(I=(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4`,children:[p,g,y,b,x,k,te,ne,F]}),t[89]=x,t[90]=k,t[91]=p,t[92]=te,t[93]=ne,t[94]=F,t[95]=g,t[96]=y,t[97]=b,t[98]=I):I=t[98],I}function dt(e){return(0,Z.jsx)(s,{value:e.id,children:e.name},e.id)}function ft(e,t){return t.reduce((t,n)=>n.automationId===e&&(!t||n.createdAtMs>t.createdAtMs)?n:t,void 0)}function pt(e,t){let n=ft(e.id,t),r=e.state.lastRunAtMs&&(!n||e.state.lastRunAtMs>n.createdAtMs)?e.state.lastRunStatus:n?.status??e.state.lastRunStatus;return r===`failed`||r===`timeout`}function mt(e,t,n){return e?We(e,n):t.never}function ht(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 gt(e){return e.safety?.mode??`auto_apply`}function _t(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 vt(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 yt(e){return e.status===`running`||e.status===`queued`||e.status===`cancelling`}function bt(e){return e.status===`failed`||e.status===`timeout`}function xt(e,t){return e.action.kind===`agent`?e.action.instruction:e.action.kind===`workflow`&&e.action.goal?.trim()||ht(e.action,t)}function St(e){return(e.description?.match(/\[managed-by=([^\]]+)\]/))?.[1]?.trim()||null}function Ct(e){return!!St(e)}function wt(e){return e.description?.replace(/\s*\[managed-by=[^\]]+\]\s*/g,` `).trim()??``}function Tt(e){return yt(e)?0:bt(e)?1:e.status===`succeeded`?2:3}function Et(e){return[...e].sort((e,t)=>{let n=Tt(e)-Tt(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function Dt(){let e=(0,be.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(Ot)})]}),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 Ot(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 kt({projectId:e,embedded:t=!1,title:n,subtitle:r}){let a=p(e=>e.language),c=m(a),l=c.automations,C=c.cron,ee=M(e=>e.setPageHeader),E=M(e=>e.clearPageHeader),[D,O]=i(),k=D.get(`run`)?.trim()??``,A=D.get(`automation`)?.trim()??``,N=D.get(`draft`)?.trim()??``,F=D.get(`action`)?.trim()??``,I=D.get(`projectId`)?.trim()??``,R=e?.trim()||I,z=!!e?.trim(),oe=D.get(`autogenerate`)===`1`,se=(0,q.useRef)(``),le=D.get(`status`),H=le===`active`||le===`paused`||le===`system`||le===`attention`?le:`all`,de=D.get(`q`)??``,U=e=>O(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`status`):n.set(`status`,e),n.delete(`automation`),n}),fe=e=>O(t=>{let n=new URLSearchParams(t);return e?n.set(`q`,e):n.delete(`q`),n.delete(`automation`),n},{replace:!0}),[W,pe]=(0,q.useState)(null),[he,G]=(0,q.useState)(!1),[ge,K]=(0,q.useState)(`blank`),[ye,be]=(0,q.useState)(null),[xe,Se]=(0,q.useState)(!1),[J,Ce]=(0,q.useState)(Ze),[we,Te]=(0,q.useState)(null),[Ee,De]=(0,q.useState)(null),[Oe,ke]=(0,q.useState)(!1),[Y,X]=(0,q.useState)(null),[Ae,je]=(0,q.useState)(``),[Me,Ne]=(0,q.useState)(null),[Pe,Fe]=(0,q.useState)(!1),[Ie,Le]=(0,q.useState)(!1),[Re,ze]=(0,q.useState)(R),[Be,Ve]=(0,q.useState)(`new_session`),[He,Ue]=(0,q.useState)(`attention`),[We,Ge]=(0,q.useState)(null),[Ke,qe]=(0,q.useState)(!1),[Ye,Xe]=(0,q.useState)(!1),[Qe,et]=(0,q.useState)(!1),[tt,nt]=(0,q.useState)(null),rt=x([`automations`,R],()=>V.list(R?{projectId:R}:void 0),{refreshInterval:15e3}),it=x([`automation-runs`,R],()=>V.runs(50,void 0,R?{projectId:R}:void 0),{refreshInterval:1e4}),lt=x(Y?[`automation-history`,Y,R]:null,()=>V.runs(50,Y,R?{projectId:R}:void 0),{refreshInterval:1e4}),dt=x(Ee?`automation-run-events:${Ee}`:null,()=>V.runEvents(Ee),{refreshInterval:5e3}),mt=x(`automation-workflow-definitions`,ue),ht=x(`automation-browser-automations`,()=>_e.list()),gt=x(`automation-chat-agents`,B),_t=x(`automation-projects`,()=>P({sortBy:`name`,sortOrder:`asc`,limit:200})),vt=rt.isLoading&&!rt.data||it.isLoading&&!it.data,bt=rt.data?.automations??[],St=(0,q.useMemo)(()=>Et(it.data?.runs??[]),[it.data?.runs]),Tt=(0,q.useMemo)(()=>bt.filter(e=>!Ct(e)),[bt]),Ot=(0,q.useMemo)(()=>bt.filter(Ct),[bt]),kt=(0,q.useMemo)(()=>new Set(Ot.map(e=>e.id)),[Ot]),Mt=(0,q.useMemo)(()=>St.filter(e=>!kt.has(e.automationId)),[St,kt]),Nt=(0,q.useMemo)(()=>St.find(e=>e.id===Ee)??lt.data?.runs.find(e=>e.id===Ee)??null,[St,Ee,lt.data]),Pt=(0,q.useMemo)(()=>bt.find(e=>e.id===Y)??null,[bt,Y]),It=(0,q.useMemo)(()=>bt.find(e=>e.id===ye)??null,[bt,ye]),Lt=(0,q.useMemo)(()=>[...lt.data?.runs??St].filter(e=>e.automationId===Y).sort((e,t)=>t.createdAtMs-e.createdAtMs),[St,Y,lt.data]),Rt=dt.data?.events??[],zt=(0,q.useMemo)(()=>Mt.filter(e=>!yt(e)&&e.readAtMs==null),[Mt]),Ht=de.trim().toLocaleLowerCase(),Ut=(0,q.useMemo)(()=>(H===`system`?Ot:Tt).filter(e=>H===`attention`&&!pt(e,Mt)||H===`active`&&!e.enabled||H===`paused`&&e.enabled?!1:Ht?[e.name,wt(e),xt(e,l),Je(e.trigger,l,C,a)].some(e=>e.toLocaleLowerCase().includes(Ht)):!0),[C,H,l,a,Ht,Ot,Tt,Mt]),Wt=(0,q.useMemo)(()=>mt.data??[],[mt.data]),Gt=(0,q.useMemo)(()=>(ht.data?.automations??[]).filter(e=>e.enabled),[ht.data]),Kt=gt.data?.items??[],qt=_t.data?.items??[],Jt=(0,q.useMemo)(()=>Wt.find(e=>e.id===J.workflowId.trim())??null,[J.workflowId,Wt]),Zt=(0,q.useMemo)(()=>Gt.find(e=>e.id===J.browserAutomationId.trim())??null,[Gt,J.browserAutomationId]),Qt=J.actionMode===`workflow`&&(!J.workflowId.trim()||Wt.length>0&&!Wt.some(e=>e.id===J.workflowId)),$t=J.actionMode===`workflow`&&Jt?!me(Jt,J.workflowInput,J.workflowInputValid).valid:!1,$=!!J.name.trim()&&(J.triggerMode!==`once`||Number.isFinite(new Date(J.onceAt).getTime())&&(!!It||new Date(J.onceAt).getTime()>Date.now()))&&(![`daily`,`weekly`].includes(J.triggerMode)||/^(?:[01]\d|2[0-3]):[0-5]\d$/.test(J.time))&&(J.triggerMode!==`event`||!!J.eventType.trim()&&at(J.eventPayloadMatch))&&(J.actionMode===`workflow`?!Qt&&!$t:J.actionMode===`browser_automation`?Zt!==null&&ve(Zt,J.browserAutomationInputs):!!J.instruction.trim()),en=(0,q.useMemo)(()=>ct(l),[l]),tn=Tt.filter(e=>pt(e,Mt));(0,q.useEffect)(()=>{if(Ut.length===0){X(null);return}if(A&&Ut.some(e=>e.id===A)){X(A);return}Y&&Ut.some(e=>e.id===Y)||X(Ut[0].id)},[A,Ut,Y]);let nn=(0,q.useCallback)(async()=>{await Promise.all([rt.mutate(),it.mutate(),lt.mutate(),dt.mutate()])},[rt.mutate,dt.mutate,it.mutate,lt.mutate]),rn=(0,q.useCallback)(e=>{if(z){X(null),De(null);return}O(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n.delete(`automation`),n.delete(`run`),n}),X(null),De(null)},[z,O]);(0,q.useEffect)(()=>{z&&(ze(R),Ce(e=>e.projectId===R?e:{...e,projectId:R}))},[R,z]);let an=(0,q.useCallback)(e=>{if(be(null),Se(!1),Te(null),K(e),G(!0),e===`blank`){Ce({...Ze,projectId:R});return}je(``),Ne(null),Le(!1),ze(R),Ve(`new_session`),Ue(`attention`)},[R]),on=e=>{pe(e),Ce({...e.form,projectId:R}),be(null),Se(!1),Te(null),K(`quick`),G(!0)},sn=(0,q.useCallback)(e=>{Ce(ot(e,Wt)),be(e.id),Se(!1),X(null),K(`blank`),G(!0)},[Wt]),cn=(0,q.useCallback)(()=>{Me&&(Ce({...ot(Me.automation,Wt),projectId:Re,conversationMode:Be,notificationPolicy:He}),be(null),Se(!0),K(`blank`))},[Me,Be,He,Re,Wt]),ln=(0,q.useCallback)(async()=>{et(!0),Te(null);try{await nn()}catch(e){Te(e instanceof Error?e.message:String(e))}finally{et(!1)}},[l.feedback.actionFailed,nn]);(0,q.useEffect)(()=>{let e=bt.find(e=>e.id===A);!e||!Ct(e)||H===`system`||O(e=>{let t=new URLSearchParams(e);return t.set(`status`,`system`),t},{replace:!0})},[A,bt,H,O]),(0,q.useEffect)(()=>{F===`create`&&(an(`blank`),O(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t},{replace:!0}))},[F,an,O]),(0,q.useEffect)(()=>{if(!N)return;let e=`${a}:${oe?`auto`:`seed`}:${N}`;se.current!==e&&(se.current=e,je(N),Ne(null),Le(!1),ze(R),K(`draft`),G(!0),O(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),oe&&(Te(null),Fe(!0),V.draft({prompt:N,language:a}).then(e=>{Ne(e.draft),Le(!1)}).catch(e=>{Te(e instanceof Error?e.message:String(e))}).finally(()=>{Fe(!1)})))},[oe,N,a,R,O]);let un=(0,q.useCallback)(e=>{let t=St.find(t=>t.id===e)??lt.data?.runs.find(t=>t.id===e);if(!t||yt(t)||t.readAtMs!=null)return;let n=Date.now();it.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),lt.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),V.markRunRead(e).catch(e=>{Te(e instanceof Error?e.message:String(e)),it.mutate(),lt.mutate()})},[St,it.mutate,lt.data,lt.mutate]),dn=(0,q.useCallback)(e=>{un(e),De(e),ke(!0),O(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[un,O]),fn=(0,q.useCallback)(e=>{X(e);let t=ft(e,St);O(t=>{let n=new URLSearchParams(t);return n.set(`automation`,e),n},{replace:!0}),t&&t.readAtMs==null&&!yt(t)&&un(t.id)},[un,St,O]);(0,q.useEffect)(()=>{k&&(un(k),De(k),ke(!0))},[un,k]),(0,q.useEffect)(()=>{Ge(null),Xe(!1)},[Ee]);async function pn(){if(Te(null),J.triggerMode===`once`&&!It&&new Date(J.onceAt).getTime()<=Date.now()){Te(l.experience.futureTime);return}if(!(!$||tt)&&!(ge===`quick`&&W?.requiresProject&&!J.projectId)){if(xe&&Me){nt(`draft:edit`);try{let e=$e(J,Jt),{simulation:t}=await V.simulate(e);Ne({...Me,automation:e,simulation:t}),ze(J.projectId),Ve(J.conversationMode),Ue(J.notificationPolicy),Le(!1),Se(!1),K(`draft`)}catch(e){Te(e instanceof Error?e.message:String(e))}finally{nt(null)}return}if(It){let e=It.id;await mn(`automation:${e}:edit`,()=>V.update(e,st(It,J,Jt)))&&(G(!1),be(null),X(e));return}nt(`automation:create`);try{let e=$e(J,Jt),{automation:t}=await V.create(e);Ce(Ze),G(!1),O(e=>{let n=new URLSearchParams(e);return n.delete(`status`),n.delete(`q`),n.delete(`run`),n.set(`automation`,t.id),z||(t.projectId?n.set(`projectId`,t.projectId):n.delete(`projectId`)),n}),await nn(),X(t.id)}catch(e){Te(e instanceof Error?e.message:String(e))}finally{nt(null)}}}async function mn(e,t){Te(null),nt(e);try{return await t(),await nn(),!0}catch(e){return Te(e instanceof Error?e.message:String(e)),!1}finally{nt(null)}}async function hn(){await mn(`runs:read-all`,()=>V.markAllRunsRead(R||void 0))}async function gn(){let e=Ae.trim();if(e){Te(null),Fe(!0);try{Ne((await V.draft({prompt:e,language:a})).draft),Le(!1)}catch(e){Te(e instanceof Error?e.message:String(e))}finally{Fe(!1)}}}async function _n(){if(!Me)return;let e=``,t=``;await mn(`draft:publish`,async()=>{let{automation:n}=await V.create({...Me.automation,...Re?{projectId:Re}:{projectId:void 0},conversationMode:Be,notificationPolicy:He});Ne(null),je(``),Le(!1),G(!1),U(`all`),fe(``),e=n.id,t=n.projectId??``})&&e&&(rn(t),X(e))}async function vn(){if(!Me)return;let e=``,t=``,n=``;await mn(`draft:test`,async()=>{let{automation:r}=await V.create({...Me.automation,...Re?{projectId:Re}:{projectId:void 0},conversationMode:Be,notificationPolicy:He,enabled:!1}),{run:i}=await V.runNow(r.id);e=r.id,t=r.projectId??``,n=i.id,Ne(null),je(``),Le(!1),G(!1),U(`all`),fe(``)})&&e&&n&&(rn(t),X(e),dn(n))}async function yn(e){Te(null),qe(!0),Ge(null),Xe(!1);try{Ge((await V.repairDraft(e.id,{language:a})).repair)}catch(e){Te(e instanceof Error?e.message:String(e))}finally{qe(!1)}}async function bn(e){We&&await mn(`run:${e.id}:repair`,async()=>{await V.update(e.automationId,We.patch),Ge(null),Xe(!1)})}let xn=(0,q.useMemo)(()=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(ce,{className:`size-9 shrink-0 p-0`,loading:Qe,label:l.refresh,onClick:ln}),(0,Z.jsxs)(S,{variant:`primary`,onClick:()=>an(`draft`),children:[(0,Z.jsx)(u,{className:`size-4`}),l.new]})]}),[l.new,l.refresh,an,Qe,ln]);return(0,q.useLayoutEffect)(()=>{if(!t)return ee({startExtra:null,main:(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:l.title}),end:xn}),()=>E()},[E,t,xn,l.title,ee]),(0,Z.jsxs)(`div`,{className:f(`flex min-h-0 min-w-0 flex-1 flex-col`,t?`bg-transparent`:`bg-surface-panel`),children:[(0,Z.jsxs)(`div`,{className:f(`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)(L,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n||l.title})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r||l.subtitle})]}),xn]}):null,we||rt.error||it.error?(0,Z.jsx)(`div`,{role:`alert`,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:we||l.feedback.actionFailed}):null,!vt&&!rt.error&&Tt.length===0&&H!==`system`?(0,Z.jsxs)(`section`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-6`,children:[(0,Z.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:l.experience.scenes}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:l.experience.scenesDescription}),(0,Z.jsx)(At,{templates:en,labels:l,onSelect:on}),(0,Z.jsx)(S,{className:`mt-4`,variant:`ghost`,onClick:()=>an(`draft`),children:l.experience.custom})]}):null,!vt&&tn.length>0&&H!==`system`?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>U(`attention`),className:`flex items-center gap-3 rounded-lg border border-red-500/20 bg-red-500/5 px-4 py-3 text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,Z.jsx)(ne,{className:`size-4 shrink-0 text-red-700 dark:text-red-300`,"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`min-w-0 text-sm text-fg`,children:[(0,Z.jsxs)(`span`,{className:`font-medium`,children:[l.experience.executionIssues,` · `,tn.length]}),(0,Z.jsx)(`span`,{className:`ml-2 text-fg-muted`,children:l.experience.issuesDescription})]})]}):null,vt?(0,Z.jsx)(Dt,{}):Tt.length>0||H===`system`?(0,Z.jsxs)(`section`,{className:`grid min-h-0 items-start gap-4 xl:grid-cols-[minmax(18rem,0.8fr)_minmax(0,1.5fr)]`,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:[z?null:(0,Z.jsxs)(o,{"aria-label":l.filters.project,className:Q,value:R,onChange:e=>rn(e.target.value),children:[(0,Z.jsx)(s,{value:``,children:l.filters.allProjects}),qt.map(e=>(0,Z.jsx)(s,{value:e.id,children:e.name},e.id))]}),(0,Z.jsxs)(`label`,{className:f(`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`,!z&&`mt-2`),children:[(0,Z.jsx)(re,{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:de,onChange:e=>fe(e.target.value),placeholder:l.filters.search,"aria-label":l.filters.search})]}),(0,Z.jsxs)(`nav`,{className:`mt-3 flex flex-wrap items-center gap-1`,"aria-label":l.filters.status,children:[[{id:`all`,label:l.filters.all},{id:`active`,label:l.filters.active},{id:`paused`,label:l.paused},{id:`attention`,label:l.experience.executionIssues}].map(e=>(0,Z.jsx)(`button`,{type:`button`,className:f(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,H===e.id&&`bg-surface-hover text-fg`),onClick:()=>U(e.id),"aria-pressed":H===e.id,children:e.label},e.id)),(0,Z.jsxs)(w,{children:[(0,Z.jsx)(te,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:f(`ml-auto rounded-md p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,H===`system`&&`bg-surface-hover text-fg`),"aria-label":l.system.title,children:(0,Z.jsx)(ae,{className:`size-4`})})}),(0,Z.jsx)(ie,{children:(0,Z.jsx)(T,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,Z.jsxs)(j,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>U(`system`),children:[l.system.title,` `,Ot.length]})})})]})]}),zt.length>0&&H!==`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:[l.filters.unread,` · `,zt.length]}),(0,Z.jsx)(`button`,{type:`button`,className:`font-medium hover:underline`,disabled:tt===`runs:read-all`,onClick:()=>void hn(),children:l.filters.markAllRead})]}):null]}),(0,Z.jsx)(Ft,{automations:Ut,runs:H===`system`?St:Mt,labels:l,cronLabels:C,language:a,selectedAutomationId:Y,onOpenDetails:fn})]}),Pt?(0,Z.jsx)(Vt,{automation:Pt,runs:Lt,runsLoading:lt.isLoading,runsError:lt.error?l.feedback.actionFailed:void 0,labels:l,cronLabels:C,language:a,projects:qt,busyAction:tt,onEdit:sn,onSelectRun:dn,onAction:mn},Pt.id):(0,Z.jsx)(Yt,{icon:(0,Z.jsx)(L,{className:`size-5`}),title:l.empty.filtered})]}):null,!vt&&Tt.length>0?(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(S,{variant:`ghost`,onClick:()=>an(`draft`),children:[(0,Z.jsx)(u,{className:`size-4`,"aria-hidden":!0}),l.experience.discover]})}):null]}),(0,Z.jsx)(b,{open:he,onOpenChange:e=>{G(e),e||(be(null),Se(!1))},children:(0,Z.jsxs)(_,{children:[(0,Z.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(v,{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)(y,{className:`text-base font-semibold text-fg`,children:ge===`draft`?l.draft.title:It?l.editTitle:xe?l.draft.editTitle:l.createTitle}),(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(S,{variant:`ghost`,"aria-label":l.close,children:(0,Z.jsx)(d,{className:`size-4`})})})]}),we?(0,Z.jsx)(`p`,{role:`alert`,className:`px-5 py-2 text-sm text-red-700 dark:text-red-300`,children:we}):null,ge===`draft`?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,Z.jsx)(jt,{labels:l,prompt:Ae,draft:Me,loading:Pe,approved:Ie,publishBusy:tt===`draft:publish`,testBusy:tt===`draft:test`,templates:en,projects:qt,projectId:Re,conversationMode:Be,notificationPolicy:He,onPromptChange:je,onGenerate:gn,onEdit:cn,onPublish:_n,onTest:vn,onProjectChange:ze,onConversationModeChange:Ve,onNotificationPolicyChange:Ue,projectLocked:z,onApprovedChange:Le,onDiscard:()=>{Ne(null),Le(!1)},onTemplateSelect:e=>{on(e),Ce({...e.form,projectId:Re})},onOpenAdvanced:()=>{Ce({...Ze,projectId:Re,conversationMode:Be,notificationPolicy:He}),K(`blank`)}})}):(0,Z.jsxs)(Z.Fragment,{children:[ge===`quick`&&W?(0,Z.jsx)(ut,{form:J,setForm:Ce,labels:l,projects:qt,projectLocked:z,source:W.source,requiresProject:W.requiresProject}):(0,Z.jsx)(Xt,{form:J,labels:l,setForm:Ce,projects:qt,workflowDefinitions:Wt,selectedWorkflow:Jt,workflowsLoading:mt.isLoading,browserAutomations:Gt,selectedBrowserAutomation:Zt,browserAutomationsLoading:ht.isLoading,agentOptions:Kt,agentsLoading:gt.isLoading,language:a,projectLocked:z}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[ge===`quick`?(0,Z.jsx)(S,{variant:`ghost`,onClick:()=>K(`blank`),children:l.draft.advancedCreate}):null,xe?(0,Z.jsx)(S,{variant:`ghost`,onClick:()=>{Se(!1),K(`draft`)},children:l.cancel}):(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(S,{variant:`ghost`,children:l.cancel})}),(0,Z.jsx)(S,{variant:`primary`,onClick:pn,disabled:!$||!!tt||ge===`quick`&&!!W?.requiresProject&&!J.projectId,children:tt===`automation:create`||tt===`draft:edit`||It&&tt===`automation:${It.id}:edit`?l.feedback.working:It||xe?l.save:l.experience.createEnabled})]})]})]})]})}),(0,Z.jsx)(b,{open:Oe&&!!Nt,onOpenChange:e=>{ke(e),!e&&O(e=>{let t=new URLSearchParams(e);return t.delete(`run`),t},{replace:!0})},children:(0,Z.jsxs)(_,{children:[(0,Z.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(v,{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)(y,{className:`truncate text-base font-semibold text-fg`,children:Nt?.automationName??l.dashboard.result}),(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(S,{variant:`ghost`,"aria-label":l.close,children:(0,Z.jsx)(d,{className:`size-4`})})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Z.jsx)(Bt,{className:`rounded-none border-0`,run:Nt,events:Rt,labels:l,cronLabels:C,language:a,loading:dt.isLoading,repairDraft:We,repairLoading:Ke,repairApproved:Ye,busyAction:tt,onRepairApprovedChange:Xe,onSuggestRepair:yn,onApplyRepair:bn})})]})]})})]})}function At(e){let t=(0,be.c)(9),{templates:n,labels:r,onSelect:i}=e,a;if(t[0]!==r||t[1]!==i||t[2]!==n){let e;t[4]!==r||t[5]!==i?(e=e=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge-subtle bg-surface-panel p-4 text-left hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,Z.jsx)(k,{className:`mb-3 size-4 text-accent-fg`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.name}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.description}),(0,Z.jsxs)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:[r.experience.source,`: `,e.source]})]},e.name),t[4]=r,t[5]=i,t[6]=e):e=t[6],a=n.map(e),t[0]=r,t[1]=i,t[2]=n,t[3]=a}else a=t[3];let o;return t[7]===a?o=t[8]:(o=(0,Z.jsx)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:a}),t[7]=a,t[8]=o),o}function jt(e){let t=(0,be.c)(110),{labels:n,prompt:r,draft:i,loading:a,approved:c,publishBusy:l,testBusy:u,templates:d,projects:p,projectId:m,conversationMode:h,notificationPolicy:g,onPromptChange:_,onGenerate:v,onEdit:y,onPublish:b,onTest:x,onProjectChange:C,onConversationModeChange:w,onNotificationPolicyChange:T,onApprovedChange:ee,onDiscard:E,onTemplateSelect:O,onOpenAdvanced:k,projectLocked:te}=e,ne=l===void 0?!1:l,A=u===void 0?!1:u,j=te===void 0?!1:te,M=!!(i&&i.simulation.requiredConfirmations.length>0),N;t[0]!==i||t[1]!==n.draft.advancedCreate||t[2]!==n.draft.suggestions||t[3]!==n.draft.suggestionsDescription||t[4]!==n.experience||t[5]!==k||t[6]!==O||t[7]!==d?(N=i?null:(0,Z.jsxs)(`div`,{className:`mb-5 border-b border-edge-subtle pb-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:k,children:n.draft.advancedCreate})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:d.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`focus-visible:ring-2 focus-visible:ring-accent rounded-lg border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>O(e),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}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.experience.source,`: `,e.source]})]},e.name))})]}),t[0]=i,t[1]=n.draft.advancedCreate,t[2]=n.draft.suggestions,t[3]=n.draft.suggestionsDescription,t[4]=n.experience,t[5]=k,t[6]=O,t[7]=d,t[8]=N):N=t[8];let P;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(R,{className:`size-4 text-accent`}),t[9]=P):P=t[9];let I;t[10]===n.draft.title?I=t[11]:(I=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[P,n.draft.title]}),t[10]=n.draft.title,t[11]=I);let L;t[12]===n.draft.subtitle?L=t[13]:(L=(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[12]=n.draft.subtitle,t[13]=L);let z;t[14]!==I||t[15]!==L?(z=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[I,L]}),t[14]=I,t[15]=L,t[16]=z):z=t[16];let B;t[17]!==a||t[18]!==r?(B=a||!r.trim(),t[17]=a,t[18]=r,t[19]=B):B=t[19];let re;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(R,{className:`size-4`}),t[20]=re):re=t[20];let ie=a?n.draft.generating:n.draft.generate,V;t[21]!==v||t[22]!==ie||t[23]!==B?(V=(0,Z.jsxs)(S,{variant:`primary`,onClick:v,disabled:B,children:[re,ie]}),t[21]=v,t[22]=ie,t[23]=B,t[24]=V):V=t[24];let ae;t[25]!==V||t[26]!==z?(ae=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[z,V]}),t[25]=V,t[26]=z,t[27]=ae):ae=t[27];let oe;t[28]===_?oe=t[29]:(oe=e=>_(e.target.value),t[28]=_,t[29]=oe);let se;t[30]!==n.draft.placeholder||t[31]!==n.draft.title||t[32]!==r||t[33]!==oe?(se=(0,Z.jsx)(`textarea`,{"aria-label":n.draft.title,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:oe,placeholder:n.draft.placeholder}),t[30]=n.draft.placeholder,t[31]=n.draft.title,t[32]=r,t[33]=oe,t[34]=se):se=t[34];let ce=j?`sm:grid-cols-2`:`sm:grid-cols-3`,le;t[35]===ce?le=t[36]:(le=f(`mt-3 grid gap-3`,ce),t[35]=ce,t[36]=le);let ue;t[37]!==n.draft.noProject||t[38]!==n.draft.project||t[39]!==C||t[40]!==m||t[41]!==j||t[42]!==p?(ue=j?null:(0,Z.jsx)($,{label:n.draft.project,children:(0,Z.jsxs)(o,{className:Q,value:m,onChange:e=>C(e.target.value),children:[(0,Z.jsx)(s,{value:``,children:n.draft.noProject}),p.map(Mt)]})}),t[37]=n.draft.noProject,t[38]=n.draft.project,t[39]=C,t[40]=m,t[41]=j,t[42]=p,t[43]=ue):ue=t[43];let H;t[44]===w?H=t[45]:(H=e=>w(e.target.value),t[44]=w,t[45]=H);let de;t[46]===n.draft.newConversation?de=t[47]:(de=(0,Z.jsx)(s,{value:`new_session`,children:n.draft.newConversation}),t[46]=n.draft.newConversation,t[47]=de);let U;t[48]===n.draft.continuousConversation?U=t[49]:(U=(0,Z.jsx)(s,{value:`continuous`,children:n.draft.continuousConversation}),t[48]=n.draft.continuousConversation,t[49]=U);let fe;t[50]!==h||t[51]!==H||t[52]!==de||t[53]!==U?(fe=(0,Z.jsxs)(o,{className:Q,value:h,onChange:H,children:[de,U]}),t[50]=h,t[51]=H,t[52]=de,t[53]=U,t[54]=fe):fe=t[54];let W;t[55]!==n.draft.conversation||t[56]!==fe?(W=(0,Z.jsx)($,{label:n.draft.conversation,children:fe}),t[55]=n.draft.conversation,t[56]=fe,t[57]=W):W=t[57];let pe;t[58]===T?pe=t[59]:(pe=e=>T(e.target.value),t[58]=T,t[59]=pe);let me;t[60]===n.draft.notifyAttention?me=t[61]:(me=(0,Z.jsx)(s,{value:`attention`,children:n.draft.notifyAttention}),t[60]=n.draft.notifyAttention,t[61]=me);let he;t[62]===n.draft.notifyAll?he=t[63]:(he=(0,Z.jsx)(s,{value:`all`,children:n.draft.notifyAll}),t[62]=n.draft.notifyAll,t[63]=he);let G;t[64]===n.draft.notifyNone?G=t[65]:(G=(0,Z.jsx)(s,{value:`none`,children:n.draft.notifyNone}),t[64]=n.draft.notifyNone,t[65]=G);let ge;t[66]!==g||t[67]!==pe||t[68]!==me||t[69]!==he||t[70]!==G?(ge=(0,Z.jsxs)(o,{className:Q,value:g,onChange:pe,children:[me,he,G]}),t[66]=g,t[67]=pe,t[68]=me,t[69]=he,t[70]=G,t[71]=ge):ge=t[71];let _e;t[72]!==n.draft.notifications||t[73]!==ge?(_e=(0,Z.jsx)($,{label:n.draft.notifications,children:ge}),t[72]=n.draft.notifications,t[73]=ge,t[74]=_e):_e=t[74];let ve;t[75]!==le||t[76]!==ue||t[77]!==W||t[78]!==_e?(ve=(0,Z.jsxs)(`div`,{className:le,children:[ue,W,_e]}),t[75]=le,t[76]=ue,t[77]=W,t[78]=_e,t[79]=ve):ve=t[79];let K;t[80]!==c||t[81]!==i||t[82]!==n.draft.approval||t[83]!==n.draft.assumptions||t[84]!==n.draft.discard||t[85]!==n.draft.edit||t[86]!==n.draft.publish||t[87]!==n.draft.review||t[88]!==n.draft.risks||t[89]!==n.draft.safety||t[90]!==n.draft.testOnce||t[91]!==n.draft.testing||t[92]!==n.feedback||t[93]!==n.info||t[94]!==n.none||t[95]!==ee||t[96]!==E||t[97]!==y||t[98]!==b||t[99]!==x||t[100]!==ne||t[101]!==M||t[102]!==A?(K=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)(Jt,{label:n.info.when,value:i.simulation.triggerSummary}),(0,Z.jsx)(Jt,{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)(Nt,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,Z.jsx)(Nt,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,Z.jsx)(Nt,{title:n.draft.risks,items:i.risks,empty:n.none}),M?(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:c,onChange:e=>ee(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:y,children:[(0,Z.jsx)(D,{className:`size-4`}),n.draft.edit]}),(0,Z.jsxs)(S,{variant:`secondary`,onClick:x,disabled:A||ne||M&&!c,children:[(0,Z.jsx)(F,{className:`size-4`}),A?n.draft.testing:n.draft.testOnce]}),(0,Z.jsx)(S,{variant:`primary`,onClick:b,disabled:ne||M&&!c,children:ne?n.feedback.working:n.draft.publish})]})]})]}):null,t[80]=c,t[81]=i,t[82]=n.draft.approval,t[83]=n.draft.assumptions,t[84]=n.draft.discard,t[85]=n.draft.edit,t[86]=n.draft.publish,t[87]=n.draft.review,t[88]=n.draft.risks,t[89]=n.draft.safety,t[90]=n.draft.testOnce,t[91]=n.draft.testing,t[92]=n.feedback,t[93]=n.info,t[94]=n.none,t[95]=ee,t[96]=E,t[97]=y,t[98]=b,t[99]=x,t[100]=ne,t[101]=M,t[102]=A,t[103]=K):K=t[103];let ye;return t[104]!==ae||t[105]!==se||t[106]!==ve||t[107]!==K||t[108]!==N?(ye=(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[N,ae,se,ve,K]}),t[104]=ae,t[105]=se,t[106]=ve,t[107]=K,t[108]=N,t[109]=ye):ye=t[109],ye}function Mt(e){return(0,Z.jsx)(s,{value:e.id,children:e.name},e.id)}function Nt(e){let t=(0,be.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(Pt):(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 Pt(e){return(0,Z.jsxs)(`li`,{children:[`- `,e]},e)}function Ft(e){let t=(0,be.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)(L,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===i.empty.filtered?n=t[2]:(n=(0,Z.jsx)(Yt,{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(It),n=t.find(yt),l=t[0];return(0,Z.jsxs)(`button`,{type:`button`,className:f(`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`),style:{contentVisibility:`auto`,containIntrinsicSize:`auto 130px`},"aria-current":s===e.id?`true`:void 0,onClick:()=>c(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:f(`size-2 shrink-0 rounded-full`,n?`bg-blue-500`:pt(e,t)?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-fg-subtle`)}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-fg`,children:e.name}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:e.enabled?i.enabled:i.paused}),l&&l.readAtMs==null&&!yt(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.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:f(`line-clamp-2`,l?.error&&`text-red-700 dark:text-red-300`),children:l?l.error||l.summary||i.status[l.status]:e.state.lastError||(e.state.lastRunStatus?i.status[e.state.lastRunStatus]:i.experience.noRuns)}),l?.status?(0,Z.jsx)(`span`,{className:f(`shrink-0 rounded-full px-1.5 py-0.5`,_t(l.status)),children:i.status[l.status]}):null]}),(0,Z.jsxs)(`div`,{className:`mt-2 space-y-1 pl-4 text-xs text-fg-muted`,children:[l?(0,Z.jsxs)(`div`,{children:[i.last,`: `,mt(l.createdAtMs,i,o)]}):null,(0,Z.jsx)(`div`,{children:e.enabled?`${i.next}: ${Ye(e,i,o)}`:i.paused}),(0,Z.jsx)(`div`,{children:Je(e.trigger,i,a,o)})]})]},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 It(e,t){return t.createdAtMs-e.createdAtMs}function Lt(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 Rt(e){let t=(0,be.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[o,s]=(0,q.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,p=l.length>720||d>18,m;t[4]!==p||t[5]!==l?(m=p?`${l.split(`
3
- `).slice(0,10).join(`
4
- `).trimEnd()}...`:l,t[4]=p,t[5]=l,t[6]=m):m=t[6];let h=m,g;t[7]!==o||t[8]!==p||t[9]!==r||t[10]!==i?(g=p?(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(zt),"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)(ee,{className:f(`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]=p,t[9]=r,t[10]=i,t[11]=g):g=t[11];let _=o||!p?l:h,v;t[12]===_?v=t[13]:(v=(0,Z.jsx)(`pre`,{className:`whitespace-pre-wrap break-all px-2.5 pb-2 text-xs leading-relaxed text-fg-muted`,children:_}),t[12]=_,t[13]=v);let y;return t[14]!==g||t[15]!==v?(y=(0,Z.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[g,v]}),t[14]=g,t[15]=v,t[16]=y):y=t[16],y}function zt(e){return!e}function Bt(e){let t=(0,be.c)(148),{className:n,run:r,events:i,labels:o,cronLabels:s,language:u,loading:d,repairDraft:p,repairLoading:m,repairApproved:h,busyAction:g,onRepairApprovedChange:_,onSuggestRepair:v,onApplyRepair:y}=e;if(!r){let e;t[0]===n?e=t[1]:(e=f(`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)(le,{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 b=r.error||r.summary,x=r.conversationId?`/chat/${encodeURIComponent(r.conversationId)}`:r.workflowRunId?`/workflows?run=${encodeURIComponent(r.workflowRunId)}`:null,w=r.conversationId?o.runDetail.openConversation:o.runDetail.openWorkflow,T=r.conversationId?z:O,E=yt(r)?le:r.status===`succeeded`?c:ne,D;t[8]===n?D=t[9]:(D=f(`rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,n),t[8]=n,t[9]=D);let k;t[10]===r.automationName?k=t[11]:(k=(0,Z.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=k);let te;t[12]===r.id?te=t[13]:(te=r.id.slice(0,8),t[12]=r.id,t[13]=te);let j;t[14]===te?j=t[15]:(j=(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:te}),t[14]=te,t[15]=j);let M;t[16]!==k||t[17]!==j?(M=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[k,j]}),t[16]=k,t[17]=j,t[18]=M):M=t[18];let N;t[19]===r.status?N=t[20]:(N=f(`shrink-0 rounded-full px-2 py-0.5 text-xs`,_t(r.status)),t[19]=r.status,t[20]=N);let P=o.status[r.status],F;t[21]!==N||t[22]!==P?(F=(0,Z.jsx)(`span`,{className:N,children:P}),t[21]=N,t[22]=P,t[23]=F):F=t[23];let I;t[24]!==M||t[25]!==F?(I=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[M,F]}),t[24]=M,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==o||t[28]!==u||t[29]!==r.createdAtMs?(L=mt(r.createdAtMs,o,u),t[27]=o,t[28]=u,t[29]=r.createdAtMs,t[30]=L):L=t[30];let B;t[31]===L?B=t[32]:(B=(0,Z.jsx)(`span`,{children:L}),t[31]=L,t[32]=B);let re;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[33]=re):re=t[33];let ie=o.details.duration,V;t[34]!==o||t[35]!==r.durationMs?(V=vt(r.durationMs,o),t[34]=o,t[35]=r.durationMs,t[36]=V):V=t[36];let ae;t[37]!==o.details.duration||t[38]!==V?(ae=(0,Z.jsxs)(`span`,{children:[ie,` `,V]}),t[37]=o.details.duration,t[38]=V,t[39]=ae):ae=t[39];let oe;t[40]!==B||t[41]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[B,re,ae]}),t[40]=B,t[41]=ae,t[42]=oe):oe=t[42];let se;t[43]!==o.repair||t[44]!==v||t[45]!==m||t[46]!==r?(se=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:()=>v(r),disabled:m,children:[(0,Z.jsx)(R,{className:`size-4`}),m?o.repair.generating:o.repair.suggest]})}):null,t[43]=o.repair,t[44]=v,t[45]=m,t[46]=r,t[47]=se):se=t[47];let ce;t[48]!==oe||t[49]!==se||t[50]!==I?(ce=(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[I,oe,se]}),t[48]=oe,t[49]=se,t[50]=I,t[51]=ce):ce=t[51];let ue;t[52]===r?ue=t[53]:(ue=yt(r)?`text-blue-500`:bt(r)?`text-red-500`:r.status===`succeeded`?`text-emerald-500`:`text-fg-muted`,t[52]=r,t[53]=ue);let de;t[54]===ue?de=t[55]:(de=f(`size-4`,ue),t[54]=ue,t[55]=de);let U;t[56]!==E||t[57]!==de?(U=(0,Z.jsx)(E,{className:de}),t[56]=E,t[57]=de,t[58]=U):U=t[58];let fe;t[59]!==o.runDetail.resultTitle||t[60]!==U?(fe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[U,o.runDetail.resultTitle]}),t[59]=o.runDetail.resultTitle,t[60]=U,t[61]=fe):fe=t[61];let W;t[62]!==T||t[63]!==w||t[64]!==x?(W=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)(T,{className:`size-3.5`}),w,(0,Z.jsx)(A,{className:`size-3.5`})]})}):null,t[62]=T,t[63]=w,t[64]=x,t[65]=W):W=t[65];let pe;t[66]!==fe||t[67]!==W?(pe=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[fe,W]}),t[66]=fe,t[67]=W,t[68]=pe):pe=t[68];let me=r.error&&`border-red-500/25 bg-red-500/5`,he;t[69]===me?he=t[70]:(he=f(`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 G;t[71]!==o.runDetail.noResult||t[72]!==o.runDetail.resultPending||t[73]!==b||t[74]!==r?(G=b?r.error?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-red-700 dark:text-red-300`,children:b}):(0,Z.jsx)(l,{content:b,compact:!0,className:`text-sm`}):(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:yt(r)?o.runDetail.resultPending:o.runDetail.noResult}),t[71]=o.runDetail.noResult,t[72]=o.runDetail.resultPending,t[73]=b,t[74]=r,t[75]=G):G=t[75];let ge;t[76]!==he||t[77]!==G?(ge=(0,Z.jsx)(`div`,{className:he,children:G}),t[76]=he,t[77]=G,t[78]=ge):ge=t[78];let _e;t[79]!==pe||t[80]!==ge?(_e=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[pe,ge]}),t[79]=pe,t[80]=ge,t[81]=_e):_e=t[81];let ve;t[82]===o.runDetail.runInfo?ve=t[83]:(ve=(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.runDetail.runInfo}),t[82]=o.runDetail.runInfo,t[83]=ve);let K;t[84]!==s||t[85]!==o||t[86]!==u||t[87]!==r.manual||t[88]!==r.triggerSnapshot?(K=r.manual?o.trigger.manual:Je(r.triggerSnapshot,o,s,u),t[84]=s,t[85]=o,t[86]=u,t[87]=r.manual,t[88]=r.triggerSnapshot,t[89]=K):K=t[89];let ye;t[90]!==o.explain.whyRan||t[91]!==K?(ye=(0,Z.jsx)(Kt,{label:o.explain.whyRan,value:K}),t[90]=o.explain.whyRan,t[91]=K,t[92]=ye):ye=t[92];let q=o.details.started,xe;t[93]!==o||t[94]!==u||t[95]!==r.startedAtMs?(xe=mt(r.startedAtMs,o,u),t[93]=o,t[94]=u,t[95]=r.startedAtMs,t[96]=xe):xe=t[96];let Se;t[97]!==o.details.started||t[98]!==xe?(Se=(0,Z.jsx)(Kt,{label:q,value:xe}),t[97]=o.details.started,t[98]=xe,t[99]=Se):Se=t[99];let J;t[100]!==o.details.model||t[101]!==r.model?(J=r.model?(0,Z.jsx)(Kt,{label:o.details.model,value:r.model}):null,t[100]=o.details.model,t[101]=r.model,t[102]=J):J=t[102];let Ce;t[103]!==ye||t[104]!==Se||t[105]!==J?(Ce=(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[ye,Se,J]}),t[103]=ye,t[104]=Se,t[105]=J,t[106]=Ce):Ce=t[106];let we;t[107]!==ve||t[108]!==Ce?(we=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[ve,Ce]}),t[107]=ve,t[108]=Ce,t[109]=we):we=t[109];let Te;t[110]!==g||t[111]!==o||t[112]!==y||t[113]!==_||t[114]!==h||t[115]!==p||t[116]!==r?(Te=p?(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:p.explanation}),p.expectedEffect?(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:p.expectedEffect}):null,(0,Z.jsx)(Nt,{title:o.repair.risks,items:p.risks,empty:o.none}),(0,Z.jsx)(Rt,{value:p.patch,labels:o,title:o.details.repairPatch}),p.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:h,onChange:e=>_(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:()=>y(r),disabled:g===`run:${r.id}:repair`||p.requiresApproval&&!h,children:g===`run:${r.id}:repair`?o.feedback.working:o.repair.apply})})]}):null,t[110]=g,t[111]=o,t[112]=y,t[113]=_,t[114]=h,t[115]=p,t[116]=r,t[117]=Te):Te=t[117];let Ee;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(H,{className:`size-4 shrink-0`}),t[118]=Ee):Ee=t[118];let De;t[119]===o.runDetail.technicalEvents?De=t[120]:(De=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium text-fg-muted`,children:[Ee,o.runDetail.technicalEvents]}),t[119]=o.runDetail.technicalEvents,t[120]=De);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)(ee,{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]!==De||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:[De,Y]}),t[127]=De,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]!==u||t[135]!==d?(je=(0,Z.jsx)(`div`,{className:`mt-4`,children:d?(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:f(`mt-1 size-2 rounded-full`,qt(e.type))}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm text-fg`,children:Lt(e,o)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[mt(e.createdAtMs,o,u),` · `,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)(ee,{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]=u,t[135]=d,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]!==D||t[142]!==ce||t[143]!==_e||t[144]!==we||t[145]!==Te||t[146]!==Me?(Ne=(0,Z.jsxs)(`aside`,{className:D,children:[ce,_e,we,Te,Me]}),t[141]=D,t[142]=ce,t[143]=_e,t[144]=we,t[145]=Te,t[146]=Me,t[147]=Ne):Ne=t[147],Ne}function Vt(e){let t=(0,be.c)(113),{automation:n,runs:r,runsLoading:i,runsError:a,labels:o,cronLabels:s,language:u,projects:d,busyAction:p,onEdit:m,onSelectRun:h,onAction:g}=e,_=p===`automation:${n.id}:run`,v=p===`automation:${n.id}:toggle`,y=p===`automation:${n.id}:delete`,b;t[0]===n?b=t[1]:(b=Ct(n),t[0]=n,t[1]=b);let x=b,ee;t[2]===n.name?ee=t[3]:(ee=(0,Z.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:n.name}),t[2]=n.name,t[3]=ee);let O=n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`,k;t[4]===O?k=t[5]:(k=f(`shrink-0 rounded-full px-2 py-0.5 text-xs`,O),t[4]=O,t[5]=k);let ne=n.enabled?o.enabled:o.paused,A;t[6]!==k||t[7]!==ne?(A=(0,Z.jsx)(`span`,{className:k,children:ne}),t[6]=k,t[7]=ne,t[8]=A):A=t[8];let M;t[9]!==ee||t[10]!==A?(M=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[ee,A]}),t[9]=ee,t[10]=A,t[11]=M):M=t[11];let N;t[12]===n?N=t[13]:(N=wt(n)?(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:wt(n)}):null,t[12]=n,t[13]=N);let P;t[14]!==M||t[15]!==N?(P=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[M,N]}),t[14]=M,t[15]=N,t[16]=P):P=t[16];let L;t[17]!==n||t[18]!==p||t[19]!==y||t[20]!==o.dashboard.delete||t[21]!==o.dashboard.deleted||t[22]!==o.dashboard.pause||t[23]!==o.dashboard.resume||t[24]!==o.dashboard.resumed||t[25]!==o.dashboard.runNow||t[26]!==o.details||t[27]!==o.edit||t[28]!==o.experience.deleteConfirm||t[29]!==o.feedback||t[30]!==g||t[31]!==m||t[32]!==x||t[33]!==_||t[34]!==v?(L=x?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Z.jsxs)(S,{variant:`secondary`,disabled:p!==null,onClick:()=>void g(`automation:${n.id}:toggle`,()=>n.enabled?V.pause(n.id):V.resume(n.id),n.enabled?o.feedback.paused:o.dashboard.resumed),children:[v?(0,Z.jsx)(E,{className:`size-4 animate-spin`}):n.enabled?(0,Z.jsx)(I,{className:`size-4`}):(0,Z.jsx)(F,{className:`size-4`}),n.enabled?o.dashboard.pause:o.dashboard.resume]}),(0,Z.jsxs)(S,{variant:`primary`,disabled:p!==null,onClick:()=>void g(`automation:${n.id}:run`,()=>V.runNow(n.id),o.feedback.rerunQueued),children:[_?(0,Z.jsx)(E,{className:`size-4 animate-spin`}):(0,Z.jsx)(F,{className:`size-4`}),o.dashboard.runNow]}),(0,Z.jsxs)(w,{children:[(0,Z.jsx)(te,{asChild:!0,children:(0,Z.jsx)(S,{variant:`ghost`,className:`size-9 p-0`,"aria-label":o.details.moreActions,children:(0,Z.jsx)(ae,{className:`size-4`})})}),(0,Z.jsx)(ie,{children:(0,Z.jsxs)(T,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Z.jsxs)(j,{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:()=>m(n),children:[(0,Z.jsx)(D,{className:`size-4`}),o.edit]}),(0,Z.jsxs)(j,{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:p!==null,onSelect:()=>{window.confirm(o.experience.deleteConfirm)&&g(`automation:${n.id}:delete`,()=>V.remove(n.id),o.dashboard.deleted)},children:[y?(0,Z.jsx)(E,{className:`size-4 animate-spin`}):(0,Z.jsx)(oe,{className:`size-4`}),o.dashboard.delete]})]})})]})]}),t[17]=n,t[18]=p,t[19]=y,t[20]=o.dashboard.delete,t[21]=o.dashboard.deleted,t[22]=o.dashboard.pause,t[23]=o.dashboard.resume,t[24]=o.dashboard.resumed,t[25]=o.dashboard.runNow,t[26]=o.details,t[27]=o.edit,t[28]=o.experience.deleteConfirm,t[29]=o.feedback,t[30]=g,t[31]=m,t[32]=x,t[33]=_,t[34]=v,t[35]=L):L=t[35];let R;t[36]!==L||t[37]!==P?(R=(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[P,L]}),t[36]=L,t[37]=P,t[38]=R):R=t[38];let z;t[39]===o.dashboard.latestResult?z=t[40]:(z=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:o.dashboard.latestResult}),t[39]=o.dashboard.latestResult,t[40]=z);let B;t[41]!==o.experience.viewResult||t[42]!==h||t[43]!==r[0]?(B=r[0]?(0,Z.jsx)(S,{variant:`secondary`,onClick:()=>h(r[0].id),children:o.experience.viewResult}):null,t[41]=o.experience.viewResult,t[42]=h,t[43]=r[0],t[44]=B):B=t[44];let re;t[45]!==z||t[46]!==B?(re=(0,Z.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[z,B]}),t[45]=z,t[46]=B,t[47]=re):re=t[47];let se;t[48]!==o||t[49]!==u||t[50]!==r[0]||t[51]!==a||t[52]!==i?(se=a?(0,Z.jsx)(`p`,{role:`alert`,className:`text-sm text-red-700 dark:text-red-300`,children:a}):i?(0,Z.jsx)(C,{className:`h-28 w-full`}):r[0]?(0,Z.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge-subtle bg-surface-base p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{className:f(`rounded-full px-2 py-0.5`,_t(r[0].status)),children:o.status[r[0].status]}),mt(r[0].createdAtMs,o,u)]}),(0,Z.jsx)(l,{content:r[0].error||r[0].summary||(yt(r[0])?o.runDetail.resultPending:o.runDetail.noResult),compact:!0})]}):(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.experience.noRuns}),t[48]=o,t[49]=u,t[50]=r[0],t[51]=a,t[52]=i,t[53]=se):se=t[53];let ce;t[54]!==n||t[55]!==o||t[56]!==u?(ce=n.enabled?`${o.next}: ${Ye(n,o,u)}`:o.paused,t[54]=n,t[55]=o,t[56]=u,t[57]=ce):ce=t[57];let ue;t[58]===ce?ue=t[59]:(ue=(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:ce}),t[58]=ce,t[59]=ue);let H;t[60]!==re||t[61]!==se||t[62]!==ue?(H=(0,Z.jsxs)(`section`,{children:[re,se,ue]}),t[60]=re,t[61]=se,t[62]=ue,t[63]=H):H=t[63];let de;t[64]===o.dashboard.runHistory?de=t[65]:(de=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:o.dashboard.runHistory}),t[64]=o.dashboard.runHistory,t[65]=de);let U;t[66]===o.dashboard.runHistoryDescription?U=t[67]:(U=(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:o.dashboard.runHistoryDescription}),t[66]=o.dashboard.runHistoryDescription,t[67]=U);let fe;t[68]!==de||t[69]!==U?(fe=(0,Z.jsxs)(`div`,{children:[de,U]}),t[68]=de,t[69]=U,t[70]=fe):fe=t[70];let W;t[71]===r.length?W=t[72]:(W=(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-base px-2.5 py-1 text-xs text-fg-muted`,children:r.length}),t[71]=r.length,t[72]=W);let pe;t[73]!==fe||t[74]!==W?(pe=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[fe,W]}),t[73]=fe,t[74]=W,t[75]=pe):pe=t[75];let me;t[76]!==o||t[77]!==u||t[78]!==h||t[79]!==r||t[80]!==i?(me=i?(0,Z.jsx)(C,{className:`h-24 w-full`}):r.length===0?(0,Z.jsx)(Yt,{className:`min-h-24 py-6`,icon:(0,Z.jsx)(le,{className:`size-5`}),title:o.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:()=>h(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)(c,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,Z.jsx)(le,{className:`size-4 shrink-0 text-fg-muted`}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:mt(e.createdAtMs,o,u)})]}),(0,Z.jsx)(`span`,{className:f(`shrink-0 rounded-full px-2 py-0.5 text-xs`,_t(e.status)),children:o.status[e.status]})]}),(0,Z.jsx)(`p`,{className:f(`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||ht(e.actionSnapshot,o)})]},e.id))}),t[76]=o,t[77]=u,t[78]=h,t[79]=r,t[80]=i,t[81]=me):me=t[81];let he;t[82]!==pe||t[83]!==me?(he=(0,Z.jsxs)(`section`,{className:`min-w-0`,children:[pe,me]}),t[82]=pe,t[83]=me,t[84]=he):he=t[84];let G;t[85]===o.experience.settings?G=t[86]:(G=(0,Z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:o.experience.settings}),t[85]=o.experience.settings,t[86]=G);let ge;t[87]!==n||t[88]!==o?(ge=xt(n,o),t[87]=n,t[88]=o,t[89]=ge):ge=t[89];let _e;t[90]===ge?_e=t[91]:(_e=(0,Z.jsx)(l,{content:ge,compact:!0}),t[90]=ge,t[91]=_e);let ve;t[92]!==n||t[93]!==s||t[94]!==o||t[95]!==u||t[96]!==d?(ve=(0,Z.jsx)(Ut,{automation:n,labels:o,cronLabels:s,language:u,projects:d}),t[92]=n,t[93]=s,t[94]=o,t[95]=u,t[96]=d,t[97]=ve):ve=t[97];let K;t[98]!==_e||t[99]!==ve?(K=(0,Z.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[_e,ve]}),t[98]=_e,t[99]=ve,t[100]=K):K=t[100];let ye;t[101]!==G||t[102]!==K?(ye=(0,Z.jsxs)(`details`,{className:`rounded-lg border border-edge-subtle p-4`,children:[G,K]}),t[101]=G,t[102]=K,t[103]=ye):ye=t[103];let q;t[104]!==he||t[105]!==ye?(q=(0,Z.jsxs)(`div`,{className:`grid gap-5`,children:[he,ye]}),t[104]=he,t[105]=ye,t[106]=q):q=t[106];let xe;t[107]!==H||t[108]!==q?(xe=(0,Z.jsxs)(`div`,{className:`grid gap-5 p-5`,children:[H,q]}),t[107]=H,t[108]=q,t[109]=xe):xe=t[109];let Se;return t[110]!==R||t[111]!==xe?(Se=(0,Z.jsxs)(`article`,{className:`min-w-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel shadow-surface`,children:[R,xe]}),t[110]=R,t[111]=xe,t[112]=Se):Se=t[112],Se}function Ht(e,t){return e===`suggest_only`?t.safety.suggestOnlyDescription:e===`ask_before_apply`?t.safety.askBeforeApplyDescription:t.safety.autoApplyDescription}function Ut(e){let t=(0,be.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=gt(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)(k,{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 w=n.enabled?`${r.info.nextRun}:${v}`:v;t[78]!==r.info.schedule||t[79]!==b||t[80]!==C||t[81]!==w?(p=(0,Z.jsx)(Gt,{icon:x,label:S,value:C,description:w,descriptionTitle:b}),t[78]=r.info.schedule,t[79]=b,t[80]=C,t[81]=w,t[82]=p):p=t[82];let T;t[83]===n.action.kind?T=t[84]:(T=n.action.kind===`workflow`?(0,Z.jsx)(O,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`browser_automation`?(0,Z.jsx)(H,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(L,{className:`size-4`,"aria-hidden":!0}),t[83]=n.action.kind,t[84]=T);let ee=r.info.action,E;t[85]!==n.action||t[86]!==r?(E=ht(n.action,r),t[85]=n.action,t[86]=r,t[87]=E):E=t[87],t[88]!==r.info.action||t[89]!==T||t[90]!==E?(m=(0,Z.jsx)(Gt,{icon:T,label:ee,value:E}),t[88]=r.info.action,t[89]=T,t[90]=E,t[91]=m):m=t[91],s=Gt,t[92]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t[92]=c):c=t[92],l=r.info.permission,u=r.safety[e],d=Ht(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)(O,{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)(Gt,{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)(z,{className:`size-4`,"aria-hidden":!0}),t[107]=S):S=t[107];let C=n.conversationMode===`continuous`?r.info.continuousConversation:r.info.newConversation,w;t[108]!==r.info.conversation||t[109]!==C?(w=(0,Z.jsx)(Gt,{icon:S,label:r.info.conversation,value:C}),t[108]=r.info.conversation,t[109]=C,t[110]=w):w=t[110];let T;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),t[111]=T):T=t[111];let E=n.notificationPolicy===`all`?r.info.notifyAll:n.notificationPolicy===`none`?r.info.notifyNone:r.info.notifyAttention,D;t[112]!==r.info.notifications||t[113]!==E?(D=(0,Z.jsx)(Gt,{icon:T,label:r.info.notifications,value:E}),t[112]=r.info.notifications,t[113]=E,t[114]=D):D=t[114];let te;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(le,{className:`size-4`,"aria-hidden":!0}),t[115]=te):te=t[115];let A=r.info.lastRun,j;t[116]!==n||t[117]!==r||t[118]!==a?(j=Xe(n,r,a),t[116]=n,t[117]=r,t[118]=a,t[119]=j):j=t[119];let M=n.state.lastRunStatus===`failed`||n.state.lastRunStatus===`timeout`?`danger`:`default`,P;t[120]!==r.info.lastRun||t[121]!==j||t[122]!==M?(P=(0,Z.jsx)(Gt,{icon:te,label:A,value:j,valueTone:M}),t[120]=r.info.lastRun,t[121]=j,t[122]=M,t[123]=P):P=t[123];let F;t[124]!==n.state.consecutiveFailures||t[125]!==n.state.lastError||t[126]!==r.dashboard?(F=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]=F):F=t[127];let I;t[128]!==r.info.technicalDetails||t[129]!==_?(I=_.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)(ee,{className:`size-4 transition-transform group-open:rotate-180`,"aria-hidden":!0})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2`,children:_.map(Wt)})]}):null,t[128]=r.info.technicalDetails,t[129]=_,t[130]=I):I=t[130];let R;t[131]!==v||t[132]!==x||t[133]!==w||t[134]!==D||t[135]!==P||t[136]!==F||t[137]!==I||t[138]!==f||t[139]!==p||t[140]!==m?(R=(0,Z.jsxs)(`div`,{className:f,children:[p,m,v,x,w,D,P,F,I]}),t[131]=v,t[132]=x,t[133]=w,t[134]=D,t[135]=P,t[136]=F,t[137]=I,t[138]=f,t[139]=p,t[140]=m,t[141]=R):R=t[141];let B;return t[142]!==R||t[143]!==h||t[144]!==g?(B=(0,Z.jsxs)(`aside`,{className:h,children:[g,R]}),t[142]=R,t[143]=h,t[144]=g,t[145]=B):B=t[145],B}function Wt(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 Gt(e){let t=(0,be.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`,p;t[4]===d?p=t[5]:(p=f(`mt-1 text-sm font-medium leading-5`,d),t[4]=d,t[5]=p);let m;t[6]!==p||t[7]!==i?(m=(0,Z.jsx)(`div`,{className:p,children:i}),t[6]=p,t[7]=i,t[8]=m):m=t[8];let h;t[9]!==a||t[10]!==o?(h=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]=h):h=t[11];let g;t[12]!==u||t[13]!==m||t[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[u,m,h]}),t[12]=u,t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;return t[16]!==l||t[17]!==g?(_=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[1.25rem_1fr] gap-2.5`,children:[l,g]}),t[16]=l,t[17]=g,t[18]=_):_=t[18],_}function Kt(e){let t=(0,be.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 qt(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function Jt(e){let t=(0,be.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 Yt(e){let t=(0,be.c)(8),{className:n,icon:r,title:i}=e,a;t[0]===n?a=t[1]:(a=f(`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 Xt(e){let t=(0,be.c)(274),{form:n,labels:r,setForm:i,projects:a,workflowDefinitions:c,selectedWorkflow:l,workflowsLoading:u,browserAutomations:d,selectedBrowserAutomation:p,browserAutomationsLoading:h,agentOptions:g,agentsLoading:_,language:v,projectLocked:y}=e,b=y===void 0?!1:y,x=m(v).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),T=Date.now(),E;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(E=[1,2,3],t[2]=E):E=t[2];let D;t[3]!==w||t[4]!==T||t[5]!==v?(D=E.map(e=>Ke(T+w*e,v,T)),t[3]=w,t[4]=T,t[5]=v,t[6]=D):D=t[6];let O=D,k,te;t[7]!==n.actionMode||t[8]!==n.workflowId||t[9]!==i||t[10]!==c?(k=()=>{if(n.actionMode!==`workflow`||n.workflowId.trim())return;let e=c[0]?.id;e&&i(t=>({...t,workflowId:e,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}))},te=[n.actionMode,n.workflowId,i,c],t[7]=n.actionMode,t[8]=n.workflowId,t[9]=i,t[10]=c,t[11]=k,t[12]=te):(k=t[11],te=t[12]),(0,q.useEffect)(k,te);let ne,A;t[13]!==d||t[14]!==n.actionMode||t[15]!==n.browserAutomationId||t[16]!==i?(ne=()=>{if(n.actionMode!==`browser_automation`||n.browserAutomationId.trim())return;let e=d[0];e&&i(t=>({...t,browserAutomationId:e.id,browserAutomationInputs:K(e)}))},A=[d,n.actionMode,n.browserAutomationId,i],t[13]=d,t[14]=n.actionMode,t[15]=n.browserAutomationId,t[16]=i,t[17]=ne,t[18]=A):(ne=t[17],A=t[18]),(0,q.useEffect)(ne,A);let j;t[19]===C?j=t[20]:(j=e=>C({name:e.target.value}),t[19]=C,t[20]=j);let M;t[21]!==n.name||t[22]!==j?(M=(0,Z.jsx)(`input`,{className:Q,value:n.name,onChange:j}),t[21]=n.name,t[22]=j,t[23]=M):M=t[23];let N;t[24]!==r.form.name||t[25]!==M?(N=(0,Z.jsx)($,{label:r.form.name,children:M}),t[24]=r.form.name,t[25]=M,t[26]=N):N=t[26];let P;t[27]===C?P=t[28]:(P=e=>C({description:e.target.value}),t[27]=C,t[28]=P);let F;t[29]!==n.description||t[30]!==P?(F=(0,Z.jsx)(`input`,{className:Q,value:n.description,onChange:P}),t[29]=n.description,t[30]=P,t[31]=F):F=t[31];let I;t[32]!==r.form.description||t[33]!==F?(I=(0,Z.jsx)($,{label:r.form.description,children:F}),t[32]=r.form.description,t[33]=F,t[34]=I):I=t[34];let L;t[35]!==n.projectId||t[36]!==r.form.noProject||t[37]!==r.form.project||t[38]!==b||t[39]!==a||t[40]!==C?(L=b?null:(0,Z.jsx)($,{label:r.form.project,children:(0,Z.jsxs)(o,{className:Q,value:n.projectId,onChange:e=>C({projectId:e.target.value}),children:[(0,Z.jsx)(s,{value:``,children:r.form.noProject}),a.map($t)]})}),t[35]=n.projectId,t[36]=r.form.noProject,t[37]=r.form.project,t[38]=b,t[39]=a,t[40]=C,t[41]=L):L=t[41];let R;t[42]===r.form.trigger?R=t[43]:(R=(0,Z.jsx)(en,{title:r.form.trigger}),t[42]=r.form.trigger,t[43]=R);let z;t[44]===C?z=t[45]:(z=e=>C({triggerMode:e.target.value}),t[44]=C,t[45]=z);let B;t[46]===r.trigger.manual?B=t[47]:(B=(0,Z.jsx)(s,{value:`manual`,children:r.trigger.manual}),t[46]=r.trigger.manual,t[47]=B);let re;t[48]===r.trigger.once?re=t[49]:(re=(0,Z.jsx)(s,{value:`once`,children:r.trigger.once}),t[48]=r.trigger.once,t[49]=re);let ie;t[50]===r.trigger.daily?ie=t[51]:(ie=(0,Z.jsx)(s,{value:`daily`,children:r.trigger.daily}),t[50]=r.trigger.daily,t[51]=ie);let V;t[52]===r.trigger.weekly?V=t[53]:(V=(0,Z.jsx)(s,{value:`weekly`,children:r.trigger.weekly}),t[52]=r.trigger.weekly,t[53]=V);let ae;t[54]===r.trigger.interval?ae=t[55]:(ae=(0,Z.jsx)(s,{value:`interval`,children:r.trigger.interval}),t[54]=r.trigger.interval,t[55]=ae);let oe;t[56]===r.trigger.customCron?oe=t[57]:(oe=(0,Z.jsx)(s,{value:`cron`,children:r.trigger.customCron}),t[56]=r.trigger.customCron,t[57]=oe);let ce;t[58]===r.trigger.webhook?ce=t[59]:(ce=(0,Z.jsx)(s,{value:`webhook`,children:r.trigger.webhook}),t[58]=r.trigger.webhook,t[59]=ce);let le;t[60]===r.trigger.taskBlocked?le=t[61]:(le=(0,Z.jsx)(s,{value:`taskBlocked`,children:r.trigger.taskBlocked}),t[60]=r.trigger.taskBlocked,t[61]=le);let ue;t[62]===r.trigger.noteCreated?ue=t[63]:(ue=(0,Z.jsx)(s,{value:`noteCreated`,children:r.trigger.noteCreated}),t[62]=r.trigger.noteCreated,t[63]=ue);let H;t[64]===r.trigger.workflowFailed?H=t[65]:(H=(0,Z.jsx)(s,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[64]=r.trigger.workflowFailed,t[65]=H);let de;t[66]===r.trigger.sessionUpdated?de=t[67]:(de=(0,Z.jsx)(s,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[66]=r.trigger.sessionUpdated,t[67]=de);let U;t[68]===r.trigger.customEvent?U=t[69]:(U=(0,Z.jsx)(s,{value:`event`,children:r.trigger.customEvent}),t[68]=r.trigger.customEvent,t[69]=U);let W;t[70]!==n.triggerMode||t[71]!==z||t[72]!==B||t[73]!==re||t[74]!==ie||t[75]!==V||t[76]!==ae||t[77]!==oe||t[78]!==ce||t[79]!==le||t[80]!==ue||t[81]!==H||t[82]!==de||t[83]!==U?(W=(0,Z.jsxs)(o,{className:Q,value:n.triggerMode,onChange:z,children:[B,re,ie,V,ae,oe,ce,le,ue,H,de,U]}),t[70]=n.triggerMode,t[71]=z,t[72]=B,t[73]=re,t[74]=ie,t[75]=V,t[76]=ae,t[77]=oe,t[78]=ce,t[79]=le,t[80]=ue,t[81]=H,t[82]=de,t[83]=U,t[84]=W):W=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)(fe,{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)(o,{className:Q,value:n.weekday,onChange:e=>C({weekday:e.target.value}),children:[(0,Z.jsx)(s,{value:`1`,children:r.weekdays.monday}),(0,Z.jsx)(s,{value:`2`,children:r.weekdays.tuesday}),(0,Z.jsx)(s,{value:`3`,children:r.weekdays.wednesday}),(0,Z.jsx)(s,{value:`4`,children:r.weekdays.thursday}),(0,Z.jsx)(s,{value:`5`,children:r.weekdays.friday}),(0,Z.jsx)(s,{value:`6`,children:r.weekdays.saturday}),(0,Z.jsx)(s,{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 G=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)(o,{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)(s,{value:`minute`,children:r.form.intervalUnits.minute}),(0,Z.jsx)(s,{value:`hour`,children:r.form.intervalUnits.hour}),(0,Z.jsx)(s,{value:`day`,children:r.form.intervalUnits.day}),(0,Z.jsx)(s,{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:f(`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,v)},`${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,v)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[r.form.nextThreeRuns,`:`,O.join(v===`zh`?`、`:`, `)]}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:r.form.fixedIntervalHint})]})]}):null,_e;t[98]!==n.cronExpr||t[99]!==n.triggerMode||t[100]!==r.form.expression||t[101]!==C?(_e=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]=_e):_e=t[102];let ve;t[103]!==n.triggerMode||t[104]!==n.webhookSecretId||t[105]!==r.form.secretId||t[106]!==C?(ve=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]=ve):ve=t[107];let xe;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?(xe=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:f(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]=xe):xe=t[117];let Se;t[118]===r.form.action?Se=t[119]:(Se=(0,Z.jsx)(en,{title:r.form.action}),t[118]=r.form.action,t[119]=Se);let J;t[120]!==n.timeoutSeconds||t[121]!==n.workflowId||t[122]!==C||t[123]!==c?(J=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()&&c[0]?{workflowId:c[0].id,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}:{}})},t[120]=n.timeoutSeconds,t[121]=n.workflowId,t[122]=C,t[123]=c,t[124]=J):J=t[124];let Ce;t[125]===r.action.runAgent?Ce=t[126]:(Ce=(0,Z.jsx)(s,{value:`agent`,children:r.action.runAgent}),t[125]=r.action.runAgent,t[126]=Ce);let we;t[127]===r.action.runWorkflow?we=t[128]:(we=(0,Z.jsx)(s,{value:`workflow`,children:r.action.runWorkflow}),t[127]=r.action.runWorkflow,t[128]=we);let Te=v===`zh`?`浏览器自动化`:`Browser automation`,Ee;t[129]===Te?Ee=t[130]:(Ee=(0,Z.jsx)(s,{value:`browser_automation`,children:Te}),t[129]=Te,t[130]=Ee);let De;t[131]!==n.actionMode||t[132]!==J||t[133]!==Ce||t[134]!==we||t[135]!==Ee?(De=(0,Z.jsxs)(o,{className:Q,value:n.actionMode,onChange:J,children:[Ce,we,Ee]}),t[131]=n.actionMode,t[132]=J,t[133]=Ce,t[134]=we,t[135]=Ee,t[136]=De):De=t[136];let Oe=n.actionMode===`browser_automation`?null:(0,Z.jsx)($,{label:r.form.agent,children:(0,Z.jsxs)(o,{className:Q,value:n.agentId,onChange:e=>C({agentId:e.target.value}),children:[(0,Z.jsx)(s,{value:``,children:_?r.form.loadingAgents:r.form.defaultAgent}),g.map(e=>(0,Z.jsx)(s,{value:e.id,children:se(e,x)},e.id))]})}),ke;t[137]!==d||t[138]!==h||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]!==v||t[155]!==p||t[156]!==l||t[157]!==C||t[158]!==c||t[159]!==u?(ke=n.actionMode===`agent`?(0,Z.jsxs)($,{label:r.form.instruction,children:[(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(pe,{value:n.instruction,onApply:e=>C({instruction:e}),fieldId:`automation.instruction`,fieldLabel:r.form.instruction,scenario:`automation.instruction`,locale:v,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,agentId:n.agentId},showLabel:!1})}),(0,Z.jsx)(`textarea`,{className:f(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)(o,{className:Q,value:n.workflowId,onChange:e=>C({workflowId:e.target.value,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}),disabled:u||c.length===0,children:[u?(0,Z.jsx)(s,{value:``,children:r.form.loadingWorkflows}):null,!u&&c.length===0?(0,Z.jsx)(s,{value:``,children:r.form.noWorkflows}):null,c.map(Qt)]})}),l?(0,Z.jsx)(ge,{definition:l,language:v,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:l.id,workflowTitle:l.title,workflowDescription:l.description}},inputClassName:`rounded-lg`}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:v===`zh`?`浏览器自动化`:`Browser automation`,children:(0,Z.jsxs)(o,{className:Q,value:n.browserAutomationId,onChange:e=>{let t=d.find(t=>t.id===e.target.value);C({browserAutomationId:e.target.value,browserAutomationInputs:t?K(t):{}})},disabled:h||d.length===0,children:[d.length===0?(0,Z.jsx)(s,{value:``,children:v===`zh`?`没有已启用的浏览器自动化`:`No enabled browser automations`}):null,d.map(Zt)]})}),p&&Object.keys(p.inputs).length>0?(0,Z.jsx)($,{label:v===`zh`?`运行时填写`:`Run inputs`,children:(0,Z.jsx)(ye,{automation:p,values:n.browserAutomationInputs,language:v,onChange:e=>C({browserAutomationInputs:e})})}):null]}),t[137]=d,t[138]=h,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]=v,t[155]=p,t[156]=l,t[157]=C,t[158]=c,t[159]=u,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)(ee,{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)(en,{title:r.form.safety}),(0,Z.jsxs)($,{label:r.form.safety,children:[(0,Z.jsxs)(o,{className:Q,value:n.safetyMode,onChange:e=>{let t=e.target.value;C({safetyMode:t})},children:[(0,Z.jsx)(s,{value:`suggest_only`,children:r.safety.suggest_only}),(0,Z.jsx)(s,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),(0,Z.jsx)(s,{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)(en,{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)(s,{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)(s,{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)(o,{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)(s,{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)(s,{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)(s,{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)(o,{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)(en,{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]!==N||t[258]!==I||t[259]!==L||t[260]!==R||t[261]!==W||t[262]!==me||t[263]!==he||t[264]!==G||t[265]!==_e||t[266]!==ve||t[267]!==xe||t[268]!==Se||t[269]!==De||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:[N,I,L,R,W,me,he,G,_e,ve,xe,Se,De,Oe,ke,pt]})}),t[257]=N,t[258]=I,t[259]=L,t[260]=R,t[261]=W,t[262]=me,t[263]=he,t[264]=G,t[265]=_e,t[266]=ve,t[267]=xe,t[268]=Se,t[269]=De,t[270]=Oe,t[271]=ke,t[272]=pt,t[273]=mt):mt=t[273],mt}function Zt(e){return(0,Z.jsx)(s,{value:e.id,children:e.name},e.id)}function Qt(e){return(0,Z.jsx)(s,{value:e.id,children:e.title||e.name},e.id)}function $t(e){return(0,Z.jsx)(s,{value:e.id,children:e.name},e.id)}var Q=`min-h-11 w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-base sm:min-h-0 sm:text-sm text-fg outline-none focus:border-accent`;function $(e){let t=(0,be.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 en(e){let t=(0,be.c)(3),{title:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(O,{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{kt as t};
@@ -1,3 +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{d as i,h as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./popover-select-DldSX8GX.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./download-Dk-ZjtO6.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{a as d,c as f,n as p,r as m}from"./locale-store-CwuCkjo7.js";import{t as h}from"./messages-D6CRVWtT.js";import{i as g}from"./vendor-swr-BIWyz7Rc.js";import{t as _}from"./button-CGlRPNzi.js";import{n as v,r as y}from"./gateway-config-swr-B2xVR9gt.js";import{t as b}from"./skeleton-BwbyijEw.js";import{$r as x,Gc as S,Ic as C,Ql as w,Qr as ee,Yl as T,Zr as E,_l as te,ac as ne,cu as D,ei as O,il as re,ni as k,oa as ie,pu as ae,sa as A,ti as j}from"./index-B7JCOaCc.js";import{n as oe,r as M}from"./settings-page-layout-CsUQKRq0.js";import{n as se}from"./settings-loading-skeleton-CAmWMaOT.js";import{n as N,t as P}from"./use-autosave-BHxjmV8l.js";import{t as ce}from"./settings-advanced-gate-BgtDlDZh.js";var F=n(),I=e(t(),1);function le(e){let[t,n]=(0,I.useState)(!1),[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(null),l=(0,I.useRef)(null);return{running:t,cancelling:r,progress:a,error:s,install:(0,I.useCallback)(async()=>{if(l.current)return;let t=new AbortController;l.current=t,n(!0),o(null),c(null);try{let n=await O(o,t.signal);if(!n.ok){n.error!==`cancelled`&&c(n.message??n.error);return}e()}catch(e){t.signal.aborted||c(e instanceof Error?e.message:String(e))}finally{l.current===t&&(l.current=null),n(!1),i(!1)}},[e]),cancel:(0,I.useCallback)(async()=>{l.current&&(i(!0),await E().catch(()=>{}),l.current.abort())},[])}}var L=r(),R={extension:`Chrome extension`,playwright:`Playwright Chromium`,cdp:`CDP`,remote:`Remote browser`};function z(e){let{enabled:t,driverKind:n,autosaveStatus:r,zh:a}=e,o=i(),c=g(t?[`browser-control-status`,n]:null,ee,{revalidateOnFocus:!0,refreshInterval:n===`extension`?3e3:0}),[l,d]=(0,I.useState)(null),[f,p]=(0,I.useState)(null),[m,h]=(0,I.useState)(null),v=r===`dirty`||r===`saving`;(0,I.useEffect)(()=>{r===`saved`&&c.mutate()},[r,c.mutate]);let y=(0,I.useCallback)(async(e,t,n)=>{d(e),p(null),h(null);try{await t(),h(n),await c.mutate()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(null)}},[c.mutate]),x=le((0,I.useCallback)(()=>{h(a?`Chromium 已安装,可以开始连接测试。`:`Chromium is installed and ready to test.`),c.mutate()},[c.mutate,a])),w=c.data?.payload,T=w?.driverKind===n,E=t?v||!T?`syncing`:w?.state:`disabled`;return(0,L.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(E===`ready`?s:E===`syncing`?u:ne,{className:`size-4 shrink-0 ${E===`ready`?`text-success`:E===`syncing`?`animate-spin text-fg-muted`:E===`disabled`?`text-fg-subtle`:`text-warning`}`}),(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a?`浏览器就绪状态`:`Browser readiness`}),(0,L.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-xs ${E===`ready`?`bg-success-soft text-success`:E===`disabled`?`bg-surface-hover text-fg-muted`:`bg-warning-soft text-warning`}`,children:E===`ready`?a?`已就绪`:`Ready`:E===`disabled`?a?`未启用`:`Disabled`:E===`syncing`?a?`正在应用配置`:`Applying configuration`:a?`需要处理`:`Needs attention`})]}),(0,L.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[R[n],w?.detail&&T?` · ${w.detail}`:``]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsxs)(_,{variant:`ghost`,className:`h-9`,onClick:()=>void c.mutate(),disabled:c.isValidating,children:[(0,L.jsx)(C,{className:`size-3.5 ${c.isValidating?`animate-spin`:``}`}),a?`刷新`:`Refresh`]}),(0,L.jsxs)(_,{variant:`secondary`,className:`h-9`,disabled:!t||v||l!==null||x.running,onClick:()=>void y(`test`,k,a?`连接测试成功。`:`Connection test passed.`),children:[l===`test`?(0,L.jsx)(u,{className:`size-3.5 animate-spin`}):(0,L.jsx)(S,{className:`size-3.5`}),a?`测试连接`:`Test connection`]})]})]}),t&&c.isLoading?(0,L.jsxs)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-3`,children:[(0,L.jsx)(b,{className:`h-12`}),(0,L.jsx)(b,{className:`h-12`}),(0,L.jsx)(b,{className:`h-12`})]}):null,t&&c.error?(0,L.jsx)(H,{tone:`error`,children:c.error instanceof Error?c.error.message:String(c.error)}):null,f||x.error?(0,L.jsx)(H,{tone:`error`,children:f??x.error}):null,m?(0,L.jsx)(H,{tone:`success`,children:m}):null,t&&n===`extension`&&T?(0,L.jsx)(ue,{status:w?.driverStatus,zh:a,busy:l,run:y,onConnectRemote:()=>o(`/settings/devices?startDevicePairing=browser`)}):null,t&&n===`playwright`&&T?(0,L.jsx)(B,{status:w?.driverStatus,zh:a,installer:x}):null,t&&n===`cdp`?(0,L.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-subtle px-3 py-2 text-xs leading-5 text-fg-muted`,children:a?`连接测试会验证已保存的 CDP 地址,并复用浏览器中现有的标签页和登录状态。`:`The connection test verifies the saved CDP endpoint and reuses that browser’s existing tabs and signed-in state.`}):null,t&&n===`remote`?(0,L.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-subtle px-3 py-2 text-xs leading-5 text-fg-muted`,children:a?`连接测试会在服务商侧创建一个临时浏览器会话,并在测试结束后立即关闭。`:`The connection test creates a temporary provider session and closes it immediately after the test.`}):null]})}function ue(e){let t=(0,F.c)(70),{status:n,zh:r,busy:i,run:a,onConnectRemote:o}=e,s=n?.artifacts,d=r?`扩展文件`:`Extension files`,f=s?.installed===!0,p=s?.installed?r?`已安装`:`Installed`:r?`未安装或需更新`:`Install or update required`,m;t[0]!==d||t[1]!==f||t[2]!==p?(m=(0,L.jsx)(V,{label:d,ok:f,value:p}),t[0]=d,t[1]=f,t[2]=p,t[3]=m):m=t[3];let h=r?`本机自动发现`:`Local auto-discovery`,g=s?.nativeHost?.installed===!0,v=s?.nativeHost?.installed?r?`已就绪`:`Ready`:s?.nativeHost?.reason??(r?`需要修复`:`Repair required`),y;t[4]!==h||t[5]!==g||t[6]!==v?(y=(0,L.jsx)(V,{label:h,ok:g,value:v}),t[4]=h,t[5]=g,t[6]=v,t[7]=y):y=t[7];let b=r?`安全通道`:`Secure channel`,C=n?.transport===`gateway-realtime`,ee=n?.transport===`gateway-realtime`?`Gateway Realtime`:r?`不可用`:`Unavailable`,T;t[8]!==ee||t[9]!==b||t[10]!==C?(T=(0,L.jsx)(V,{label:b,ok:C,value:ee}),t[8]=ee,t[9]=b,t[10]=C,t[11]=T):T=t[11];let E=r?`Chrome 连接`:`Chrome connection`,te=n?.connected===!0,ne=n?.connected?r?`已连接`:`Connected`:n?.socketConnected?r?`需要重新加载扩展`:`Reload extension`:r?`等待扩展连接`:`Waiting for extension`,D;t[12]!==E||t[13]!==te||t[14]!==ne?(D=(0,L.jsx)(V,{label:E,ok:te,value:ne}),t[12]=E,t[13]=te,t[14]=ne,t[15]=D):D=t[15];let O;t[16]!==T||t[17]!==D||t[18]!==m||t[19]!==y?(O=(0,L.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[m,y,T,D]}),t[16]=T,t[17]=D,t[18]=m,t[19]=y,t[20]=O):O=t[20];let re=s?.extensionDir??`Gateway Realtime`,k;t[21]===re?k=t[22]:(k=(0,L.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:re}),t[21]=re,t[22]=k);let ie=s?.installed?`secondary`:`primary`,ae=i!==null,A;t[23]!==s?.installed||t[24]!==a||t[25]!==r?(A=()=>void a(`extension-install`,()=>x(!!s?.installed),r?`扩展文件已准备好。`:`Extension files are ready.`),t[23]=s?.installed,t[24]=a,t[25]=r,t[26]=A):A=t[26];let j;t[27]===i?j=t[28]:(j=i===`extension-install`?(0,L.jsx)(u,{className:`size-3.5 animate-spin`}):(0,L.jsx)(c,{className:`size-3.5`}),t[27]=i,t[28]=j);let oe=s?.installed?r?`刷新扩展文件`:`Refresh files`:r?`安装扩展文件`:`Install extension`,M;t[29]!==ie||t[30]!==ae||t[31]!==A||t[32]!==j||t[33]!==oe?(M=(0,L.jsxs)(_,{className:`h-9`,variant:ie,disabled:ae,onClick:A,children:[j,oe]}),t[29]=ie,t[30]=ae,t[31]=A,t[32]=j,t[33]=oe,t[34]=M):M=t[34];let se=!s?.installed||i!==null,N;t[35]!==a||t[36]!==r?(N=()=>void a(`extension-open`,fe,r?`已打开 Chrome 扩展页。`:`Chrome extensions opened.`),t[35]=a,t[36]=r,t[37]=N):N=t[37];let P;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,L.jsx)(l,{className:`size-3.5`}),t[38]=P):P=t[38];let ce=r?`打开扩展页`:`Open extensions`,I;t[39]!==se||t[40]!==N||t[41]!==ce?(I=(0,L.jsxs)(_,{className:`h-9`,variant:`secondary`,disabled:se,onClick:N,children:[P,ce]}),t[39]=se,t[40]=N,t[41]=ce,t[42]=I):I=t[42];let le=!s?.installed||i!==null,R;t[43]!==a||t[44]!==r?(R=()=>void a(`extension-folder`,de,r?`已打开扩展目录。`:`Extension folder opened.`),t[43]=a,t[44]=r,t[45]=R):R=t[45];let z;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,L.jsx)(w,{className:`size-3.5`}),t[46]=z):z=t[46];let ue=r?`打开扩展目录`:`Open folder`,B;t[47]!==le||t[48]!==R||t[49]!==ue?(B=(0,L.jsxs)(_,{className:`h-9`,variant:`ghost`,disabled:le,onClick:R,children:[z,ue]}),t[47]=le,t[48]=R,t[49]=ue,t[50]=B):B=t[50];let H=i!==null,U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,L.jsx)(S,{className:`size-3.5`}),t[51]=U):U=t[51];let pe=r?`连接远程 Chrome`:`Connect remote Chrome`,W;t[52]!==o||t[53]!==H||t[54]!==pe?(W=(0,L.jsxs)(_,{className:`h-9`,variant:`secondary`,disabled:H,onClick:o,children:[U,pe]}),t[52]=o,t[53]=H,t[54]=pe,t[55]=W):W=t[55];let G;t[56]!==M||t[57]!==I||t[58]!==B||t[59]!==W?(G=(0,L.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[M,I,B,W]}),t[56]=M,t[57]=I,t[58]=B,t[59]=W,t[60]=G):G=t[60];let K;t[61]!==n?.connected||t[62]!==n?.socketConnected||t[63]!==r?(K=n?.connected?null:(0,L.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-muted`,children:n?.socketConnected?r?`扩展仍在运行旧协议。请打开 Chrome 扩展页,找到 xopc 并点击“重新加载”,然后刷新状态。`:`The extension is still running an older protocol. Open Chrome Extensions, find xopc, click Reload, then refresh status.`:r?`打开 xopc Chrome 扩展后,它会自动发现并安全连接本机 Gateway;只有连接另一台电脑时才需要一次性邀请和手动确认。`:`Open the xopc Chrome extension to discover and securely connect to a local Gateway automatically. A one-time invitation and explicit approval are only required for Chrome on another computer.`}),t[61]=n?.connected,t[62]=n?.socketConnected,t[63]=r,t[64]=K):K=t[64];let q;return t[65]!==O||t[66]!==k||t[67]!==G||t[68]!==K?(q=(0,L.jsxs)(`div`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[O,k,G,K]}),t[65]=O,t[66]=k,t[67]=G,t[68]=K,t[69]=q):q=t[69],q}function de(){return j(`folder`)}function fe(){return j(`chrome`)}function B(e){let t=(0,F.c)(28),{status:n,zh:r,installer:i}=e,a=n?.installed===!0,o=n?.installed?r?`已安装`:`Installed`:n?.reason??(r?`未安装`:`Not installed`),s;t[0]!==a||t[1]!==o?(s=(0,L.jsx)(V,{label:`Chromium`,ok:a,value:o}),t[0]=a,t[1]=o,t[2]=s):s=t[2];let l;t[3]===n?l=t[4]:(l=n?.executablePath?(0,L.jsx)(`p`,{className:`mt-2 break-all text-xs text-fg-subtle`,children:n.executablePath}):null,t[3]=n,t[4]=l);let d;t[5]===i.progress?d=t[6]:(d=i.progress?(0,L.jsxs)(`div`,{className:`mt-3`,children:[(0,L.jsxs)(`div`,{className:`flex justify-between text-xs text-fg-muted`,children:[(0,L.jsx)(`span`,{children:i.progress.message??i.progress.phase}),(0,L.jsx)(`span`,{children:i.progress.percent==null?``:`${Math.round(i.progress.percent)}%`})]}),(0,L.jsx)(`div`,{className:`mt-1 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,L.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width]`,style:{width:`${i.progress.percent??8}%`}})})]}):null,t[5]=i.progress,t[6]=d);let f=n?.installed?`secondary`:`primary`,p;t[7]===i?p=t[8]:(p=()=>void i.install(),t[7]=i,t[8]=p);let m;t[9]===i.running?m=t[10]:(m=i.running?(0,L.jsx)(u,{className:`size-3.5 animate-spin`}):(0,L.jsx)(c,{className:`size-3.5`}),t[9]=i.running,t[10]=m);let h=n?.installed?r?`重新安装 Chromium`:`Reinstall Chromium`:r?`安装 Chromium`:`Install Chromium`,g;t[11]!==i.running||t[12]!==f||t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,L.jsxs)(_,{variant:f,className:`h-9`,disabled:i.running,onClick:p,children:[m,h]}),t[11]=i.running,t[12]=f,t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16];let v;t[17]!==i||t[18]!==r?(v=i.running?(0,L.jsx)(_,{variant:`ghost`,className:`h-9`,disabled:i.cancelling,onClick:()=>void i.cancel(),children:i.cancelling?r?`正在取消…`:`Cancelling…`:r?`取消`:`Cancel`}):null,t[17]=i,t[18]=r,t[19]=v):v=t[19];let y;t[20]!==v||t[21]!==g?(y=(0,L.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[g,v]}),t[20]=v,t[21]=g,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==s||t[25]!==l||t[26]!==d?(b=(0,L.jsxs)(`div`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[s,l,d,y]}),t[23]=y,t[24]=s,t[25]=l,t[26]=d,t[27]=b):b=t[27],b}function V(e){let t=(0,F.c)(11),{label:n,ok:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,L.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=a);let o=`mt-1 flex items-center gap-1.5 text-sm ${r?`text-success`:`text-fg-muted`}`,s=`size-1.5 rounded-full ${r?`bg-success`:`bg-warning`}`,c;t[2]===s?c=t[3]:(c=(0,L.jsx)(`span`,{className:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c||t[6]!==i?(l=(0,L.jsxs)(`p`,{className:o,children:[c,i]}),t[4]=o,t[5]=c,t[6]=i,t[7]=l):l=t[7];let u;return t[8]!==a||t[9]!==l?(u=(0,L.jsxs)(`div`,{className:`rounded-lg bg-surface-subtle px-3 py-2`,children:[a,l]}),t[8]=a,t[9]=l,t[10]=u):u=t[10],u}function H(e){let t=(0,F.c)(4),{tone:n,children:r}=e,i=`mt-3 rounded-lg px-3 py-2 text-xs ${n===`success`?`bg-success-soft text-success`:`bg-danger-soft text-danger`}`,a=n===`error`?`alert`:`status`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,L.jsx)(`p`,{className:i,role:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function U(e){let t=(0,F.c)(36),{sectionId:n,vm:r,children:i}=e,a=p(pe),o;t[0]===a?o=t[1]:(o=h(a),t[0]=a,t[1]=o);let s=o,c=s.agentSettings,l=s.settingsSections[n]??n;if(!r.hasToken){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(ae,{className:`mt-0.5 size-5 shrink-0 text-fg-subtle`,strokeWidth:1.75}),t[2]=e):e=t[2];let n;t[3]===l?n=t[4]:(n=(0,L.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:l}),t[3]=l,t[4]=n);let r;t[5]===c.needToken?r=t[6]:(r=(0,L.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:c.needToken}),t[5]=c.needToken,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,L.jsx)(M,{gap:`gap-3`,padding:`px-3 py-10 sm:px-5 xl:px-6`,children:(0,L.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl bg-surface-base p-6`,children:[e,(0,L.jsxs)(`div`,{children:[n,r]})]})}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}if(r.loading){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(M,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,L.jsx)(se,{sections:1})}),t[10]=e):e=t[10],e}if(!r.form){let e=r.error??r.fetchError??c.loadError,n;t[11]===e?n=t[12]:(n=(0,L.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[11]=e,t[12]=n);let i;t[13]===r?i=t[14]:(i=()=>void r.mutate(),t[13]=r,t[14]=i);let a;t[15]!==s.logs.refresh||t[16]!==i?(a=(0,L.jsx)(_,{type:`button`,variant:`secondary`,onClick:i,children:s.logs.refresh}),t[15]=s.logs.refresh,t[16]=i,t[17]=a):a=t[17];let o;return t[18]!==n||t[19]!==a?(o=(0,L.jsxs)(M,{gap:`gap-3`,padding:`px-3 py-10 sm:px-5 xl:px-6`,children:[n,a]}),t[18]=n,t[19]=a,t[20]=o):o=t[20],o}let u;t[21]!==r.autosaveStatus||t[22]!==r.error?(u=(0,L.jsx)(N,{status:r.autosaveStatus,error:r.error}),t[21]=r.autosaveStatus,t[22]=r.error,t[23]=u):u=t[23];let d;t[24]!==l||t[25]!==u?(d=(0,L.jsx)(oe,{title:l,actions:u}),t[24]=l,t[25]=u,t[26]=d):d=t[26];let f;t[27]===r.error?f=t[28]:(f=r.error?(0,L.jsx)(`div`,{className:`rounded-md border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900/50 dark:bg-red-950/50 dark:text-red-400`,role:`alert`,children:r.error}):null,t[27]=r.error,t[28]=f);let m;t[29]===i?m=t[30]:(m=(0,L.jsx)(`div`,{className:`flex min-w-0 flex-col gap-5 pb-8`,children:i}),t[29]=i,t[30]=m);let g;return t[31]!==d||t[32]!==f||t[33]!==m||t[34]!==r.onBlurCapture?(g=(0,L.jsxs)(M,{gap:`gap-6`,onBlurCapture:r.onBlurCapture,children:[d,f,m]}),t[31]=d,t[32]=f,t[33]=m,t[34]=r.onBlurCapture,t[35]=g):g=t[35],g}function pe(e){return e.language}var W={enabled:!0,driverKind:`extension`,headless:!1,executablePath:``,cdpEndpoint:`http://127.0.0.1:9222`,remoteProvider:`browserbase`,remoteApiKey:``,remoteProjectId:``,remoteRegion:``,maxNodes:180,maxCharacters:12e3,visualFallback:!0,actionTimeoutMs:3e4,sessionTimeoutMs:9e5,maxSequenceLength:5,allowedPrivateHosts:``,crossDomainNavigation:`ask`,uploads:`ask`,consequentialActions:`ask`};function G(e){let t=J(J(e).browser),n=J(t.driver),r=J(t.observation),i=J(t.limits),a=J(t.security),o=n.kind;return{...W,enabled:t.enabled!==!1,driverKind:o===`playwright`||o===`cdp`||o===`remote`?o:`extension`,headless:n.headless===!0,executablePath:Y(n.executablePath,``),cdpEndpoint:Y(n.endpoint,W.cdpEndpoint),remoteProvider:n.provider===`browser-use`?`browser-use`:`browserbase`,remoteApiKey:Y(n.apiKey,``),remoteProjectId:Y(n.projectId,``),remoteRegion:Y(n.region,``),maxNodes:X(r.maxNodes,W.maxNodes),maxCharacters:X(r.maxCharacters,W.maxCharacters),visualFallback:r.visualFallback!==!1,actionTimeoutMs:X(i.actionTimeoutMs,W.actionTimeoutMs),sessionTimeoutMs:X(i.sessionTimeoutMs,W.sessionTimeoutMs),maxSequenceLength:X(i.maxSequenceLength,W.maxSequenceLength),allowedPrivateHosts:Array.isArray(a.allowedPrivateHosts)?a.allowedPrivateHosts.filter(e=>typeof e==`string`).join(`
2
- `):``,crossDomainNavigation:he(a.crossDomainNavigation),uploads:he(a.uploads),consequentialActions:he(a.consequentialActions)}}function K(e){let t=e.driverKind===`extension`?{kind:`extension`}:e.driverKind===`playwright`?{kind:`playwright`,headless:e.headless,...e.executablePath.trim()?{executablePath:e.executablePath.trim()}:{}}:e.driverKind===`cdp`?{kind:`cdp`,endpoint:e.cdpEndpoint.trim()}:{kind:`remote`,provider:e.remoteProvider,...e.remoteApiKey.trim()?{apiKey:e.remoteApiKey.trim()}:{},...e.remoteProjectId.trim()?{projectId:e.remoteProjectId.trim()}:{},...e.remoteRegion.trim()?{region:e.remoteRegion.trim()}:{}};return{enabled:e.enabled,driver:t,observation:{maxNodes:e.maxNodes,maxCharacters:e.maxCharacters,visualFallback:e.visualFallback},limits:{actionTimeoutMs:e.actionTimeoutMs,sessionTimeoutMs:e.sessionTimeoutMs,maxSequenceLength:e.maxSequenceLength},security:{privateNetworks:`deny`,allowedPrivateHosts:e.allowedPrivateHosts.split(`
3
- `).map(e=>e.trim()).filter(Boolean),crossDomainNavigation:e.crossDomainNavigation,uploads:e.uploads,consequentialActions:e.consequentialActions}}}function q(e){if(e.driverKind===`cdp`)try{let t=new URL(e.cdpEndpoint);if(t.protocol!==`http:`&&t.protocol!==`https:`&&t.protocol!==`ws:`&&t.protocol!==`wss:`)return`CDP endpoint must use http, https, ws, or wss.`}catch{return`Enter a valid CDP endpoint URL.`}return!Number.isInteger(e.maxNodes)||e.maxNodes<20||e.maxNodes>500?`Max nodes must be between 20 and 500.`:!Number.isInteger(e.maxCharacters)||e.maxCharacters<1e3||e.maxCharacters>5e4?`Max characters must be between 1,000 and 50,000.`:!Number.isInteger(e.actionTimeoutMs)||e.actionTimeoutMs<1e3||e.actionTimeoutMs>12e4?`Action timeout must be between 1,000 and 120,000 ms.`:!Number.isInteger(e.sessionTimeoutMs)||e.sessionTimeoutMs<6e4||e.sessionTimeoutMs>36e5?`Session timeout must be between 60,000 and 3,600,000 ms.`:!Number.isInteger(e.maxSequenceLength)||e.maxSequenceLength<1||e.maxSequenceLength>10?`Sequence length must be between 1 and 10.`:null}async function me(e){await d(m(`/api/config`),{method:`PATCH`,body:JSON.stringify({browser:K(e)})}),v()}function J(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Y(e,t){return typeof e==`string`?e:t}function X(e,t){return typeof e==`number`&&Number.isFinite(e)?e:t}function he(e){return e===`allow`||e===`deny`?e:`ask`}var ge=ie();function _e(e){let t=!!f(e=>e.conversationId),[n,r]=(0,I.useReducer)(ge,{form:null,baseline:null}),i=n.form,a=n.baseline,o=(0,I.useRef)(!1),s=(0,I.useRef)(i);s.current=i;let c=(0,I.useRef)(null),{data:l,error:u,isLoading:d,mutate:p}=y(t);A({enabled:t,parsed:(0,I.useMemo)(()=>l?.payload?.config===void 0?null:G(l.payload.config),[l]),dirty:o.current,trackedParsedRef:c,dispatch:r,onResetDirty:()=>{o.current=!1}});let m=!!(t&&d&&l===void 0&&!u),h=u instanceof Error?u.message:u?String(u):null,g=(0,I.useMemo)(()=>!i||!a?!1:JSON.stringify(i)!==JSON.stringify(a),[i,a]),_=(0,I.useCallback)(e=>{o.current=!0,r({type:`patch`,patch:e})},[]),v=P({value:i,dirty:g,onSave:(0,I.useCallback)(async t=>{try{await me(t),r({type:`saved`,value:t}),o.current=!!(s.current&&JSON.stringify(s.current)!==JSON.stringify(t))}catch(t){throw Error(t instanceof Error?t.message:e.saveError)}},[e.saveError]),validate:q});return{hasToken:t,loading:m,fetchError:h,form:i,update:_,autosaveStatus:v.status,error:v.error,onBlurCapture:v.onBlurCapture,mutate:p}}var ve=[`extension`,`playwright`,`cdp`,`remote`];function ye(){let e=(0,F.c)(29),t=p(be),n;e[0]===t?n=e[1]:(n=h(t),e[0]=t,e[1]=n);let r=_e(n.agentSettings),i=r.form,s=t===`zh`,[c]=a(),l=(0,I.useRef)(!1),u;e[2]!==i||e[3]!==c||e[4]!==r?(u=()=>{if(!i||l.current)return;l.current=!0;let e=c.get(`driver`);ve.includes(e)&&e!==i.driverKind&&r.update({driverKind:e})},e[2]=i,e[3]=c,e[4]=r,e[5]=u):u=e[5];let d;e[6]!==i||e[7]!==c||e[8]!==r.update?(d=[i,c,r.update],e[6]=i,e[7]=c,e[8]=r.update,e[9]=d):d=e[9],(0,I.useEffect)(u,d);let f=s?`Chrome 扩展(推荐)`:`Chrome extension (recommended)`,m;e[10]===f?m=e[11]:(m={value:`extension`,label:f},e[10]=f,e[11]=m);let g;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(g={value:`playwright`,label:`Playwright Chromium`},e[12]=g):g=e[12];let _=s?`CDP 已有浏览器`:`Existing browser over CDP`,v;e[13]===_?v=e[14]:(v={value:`cdp`,label:_},e[13]=_,e[14]=v);let y=s?`远程浏览器`:`Remote browser`,b;e[15]===y?b=e[16]:(b={value:`remote`,label:y},e[15]=y,e[16]=b);let x;e[17]!==m||e[18]!==v||e[19]!==b?(x=[m,g,v,b],e[17]=m,e[18]=v,e[19]=b,e[20]=x):x=e[20];let S=x,C;e[21]!==S||e[22]!==i||e[23]!==r||e[24]!==s?(C=i?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(z,{enabled:i.enabled,driverKind:i.driverKind,autosaveStatus:r.autosaveStatus,zh:s}),(0,L.jsxs)(Se,{title:s?`运行方式`:`Connection`,icon:(0,L.jsx)(re,{className:`size-4`}),children:[(0,L.jsx)(Ce,{label:s?`启用浏览器控制`:`Enable browser control`,checked:i.enabled,onChange:e=>r.update({enabled:e})}),(0,L.jsx)(Z,{label:s?`浏览器连接`:`Browser connection`,children:(0,L.jsx)(o,{value:i.driverKind,options:S,placeholder:s?`选择连接方式`:`Choose a connection`,allowEmpty:!1,onChange:e=>r.update({driverKind:e})})}),(0,L.jsx)(xe,{kind:i.driverKind,zh:s}),i.driverKind===`playwright`?(0,L.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-subtle p-4`,children:[(0,L.jsx)(Ce,{label:s?`无头模式`:`Headless mode`,description:s?`后台运行,不显示浏览器窗口。关闭后可观察智能体的操作过程。`:`Run in the background without a visible window. Turn off to watch the agent work.`,checked:i.headless,onChange:e=>r.update({headless:e})}),(0,L.jsx)(Q,{label:s?`Chromium 可执行文件(可选)`:`Chromium executable (optional)`,description:s?`留空时使用由 xopc 安装的 Chromium。`:`Leave empty to use Chromium installed by xopc.`,value:i.executablePath,onChange:e=>r.update({executablePath:e})})]}):null,i.driverKind===`cdp`?(0,L.jsx)(`div`,{className:`rounded-lg bg-surface-subtle p-4`,children:(0,L.jsx)(Q,{label:`CDP endpoint`,description:s?`例如 http://127.0.0.1:9222。Chrome 需要开启 remote debugging。`:`For example http://127.0.0.1:9222. Chrome must be started with remote debugging enabled.`,value:i.cdpEndpoint,onChange:e=>r.update({cdpEndpoint:e})})}):null,i.driverKind===`remote`?(0,L.jsxs)(`div`,{className:`space-y-4 rounded-lg bg-surface-subtle p-4`,children:[(0,L.jsx)(Z,{label:s?`服务商`:`Provider`,children:(0,L.jsx)(o,{value:i.remoteProvider,options:[{value:`browserbase`,label:`Browserbase`},{value:`browser-use`,label:`Browser Use`}],placeholder:s?`选择服务商`:`Choose a provider`,allowEmpty:!1,onChange:e=>r.update({remoteProvider:e})})}),(0,L.jsx)(Q,{label:`API key`,type:`password`,autoComplete:`off`,value:i.remoteApiKey,onChange:e=>r.update({remoteApiKey:e})}),(0,L.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,L.jsx)(Q,{label:`Project ID`,value:i.remoteProjectId,onChange:e=>r.update({remoteProjectId:e})}),(0,L.jsx)(Q,{label:`Region`,value:i.remoteRegion,onChange:e=>r.update({remoteRegion:e})})]})]}):null]}),(0,L.jsx)(ce,{children:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Se,{title:s?`页面理解`:`Page understanding`,icon:(0,L.jsx)(D,{className:`size-4`}),children:[(0,L.jsx)(Ce,{label:s?`需要时附加截图`:`Attach screenshots when needed`,checked:i.visualFallback,onChange:e=>r.update({visualFallback:e})}),(0,L.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,L.jsx)($,{label:s?`语义节点上限`:`Semantic node limit`,description:`20–500`,min:20,max:500,value:i.maxNodes,onChange:e=>r.update({maxNodes:e})}),(0,L.jsx)($,{label:s?`文本字符上限`:`Text character limit`,description:`1,000–50,000`,min:1e3,max:5e4,step:1e3,value:i.maxCharacters,onChange:e=>r.update({maxCharacters:e})})]})]}),(0,L.jsx)(Se,{title:s?`执行限制`:`Execution limits`,icon:(0,L.jsx)(T,{className:`size-4`}),children:(0,L.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,L.jsx)($,{label:s?`操作超时(毫秒)`:`Action timeout (ms)`,min:1e3,max:12e4,step:1e3,value:i.actionTimeoutMs,onChange:e=>r.update({actionTimeoutMs:e})}),(0,L.jsx)($,{label:s?`会话超时(毫秒)`:`Session timeout (ms)`,min:6e4,max:36e5,step:6e4,value:i.sessionTimeoutMs,onChange:e=>r.update({sessionTimeoutMs:e})}),(0,L.jsx)($,{label:s?`批量步骤上限`:`Sequence step limit`,min:1,max:10,value:i.maxSequenceLength,onChange:e=>r.update({maxSequenceLength:e})})]})}),(0,L.jsxs)(Se,{title:s?`安全与审批`:`Safety and approvals`,icon:(0,L.jsx)(te,{className:`size-4`}),children:[(0,L.jsx)(Q,{label:s?`允许访问的私网主机`:`Allowed private hosts`,description:s?`每行一个主机名或 IP,不支持通配符。`:`One hostname or IP per line. Wildcards are not supported.`,multiline:!0,value:i.allowedPrivateHosts,onChange:e=>r.update({allowedPrivateHosts:e})}),(0,L.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,L.jsx)(we,{zh:s,label:s?`跨域导航`:`Cross-domain navigation`,value:i.crossDomainNavigation,onChange:e=>r.update({crossDomainNavigation:e})}),(0,L.jsx)(we,{zh:s,label:s?`高影响动作`:`Consequential actions`,value:i.consequentialActions,onChange:e=>r.update({consequentialActions:e})}),(0,L.jsx)(we,{zh:s,label:s?`文件上传`:`File uploads`,value:i.uploads,onChange:e=>r.update({uploads:e})})]})]})]})})]}):null,e[21]=S,e[22]=i,e[23]=r,e[24]=s,e[25]=C):C=e[25];let w;return e[26]!==C||e[27]!==r?(w=(0,L.jsx)(U,{sectionId:`agent-browser`,vm:r,children:C}),e[26]=C,e[27]=r,e[28]=w):w=e[28],w}function be(e){return e.language}function xe(e){let t=(0,F.c)(7),{kind:n,zh:r}=e,i=r?`直接操作你正在使用的 Chrome,保留登录状态和现有标签页;最适合日常协作。`:`Operate your current Chrome with its signed-in state and existing tabs; best for daily collaboration.`,a=r?`由 xopc 启动独立 Chromium,环境隔离、自动化稳定,适合无人值守任务。`:`Let xopc launch an isolated Chromium; stable for unattended automation.`,o=r?`连接已开启远程调试的 Chrome 或 Chromium,适合自定义浏览器启动方式。`:`Connect to Chrome or Chromium already running with remote debugging.`,s=r?`使用 Browserbase 或 Browser Use 的云端浏览器,适合服务器环境和长任务。`:`Use a Browserbase or Browser Use cloud browser for servers and long-running tasks.`,c;t[0]!==i||t[1]!==a||t[2]!==o||t[3]!==s?(c={extension:i,playwright:a,cdp:o,remote:s},t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c):c=t[4];let l=c[n],u;return t[5]===l?u=t[6]:(u=(0,L.jsx)(`p`,{className:`rounded-lg bg-surface-subtle px-3 py-2 text-xs leading-5 text-fg-muted`,children:l}),t[5]=l,t[6]=u),u}function Se(e){let t=(0,F.c)(17),{title:n,description:r,icon:i,children:a}=e,o;t[0]===i?o=t[1]:(o=(0,L.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:i}),t[0]=i,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n}),t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=r?(0,L.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r}):null,t[4]=r,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,L.jsxs)(`div`,{children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==o||t[10]!==l?(u=(0,L.jsxs)(`div`,{className:`mb-4 flex items-start gap-2`,children:[o,l]}),t[9]=o,t[10]=l,t[11]=u):u=t[11];let d;t[12]===a?d=t[13]:(d=(0,L.jsx)(`div`,{className:`space-y-4`,children:a}),t[12]=a,t[13]=d);let f;return t[14]!==u||t[15]!==d?(f=(0,L.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-5`,children:[u,d]}),t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function Z(e){let t=(0,F.c)(8),{label:n,description:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,L.jsx)(`span`,{className:`mb-1.5 block font-medium`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,L.jsx)(`span`,{className:`mt-1.5 block text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,L.jsxs)(`label`,{className:`block text-sm text-fg`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Q(e){let t=(0,F.c)(10),{label:n,description:r,value:i,onChange:a,type:o,multiline:s,autoComplete:c}=e,l=o===void 0?`text`:o,u=s===void 0?!1:s,d;t[0]!==c||t[1]!==u||t[2]!==a||t[3]!==l||t[4]!==i?(d=u?(0,L.jsx)(`textarea`,{rows:3,value:i,onChange:e=>a(e.target.value),className:`w-full rounded-lg border border-edge bg-surface-subtle px-3 py-2 text-sm text-fg outline-none focus:border-accent`}):(0,L.jsx)(`input`,{type:l,autoComplete:c,value:i,onChange:e=>a(e.target.value),className:`w-full rounded-lg border border-edge bg-surface-subtle px-3 py-2 text-sm text-fg outline-none focus:border-accent`}),t[0]=c,t[1]=u,t[2]=a,t[3]=l,t[4]=i,t[5]=d):d=t[5];let f;return t[6]!==r||t[7]!==n||t[8]!==d?(f=(0,L.jsx)(Z,{label:n,description:r,children:d}),t[6]=r,t[7]=n,t[8]=d,t[9]=f):f=t[9],f}function $(e){let t=(0,F.c)(12),{label:n,description:r,value:i,onChange:a,min:o,max:s,step:c}=e,l=c===void 0?1:c,u;t[0]===a?u=t[1]:(u=e=>{let t=Number(e.target.value);Number.isFinite(t)&&a(t)},t[0]=a,t[1]=u);let d;t[2]!==s||t[3]!==o||t[4]!==l||t[5]!==u||t[6]!==i?(d=(0,L.jsx)(`input`,{type:`number`,min:o,max:s,step:l,value:i,onChange:u,className:`h-10 w-full rounded-lg border border-edge bg-surface-subtle px-3 text-sm text-fg outline-none focus:border-accent`}),t[2]=s,t[3]=o,t[4]=l,t[5]=u,t[6]=i,t[7]=d):d=t[7];let f;return t[8]!==r||t[9]!==n||t[10]!==d?(f=(0,L.jsx)(Z,{label:n,description:r,children:d}),t[8]=r,t[9]=n,t[10]=d,t[11]=f):f=t[11],f}function Ce(e){let t=(0,F.c)(15),{label:n,description:r,checked:i,onChange:a}=e,o;t[0]===a?o=t[1]:(o=e=>a(e.target.checked),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==o?(s=(0,L.jsx)(`input`,{type:`checkbox`,checked:i,onChange:o,className:`mt-0.5 size-4 accent-accent`}),t[2]=i,t[3]=o,t[4]=s):s=t[4];let c;t[5]===n?c=t[6]:(c=(0,L.jsx)(`span`,{className:`block font-medium`,children:n}),t[5]=n,t[6]=c);let l;t[7]===r?l=t[8]:(l=r?(0,L.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-subtle`,children:r}):null,t[7]=r,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,L.jsxs)(`span`,{children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==s||t[13]!==u?(d=(0,L.jsxs)(`label`,{className:`flex items-start gap-3 text-sm text-fg`,children:[s,u]}),t[12]=s,t[13]=u,t[14]=d):d=t[14],d}function we(e){let t=(0,F.c)(20),{zh:n,label:r,value:i,onChange:a}=e,s=n?`每次询问`:`Ask each time`,c;t[0]===s?c=t[1]:(c={value:`ask`,label:s},t[0]=s,t[1]=c);let l=n?`允许`:`Allow`,u;t[2]===l?u=t[3]:(u={value:`allow`,label:l},t[2]=l,t[3]=u);let d=n?`拒绝`:`Deny`,f;t[4]===d?f=t[5]:(f={value:`deny`,label:d},t[4]=d,t[5]=f);let p;t[6]!==c||t[7]!==u||t[8]!==f?(p=[c,u,f],t[6]=c,t[7]=u,t[8]=f,t[9]=p):p=t[9];let m=p,h=n?`选择策略`:`Choose a policy`,g;t[10]===a?g=t[11]:(g=e=>a(e),t[10]=a,t[11]=g);let _;t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==i?(_=(0,L.jsx)(o,{value:i,options:m,placeholder:h,allowEmpty:!1,onChange:g}),t[12]=m,t[13]=h,t[14]=g,t[15]=i,t[16]=_):_=t[16];let v;return t[17]!==r||t[18]!==_?(v=(0,L.jsx)(Z,{label:r,children:_}),t[17]=r,t[18]=_,t[19]=v):v=t[19],v}export{ye as AgentBrowserSettingsPage};