@xopcai/xopc 0.0.147 → 0.0.148

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 (97) 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-DXeSSlw1.js → activity-store-B5h0UGWn.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CFdJKSjY.js → agent-avatar-dicebear-Dy5VvLUq.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-DKjbRpbA.js → agents-Ci1U96gj.js} +1 -1
  6. package/dist/gateway/static/root/assets/{api-Bs69B5zA.js → api-B3J2AmQW.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-ag1ViXT_.js → app-management-settings-panel-BbSLDubO.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-C6iMpwOM.js → appearance-settings-D9wK0UKA.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-Z6cQTPS6.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-Dwi3mIBy.js → archive-plugin-DaDK-FYa.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-BaCDoq40.js → attachment-load-CKiBdU_s.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automation-suggestion-card-CwqtFgnw.js → automation-suggestion-card-8Qbnxq-p.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-DlupOxFQ.js → automations-page-D7HmeFdr.js} +1 -1
  14. package/dist/gateway/static/root/assets/{binary-plugins-DoAYhsxa.js → binary-plugins-ByZbwN2A.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-Bw72pO7S.js → block-editor-DGaI2ucU.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-settings-page-BwLoUBcZ.js → browser-settings-page-BZ25v96s.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capability-presets-api-vdbAR65Q.js → capability-presets-api-DaPf3b5d.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-BAsKbJgm.js → capability-presets-settings-panel-C0iHFbY9.js} +1 -1
  19. package/dist/gateway/static/root/assets/{channel-recipient-api-rTG26jpV.js → channel-recipient-api-DrbkoYyF.js} +1 -1
  20. package/dist/gateway/static/root/assets/{channels-settings-CxFWy0cE.js → channels-settings-Bc7FVeqs.js} +1 -1
  21. package/dist/gateway/static/root/assets/channels-status-swr-P3J5voxb.js +1 -0
  22. package/dist/gateway/static/root/assets/{connector-logo-DIMP4NWY.js → connector-logo-CiHea96v.js} +1 -1
  23. package/dist/gateway/static/root/assets/{connectors-page-BjQQwX62.js → connectors-page-oi41mE3U.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-kQq2e0BN.js → desktop-pet-DzdsBRdD.js} +1 -1
  25. package/dist/gateway/static/root/assets/{desktop-pet-settings-B6vtozMY.js → desktop-pet-settings-B-URlTdB.js} +1 -1
  26. package/dist/gateway/static/root/assets/{directory-picker-path-field-Dn5-e3v4.js → directory-picker-path-field-g_N_ROC-.js} +1 -1
  27. package/dist/gateway/static/root/assets/{dreaming-settings-BzwIujPG.js → dreaming-settings-DnEe0Mxg.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-debug-page-D_e_hsEy.js → extension-debug-page-DPkoOQED.js} +1 -1
  29. package/dist/gateway/static/root/assets/{extension-page-D15CWHBd.js → extension-page-Cf_gDelx.js} +1 -1
  30. package/dist/gateway/static/root/assets/{extension-settings-page-D4P0n1om.js → extension-settings-page-YlXpJV9k.js} +1 -1
  31. package/dist/gateway/static/root/assets/{gateway-config-api-B4qZctjG.js → gateway-config-api-BxHgXB-I.js} +1 -1
  32. package/dist/gateway/static/root/assets/{gateway-settings-BvndV7TP.js → gateway-settings-CGphLe9T.js} +1 -1
  33. package/dist/gateway/static/root/assets/{gateway-startup-retry-BpgMunEb.js → gateway-startup-retry-ChI88pp7.js} +1 -1
  34. package/dist/gateway/static/root/assets/{goal-create-dialog-DrVHKXHq.js → goal-create-dialog-ClzciTH5.js} +1 -1
  35. package/dist/gateway/static/root/assets/{goal-detail-page-PHlCwv68.js → goal-detail-page-CyaLkWhd.js} +1 -1
  36. package/dist/gateway/static/root/assets/{goals-config-api-B6YJB_ct.js → goals-config-api-NoJKU8UZ.js} +1 -1
  37. package/dist/gateway/static/root/assets/{goals-page-Hg9uyO6e.js → goals-page-C-srWhsP.js} +1 -1
  38. package/dist/gateway/static/root/assets/{goals-settings-BROWCIcL.js → goals-settings-kQ1pBOM9.js} +1 -1
  39. package/dist/gateway/static/root/assets/{heartbeat-settings-CoCwIOIg.js → heartbeat-settings-C6jSQCXQ.js} +1 -1
  40. package/dist/gateway/static/root/assets/index-DktduA8Z.css +1 -0
  41. package/dist/gateway/static/root/assets/{index-CxkNzw3e.js → index-twNrYC3D.js} +59 -59
  42. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Bm_AIYQ7.js → keyboard-shortcuts-settings-CIQ6wLqH.js} +1 -1
  43. package/dist/gateway/static/root/assets/{local-app-workbench-page-BJWFcxwG.js → local-app-workbench-page-DcaqgchY.js} +1 -1
  44. package/dist/gateway/static/root/assets/local-apps-page-BO6odwNn.js +1 -0
  45. package/dist/gateway/static/root/assets/{locale-store-Bp8joZck.js → locale-store-BP67jtYG.js} +1 -1
  46. package/dist/gateway/static/root/assets/{logs-page-DOmK61ey.js → logs-page-B_13EkK7.js} +1 -1
  47. package/dist/gateway/static/root/assets/{markdown-split-Dy7QpaAz.js → markdown-split-DbJZwtmM.js} +1 -1
  48. package/dist/gateway/static/root/assets/{media-plugins-3Lxliy9D.js → media-plugins-B0WH561o.js} +1 -1
  49. package/dist/gateway/static/root/assets/{messages-CQGpD-dC.js → messages-BIsSVgW7.js} +5 -5
  50. package/dist/gateway/static/root/assets/{models-hub-panel-DGCZom4o.js → models-hub-panel-DkCTjUj_.js} +1 -1
  51. package/dist/gateway/static/root/assets/{notes-page-BJtT4vSf.js → notes-page-B72S7M1Z.js} +1 -1
  52. package/dist/gateway/static/root/assets/{notes-workbench-B_bN7cOR.js → notes-workbench-CfWQczho.js} +2 -2
  53. package/dist/gateway/static/root/assets/{page-tabs-DKB6RDre.js → page-tabs-LjSEtOvG.js} +1 -1
  54. package/dist/gateway/static/root/assets/{preview-open-alternatives-Br_YhYHp.js → preview-open-alternatives-Cn8Jp9jw.js} +1 -1
  55. package/dist/gateway/static/root/assets/project-detail-page-BWOTQX4M.js +1 -0
  56. package/dist/gateway/static/root/assets/{projects-page-DvfL7fSe.js → projects-page-C81dHQ5i.js} +1 -1
  57. package/dist/gateway/static/root/assets/{remote-access-hub-DqwMXSXP.js → remote-access-hub-U1FQUBtJ.js} +1 -1
  58. package/dist/gateway/static/root/assets/{save-bar-controls-BgIE9BBh.js → save-bar-controls-BDUPII5R.js} +1 -1
  59. package/dist/gateway/static/root/assets/{schedule-field-BXDP-oMz.js → schedule-field-B1NY9MNs.js} +1 -1
  60. package/dist/gateway/static/root/assets/{schema-form-Dhv-SmjG.js → schema-form-CnsFMun1.js} +1 -1
  61. package/dist/gateway/static/root/assets/{sessions-page-B_mOZkQk.js → sessions-page-t6DzYLpM.js} +1 -1
  62. package/dist/gateway/static/root/assets/settings-advanced-gate-DggKrWED.js +1 -0
  63. package/dist/gateway/static/root/assets/{settings-collapsible-section-CUTExnlK.js → settings-collapsible-section-D9jJ6KlR.js} +1 -1
  64. package/dist/gateway/static/root/assets/{settings-form-section-CmnDhsf0.js → settings-form-section-36IjMuUY.js} +1 -1
  65. package/dist/gateway/static/root/assets/{settings-loading-skeleton-B79dq-XY.js → settings-loading-skeleton-DyYMmawg.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-page-layout-DaFwstQw.js → settings-page-layout-BAP5LguT.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-page-Db8uAv3X.js → settings-page-yv4TeHfF.js} +1 -1
  68. package/dist/gateway/static/root/assets/{setup-status-panel-BUSEj0KK.js → setup-status-panel-DncjFopP.js} +1 -1
  69. package/dist/gateway/static/root/assets/{share-preview-page-Bi00uXzV.js → share-preview-page-BBxZ9lX5.js} +1 -1
  70. package/dist/gateway/static/root/assets/{shares-settings-DzsTYfuX.js → shares-settings-Brx1LsY9.js} +1 -1
  71. package/dist/gateway/static/root/assets/skill-reload-api-C_sLcSxh.js +1 -0
  72. package/dist/gateway/static/root/assets/{skills-page-DeB1tQZL.js → skills-page-BPzqM78D.js} +1 -1
  73. package/dist/gateway/static/root/assets/{system-settings-panel-Cxaph7hW.js → system-settings-panel-B3ceUo4i.js} +1 -1
  74. package/dist/gateway/static/root/assets/{theme-store-eCTN1RpG.js → theme-store-_efiWyB8.js} +1 -1
  75. package/dist/gateway/static/root/assets/{typed-models-lib-CcZ_tyFY.js → typed-models-lib-Dp1PvxGZ.js} +1 -1
  76. package/dist/gateway/static/root/assets/{use-channel-catalog-C4PWbNoi.js → use-channel-catalog-XHelnCa_.js} +1 -1
  77. package/dist/gateway/static/root/assets/{user-context-page-QTVMx_hG.js → user-context-page-Dg_4sJJz.js} +1 -1
  78. package/dist/gateway/static/root/assets/{user-profile-fields-editor-CPOO9Jz5.js → user-profile-fields-editor-nOOg0uBi.js} +1 -1
  79. package/dist/gateway/static/root/assets/{user-profile-settings-panel-C8cgtSF7.js → user-profile-settings-panel-9fBPCoA9.js} +1 -1
  80. package/dist/gateway/static/root/assets/{utils-CiZK2KwH.js → utils-3AORlPIm.js} +1 -1
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-b-YZtvUu.js → voice-api-key-field-Bc-xxEHw.js} +1 -1
  82. package/dist/gateway/static/root/assets/{work-discovery-page-4zVDOl2G.js → work-discovery-page-CCMe2E98.js} +1 -1
  83. package/dist/gateway/static/root/assets/{work-item-detail-page-CHe2tfkc.js → work-item-detail-page-CnVze8sW.js} +1 -1
  84. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-8SLCYeXE.js → workflow-run-setup-panel-DUKlCVcY.js} +1 -1
  85. package/dist/gateway/static/root/assets/{workflows-page-DEOFqiWn.js → workflows-page-1Hh-__Ur.js} +1 -1
  86. package/dist/gateway/static/root/index.html +7 -7
  87. package/dist/package.js +1 -1
  88. package/dist/src/config/agent-profile.js +1 -1
  89. package/dist/src/gateway/agents-admin.js +1 -1
  90. package/package.json +1 -1
  91. package/dist/gateway/static/root/assets/apps-page-CpX3lBFF.js +0 -1
  92. package/dist/gateway/static/root/assets/channels-status-swr-OKlqTtKJ.js +0 -1
  93. package/dist/gateway/static/root/assets/index-DjCSOyaN.css +0 -1
  94. package/dist/gateway/static/root/assets/local-apps-page-BsiZMrEf.js +0 -1
  95. package/dist/gateway/static/root/assets/project-detail-page-Dq8JouJj.js +0 -1
  96. package/dist/gateway/static/root/assets/settings-advanced-gate-BHGmH6YS.js +0 -1
  97. package/dist/gateway/static/root/assets/skill-reload-api-DSsdU081.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as s}from"./cn-BQ_8x0bT.js";import{t as c}from"./messages-CQGpD-dC.js";import{n as ee}from"./locale-store-Bp8joZck.js";import{Al as l,As as u,Cc as d,Dl as te,Fo as f,Ia as ne,Ko as p,Nc as m,Ps as h,Wo as re,Xl as ie,a as ae,f as oe,ht as se,hu as g,l as ce,m as le,mc as ue,ms as _,o as de,oc as fe,p as pe,pl as v,ru as y,s as me,sc as he,u as b,xl as x}from"./index-CxkNzw3e.js";var S=n(),C=e(t(),1),w=r();function ge(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function T(e){return e?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):``}function _e(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function ve(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:e.kind===`note`?`/notes/${encodeURIComponent(e.targetId)}`:`#`}function E(e){let t=(0,S.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,w.jsx)(`dt`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a=r||`-`,o;t[2]===a?o=t[3]:(o=(0,w.jsx)(`dd`,{className:`min-w-0 break-words text-sm text-fg`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,w.jsxs)(`div`,{className:`grid gap-1`,children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function ye(e){let t=(0,S.c)(9),{events:n,t:r}=e;if(!n.length){let e;return t[0]===r.detail.noActivity?e=t[1]:(e=(0,w.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:r.detail.noActivity}),t[0]=r.detail.noActivity,t[1]=e),e}let i;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,w.jsx)(`article`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r.eventTypes[e.type]??e.type}),(0,w.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:T(e.createdAt)})]})},e.id),t[5]=r,t[6]=e),i=n.map(e),t[2]=n,t[3]=r,t[4]=i}else i=t[4];let a;return t[7]===i?a=t[8]:(a=(0,w.jsx)(`div`,{className:`grid gap-3`,children:i}),t[7]=i,t[8]=a),a}function D(e){return new Set(e.toLowerCase().split(/[^a-z0-9\u4e00-\u9fff]+/).filter(e=>e.length>=2))}function O(e,t,n){let r=t?.projectKind,i=[e.title,e.description,e.nextAction,e.blockedReason,e.status,e.priority,t?.name,t?.description,r].filter(Boolean).join(` `),a=[n.title,n.description,n.metadata.whenToUse,...n.metadata.tags??[]].filter(Boolean).join(` `),o=D(i),s=0;for(let e of D(a))o.has(e)&&(s+=3);let c=a.toLowerCase();return(e.status===`blocked`||e.status===`needs_input`)&&/debug|diagnos|review|audit|fix|检查|排查|修复/.test(c)&&(s+=8),e.status===`in_review`&&/review|audit|check|验收|评审|检查/.test(c)&&(s+=6),e.attachments?.length&&/analy|extract|summar|review|整理|分析|总结/.test(c)&&(s+=5),r===`coding`&&/code|repo|test|pr|review|代码|仓库|测试/.test(c)&&(s+=5),s}function be(e,t,n){return[...n].sort((n,r)=>O(e,t,r)-O(e,t,n)||n.title.localeCompare(r.title))}function k(){let{workItemId:e=``}=o(),t=i(),n=c(ee(e=>e.language)).projectDetailPage.workItems,[r,S]=(0,C.useState)(null),[D,k]=(0,C.useState)(null),[A,j]=(0,C.useState)([]),[M,xe]=(0,C.useState)([]),[N,P]=(0,C.useState)(``),[F,I]=(0,C.useState)(``),[L,R]=(0,C.useState)(!0),[z,B]=(0,C.useState)(!1),[V,H]=(0,C.useState)(null),U=(0,C.useRef)(null),W=f(e=>e.setPageHeader),G=f(e=>e.clearPageHeader),K=(0,C.useMemo)(()=>r?`/projects/${encodeURIComponent(r.projectId)}/work-items`:`/projects`,[r]),q=(0,C.useCallback)(async()=>{if(e){R(!0),H(null);try{let[t,n]=await Promise.all([ce(e),b(e).catch(()=>({events:[]}))]);S(t.item),I(t.item.nextAction||t.item.title),j(n.events);let[r,i]=await Promise.all([ne(t.item.projectId).catch(()=>null),se().catch(()=>[])]),a=be(t.item,r,i);k(r),xe(a),P(e=>e||a[0]?.id||``)}catch(e){H(e instanceof Error?e.message:String(e))}finally{R(!1)}}},[e]);(0,C.useEffect)(()=>{q()},[q]);let J=(0,C.useCallback)(async()=>{if(r){B(!0),H(null);try{let e=await oe(r.id);S(e.item),t(`/chat/${encodeURIComponent(e.session.key)}`)}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[r,t]),Y=(0,C.useCallback)(async()=>{if(r){B(!0),H(null);try{let e=await ae(r.id);S(e.item),t(`/goals/${encodeURIComponent(e.goal.id)}`)}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[r,t]),X=(0,C.useCallback)(async e=>{j((await b(e).catch(()=>({events:[]}))).events)},[]),Z=(0,C.useCallback)(async()=>{if(!(!r||!N)){B(!0),H(null);try{let e=await pe(r.id,{definitionId:N,goal:F.trim()||r.nextAction||r.title});S(e.item),await X(e.item.id),t(`/workflows?run=${encodeURIComponent(e.runId)}`)}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[r,t,X,N,F]),Se=(0,C.useCallback)(async e=>{if(!(!r||!e.length)){B(!0),H(null);try{let t=await le(r.id,e);S(t.item),await X(t.item.id)}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[r,X]),Ce=(0,C.useCallback)(async e=>{if(r){B(!0),H(null);try{let t=await de(r.id,e.id);S(t.item),await X(t.item.id)}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[r,X]),we=(0,C.useCallback)(async e=>{if(r){H(null);try{await me(r.id,e)}catch(e){H(e instanceof Error?e.message:String(e))}}},[r]),Q=(0,C.useMemo)(()=>r?M.filter(e=>O(r,D,e)>0).slice(0,3):[],[r,D,M]),$=(0,C.useMemo)(()=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(_,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void q(),children:[(0,w.jsx)(he,{className:`size-3.5`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`hidden sm:inline`,children:n.refreshShort})]}),r?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:z,onClick:J,children:[(0,w.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.startChat})]}),(0,w.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:z,onClick:Y,children:[(0,w.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.createGoal})]})]}):null]}),[z,Y,J,r,q,n.detail.createGoal,n.detail.startChat,n.refreshShort]);return(0,C.useLayoutEffect)(()=>(W({startExtra:(0,w.jsx)(a,{to:K,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":D?.name?n.detail.backToProject.replace(`{{name}}`,D.name):n.detail.backToProjects,children:(0,w.jsx)(g,{className:`size-4`,"aria-hidden":!0})}),main:(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,w.jsx)(y,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,w.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r?.title??(L?n.detail.loading:n.detail.notFound)})]}),r?(0,w.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[n.statuses[r.status],` · `,n.priorities[r.priority],` · `,D?.name||r.projectId,` · `,n.updated,`: `,T(r.updatedAt)]}):null]}),end:$}),()=>G()),[G,$,r,L,D?.name,K,W,n,D]),L?(0,w.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,w.jsx)(`div`,{className:`h-8 w-40 animate-pulse rounded-md bg-surface-hover`}),(0,w.jsx)(`div`,{className:`mt-5 h-44 animate-pulse rounded-xl bg-surface-hover`})]}):V||!r?(0,w.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,children:[(0,w.jsxs)(a,{to:`/projects`,className:`inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,w.jsx)(g,{className:`size-4`,"aria-hidden":!0}),n.detail.backToProjects]}),(0,w.jsx)(`div`,{className:`mt-5 rounded-lg border border-danger/30 bg-danger-soft px-4 py-3 text-sm text-danger`,children:V||n.detail.notFound})]}):(0,w.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[(0,w.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-4 shadow-surface sm:px-5`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,w.jsx)(y,{className:`size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,w.jsx)(`h1`,{className:`min-w-0 break-words text-lg font-semibold leading-7 text-fg`,children:r.title})]}),(0,w.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs`,children:[(0,w.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 font-medium`,ge(r.status)),children:n.statuses[r.status]}),(0,w.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.priorities[r.priority]}),r.archivedAt?(0,w.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.detail.archived}):null]})]}),(0,w.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,w.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:z,onClick:J,children:[(0,w.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startChat]}),(0,w.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:z,onClick:Y,children:[(0,w.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),n.detail.createGoal]})]})]}),(0,w.jsxs)(`dl`,{className:`mt-5 grid gap-4 border-t border-edge pt-4 sm:grid-cols-2`,children:[(0,w.jsx)(E,{label:n.create.descriptionLabel,value:r.description||n.detail.noDescription}),(0,w.jsx)(E,{label:n.nextAction,value:r.nextAction||n.noNextAction}),(0,w.jsx)(E,{label:n.blockedReason,value:r.blockedReason||n.detail.noBlockedReason}),(0,w.jsx)(E,{label:n.updated,value:T(r.updatedAt)})]})]}),(0,w.jsxs)(`div`,{className:`mt-4 grid min-h-0 gap-4 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,w.jsxs)(`section`,{className:`min-w-0`,children:[(0,w.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,w.jsx)(x,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,w.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.activity})]}),(0,w.jsx)(ye,{events:A,t:n})]}),(0,w.jsxs)(`aside`,{className:`grid content-start gap-4`,children:[(0,w.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,w.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,w.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,w.jsx)(v,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`truncate`,children:n.detail.workflowTitle})]})}),(0,w.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.detail.workflowHint}),(0,w.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,w.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowTemplate,(0,w.jsxs)(re,{className:`h-9 rounded-md border border-edge bg-surface-base px-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:N,disabled:z||M.length===0,onChange:e=>P(e.target.value),children:[M.length===0?(0,w.jsx)(p,{value:``,children:n.detail.noWorkflowTemplates}):null,M.map(e=>(0,w.jsx)(p,{value:e.id,children:e.title},e.id))]})]}),Q.length?(0,w.jsxs)(`div`,{className:`grid gap-1`,children:[(0,w.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n.detail.recommendedWorkflows}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Q.map(e=>(0,w.jsx)(`button`,{type:`button`,className:s(`min-w-0 rounded-md border px-2 py-1 text-left text-xs transition-colors`,N===e.id?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),disabled:z,onClick:()=>P(e.id),children:(0,w.jsx)(`span`,{className:`block max-w-48 truncate`,children:e.title})},e.id))})]}):null,(0,w.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowGoal,(0,w.jsx)(`textarea`,{className:`min-h-20 resize-y rounded-md border border-edge bg-surface-base px-2 py-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:F,disabled:z,onChange:e=>I(e.target.value)})]}),(0,w.jsxs)(_,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3 text-xs`,disabled:z||!N,onClick:Z,children:[(0,w.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startWorkflow]}),M.length?null:(0,w.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.detail.noWorkflowTemplates})]})]}),(0,w.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,w.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,w.jsx)(d,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`truncate`,children:n.attachments.title})]}),(0,w.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:z,onClick:()=>U.current?.click(),children:[(0,w.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),n.attachments.add]}),(0,w.jsx)(`input`,{ref:U,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{Se(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),(0,w.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.attachments?.length?r.attachments.map(e=>(0,w.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-base px-2 py-2 text-sm`,children:[(0,w.jsx)(x,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`div`,{className:`truncate font-medium text-fg`,children:e.fileName}),(0,w.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[e.mimeType,` · `,_e(e.size)]})]}),(0,w.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:n.attachments.download,"aria-label":n.attachments.download,disabled:z,onClick:()=>void we(e),children:(0,w.jsx)(l,{className:`size-3.5`,"aria-hidden":!0})}),(0,w.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:n.attachments.remove,"aria-label":n.attachments.remove,disabled:z,onClick:()=>void Ce(e),children:(0,w.jsx)(u,{className:`size-3.5`,"aria-hidden":!0})})]},e.id)):(0,w.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.attachments.empty})})]}),(0,w.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,w.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.links}),(0,w.jsx)(`div`,{className:`mt-3 grid gap-1 text-sm`,children:r.links?.length?r.links.map(e=>(0,w.jsxs)(a,{to:ve(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,w.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,w.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[n.linkKinds[e.kind],(0,w.jsx)(te,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,w.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.detail.noLinks})})]}),(0,w.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,w.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.project}),(0,w.jsxs)(a,{to:K,className:`mt-2 inline-flex min-w-0 items-center gap-2 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,w.jsx)(ie,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`min-w-0 truncate`,children:D?.name||r.projectId})]})]})]})]})]})}export{k as WorkItemDetailPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as s}from"./cn-BQ_8x0bT.js";import{t as c}from"./messages-BIsSVgW7.js";import{n as ee}from"./locale-store-BP67jtYG.js";import{Al as l,As as u,Cc as d,Dl as te,Fo as f,Ia as ne,Ko as p,Nc as m,Ps as h,Wo as re,Xl as ie,a as ae,f as oe,ht as se,hu as g,l as ce,m as le,mc as ue,ms as _,o as de,oc as fe,p as pe,pl as v,ru as y,s as me,sc as he,u as b,xl as x}from"./index-twNrYC3D.js";var S=n(),C=e(t(),1),w=r();function ge(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function T(e){return e?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):``}function _e(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function ve(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:e.kind===`note`?`/notes/${encodeURIComponent(e.targetId)}`:`#`}function E(e){let t=(0,S.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,w.jsx)(`dt`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a=r||`-`,o;t[2]===a?o=t[3]:(o=(0,w.jsx)(`dd`,{className:`min-w-0 break-words text-sm text-fg`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,w.jsxs)(`div`,{className:`grid gap-1`,children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function ye(e){let t=(0,S.c)(9),{events:n,t:r}=e;if(!n.length){let e;return t[0]===r.detail.noActivity?e=t[1]:(e=(0,w.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:r.detail.noActivity}),t[0]=r.detail.noActivity,t[1]=e),e}let i;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,w.jsx)(`article`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r.eventTypes[e.type]??e.type}),(0,w.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:T(e.createdAt)})]})},e.id),t[5]=r,t[6]=e),i=n.map(e),t[2]=n,t[3]=r,t[4]=i}else i=t[4];let a;return t[7]===i?a=t[8]:(a=(0,w.jsx)(`div`,{className:`grid gap-3`,children:i}),t[7]=i,t[8]=a),a}function D(e){return new Set(e.toLowerCase().split(/[^a-z0-9\u4e00-\u9fff]+/).filter(e=>e.length>=2))}function O(e,t,n){let r=t?.projectKind,i=[e.title,e.description,e.nextAction,e.blockedReason,e.status,e.priority,t?.name,t?.description,r].filter(Boolean).join(` `),a=[n.title,n.description,n.metadata.whenToUse,...n.metadata.tags??[]].filter(Boolean).join(` `),o=D(i),s=0;for(let e of D(a))o.has(e)&&(s+=3);let c=a.toLowerCase();return(e.status===`blocked`||e.status===`needs_input`)&&/debug|diagnos|review|audit|fix|检查|排查|修复/.test(c)&&(s+=8),e.status===`in_review`&&/review|audit|check|验收|评审|检查/.test(c)&&(s+=6),e.attachments?.length&&/analy|extract|summar|review|整理|分析|总结/.test(c)&&(s+=5),r===`coding`&&/code|repo|test|pr|review|代码|仓库|测试/.test(c)&&(s+=5),s}function be(e,t,n){return[...n].sort((n,r)=>O(e,t,r)-O(e,t,n)||n.title.localeCompare(r.title))}function k(){let{workItemId:e=``}=o(),t=i(),n=c(ee(e=>e.language)).projectDetailPage.workItems,[r,S]=(0,C.useState)(null),[D,k]=(0,C.useState)(null),[A,j]=(0,C.useState)([]),[M,xe]=(0,C.useState)([]),[N,P]=(0,C.useState)(``),[F,I]=(0,C.useState)(``),[L,R]=(0,C.useState)(!0),[z,B]=(0,C.useState)(!1),[V,H]=(0,C.useState)(null),U=(0,C.useRef)(null),W=f(e=>e.setPageHeader),G=f(e=>e.clearPageHeader),K=(0,C.useMemo)(()=>r?`/projects/${encodeURIComponent(r.projectId)}/work-items`:`/projects`,[r]),q=(0,C.useCallback)(async()=>{if(e){R(!0),H(null);try{let[t,n]=await Promise.all([ce(e),b(e).catch(()=>({events:[]}))]);S(t.item),I(t.item.nextAction||t.item.title),j(n.events);let[r,i]=await Promise.all([ne(t.item.projectId).catch(()=>null),se().catch(()=>[])]),a=be(t.item,r,i);k(r),xe(a),P(e=>e||a[0]?.id||``)}catch(e){H(e instanceof Error?e.message:String(e))}finally{R(!1)}}},[e]);(0,C.useEffect)(()=>{q()},[q]);let J=(0,C.useCallback)(async()=>{if(r){B(!0),H(null);try{let e=await oe(r.id);S(e.item),t(`/chat/${encodeURIComponent(e.session.key)}`)}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[r,t]),Y=(0,C.useCallback)(async()=>{if(r){B(!0),H(null);try{let e=await ae(r.id);S(e.item),t(`/goals/${encodeURIComponent(e.goal.id)}`)}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[r,t]),X=(0,C.useCallback)(async e=>{j((await b(e).catch(()=>({events:[]}))).events)},[]),Z=(0,C.useCallback)(async()=>{if(!(!r||!N)){B(!0),H(null);try{let e=await pe(r.id,{definitionId:N,goal:F.trim()||r.nextAction||r.title});S(e.item),await X(e.item.id),t(`/workflows?run=${encodeURIComponent(e.runId)}`)}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[r,t,X,N,F]),Se=(0,C.useCallback)(async e=>{if(!(!r||!e.length)){B(!0),H(null);try{let t=await le(r.id,e);S(t.item),await X(t.item.id)}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[r,X]),Ce=(0,C.useCallback)(async e=>{if(r){B(!0),H(null);try{let t=await de(r.id,e.id);S(t.item),await X(t.item.id)}catch(e){H(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[r,X]),we=(0,C.useCallback)(async e=>{if(r){H(null);try{await me(r.id,e)}catch(e){H(e instanceof Error?e.message:String(e))}}},[r]),Q=(0,C.useMemo)(()=>r?M.filter(e=>O(r,D,e)>0).slice(0,3):[],[r,D,M]),$=(0,C.useMemo)(()=>(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(_,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void q(),children:[(0,w.jsx)(he,{className:`size-3.5`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`hidden sm:inline`,children:n.refreshShort})]}),r?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:z,onClick:J,children:[(0,w.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.startChat})]}),(0,w.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:z,onClick:Y,children:[(0,w.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.createGoal})]})]}):null]}),[z,Y,J,r,q,n.detail.createGoal,n.detail.startChat,n.refreshShort]);return(0,C.useLayoutEffect)(()=>(W({startExtra:(0,w.jsx)(a,{to:K,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":D?.name?n.detail.backToProject.replace(`{{name}}`,D.name):n.detail.backToProjects,children:(0,w.jsx)(g,{className:`size-4`,"aria-hidden":!0})}),main:(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,w.jsx)(y,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,w.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r?.title??(L?n.detail.loading:n.detail.notFound)})]}),r?(0,w.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[n.statuses[r.status],` · `,n.priorities[r.priority],` · `,D?.name||r.projectId,` · `,n.updated,`: `,T(r.updatedAt)]}):null]}),end:$}),()=>G()),[G,$,r,L,D?.name,K,W,n,D]),L?(0,w.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,w.jsx)(`div`,{className:`h-8 w-40 animate-pulse rounded-md bg-surface-hover`}),(0,w.jsx)(`div`,{className:`mt-5 h-44 animate-pulse rounded-xl bg-surface-hover`})]}):V||!r?(0,w.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,children:[(0,w.jsxs)(a,{to:`/projects`,className:`inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,w.jsx)(g,{className:`size-4`,"aria-hidden":!0}),n.detail.backToProjects]}),(0,w.jsx)(`div`,{className:`mt-5 rounded-lg border border-danger/30 bg-danger-soft px-4 py-3 text-sm text-danger`,children:V||n.detail.notFound})]}):(0,w.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[(0,w.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-4 shadow-surface sm:px-5`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,w.jsx)(y,{className:`size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,w.jsx)(`h1`,{className:`min-w-0 break-words text-lg font-semibold leading-7 text-fg`,children:r.title})]}),(0,w.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs`,children:[(0,w.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 font-medium`,ge(r.status)),children:n.statuses[r.status]}),(0,w.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.priorities[r.priority]}),r.archivedAt?(0,w.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.detail.archived}):null]})]}),(0,w.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,w.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:z,onClick:J,children:[(0,w.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startChat]}),(0,w.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:z,onClick:Y,children:[(0,w.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),n.detail.createGoal]})]})]}),(0,w.jsxs)(`dl`,{className:`mt-5 grid gap-4 border-t border-edge pt-4 sm:grid-cols-2`,children:[(0,w.jsx)(E,{label:n.create.descriptionLabel,value:r.description||n.detail.noDescription}),(0,w.jsx)(E,{label:n.nextAction,value:r.nextAction||n.noNextAction}),(0,w.jsx)(E,{label:n.blockedReason,value:r.blockedReason||n.detail.noBlockedReason}),(0,w.jsx)(E,{label:n.updated,value:T(r.updatedAt)})]})]}),(0,w.jsxs)(`div`,{className:`mt-4 grid min-h-0 gap-4 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,w.jsxs)(`section`,{className:`min-w-0`,children:[(0,w.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,w.jsx)(x,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,w.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.activity})]}),(0,w.jsx)(ye,{events:A,t:n})]}),(0,w.jsxs)(`aside`,{className:`grid content-start gap-4`,children:[(0,w.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,w.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,w.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,w.jsx)(v,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`truncate`,children:n.detail.workflowTitle})]})}),(0,w.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.detail.workflowHint}),(0,w.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,w.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowTemplate,(0,w.jsxs)(re,{className:`h-9 rounded-md border border-edge bg-surface-base px-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:N,disabled:z||M.length===0,onChange:e=>P(e.target.value),children:[M.length===0?(0,w.jsx)(p,{value:``,children:n.detail.noWorkflowTemplates}):null,M.map(e=>(0,w.jsx)(p,{value:e.id,children:e.title},e.id))]})]}),Q.length?(0,w.jsxs)(`div`,{className:`grid gap-1`,children:[(0,w.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n.detail.recommendedWorkflows}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Q.map(e=>(0,w.jsx)(`button`,{type:`button`,className:s(`min-w-0 rounded-md border px-2 py-1 text-left text-xs transition-colors`,N===e.id?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),disabled:z,onClick:()=>P(e.id),children:(0,w.jsx)(`span`,{className:`block max-w-48 truncate`,children:e.title})},e.id))})]}):null,(0,w.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowGoal,(0,w.jsx)(`textarea`,{className:`min-h-20 resize-y rounded-md border border-edge bg-surface-base px-2 py-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:F,disabled:z,onChange:e=>I(e.target.value)})]}),(0,w.jsxs)(_,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3 text-xs`,disabled:z||!N,onClick:Z,children:[(0,w.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startWorkflow]}),M.length?null:(0,w.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.detail.noWorkflowTemplates})]})]}),(0,w.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,w.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,w.jsx)(d,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`truncate`,children:n.attachments.title})]}),(0,w.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:z,onClick:()=>U.current?.click(),children:[(0,w.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),n.attachments.add]}),(0,w.jsx)(`input`,{ref:U,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{Se(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),(0,w.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.attachments?.length?r.attachments.map(e=>(0,w.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-base px-2 py-2 text-sm`,children:[(0,w.jsx)(x,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`div`,{className:`truncate font-medium text-fg`,children:e.fileName}),(0,w.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[e.mimeType,` · `,_e(e.size)]})]}),(0,w.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:n.attachments.download,"aria-label":n.attachments.download,disabled:z,onClick:()=>void we(e),children:(0,w.jsx)(l,{className:`size-3.5`,"aria-hidden":!0})}),(0,w.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:n.attachments.remove,"aria-label":n.attachments.remove,disabled:z,onClick:()=>void Ce(e),children:(0,w.jsx)(u,{className:`size-3.5`,"aria-hidden":!0})})]},e.id)):(0,w.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.attachments.empty})})]}),(0,w.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,w.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.links}),(0,w.jsx)(`div`,{className:`mt-3 grid gap-1 text-sm`,children:r.links?.length?r.links.map(e=>(0,w.jsxs)(a,{to:ve(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,w.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,w.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[n.linkKinds[e.kind],(0,w.jsx)(te,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,w.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.detail.noLinks})})]}),(0,w.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,w.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.project}),(0,w.jsxs)(a,{to:K,className:`mt-2 inline-flex min-w-0 items-center gap-2 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,w.jsx)(ie,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`min-w-0 truncate`,children:D?.name||r.projectId})]})]})]})]})]})}export{k as WorkItemDetailPage};
@@ -1,3 +1,3 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-CQGpD-dC.js";import{d as o,r as s}from"./locale-store-Bp8joZck.js";import{Ao as c,D as l,El as u,H as d,Hs as f,Ji as p,Ko as m,Ks as h,M as g,Mo as _,No as v,Oo as y,Po as b,Ps as x,Q as S,Qc as C,Wo as w,Ws as T,Z as E,eu as D,ko as O,ms as k,sc as A,vs as ee,ws as j}from"./index-CxkNzw3e.js";var M=e(t(),1),N=n();function P(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function F(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function I(e,t={}){let n=P(e.split(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-BIsSVgW7.js";import{d as o,r as s}from"./locale-store-BP67jtYG.js";import{Ao as c,D as l,El as u,H as d,Hs as f,Ji as p,Ko as m,Ks as h,M as g,Mo as _,No as v,Oo as y,Po as b,Ps as x,Q as S,Qc as C,Wo as w,Ws as T,Z as E,eu as D,ko as O,ms as k,sc as A,vs as ee,ws as j}from"./index-twNrYC3D.js";var M=e(t(),1),N=n();function P(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function F(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function I(e,t={}){let n=P(e.split(`
2
2
  `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
3
3
  `));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(F(n));return null}async function te(e,t={}){let n=await s(o(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,c=``,l=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=I(e,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});n!==null&&(c=n)}}if(e)break}if(a.trim()){let e=I(a,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});e!==null&&(c=e)}let u=c.trim();if(!u)throw Error(`AI returned an empty suggestion`);return{text:u,thinking:l.trim()||void 0}}function ne(){let[e,t]=(0,M.useState)(``),[n,r]=(0,M.useState)(``),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,M.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await te(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,M.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var L=r(),re=5;function ie(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function R(e){let t=(0,N.c)(232),{value:n,onApply:r,fieldId:a,fieldLabel:o,scenario:s,format:l,intent:d,locale:m,context:h,disabled:g,className:x,showLabel:S}=e,C=s===void 0?`generic.text`:s,w=l===void 0?`plain`:l,E=d===void 0?`improve`:d,j=S===void 0?!0:S,[P,F]=(0,M.useState)(!1),[I,te]=(0,M.useState)(n),[R,z]=(0,M.useState)(`preview`),[B,V]=(0,M.useState)(``),[H,U]=(0,M.useState)(`edit`),[W,se]=(0,M.useState)(!0),ce=(0,M.useRef)(null),G=(0,M.useRef)(!0),{suggestion:K,thinking:q,loading:J,error:Y,generate:le,reset:X}=ne(),ue;t[0]===m?ue=t[1]:(ue=ie(m),t[0]=m,t[1]=ue);let Z=ue,de;t[2]!==J||t[3]!==q?(de=J&&q.trim().length>0,t[2]=J,t[3]=q,t[4]=de):de=t[4];let Q=de,fe,pe;t[5]!==P||t[6]!==n?(fe=()=>{P||te(n)},pe=[P,n],t[5]=P,t[6]=n,t[7]=fe,t[8]=pe):(fe=t[7],pe=t[8]),(0,M.useEffect)(fe,pe);let me,he;t[9]===K?(me=t[10],he=t[11]):(he=()=>{V(K)},me=[K],t[9]=K,t[10]=me,t[11]=he),(0,M.useEffect)(he,me);let ge,_e;t[12]===q?(ge=t[13],_e=t[14]):(ge=()=>{q.trim()&&se(!0)},_e=[q],t[12]=q,t[13]=ge,t[14]=_e),(0,M.useEffect)(ge,_e);let ve;t[15]!==Q||t[16]!==W?(ve=()=>{let e=ce.current;!e||!Q||!W||G.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=W,t[17]=ve):ve=t[17];let ye;t[18]!==Q||t[19]!==q||t[20]!==W?(ye=[Q,q,W],t[18]=Q,t[19]=q,t[20]=W,t[21]=ye):ye=t[21],(0,M.useLayoutEffect)(ve,ye);let be;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>{let e=ce.current;e&&(G.current=e.scrollHeight-e.scrollTop-e.clientHeight<=re)},t[22]=be):be=t[22];let xe=be,Se;t[23]!==h||t[24]!==a||t[25]!==o||t[26]!==w||t[27]!==le||t[28]!==E||t[29]!==m||t[30]!==C?(Se=async e=>{U(`edit`),se(!0),G.current=!0,await le({intent:E,scenario:C,input:e,locale:m,field:{id:a,label:o,format:w},context:h})},t[23]=h,t[24]=a,t[25]=o,t[26]=w,t[27]=le,t[28]=E,t[29]=m,t[30]=C,t[31]=Se):Se=t[31];let Ce=Se,we;t[32]!==X||t[33]!==n?(we=()=>{te(n),z(`preview`),V(``),U(`edit`),se(!0),X(),F(!0)},t[32]=X,t[33]=n,t[34]=we):we=t[34];let Te=we,Ee;t[35]!==I||t[36]!==Ce?(Ee=async()=>{await Ce(I)},t[35]=I,t[36]=Ce,t[37]=Ee):Ee=t[37];let De=Ee,Oe;t[38]!==X||t[39]!==n?(Oe=()=>{F(!1),te(n),z(`preview`),V(``),U(`edit`),se(!0),X()},t[38]=X,t[39]=n,t[40]=Oe):Oe=t[40];let $=Oe,ke;t[41]!==$||t[42]!==I||t[43]!==r?(ke=()=>{r(I),$()},t[41]=$,t[42]=I,t[43]=r,t[44]=ke):ke=t[44];let Ae=ke,je;t[45]!==$||t[46]!==B||t[47]!==r?(je=()=>{B.trim()&&(r(B),$())},t[45]=$,t[46]=B,t[47]=r,t[48]=je):je=t[48];let Me=je,Ne;t[49]!==$||t[50]!==I||t[51]!==B||t[52]!==r?(Ne=()=>{if(!B.trim())return;let e=I.trimEnd();r(e?`${e}\n\n${B}`:B),$()},t[49]=$,t[50]=I,t[51]=B,t[52]=r,t[53]=Ne):Ne=t[53];let Pe=Ne,Fe;t[54]!==B||t[55]!==Y||t[56]!==J?(Fe=!J&&!Y&&B.trim().length>0,t[54]=B,t[55]=Y,t[56]=J,t[57]=Fe):Fe=t[57];let Ie=Fe,Le=I!==n,Re;t[58]!==B||t[59]!==Y||t[60]!==q?(Re=B.trim().length>0||q.trim().length>0||!!Y,t[58]=B,t[59]=Y,t[60]=q,t[61]=Re):Re=t[61];let ze=Re,Be=!j&&`size-7 p-0`,Ve;t[62]!==x||t[63]!==Be?(Ve=i(`h-7 gap-1 px-2 text-xs`,Be,x),t[62]=x,t[63]=Be,t[64]=Ve):Ve=t[64];let He=g||J,Ue;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,L.jsx)(T,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=Ue):Ue=t[65];let We=j?Z.buttonTitle:null,Ge;t[66]!==Z.buttonTitle||t[67]!==Te||t[68]!==Ve||t[69]!==He||t[70]!==We?(Ge=(0,L.jsxs)(k,{type:`button`,variant:`ghost`,className:Ve,title:Z.buttonTitle,"aria-label":Z.buttonTitle,disabled:He,onClick:Te,children:[Ue,We]}),t[66]=Z.buttonTitle,t[67]=Te,t[68]=Ve,t[69]=He,t[70]=We,t[71]=Ge):Ge=t[71];let Ke;t[72]===$?Ke=t[73]:(Ke=e=>e?F(!0):$(),t[72]=$,t[73]=Ke);let qe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,L.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[74]=qe):qe=t[74];let Je;t[75]===Z.title?Je=t[76]:(Je=(0,L.jsx)(b,{className:`text-base font-semibold text-fg`,children:Z.title}),t[75]=Z.title,t[76]=Je);let Ye;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,L.jsx)(ee,{className:`size-5`,strokeWidth:1.75}),t[77]=Ye):Ye=t[77];let Xe;t[78]===Z.close?Xe=t[79]:(Xe=(0,L.jsx)(O,{asChild:!0,children:(0,L.jsx)(k,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":Z.close,children:Ye})}),t[78]=Z.close,t[79]=Xe);let Ze;t[80]!==Je||t[81]!==Xe?(Ze=(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[Je,Xe]}),t[80]=Je,t[81]=Xe,t[82]=Ze):Ze=t[82];let Qe;t[83]===Z.current?Qe=t[84]:(Qe=(0,L.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:Z.current}),t[83]=Z.current,t[84]=Qe);let $e=R===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,et;t[85]===$e?et=t[86]:(et=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,$e),t[85]=$e,t[86]=et);let tt,nt;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(tt=()=>z(`edit`),nt=(0,L.jsx)(f,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[87]=tt,t[88]=nt):(tt=t[87],nt=t[88]);let rt;t[89]!==Z.edit||t[90]!==et?(rt=(0,L.jsxs)(`button`,{type:`button`,className:et,onClick:tt,children:[nt,Z.edit]}),t[89]=Z.edit,t[90]=et,t[91]=rt):rt=t[91];let it=R===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,at;t[92]===it?at=t[93]:(at=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,it),t[92]=it,t[93]=at);let ot,st;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(ot=()=>z(`preview`),st=(0,L.jsx)(u,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[94]=ot,t[95]=st):(ot=t[94],st=t[95]);let ct;t[96]!==Z.preview||t[97]!==at?(ct=(0,L.jsxs)(`button`,{type:`button`,className:at,onClick:ot,children:[st,Z.preview]}),t[96]=Z.preview,t[97]=at,t[98]=ct):ct=t[98];let lt;t[99]!==rt||t[100]!==ct?(lt=(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[rt,ct]}),t[99]=rt,t[100]=ct,t[101]=lt):lt=t[101];let ut;t[102]!==Qe||t[103]!==lt?(ut=(0,L.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[Qe,lt]}),t[102]=Qe,t[103]=lt,t[104]=ut):ut=t[104];let dt;t[105]!==I||t[106]!==R||t[107]!==w||t[108]!==Z.current||t[109]!==Z.empty?(dt=R===`preview`?(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:w===`markdown`?(0,L.jsx)(p,{content:I||Z.empty,compact:!0,className:`text-sm`}):(0,L.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:I||Z.empty})}):(0,L.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:I,onChange:e=>te(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[105]=I,t[106]=R,t[107]=w,t[108]=Z.current,t[109]=Z.empty,t[110]=dt):dt=t[110];let ft;t[111]!==ut||t[112]!==dt?(ft=(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[ut,dt]}),t[111]=ut,t[112]=dt,t[113]=ft):ft=t[113];let pt;t[114]===Z.editedSuggestion?pt=t[115]:(pt=(0,L.jsx)(`span`,{children:Z.editedSuggestion}),t[114]=Z.editedSuggestion,t[115]=pt);let mt;t[116]!==Z.loading||t[117]!==J?(mt=J?(0,L.jsx)(`span`,{className:`ml-2 font-normal`,children:Z.loading}):null,t[116]=Z.loading,t[117]=J,t[118]=mt):mt=t[118];let ht;t[119]!==pt||t[120]!==mt?(ht=(0,L.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[pt,mt]}),t[119]=pt,t[120]=mt,t[121]=ht):ht=t[121];let gt=H===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,_t;t[122]===gt?_t=t[123]:(_t=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,gt),t[122]=gt,t[123]=_t);let vt,yt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(vt=()=>U(`edit`),yt=(0,L.jsx)(f,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[124]=vt,t[125]=yt):(vt=t[124],yt=t[125]);let bt;t[126]!==Z.edit||t[127]!==_t?(bt=(0,L.jsxs)(`button`,{type:`button`,className:_t,onClick:vt,children:[yt,Z.edit]}),t[126]=Z.edit,t[127]=_t,t[128]=bt):bt=t[128];let xt=H===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,St;t[129]===xt?St=t[130]:(St=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,xt),t[129]=xt,t[130]=St);let Ct,wt;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=()=>U(`preview`),wt=(0,L.jsx)(u,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[131]=Ct,t[132]=wt):(Ct=t[131],wt=t[132]);let Tt;t[133]!==Z.preview||t[134]!==St?(Tt=(0,L.jsxs)(`button`,{type:`button`,className:St,onClick:Ct,children:[wt,Z.preview]}),t[133]=Z.preview,t[134]=St,t[135]=Tt):Tt=t[135];let Et;t[136]!==bt||t[137]!==Tt?(Et=(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[bt,Tt]}),t[136]=bt,t[137]=Tt,t[138]=Et):Et=t[138];let Dt;t[139]!==ht||t[140]!==Et?(Dt=(0,L.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[ht,Et]}),t[139]=ht,t[140]=Et,t[141]=Dt):Dt=t[141];let Ot=Q?`opacity-100`:`pointer-events-none opacity-0`,kt;t[142]===Ot?kt=t[143]:(kt=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ot),t[142]=Ot,t[143]=kt);let At=!Q,jt;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(jt=()=>se(ae),t[144]=jt):jt=t[144];let Mt;t[145]!==Z.thinkingLoading||t[146]!==J?(Mt=J?(0,L.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,Z.thinkingLoading]}):null,t[145]=Z.thinkingLoading,t[146]=J,t[147]=Mt):Mt=t[147];let Nt;t[148]!==Z.thinking||t[149]!==Mt?(Nt=(0,L.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Z.thinking,Mt]}),t[148]=Z.thinking,t[149]=Mt,t[150]=Nt):Nt=t[150];let Pt=W&&`rotate-180`,Ft;t[151]===Pt?Ft=t[152]:(Ft=i(`size-3.5 shrink-0 transition-transform`,Pt),t[151]=Pt,t[152]=Ft);let It;t[153]===Ft?It=t[154]:(It=(0,L.jsx)(D,{className:Ft,strokeWidth:1.75,"aria-hidden":!0}),t[153]=Ft,t[154]=It);let Lt;t[155]!==Nt||t[156]!==It?(Lt=(0,L.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:jt,children:[Nt,It]}),t[155]=Nt,t[156]=It,t[157]=Lt):Lt=t[157];let Rt;t[158]!==q||t[159]!==W?(Rt=W?(0,L.jsx)(`pre`,{ref:ce,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:xe,children:q}):null,t[158]=q,t[159]=W,t[160]=Rt):Rt=t[160];let zt;t[161]!==Lt||t[162]!==Rt?(zt=(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[Lt,Rt]}),t[161]=Lt,t[162]=Rt,t[163]=zt):zt=t[163];let Bt;t[164]!==kt||t[165]!==At||t[166]!==zt?(Bt=(0,L.jsx)(`div`,{className:kt,"aria-hidden":At,children:zt}),t[164]=kt,t[165]=At,t[166]=zt,t[167]=Bt):Bt=t[167];let Vt=Q?`pointer-events-none opacity-0`:`opacity-100`,Ht;t[168]===Vt?Ht=t[169]:(Ht=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Vt),t[168]=Vt,t[169]=Ht);let Ut;t[170]!==B||t[171]!==Y||t[172]!==w||t[173]!==Z.empty||t[174]!==Z.loading||t[175]!==Z.suggestion||t[176]!==J||t[177]!==H?(Ut=Y?(0,L.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:Y}):H===`preview`?(0,L.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:J&&!B.trim()?(0,L.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):w===`markdown`?(0,L.jsx)(p,{content:B||Z.empty,compact:!0,className:`text-sm`}):(0,L.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:B||Z.empty})}):(0,L.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:B,onChange:e=>V(e.currentTarget.value),disabled:J,placeholder:J?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[170]=B,t[171]=Y,t[172]=w,t[173]=Z.empty,t[174]=Z.loading,t[175]=Z.suggestion,t[176]=J,t[177]=H,t[178]=Ut):Ut=t[178];let Wt;t[179]!==Ht||t[180]!==Ut?(Wt=(0,L.jsx)(`div`,{className:Ht,children:Ut}),t[179]=Ht,t[180]=Ut,t[181]=Wt):Wt=t[181];let Gt;t[182]!==Bt||t[183]!==Wt?(Gt=(0,L.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[Bt,Wt]}),t[182]=Bt,t[183]=Wt,t[184]=Gt):Gt=t[184];let Kt;t[185]!==Dt||t[186]!==Gt?(Kt=(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Dt,Gt]}),t[185]=Dt,t[186]=Gt,t[187]=Kt):Kt=t[187];let qt;t[188]!==ft||t[189]!==Kt?(qt=(0,L.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[ft,Kt]}),t[188]=ft,t[189]=Kt,t[190]=qt):qt=t[190];let Jt;t[191]!==$||t[192]!==Z.cancel?(Jt=(0,L.jsx)(k,{type:`button`,variant:`secondary`,onClick:$,children:Z.cancel}),t[191]=$,t[192]=Z.cancel,t[193]=Jt):Jt=t[193];let Yt=!Le,Xt;t[194]!==Ae||t[195]!==Z.applyCurrent||t[196]!==Yt?(Xt=(0,L.jsx)(k,{type:`button`,variant:`secondary`,disabled:Yt,onClick:Ae,children:Z.applyCurrent}),t[194]=Ae,t[195]=Z.applyCurrent,t[196]=Yt,t[197]=Xt):Xt=t[197];let Zt;t[198]===De?Zt=t[199]:(Zt=()=>void De(),t[198]=De,t[199]=Zt);let Qt;t[200]===ze?Qt=t[201]:(Qt=ze?(0,L.jsx)(A,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,L.jsx)(T,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[200]=ze,t[201]=Qt);let $t=ze?Z.regenerate:Z.generate,en;t[202]!==J||t[203]!==Zt||t[204]!==Qt||t[205]!==$t?(en=(0,L.jsxs)(k,{type:`button`,variant:`secondary`,disabled:J,onClick:Zt,children:[Qt,$t]}),t[202]=J,t[203]=Zt,t[204]=Qt,t[205]=$t,t[206]=en):en=t[206];let tn=!Ie,nn;t[207]!==Pe||t[208]!==Z.append||t[209]!==tn?(nn=(0,L.jsx)(k,{type:`button`,variant:`secondary`,disabled:tn,onClick:Pe,children:Z.append}),t[207]=Pe,t[208]=Z.append,t[209]=tn,t[210]=nn):nn=t[210];let rn=!Ie,an;t[211]!==Me||t[212]!==Z.replace||t[213]!==rn?(an=(0,L.jsx)(k,{type:`button`,variant:`primary`,disabled:rn,onClick:Me,children:Z.replace}),t[211]=Me,t[212]=Z.replace,t[213]=rn,t[214]=an):an=t[214];let on;t[215]!==Jt||t[216]!==Xt||t[217]!==en||t[218]!==nn||t[219]!==an?(on=(0,L.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[Jt,Xt,en,nn,an]}),t[215]=Jt,t[216]=Xt,t[217]=en,t[218]=nn,t[219]=an,t[220]=on):on=t[220];let sn;t[221]!==Ze||t[222]!==qt||t[223]!==on?(sn=(0,L.jsxs)(v,{children:[qe,(0,L.jsx)(`div`,{className:`fixed inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,L.jsxs)(c,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,onOpenAutoFocus:oe,children:[Ze,qt,on]})})]}),t[221]=Ze,t[222]=qt,t[223]=on,t[224]=sn):sn=t[224];let cn;t[225]!==P||t[226]!==Ke||t[227]!==sn?(cn=(0,L.jsx)(y,{open:P,onOpenChange:Ke,children:sn}),t[225]=P,t[226]=Ke,t[227]=sn,t[228]=cn):cn=t[228];let ln;return t[229]!==cn||t[230]!==Ge?(ln=(0,L.jsxs)(L.Fragment,{children:[Ge,cn]}),t[229]=cn,t[230]=Ge,t[231]=ln):ln=t[231],ln}function ae(e){return!e}function oe(e){return e.preventDefault()}function z(e,t){return e[t]??t}function B(e,t){let n=d[e]??[];if(n.length===0)return{};let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{},i={};for(let e of n){let t=r[e.key];t!=null&&(i[e.key]=String(t))}return i}function V(e){let t=(0,N.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,L.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,L.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,L.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function H(e){let t=(0,N.c)(34),{workflowName:n,language:r,argValues:o,onArgValuesChange:s,goal:c,onGoalChange:l,examplePrompts:u,showGoal:f,inputClassName:p,aiAssist:m}=e,h;t[0]===u?h=t[1]:(h=u===void 0?[]:u,t[0]=u,t[1]=h);let g=h,_=f===void 0?!0:f,v,y,b,x,S,C,w;if(t[2]!==m||t[3]!==o||t[4]!==g||t[5]!==c||t[6]!==p||t[7]!==r||t[8]!==s||t[9]!==l||t[10]!==_||t[11]!==n){b=a(r).workflows;let e=d[n]??[];y=e.length>0;let u=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,p),f;t[19]!==o||t[20]!==s||t[21]!==l?(f=e=>{E(e,l,e=>{s(e(o))})},t[19]=o,t[20]=s,t[21]=l,t[22]=f):f=t[22],v=f,x=`flex flex-col gap-3`,S=e.map(e=>{let t=z(b.args,e.labelKey),a=z(b.args,e.placeholderKey),c=o[e.key]??``;return(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&m?(0,L.jsx)(R,{value:c,onApply:t=>s({...o,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:m.argScenario??`workflow.arg`,locale:r,context:{...m.context,workflowName:n,workflowArgs:o,fieldKey:e.key},disabled:m.disabled,showLabel:!1}):null]}),e.multiline?(0,L.jsx)(`textarea`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:i(u,`min-h-20 resize-y`)}):(0,L.jsx)(`input`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:u})]},e.key)}),C=y&&g.length>0?(0,L.jsx)(V,{examples:g,labels:b,onSelect:v}):null,w=_?(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:b.goalLabel}),m?(0,L.jsx)(R,{value:c,onApply:l,fieldId:`workflow.goal`,fieldLabel:b.goalLabel,scenario:m.goalScenario??`cron.workflowGoal`,locale:r,context:{...m.context,workflowName:n,workflowArgs:o},disabled:m.disabled,showLabel:!1}):null]}),(0,L.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),placeholder:b.goalPlaceholder,className:i(u,`min-h-20 resize-y`)})]}):null,t[2]=m,t[3]=o,t[4]=g,t[5]=c,t[6]=p,t[7]=r,t[8]=s,t[9]=l,t[10]=_,t[11]=n,t[12]=v,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w}else v=t[12],y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18];let T;t[23]!==v||t[24]!==g||t[25]!==y||t[26]!==b?(T=!y&&g.length>0?(0,L.jsx)(V,{examples:g,labels:b,onSelect:v}):null,t[23]=v,t[24]=g,t[25]=y,t[26]=b,t[27]=T):T=t[27];let D;return t[28]!==x||t[29]!==S||t[30]!==C||t[31]!==w||t[32]!==T?(D=(0,L.jsxs)(`div`,{className:x,children:[S,C,w,T]}),t[28]=x,t[29]=S,t[30]=C,t[31]=w,t[32]=T,t[33]=D):D=t[33],D}var U=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`;function W(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function se({schema:e,value:t,onChange:n,labels:r,aiAssist:a,onValidChange:o}){let s=(0,M.useMemo)(()=>K(e),[e]),[c,l]=(0,M.useState)(!1),[u,d]=(0,M.useState)(()=>JSON.stringify(t,null,2)),[f,p]=(0,M.useState)(null);if(s.length===0)return null;let m=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),c&&d(JSON.stringify(i,null,2))},h=e=>{d(e);try{let t=e.trim()?JSON.parse(e):{};if(!t||typeof t!=`object`||Array.isArray(t)){p(r.rawJsonInvalid),o?.(!1);return}p(null),n(t),o?.(!0,t)}catch{p(r.rawJsonInvalid),o?.(!1)}};return(0,L.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,L.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!c;l(e),e&&(d(JSON.stringify(t,null,2)),p(null),o?.(!0))},children:r.rawJson})]}),c?(0,L.jsxs)(`div`,{className:`mt-3`,children:[(0,L.jsx)(`textarea`,{value:u,onChange:e=>h(e.target.value),spellCheck:!1,className:i(U,`min-h-40 font-mono text-xs leading-5`)}),f?(0,L.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:f}):null]}):(0,L.jsx)(`div`,{className:`mt-3 grid gap-3`,children:s.map(e=>(0,L.jsx)(ce,{field:e,value:t[e.key],labels:r,aiAssist:a,allValues:t,onChange:t=>m(e.key,t)},e.key))})]})}function ce(e){let t=(0,N.c)(30),{field:n,value:r,labels:a,aiAssist:o,allValues:s,onChange:c}=e,l=n.schema.title||n.key,u=typeof n.schema.description==`string`?n.schema.description:void 0,d=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,f;t[0]===n.schema.enum?f=t[1]:(f=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=f);let p=f,h=!!o&&!p.length&&(d===`string`||!d),g=String(l),_=n.required?` *`:``,v;t[2]!==g||t[3]!==_?(v=(0,L.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[g,_]}),t[2]=g,t[3]=_,t[4]=v):v=t[4];let y;t[5]!==o||t[6]!==s||t[7]!==n.key||t[8]!==n.schema||t[9]!==c||t[10]!==h||t[11]!==l||t[12]!==r?(y=h&&o?(0,L.jsx)(R,{value:typeof r==`string`?r:r==null?``:String(r),onApply:c,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(l),scenario:o.scenario??`workflow.arg`,locale:o.locale,context:{...o.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:s},disabled:o.disabled,showLabel:!1}):null,t[5]=o,t[6]=s,t[7]=n.key,t[8]=n.schema,t[9]=c,t[10]=h,t[11]=l,t[12]=r,t[13]=y):y=t[13];let b;t[14]!==v||t[15]!==y?(b=(0,L.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[v,y]}),t[14]=v,t[15]=y,t[16]=b):b=t[16];let x;t[17]===u?x=t[18]:(x=u?(0,L.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:u}):null,t[17]=u,t[18]=x);let S;t[19]!==u||t[20]!==p||t[21]!==a||t[22]!==c||t[23]!==d||t[24]!==r?(S=p.length>0?(0,L.jsxs)(w,{value:r==null?``:String(r),onChange:e=>c(e.target.value),className:U,children:[(0,L.jsx)(m,{value:``}),p.map(G)]}):d===`boolean`?(0,L.jsxs)(w,{value:typeof r==`boolean`?String(r):``,onChange:e=>c(e.target.value===``?void 0:e.target.value===`true`),className:U,children:[(0,L.jsx)(m,{value:``}),(0,L.jsx)(m,{value:`true`,children:a.booleanTrue}),(0,L.jsx)(m,{value:`false`,children:a.booleanFalse})]}):d===`number`||d===`integer`?(0,L.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>c(e.target.value===``?void 0:Number(e.target.value)),className:U}):(0,L.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>c(e.target.value),className:i(U,u&&u.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=u,t[20]=p,t[21]=a,t[22]=c,t[23]=d,t[24]=r,t[25]=S):S=t[25];let C;return t[26]!==b||t[27]!==x||t[28]!==S?(C=(0,L.jsxs)(`div`,{className:`block`,children:[b,x,S]}),t[26]=b,t[27]=x,t[28]=S,t[29]=C):C=t[29],C}function G(e){return(0,L.jsx)(m,{value:String(e),children:String(e)},String(e))}function K(e){let t=e.properties??{},n=new Set(e.required??[]);return Object.entries(t).map(([e,t])=>({key:e,schema:t,required:n.has(e)}))}function q(e,t){return!W(e)||!e?!0:K(e).every(e=>{if(!e.required)return!0;let n=t[e.key];return n==null?!1:typeof n==`string`?n.trim().length>0:!0})}function J(e){let t=(0,N.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,L.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,L.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,L.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Y(e,t){if(e)return W(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:l(t.argValues)}function le(e,t,n){let r=a(t).workflows;if(!e)return r.noInputSummary;let i=S(e,t);if(W(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let o=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),s=n.goal.trim()||i.description;return s&&o.unshift(s),o.length>0?o.join(` · `):r.noInputSummary}function X(e,t,n=!0){return e?n?W(e.inputSchema)?q(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(d[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function ue(e){let t=(0,N.c)(114),{definition:n,language:r,value:o,onChange:s,aiAssist:c,inputClassName:l,onValidityChange:u}=e,d;t[0]===r?d=t[1]:(d=a(r),t[0]=r,t[1]=d);let f=d.workflows,p;t[2]!==n||t[3]!==r?(p=S(n,r),t[2]=n,t[3]=r,t[4]=p):p=t[4];let m=p,[h,g]=(0,M.useState)(!0),_;t[5]===m.examplePrompts?_=t[6]:(_=m.examplePrompts??[],t[5]=m.examplePrompts,t[6]=_);let v=_,y;t[7]===n.inputSchema?y=t[8]:(y=W(n.inputSchema),t[7]=n.inputSchema,t[8]=y);let b=y,x,C,w,T,E,D,O,k,A,ee;if(t[9]!==c||t[10]!==n||t[11]!==v||t[12]!==b||t[13]!==l||t[14]!==f||t[15]!==r||t[16]!==m.description||t[17]!==s||t[18]!==u||t[19]!==h||t[20]!==o){E=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,l),a;t[31]!==n||t[32]!==s||t[33]!==u||t[34]!==h?(a=(e,t)=>{let r=t===void 0?h:t;s(e),u?.(X(n,e,r))},t[31]=n,t[32]=s,t[33]=u,t[34]=h,t[35]=a):a=t[35];let d=a,p;t[36]!==d||t[37]!==o?(p=e=>d({...o,goal:e}),t[36]=d,t[37]=o,t[38]=p):p=t[38];let _=p,y;t[39]!==d||t[40]!==o?(y=e=>d({...o,schemaInput:e}),t[39]=d,t[40]=o,t[41]=y):y=t[41];let S=y,j;t[42]!==d||t[43]!==o?(j=e=>d({...o,argValues:e}),t[42]=d,t[43]=o,t[44]=j):j=t[44];let M=j,N;if(t[45]!==_||t[46]!==S||t[47]!==o.schemaInput?(N=e=>{if(e.field===`goal`){_(e.text);return}S({...o.schemaInput,[e.field]:e.text})},t[45]=_,t[46]=S,t[47]=o.schemaInput,t[48]=N):N=t[48],x=N,!b){let e;t[49]!==c||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==m.description?(e=c?{disabled:c.disabled,argScenario:c.inputScenario??`workflow.arg`,goalScenario:c.goalScenario??`workflow.goal`,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,t[49]=c,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=m.description,t[54]=e):e=t[54];let i;t[55]!==n.name||t[56]!==v||t[57]!==l||t[58]!==r||t[59]!==M||t[60]!==_||t[61]!==e||t[62]!==o.argValues||t[63]!==o.goal?(i=(0,L.jsx)(H,{workflowName:n.name,language:r,argValues:o.argValues,onArgValuesChange:M,goal:o.goal,onGoalChange:_,examplePrompts:v,inputClassName:l,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=l,t[58]=r,t[59]=M,t[60]=_,t[61]=e,t[62]=o.argValues,t[63]=o.goal,t[64]=i):i=t[64],E=i;break bb0}w=`flex flex-col gap-3`,t[65]!==c||t[66]!==n||t[67]!==f.booleanFalse||t[68]!==f.booleanTrue||t[69]!==f.inputSchemaHeading||t[70]!==f.rawJson||t[71]!==f.rawJsonInvalid||t[72]!==r||t[73]!==m.description||t[74]!==u||t[75]!==S||t[76]!==o?(T=n.inputSchema?(0,L.jsx)(se,{schema:n.inputSchema,value:o.schemaInput,onChange:S,onValidChange:(e,t)=>{g(e),u?.(X(n,t?{...o,schemaInput:t}:o,e))},aiAssist:c?{locale:r,disabled:c.disabled,scenario:c.inputScenario??`workflow.arg`,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,labels:{inputSchemaHeading:f.inputSchemaHeading,rawJson:f.rawJson,rawJsonInvalid:f.rawJsonInvalid,booleanTrue:f.booleanTrue,booleanFalse:f.booleanFalse}}):null,t[65]=c,t[66]=n,t[67]=f.booleanFalse,t[68]=f.booleanTrue,t[69]=f.inputSchemaHeading,t[70]=f.rawJson,t[71]=f.rawJsonInvalid,t[72]=r,t[73]=m.description,t[74]=u,t[75]=S,t[76]=o,t[77]=T):T=t[77],ee=`flex flex-col gap-1`;let P;t[78]===f.goalLabel?P=t[79]:(P=(0,L.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:f.goalLabel}),t[78]=f.goalLabel,t[79]=P);let F;t[80]!==c||t[81]!==n.id||t[82]!==n.name||t[83]!==n.title||t[84]!==f.goalLabel||t[85]!==r||t[86]!==m.description||t[87]!==_||t[88]!==o.goal||t[89]!==o.schemaInput?(F=c?(0,L.jsx)(R,{value:o.goal,onApply:_,fieldId:`workflow.goal`,fieldLabel:f.goalLabel,scenario:c.goalScenario??`workflow.goal`,locale:r,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description,workflowInput:o.schemaInput},disabled:c.disabled,showLabel:!1}):null,t[80]=c,t[81]=n.id,t[82]=n.name,t[83]=n.title,t[84]=f.goalLabel,t[85]=r,t[86]=m.description,t[87]=_,t[88]=o.goal,t[89]=o.schemaInput,t[90]=F):F=t[90],t[91]!==P||t[92]!==F?(C=(0,L.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[P,F]}),t[91]=P,t[92]=F,t[93]=C):C=t[93],D=o.goal,t[94]===_?O=t[95]:(O=e=>_(e.target.value),t[94]=_,t[95]=O),k=f.goalPlaceholder,A=i(e,`min-h-20 resize-y`)}t[9]=c,t[10]=n,t[11]=v,t[12]=b,t[13]=l,t[14]=f,t[15]=r,t[16]=m.description,t[17]=s,t[18]=u,t[19]=h,t[20]=o,t[21]=x,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A,t[30]=ee}else x=t[21],C=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],k=t[28],A=t[29],ee=t[30];if(E!==Symbol.for(`react.early_return_sentinel`))return E;let j;t[96]!==D||t[97]!==O||t[98]!==k||t[99]!==A?(j=(0,L.jsx)(`textarea`,{value:D,onChange:O,placeholder:k,className:A}),t[96]=D,t[97]=O,t[98]=k,t[99]=A,t[100]=j):j=t[100];let P;t[101]!==C||t[102]!==j||t[103]!==ee?(P=(0,L.jsxs)(`div`,{className:ee,children:[C,j]}),t[101]=C,t[102]=j,t[103]=ee,t[104]=P):P=t[104];let F;t[105]!==x||t[106]!==v||t[107]!==f?(F=(0,L.jsx)(J,{examples:v,labels:f,onSelect:x}),t[105]=x,t[106]=v,t[107]=f,t[108]=F):F=t[108];let I;return t[109]!==w||t[110]!==T||t[111]!==P||t[112]!==F?(I=(0,L.jsxs)(`div`,{className:w,children:[T,P,F]}),t[109]=w,t[110]=T,t[111]=P,t[112]=F,t[113]=I):I=t[113],I}function Z(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?g(t.agentScaleExact,{count:n.min}):g(t.agentScaleRange,{min:n.min,max:n.max}):g(t.agentScaleExact,{count:e.defaults.maxSubagents})}function de(e){let t=(0,N.c)(41),{definition:n,language:r,value:o,onChange:s,mode:c,badgeLabel:l,aiAssist:u,inputClassName:d,showTimeout:f,defaultAdvancedOpen:p,onValidityChange:m}=e,_=f===void 0?!1:f,v=p===void 0?!1:p,y=a(r).workflows,[b,w]=(0,M.useState)(v),T;t[0]!==n||t[1]!==r?(T=S(n,r),t[0]=n,t[1]=r,t[2]=T):T=t[2];let E=T,O;t[3]!==n.defaults||t[4]!==o.concurrency?(O=o.concurrency.trim()?Number(o.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=o.concurrency,t[5]=O):O=t[5];let k=O,A;t[6]!==n.defaults||t[7]!==o.maxSubagents?(A=o.maxSubagents.trim()?Number(o.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=o.maxSubagents,t[8]=A):A=t[8];let ee=A,P;t[9]!==n||t[10]!==r||t[11]!==o?(P=le(n,r,o),t[9]=n,t[10]=r,t[11]=o,t[12]=P):P=t[12];let F=P,I=l??y.readyToStart,te;t[13]!==s||t[14]!==o?(te=e=>s({...o,...e}),t[13]=s,t[14]=o,t[15]=te):te=t[15];let ne=te,re=c===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,ie;t[16]===re?ie=t[17]:(ie=i(`space-y-4`,re),t[16]=re,t[17]=ie);let R=F||E.description,ae;t[18]===R?ae=t[19]:(ae=(0,L.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:R}),t[18]=R,t[19]=ae);let oe;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,L.jsx)(C,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=oe):oe=t[20];let z;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,L.jsx)(j,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=z):z=t[21];let B;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,L.jsx)(h,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=B):B=t[22];let V;t[23]!==s||t[24]!==o?(V=e=>s({...o,...e}),t[23]=s,t[24]=o,t[25]=V):V=t[25];let H;t[26]===m?H=t[27]:(H=e=>{m?.(e)},t[26]=m,t[27]=H);let U;t[28]!==u||t[29]!==n||t[30]!==d||t[31]!==r||t[32]!==V||t[33]!==H||t[34]!==o?(U=(0,L.jsx)(ue,{definition:n,language:r,value:o,onChange:V,onValidityChange:H,aiAssist:u,inputClassName:d}),t[28]=u,t[29]=n,t[30]=d,t[31]=r,t[32]=V,t[33]=H,t[34]=o,t[35]=U):U=t[35];let W;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>w(Q),t[36]=W):W=t[36];let se=y.advancedSettings,ce=b&&`rotate-180`,G;t[37]===ce?G=t[38]:(G=i(`size-4 transition-transform`,ce),t[37]=ce,t[38]=G);let K;return t[39]===G?K=t[40]:(K=(0,L.jsx)(D,{className:G}),t[39]=G,t[40]=K),(0,L.jsxs)(`div`,{className:ie,children:[(0,L.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:y.runPlanPreview}),ae]}),(0,L.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:I})]}),(0,L.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[oe,(0,L.jsx)(`span`,{children:g(y.phaseCount,{count:n.phases.length})})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[z,(0,L.jsx)(`span`,{children:Z(n,y)})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[B,(0,L.jsx)(`span`,{children:g(y.runLimitsSummary,{concurrency:k,max:ee})})]})]}),n.phases.length>0?(0,L.jsxs)(`div`,{className:`mt-4`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,L.jsx)(x,{className:`size-3.5`,"aria-hidden":!0}),y.startPlanPhases]}),(0,L.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(fe)})]}):null]}),U,(0,L.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:W,children:[se,K]}),b?(0,L.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,L.jsx)(`input`,{value:o.concurrency,onChange:e=>ne({concurrency:e.target.value}),placeholder:g(y.concurrencyPlaceholder,{default:n.defaults.concurrency}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,L.jsx)(`input`,{value:o.maxSubagents,onChange:e=>ne({maxSubagents:e.target.value}),placeholder:g(y.maxSubagentsPlaceholder,{default:n.defaults.maxSubagents}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),_?(0,L.jsx)(`input`,{value:o.timeoutSeconds??``,onChange:e=>ne({timeoutSeconds:e.target.value}),placeholder:g(y.timeoutSecondsPlaceholder,{default:n.defaults.timeoutSec}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}):null]}):null]})]})}function Q(e){return!e}function fe(e,t){return(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,L.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,L.jsx)(`span`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1 text-[11px] text-fg-muted`,children:e.title})]},e.id)}export{R as a,B as i,Y as n,X as r,de as t};