@xopcai/xopc 0.0.398 → 0.0.400

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 (158) 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/{agent-avatar-dicebear-Q-lKLSrc.js → agent-avatar-dicebear-B7GhbbJl.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-CobxTBV_.js → agent-defaults-settings-panel-Bu_K45Ek.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agents-Bgmmue5K.js → agents-ChQ0rVqM.js} +3 -3
  6. package/dist/gateway/static/root/assets/{app-management-settings-panel-CB_W2ano.js → app-management-settings-panel-DXe_yRwn.js} +1 -1
  7. package/dist/gateway/static/root/assets/{appearance-settings-B-ppSGBm.js → appearance-settings-BzHQv_NH.js} +1 -1
  8. package/dist/gateway/static/root/assets/apps-page-DRwxXHjg.js +1 -0
  9. package/dist/gateway/static/root/assets/{archive-plugin-CeQrQ693.js → archive-plugin-D4OpAzgH.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automations-page-Cc9vZanv.js → automations-page-CvoN7NI-.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-workspace-Bc4c_AEq.js → automations-workspace-KgjR_a8V.js} +1 -1
  12. package/dist/gateway/static/root/assets/{binary-plugins-BqaVBv1R.js → binary-plugins-BQ51byO-.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-B4ij8nZi.js → block-editor-CuaGcDNj.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-automation-inputs-DngvcZH9.js → browser-automation-inputs-BEj3E3Wg.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-automations-page-CdqwXyYq.js → browser-automations-page-bf2wLb_U.js} +1 -1
  16. package/dist/gateway/static/root/assets/{browser-settings-page-CJT0rB-I.js → browser-settings-page-B3B4j-fo.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capabilities-page-C56VsP0Y.js → capabilities-page-CrMVZkHU.js} +2 -2
  18. package/dist/gateway/static/root/assets/{capabilities-settings-panel-DZiA8JIq.js → capabilities-settings-panel-brKKbjb1.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capability-header-actions-Cu-ATcJq.js → capability-header-actions-DrOc-yzD.js} +1 -1
  20. package/dist/gateway/static/root/assets/{capability-links--dcwUjgv.js → capability-links-DzQWK1Fh.js} +1 -1
  21. package/dist/gateway/static/root/assets/{channels-gIjZtYnV.js → channels-DwL_FBhH.js} +1 -1
  22. package/dist/gateway/static/root/assets/{chat-terminal-dock-COdvmTgN.js → chat-terminal-dock-DmNnS6TM.js} +1 -1
  23. package/dist/gateway/static/root/assets/{computer-settings-page-C1XHsuI8.js → computer-settings-page-CzgZGc6E.js} +1 -1
  24. package/dist/gateway/static/root/assets/{connector-service-page-Cv2bhnQ5.js → connector-service-page-BIfX9zNS.js} +1 -1
  25. package/dist/gateway/static/root/assets/connectors-page-e7r6aMEp.js +1 -0
  26. package/dist/gateway/static/root/assets/{date-picker-CCnqYwy0.js → date-picker-CbrbJS2K.js} +1 -1
  27. package/dist/gateway/static/root/assets/{dependency-picker-nt5ruIio.js → dependency-picker-58ZbwNby.js} +1 -1
  28. package/dist/gateway/static/root/assets/{desktop-pet-Bn8xj1v3.js → desktop-pet-DwZJ9V8G.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-settings-Cbl1J_VE.js → desktop-pet-settings-miynV1MT.js} +1 -1
  30. package/dist/gateway/static/root/assets/{device-pairing-wizard-Tadg9co1.js → device-pairing-wizard-CcOeWnx0.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-DuE5ez1E.js → directory-picker-path-field-6MGZG98P.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-debug-page-jsNxwqNi.js → extension-debug-page-Dp_IJP6-.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-page-N_rBjYX8.js → extension-page-pWuoYmVL.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-settings-page-7qAdvlRB.js → extension-settings-page-SJ4T9oXh.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-settings-ViqOhx_m.js → gateway-settings-Ds5gFBVs.js} +1 -1
  36. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-XrkWdmrk.js → highlighted-body-KQOG7T2V-ChdUhMyZ.js} +1 -1
  37. package/dist/gateway/static/root/assets/{home-page-C_Xn_Kkz.js → home-page-BGjlHbXQ.js} +1 -1
  38. package/dist/gateway/static/root/assets/{image-generation-api-CmHdM2uL.js → image-generation-api-xTanSnq4.js} +1 -1
  39. package/dist/gateway/static/root/assets/{imports-page-B-dnvHP_.js → imports-page-DstG_R0Z.js} +1 -1
  40. package/dist/gateway/static/root/assets/index-QegseiyI.css +1 -0
  41. package/dist/gateway/static/root/assets/{index-DvKDT-RQ.js → index-fDaRYOv1.js} +8 -8
  42. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-mCs9cDgv.js → keyboard-shortcuts-settings-CtSA2o-v.js} +1 -1
  43. package/dist/gateway/static/root/assets/{local-app-workbench-page-B7AtlfWQ.js → local-app-workbench-page-Bjy2vPj-.js} +1 -1
  44. package/dist/gateway/static/root/assets/{local-apps-page-CIJE7jME.js → local-apps-page-BDApBgtY.js} +1 -1
  45. package/dist/gateway/static/root/assets/{logs-page-HawXUKF2.js → logs-page-DePchbyj.js} +1 -1
  46. package/dist/gateway/static/root/assets/{management-settings-DByEh6rq.js → management-settings-CfnxE6K5.js} +1 -1
  47. package/dist/gateway/static/root/assets/{media-plugins-B8BLxQgj.js → media-plugins-Bai9Og3V.js} +1 -1
  48. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-bXnI7rUg.js +1 -0
  49. package/dist/gateway/static/root/assets/{note-detail-panel-hQHB5fCs.js → note-detail-panel-D9IfcVdl.js} +3 -3
  50. package/dist/gateway/static/root/assets/{notes-page-BEusEk31.js → notes-page-KGS9DAHs.js} +1 -1
  51. package/dist/gateway/static/root/assets/{page-context-capture-button-42bq8N6-.js → page-context-capture-button-Hwj5mgvr.js} +1 -1
  52. package/dist/gateway/static/root/assets/{personal-page-DPR5gzhf.js → personal-page-Bmkhjsrb.js} +1 -1
  53. package/dist/gateway/static/root/assets/plugin-details-dialog-F3p7hZfb.js +1 -0
  54. package/dist/gateway/static/root/assets/{plugin-presentation-BrQpVvjC.js → plugin-presentation-BTc9eGAc.js} +1 -1
  55. package/dist/gateway/static/root/assets/{preview-open-alternatives-DKyLVLpX.js → preview-open-alternatives-DAmgAXI9.js} +1 -1
  56. package/dist/gateway/static/root/assets/{product-open-page-DcGH0AXN.js → product-open-page-Cvujq-at.js} +1 -1
  57. package/dist/gateway/static/root/assets/{product-preview-content-Ck6OzP09.js → product-preview-content-S1EfBQSH.js} +1 -1
  58. package/dist/gateway/static/root/assets/{project-detail-page-BHoQ10Eo.js → project-detail-page-nbeJjhHu.js} +1 -1
  59. package/dist/gateway/static/root/assets/{projects-page-DYsq_OLJ.js → projects-page-DKnFWTzc.js} +1 -1
  60. package/dist/gateway/static/root/assets/{remote-access-hub-CU3EChY0.js → remote-access-hub-DGjIoklN.js} +1 -1
  61. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bfs5zKDg.js → runtime-tools-settings-panel-CZHb7XN3.js} +1 -1
  62. package/dist/gateway/static/root/assets/{schema-form-BbI2BuSU.js → schema-form-P6uo4aTB.js} +1 -1
  63. package/dist/gateway/static/root/assets/{sessions-page-CjB2GOTs.js → sessions-page-B-4njnNj.js} +1 -1
  64. package/dist/gateway/static/root/assets/settings-advanced-gate-DfsiUGi6.js +1 -0
  65. package/dist/gateway/static/root/assets/{settings-form-section-BfBBJlr-.js → settings-form-section-h0HhEpiF.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-page-9yu4SN1j.js → settings-page-AknPfAp8.js} +1 -1
  67. package/dist/gateway/static/root/assets/{setup-status-panel-DhWB3feW.js → setup-status-panel-BWfAXtFX.js} +1 -1
  68. package/dist/gateway/static/root/assets/{share-preview-page-B6lQl5xb.js → share-preview-page-DELcrD4H.js} +1 -1
  69. package/dist/gateway/static/root/assets/{shares-settings-UJGjdz3F.js → shares-settings-BPuThYz5.js} +1 -1
  70. package/dist/gateway/static/root/assets/{skill-api-y2m3k_R4.js → skill-api-BZa6K-ss.js} +1 -1
  71. package/dist/gateway/static/root/assets/{skill-reload-api-Bk9FqsVa.js → skill-reload-api-kkS6CsDm.js} +1 -1
  72. package/dist/gateway/static/root/assets/{skills-page-DLd4O-Fo.js → skills-page-CgbbAh89.js} +1 -1
  73. package/dist/gateway/static/root/assets/{style-C2ptQg95.js → style-p3jWw92_.js} +1 -1
  74. package/dist/gateway/static/root/assets/{system-settings-panel-DYzcLnVk.js → system-settings-panel-CnW46J1H.js} +1 -1
  75. package/dist/gateway/static/root/assets/{task-detail-page-DLGtmHAH.js → task-detail-page-Cse314-c.js} +1 -1
  76. package/dist/gateway/static/root/assets/{tracing-settings-page-DKQYmzFn.js → tracing-settings-page-DukbNSbs.js} +1 -1
  77. package/dist/gateway/static/root/assets/{tunnel-api-C2VY_HTy.js → tunnel-api-CnUDRk-U.js} +1 -1
  78. package/dist/gateway/static/root/assets/{usage-page-CjzunQtj.js → usage-page-LsoUOpYt.js} +1 -1
  79. package/dist/gateway/static/root/assets/{use-autosave-BElgnGMt.js → use-autosave-DmXcbSNm.js} +1 -1
  80. package/dist/gateway/static/root/assets/{user-model-page-DsOGCDTR.js → user-model-page-CfyppZWW.js} +1 -1
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-FVjX0qhn.js → voice-api-key-field-BS5WRLuc.js} +1 -1
  82. package/dist/gateway/static/root/assets/{work-discovery-overlay-B2S2NZuK.js → work-discovery-overlay-9rVKP_hV.js} +1 -1
  83. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-2Gq34KQk.js → workflow-run-setup-panel-qk5NOkwL.js} +1 -1
  84. package/dist/gateway/static/root/assets/{workflows-page-CjeFD3mk.js → workflows-page--iOSBqMk.js} +1 -1
  85. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BZMIZxWg.js → xopc-cloud-account-card-B14g2TWE.js} +1 -1
  86. package/dist/gateway/static/root/index.html +2 -2
  87. package/dist/package.js +1 -1
  88. package/dist/src/agent/agent-manager.js +3 -3
  89. package/dist/src/agent/background-review/run-background-review.js +1 -1
  90. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  91. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  92. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  93. package/dist/src/agent/service/process-direct-streaming.js +1 -1
  94. package/dist/src/agent/service.js +2 -2
  95. package/dist/src/agent/skills/index.js +1 -1
  96. package/dist/src/agent/skills/managed-store.js +1 -1
  97. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  98. package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
  99. package/dist/src/agent/tool-manuals/computer.js +2 -2
  100. package/dist/src/agent/tools/computer-use-tool.js +9 -3
  101. package/dist/src/agent/tools/factory.js +1 -1
  102. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  103. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  104. package/dist/src/agent/workspace-runtime/registry.js +1 -1
  105. package/dist/src/agent-catalog/capabilities.js +2 -2
  106. package/dist/src/automations/capabilities/drafts.js +1 -1
  107. package/dist/src/automations/service/action-executor.js +2 -2
  108. package/dist/src/bootstrap/application-state.js +1 -1
  109. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  110. package/dist/src/capabilities/runtime/product.js +1 -1
  111. package/dist/src/chat-commands/agent-edit.js +1 -1
  112. package/dist/src/cli/commands/agent.js +1 -1
  113. package/dist/src/cli/commands/agents.js +1 -1
  114. package/dist/src/cli/commands/models.js +1 -1
  115. package/dist/src/cli/commands/onboard/model.js +1 -1
  116. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  117. package/dist/src/computer/diagnostics.js +1 -0
  118. package/dist/src/computer/errors.js +1 -0
  119. package/dist/src/computer/runtime.d.ts +23 -0
  120. package/dist/src/computer/runtime.js +90 -7
  121. package/dist/src/config/agent-model-intents.js +1 -1
  122. package/dist/src/config/agent-profile.js +2 -2
  123. package/dist/src/config/loader.js +1 -1
  124. package/dist/src/config/models-json.js +1 -1
  125. package/dist/src/config/schema.js +2 -2
  126. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  127. package/dist/src/gateway/agents-admin.js +2 -2
  128. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  129. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  130. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  131. package/dist/src/gateway/hono/routes/context-sources.js +1 -1
  132. package/dist/src/gateway/hono/routes/notes.js +2 -2
  133. package/dist/src/gateway/hono/routes/projects.js +2 -2
  134. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  135. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  136. package/dist/src/gateway/image-generation-setup.js +1 -1
  137. package/dist/src/gateway/lock.js +1 -1
  138. package/dist/src/gateway/service.js +8 -8
  139. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  140. package/dist/src/home-intelligence/host.js +2 -2
  141. package/dist/src/local-apps/service.js +1 -1
  142. package/dist/src/personal-agent/proactivity/service.js +1 -1
  143. package/dist/src/personal-agent/service.js +2 -2
  144. package/dist/src/providers/model-catalog-persistence.js +1 -1
  145. package/dist/src/routing/resolve-route.js +1 -1
  146. package/dist/src/routing/resolve-tui-session-key.js +1 -1
  147. package/dist/src/tasks/capabilities/read.js +2 -2
  148. package/dist/src/tasks/capabilities/write.js +1 -1
  149. package/dist/src/tasks/task-handoff-service.js +1 -1
  150. package/dist/src/tui/backends/embedded-backend.js +2 -2
  151. package/dist/src/voice/realtime/persona-context.js +1 -1
  152. package/package.json +3 -3
  153. package/dist/gateway/static/root/assets/apps-page-3qUgsGui.js +0 -1
  154. package/dist/gateway/static/root/assets/connectors-page-SmKItq0N.js +0 -1
  155. package/dist/gateway/static/root/assets/index-DWzv8ZoO.css +0 -1
  156. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CZjPT7xE.js +0 -1
  157. package/dist/gateway/static/root/assets/plugin-details-dialog-D8dKKIY9.js +0 -1
  158. package/dist/gateway/static/root/assets/settings-advanced-gate-jbVx8gcF.js +0 -1
@@ -1,2 +1,2 @@
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,f as a,g as o}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./external-link-DjqjBmc3.js";import{M as l}from"./markdown-view-B58RypQ4.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./messages-DBvKzlCl.js";import{t as p}from"./cn-0WouolD0.js";import{n as m}from"./locale-store-Jnhw2WMv.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{s as S}from"./tasks-PuIUgF9L.js";import{$c as C,An as w,Ao as T,Bu as E,Ds as D,Es as O,Go as k,Kc as A,Kl as ee,Mn as j,Ni as M,Nn as N,Rc as P,Ts as F,Ui as I,Us as te,Wc as L,Wi as ne,Yc as R,Yd as z,al as B,ao as V,cf as H,cu as U,el as W,eu as G,ff as K,gd as re,il as ie,jn as ae,ll as oe,ml as se,oa as ce,ol as q,qc as le,r as ue,rl as de,sf as fe,sl as pe,ta as me,tl as he,uf as J,ws as Y,wu as ge}from"./index-DvKDT-RQ.js";import{n as X}from"./tab-completion-input-CxtEp0aP.js";import{n as _e,t as ve}from"./task-expandable-content-HdEeV_0-.js";var Z=n(),Q=e(t(),1);function ye(e,t){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(0),l=(0,Q.useCallback)(async()=>{let t=++c.current;s(null);try{let n=await C(e);t===c.current&&r(n)}catch(e){t===c.current&&s(e instanceof Error?e.message:String(e))}finally{t===c.current&&a(!1)}},[e]);return(0,Q.useEffect)(()=>(l(),()=>{c.current++}),[l,t]),(0,Q.useEffect)(()=>{let e,t=1/0,n=n=>{let r=Date.now()+n;r>=t||(window.clearTimeout(e),t=r,e=window.setTimeout(()=>{e=void 0,t=1/0,l()},n))},r=()=>n(100),i=()=>n(750),a=()=>{document.visibilityState===`visible`&&r()},o=[`task-changed-v2`,`task-updated`,`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`,`home-advisor-updated`,`gateway-realtime-connected`,`realtime-gap`,`focus`],s=[`session-updated`,`session-transcript-updated`];return o.forEach(e=>window.addEventListener(e,r)),s.forEach(e=>window.addEventListener(e,i)),document.addEventListener(`visibilitychange`,a),()=>{o.forEach(e=>window.removeEventListener(e,r)),s.forEach(e=>window.removeEventListener(e,i)),document.removeEventListener(`visibilitychange`,a),window.clearTimeout(e)}},[l]),{home:n,loading:i,loadError:o,setLoadError:s,load:l}}var $=r(),be=12e3;function xe(e){let t=(0,Z.c)(107),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,attachmentsFull:u,voice:d,chat:f,cancelAction:m,onIntentChange:h,onPickFiles:g,onRemoveAttachment:_,onPaste:v,onDragOver:y,onDragLeave:b,onDrop:x,onSubmit:S}=e,C=n===`inline`,w;t[0]!==s||t[1]!==a?(w=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=w):w=t[2];let T=w,E=d.voiceActive&&d.phase!==`error`,D;t[3]!==S||t[4]!==d.voiceActive?(D=e=>{if(d.voiceActive){e.preventDefault();return}S(e)},t[3]=S,t[4]=d.voiceActive,t[5]=D):D=t[5];let O=C?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,k;t[6]===O?k=t[7]:(k=p(`relative`,O),t[6]=O,t[7]=k);let A;t[8]!==C||t[9]!==c||t[10]!==o.dropFiles?(A=c?(0,$.jsx)(`div`,{className:p(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,C&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=C,t[9]=c,t[10]=o.dropFiles,t[11]=A):A=t[11];let M=!C&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,N;t[12]===M?N=t[13]:(N=p(M),t[12]=M,t[13]=N);let P=C?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,F;t[14]!==r||t[15]!==o.intentLabel||t[16]!==P?(F=(0,$.jsx)(`label`,{htmlFor:r,className:P,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=P,t[17]=F):F=t[17];let I;t[18]!==l||t[19]!==f||t[20]!==d.audioLevel||t[21]!==d.cancelVoiceInput||t[22]!==d.confirmVoiceInput||t[23]!==d.elapsedLabel||t[24]!==d.error||t[25]!==d.finalTranscript||t[26]!==d.partialTranscript||t[27]!==d.phase||t[28]!==d.recordedDictation||t[29]!==d.retryVoiceInput||t[30]!==d.settingsRequired||t[31]!==d.voiceActive?(I=d.voiceActive?(0,$.jsx)(j,{phase:d.phase,elapsedLabel:d.elapsedLabel,recordedDictation:d.recordedDictation,audioLevel:d.audioLevel,partialTranscript:d.partialTranscript,finalTranscript:d.finalTranscript,error:d.error,settingsRequired:d.settingsRequired,disabled:l,chat:f,onCancel:d.cancelVoiceInput,onConfirm:d.confirmVoiceInput,onRetry:d.retryVoiceInput}):null,t[18]=l,t[19]=f,t[20]=d.audioLevel,t[21]=d.cancelVoiceInput,t[22]=d.confirmVoiceInput,t[23]=d.elapsedLabel,t[24]=d.error,t[25]=d.finalTranscript,t[26]=d.partialTranscript,t[27]=d.phase,t[28]=d.recordedDictation,t[29]=d.retryVoiceInput,t[30]=d.settingsRequired,t[31]=d.voiceActive,t[32]=I):I=t[32];let te=E&&`hidden`,R=C?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,z;t[33]!==te||t[34]!==R?(z=p(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,te,R),t[33]=te,t[34]=R,t[35]=z):z=t[35];let B;t[36]===h?B=t[37]:(B=e=>h(e.target.value),t[36]=h,t[37]=B);let V=!C,H;t[38]!==r||t[39]!==i||t[40]!==a||t[41]!==o.intentPlaceholder||t[42]!==o.intentSuggestion||t[43]!==h||t[44]!==v||t[45]!==z||t[46]!==B||t[47]!==V?(H=(0,$.jsx)(X,{ref:i,id:r,className:z,value:a,onChange:B,onPaste:v,suggestion:o.intentSuggestion,onAcceptSuggestion:h,onKeyDown:Se,placeholder:o.intentPlaceholder,maxLength:be,autoFocus:V}),t[38]=r,t[39]=i,t[40]=a,t[41]=o.intentPlaceholder,t[42]=o.intentSuggestion,t[43]=h,t[44]=v,t[45]=z,t[46]=B,t[47]=V,t[48]=H):H=t[48];let U=C?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,W;t[49]!==s||t[50]!==_||t[51]!==U?(W=(0,$.jsx)(me,{attachments:s,topPadded:!1,onRemove:_,className:U}),t[49]=s,t[50]=_,t[51]=U,t[52]=W):W=t[52];let G;t[53]!==C||t[54]!==a.length||t[55]!==o.shortcut?(G=C?null:(0,$.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:o.shortcut}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,be.toLocaleString()]})]}),t[53]=C,t[54]=a.length,t[55]=o.shortcut,t[56]=G):G=t[56];let K;t[57]!==I||t[58]!==H||t[59]!==W||t[60]!==G||t[61]!==N||t[62]!==F?(K=(0,$.jsxs)(`div`,{className:N,children:[F,I,H,W,G]}),t[57]=I,t[58]=H,t[59]=W,t[60]=G,t[61]=N,t[62]=F,t[63]=K):K=t[63];let re=C?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,ie;t[64]===re?ie=t[65]:(ie=p(`flex shrink-0 items-center gap-2 border-t`,re),t[64]=re,t[65]=ie);let ae=!C&&`mr-auto`,oe;t[66]===ae?oe=t[67]:(oe=p(`flex items-center gap-1`,ae),t[66]=ae,t[67]=oe);let se=l||u,ce;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(ge,{className:`size-4`,"aria-hidden":!0}),t[68]=ce):ce=t[68];let q;t[69]!==o.attachTitle||t[70]!==g||t[71]!==se?(q=(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:se,title:o.attachTitle,"aria-label":o.attachTitle,onClick:g,children:ce}),t[69]=o.attachTitle,t[70]=g,t[71]=se,t[72]=q):q=t[72];let le;t[73]!==l||t[74]!==f||t[75]!==d.startVoiceInput||t[76]!==d.voiceActive?(le=d.voiceActive?null:(0,$.jsx)(ne,{disabled:l,chat:f,onStart:d.startVoiceInput}),t[73]=l,t[74]=f,t[75]=d.startVoiceInput,t[76]=d.voiceActive,t[77]=le):le=t[77];let ue;t[78]!==oe||t[79]!==q||t[80]!==le?(ue=(0,$.jsxs)(`div`,{className:oe,children:[q,le]}),t[78]=oe,t[79]=q,t[80]=le,t[81]=ue):ue=t[81];let de;t[82]!==m||t[83]!==C||t[84]!==o.shortcut?(de=C?(0,$.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):m,t[82]=m,t[83]=C,t[84]=o.shortcut,t[85]=de):de=t[85];let fe=C?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,pe=!T||l||d.voiceActive,he=C?`size-3.5`:`size-4`,J;t[86]===he?J=t[87]:(J=(0,$.jsx)(ee,{className:he,"aria-hidden":!0}),t[86]=he,t[87]=J);let Y;t[88]!==o.submit||t[89]!==fe||t[90]!==pe||t[91]!==J?(Y=(0,$.jsxs)(L,{type:`submit`,variant:`primary`,className:fe,disabled:pe,children:[J,o.submit]}),t[88]=o.submit,t[89]=fe,t[90]=pe,t[91]=J,t[92]=Y):Y=t[92];let _e;t[93]!==ie||t[94]!==ue||t[95]!==de||t[96]!==Y?(_e=(0,$.jsxs)(`div`,{className:ie,children:[ue,de,Y]}),t[93]=ie,t[94]=ue,t[95]=de,t[96]=Y,t[97]=_e):_e=t[97];let ve;return t[98]!==b||t[99]!==y||t[100]!==x||t[101]!==D||t[102]!==K||t[103]!==_e||t[104]!==k||t[105]!==A?(ve=(0,$.jsxs)(`form`,{onSubmit:D,onDragOver:y,onDragLeave:b,onDrop:x,className:k,children:[A,K,_e]}),t[98]=b,t[99]=y,t[100]=x,t[101]=D,t[102]=K,t[103]=_e,t[104]=k,t[105]=A,t[106]=ve):ve=t[106],ve}function Se(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function Ce(e){let t=(0,Z.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(re,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function we(e){let t=(0,Z.c)(65),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,c,l,u;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.why||t[7]!==i||t[8]!==n.capabilities||t[9]!==n.continuation||t[10]!==n.estimatedMinutes||t[11]!==n.outcome||t[12]!==n.rationale||t[13]!==n.title){let e=n.capabilities.filter(Ee),d;t[20]===r.aiLabel?d=t[21]:(d=(0,$.jsx)(`span`,{children:r.aiLabel}),t[20]=r.aiLabel,t[21]=d);let f;t[22]!==r.minutes||t[23]!==n.estimatedMinutes?(f=n.estimatedMinutes?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[22]=r.minutes,t[23]=n.estimatedMinutes,t[24]=f):f=t[24];let p;t[25]!==d||t[26]!==f?(p=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[d,f]}),t[25]=d,t[26]=f,t[27]=p):p=t[27];let m;t[28]!==r.history||t[29]!==i?(m=(0,$.jsx)(Ce,{label:r.history,onClick:i}),t[28]=r.history,t[29]=i,t[30]=m):m=t[30],t[31]!==m||t[32]!==p?(a=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[p,m]}),t[31]=m,t[32]=p,t[33]=a):a=t[33],t[34]===n.title?o=t[35]:(o=(0,$.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[34]=n.title,t[35]=o),t[36]===n.outcome?s=t[37]:(s=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[36]=n.outcome,t[37]=s);let h;t[38]===r.why?h=t[39]:(h=(0,$.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[38]=r.why,t[39]=h),t[40]!==n.rationale||t[41]!==h?(c=(0,$.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[h,n.rationale]}),t[40]=n.rationale,t[41]=h,t[42]=c):c=t[42],t[43]!==r.automationAction||t[44]!==r.automationHint||t[45]!==n.continuation?(l=n.continuation?.kind===`automation`?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:r.automationHint}),(0,$.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.automationAction})]}):null,t[43]=r.automationAction,t[44]=r.automationHint,t[45]=n.continuation,t[46]=l):l=t[46],u=e.length>0?(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,$.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.why,t[7]=i,t[8]=n.capabilities,t[9]=n.continuation,t[10]=n.estimatedMinutes,t[11]=n.outcome,t[12]=n.rationale,t[13]=n.title,t[14]=a,t[15]=o,t[16]=s,t[17]=c,t[18]=l,t[19]=u}else a=t[14],o=t[15],s=t[16],c=t[17],l=t[18],u=t[19];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(J,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[47]=d):d=t[47];let f;t[48]===r.evidence?f=t[49]:(f=(0,$.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,d]}),t[48]=r.evidence,t[49]=f);let p;t[50]===n.evidence?p=t[51]:(p=n.evidence.map(Te),t[50]=n.evidence,t[51]=p);let m;t[52]===p?m=t[53]:(m=(0,$.jsx)(`ul`,{className:`mt-2 space-y-2 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:p}),t[52]=p,t[53]=m);let h;t[54]!==m||t[55]!==f?(h=(0,$.jsxs)(`details`,{className:`mt-4 group`,children:[f,m]}),t[54]=m,t[55]=f,t[56]=h):h=t[56];let g;return t[57]!==a||t[58]!==h||t[59]!==o||t[60]!==s||t[61]!==c||t[62]!==l||t[63]!==u?(g=(0,$.jsxs)($.Fragment,{children:[a,o,s,c,l,u,h]}),t[57]=a,t[58]=h,t[59]=o,t[60]=s,t[61]=c,t[62]=l,t[63]=u,t[64]=g):g=t[64],g}function Te(e){return(0,$.jsx)(`li`,{children:e.href?(0,$.jsx)(`a`,{href:`#${e.href}`,className:`hover:text-accent hover:underline`,children:e.observation}):e.observation},e.id)}function Ee(e){return e.readiness!==`ready`}function De(e){let t=(0,Z.c)(130),{advisor:n,copy:r,busy:i,onRefresh:a,onAction:o,onFeedback:c,onClarification:l,onOpenHistory:u,preflight:d,receipt:f}=e,[p,m]=(0,Q.useState)(),h;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(h=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=h):h=t[3];let g=h,_;t[4]!==g||t[5]!==p?(_=g.find(e=>e.id===p)??g[0],t[4]=g,t[5]=p,t[6]=_):_=t[6];let v=_,y;t[7]===g[0]?.id?y=t[8]:(y=()=>m(g[0]?.id),t[7]=g[0]?.id,t[8]=y);let b=g[0]?.id,x;if(t[9]!==n.state||t[10]!==b?(x=[n.state,b],t[9]=n.state,t[10]=b,t[11]=x):x=t[11],(0,Q.useEffect)(y,x),n.state===`disabled`)return null;if(f){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(s,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===f.title?n=t[14]:(n=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:f.title}),t[13]=f.title,t[14]=n);let i;t[15]===f.detail?i=t[16]:(i=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.detail}),t[15]=f.detail,t[16]=i);let a;t[17]!==n||t[18]!==i?(a=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=a):a=t[19];let o;t[20]!==r.history||t[21]!==u?(o=(0,$.jsx)(Ce,{label:r.history,onClick:u}),t[20]=r.history,t[21]=u,t[22]=o):o=t[22];let c=`#${f.href}`,l;t[23]!==r.viewProgress||t[24]!==c?(l=(0,$.jsx)(L,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,$.jsx)(`a`,{href:c,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=c,t[25]=l):l=t[25];let d;t[26]!==o||t[27]!==l?(d=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[o,l]}),t[26]=o,t[27]=l,t[28]=d):d=t[28];let p;return t[29]!==d||t[30]!==a?(p=(0,$.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,a,d]})}),t[29]=d,t[30]=a,t[31]=p):p=t[31],p}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let i;t[33]===r.aiLabel?i=t[34]:(i=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=i);let a;t[35]!==r.history||t[36]!==u?(a=(0,$.jsx)(Ce,{label:r.history,onClick:u}),t[35]=r.history,t[36]=u,t[37]=a):a=t[37];let o;t[38]!==i||t[39]!==a?(o=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,a]}),t[38]=i,t[39]=a,t[40]=o):o=t[40];let s;t[41]===n.question.question?s=t[42]:(s=(0,$.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=s);let c;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==l){let e;t[47]!==n.question.question||t[48]!==l?(e=e=>(0,$.jsx)(L,{type:`button`,variant:`secondary`,className:`min-h-11`,onClick:()=>l(n.question.question,e.label),children:e.label},e.id),t[47]=n.question.question,t[48]=l,t[49]=e):e=t[49],c=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=l,t[46]=c}else c=t[46];let d;t[50]===c?d=t[51]:(d=(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:c}),t[50]=c,t[51]=d);let f;return t[52]!==s||t[53]!==d||t[54]!==o?(f=(0,$.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[o,s,d]}),t[52]=s,t[53]=d,t[54]=o,t[55]=f):f=t[55],f}if(!v)return null;let S=d?.opportunityId===v.id?d.value:void 0,C;t[56]!==n.stale||t[57]!==r.refreshing?(C=n.stale?(0,$.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,$.jsx)(U,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[56]=n.stale,t[57]=r.refreshing,t[58]=C):C=t[58];let w;t[59]!==r||t[60]!==u||t[61]!==v?(w=(0,$.jsx)(we,{opportunity:v,copy:r,onOpenHistory:u}),t[59]=r,t[60]=u,t[61]=v,t[62]=w):w=t[62];let T;t[63]!==i||t[64]!==r.configure||t[65]!==r.degradedStart||t[66]!==r.setupHint||t[67]!==r.setupTitle||t[68]!==o||t[69]!==v||t[70]!==S?(T=S?.state===`needs_setup`?(0,$.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsx)(G,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:S.blockers.map(Oe)}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[S.recoveryActions.map(e=>(0,$.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),S.degradedAction?(0,$.jsx)(L,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(v,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[63]=i,t[64]=r.configure,t[65]=r.degradedStart,t[66]=r.setupHint,t[67]=r.setupTitle,t[68]=o,t[69]=v,t[70]=S,t[71]=T):T=t[71];let D;t[72]!==i||t[73]!==r.start||t[74]!==o||t[75]!==v?(D=v.actions.canStart?(0,$.jsxs)(L,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>o(v,`start`),children:[(0,$.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[72]=i,t[73]=r.start,t[74]=o,t[75]=v,t[76]=D):D=t[76];let O;t[77]!==i||t[78]!==r.discuss||t[79]!==o||t[80]!==v?(O=v.actions.canDiscuss?(0,$.jsxs)(L,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(v,`discuss`),children:[(0,$.jsx)(E,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[77]=i,t[78]=r.discuss,t[79]=o,t[80]=v,t[81]=O):O=t[81];let k;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(U,{className:`size-4`,"aria-hidden":!0}),t[82]=k):k=t[82];let A;t[83]!==i||t[84]!==r.refresh||t[85]!==a?(A=(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:a,title:r.refresh,children:[k,r.refresh]}),t[83]=i,t[84]=r.refresh,t[85]=a,t[86]=A):A=t[86];let j;t[87]===r.feedback?j=t[88]:(j=(0,$.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[87]=r.feedback,t[88]=j);let M;t[89]===r.alreadyDone?M=t[90]:(M=[`already_done`,r.alreadyDone],t[89]=r.alreadyDone,t[90]=M);let N;t[91]===r.irrelevant?N=t[92]:(N=[`irrelevant`,r.irrelevant],t[91]=r.irrelevant,t[92]=N);let P;t[93]===r.later?P=t[94]:(P=[`too_early`,r.later],t[93]=r.later,t[94]=P);let F;t[95]===r.sourceIncorrect?F=t[96]:(F=[`source_incorrect`,r.sourceIncorrect],t[95]=r.sourceIncorrect,t[96]=F);let I;t[97]===r.lessLikeThis?I=t[98]:(I=[`less_like_this`,r.lessLikeThis],t[97]=r.lessLikeThis,t[98]=I);let te;t[99]!==M||t[100]!==N||t[101]!==P||t[102]!==F||t[103]!==I?(te=[M,N,P,F,I],t[99]=M,t[100]=N,t[101]=P,t[102]=F,t[103]=I,t[104]=te):te=t[104];let ne=te,R;t[105]!==c||t[106]!==v||t[107]!==ne?(R=(0,$.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:ne.map(e=>{let[t,n]=e;return(0,$.jsx)(`button`,{type:`button`,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>c(v,t),children:n},t)})}),t[105]=c,t[106]=v,t[107]=ne,t[108]=R):R=t[108];let z;t[109]!==j||t[110]!==R?(z=(0,$.jsxs)(`details`,{className:`relative ml-auto`,children:[j,R]}),t[109]=j,t[110]=R,t[111]=z):z=t[111];let B;t[112]!==O||t[113]!==A||t[114]!==z||t[115]!==D?(B=(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[D,O,A,z]}),t[112]=O,t[113]=A,t[114]=z,t[115]=D,t[116]=B):B=t[116];let V;t[117]!==B||t[118]!==C||t[119]!==w||t[120]!==T?(V=(0,$.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[C,w,T,B]}),t[117]=B,t[118]=C,t[119]=w,t[120]=T,t[121]=V):V=t[121];let H;t[122]!==r.alternatives||t[123]!==g||t[124]!==v.id?(H=g.length>1?(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:g.filter(e=>e.id!==v.id).map(e=>(0,$.jsx)(`button`,{type:`button`,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>m(e.id),children:e.title},e.id))})]}):null,t[122]=r.alternatives,t[123]=g,t[124]=v.id,t[125]=H):H=t[125];let W;return t[126]!==r.aiLabel||t[127]!==V||t[128]!==H?(W=(0,$.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:[V,H]}),t[126]=r.aiLabel,t[127]=V,t[128]=H,t[129]=W):W=t[129],W}function Oe(e){return(0,$.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}var ke=new Set([`started`,`discussing`,`completed`]);function Ae(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(je)}),e[0]=t):t=e[0],t}function je(e){return(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,$.jsx)(P,{className:`h-4 w-24 rounded`}),(0,$.jsx)(P,{className:`h-5 w-4/5 rounded`}),(0,$.jsx)(P,{className:`h-4 w-3/5 rounded`})]},e)}function Me(e){let t=(0,Z.c)(11),{open:n,refreshKey:r,onOpenChange:i,onReevaluate:o}=e,s=m(Pe),u=f(s).projectsPage.home,p=a(),[S,C]=(0,Q.useState)(`all`),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],t[0]=w):w=t[0];let[E,D]=(0,Q.useState)(w),[O,k]=(0,Q.useState)(!1),[A,ee]=(0,Q.useState)(),j;t[1]===n?j=t[2]:(j=()=>{if(!n)return;let e=!0;return k(!0),ee(void 0),W().then(t=>{e&&D(t.items)}).catch(t=>{e&&ee(t instanceof Error?t.message:String(t))}).finally(()=>{e&&k(!1)}),()=>{e=!1}},t[1]=n,t[2]=j);let M;t[3]!==n||t[4]!==r?(M=[n,r],t[3]=n,t[4]=r,t[5]=M):M=t[5],(0,Q.useEffect)(j,M);let N=E.filter(e=>S===`all`||(S===`adopted`?ke.has(e.status):!ke.has(e.status))),P=new Intl.DateTimeFormat(s===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),F=new Intl.DateTimeFormat(s===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),I=new Map;for(let e of N){let t=P.format(new Date(e.updatedAt));I.set(t,[...I.get(t)??[],e])}let te=[...I.entries()],ne=e=>e.feedbackKind===`already_done`?u.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?u.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?u.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?u.advisorHistoryStatusLessLikeThis:{available:u.advisorHistoryStatusAvailable,started:u.advisorHistoryStatusStarted,discussing:u.advisorHistoryStatusDiscussing,completed:u.advisorHistoryStatusCompleted,snoozed:u.advisorHistoryStatusSnoozed,dismissed:u.advisorHistoryStatusDismissed,expired:u.advisorHistoryStatusExpired,superseded:u.advisorHistoryStatusSuperseded}[e.status],R=e=>{if(e.href){i(!1),p(l(`/`,e.href));return}e.status===`discussing`&&(i(!1),p(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},B;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=B):B=t[6];let V;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(re,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=V):V=t[7];let H;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),t[8]=H):H=t[8];let G=O?(0,$.jsx)(Ae,{}):A?(0,$.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,$.jsx)(`p`,{children:u.advisorHistoryLoadFailed}),(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>i(!1),children:u.advisorHistoryClose})]}):te.length===0?(0,$.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,$.jsx)(re,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:u.advisorHistoryEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.advisorHistoryEmptyHint})]}):(0,$.jsx)(`div`,{className:`space-y-6`,children:te.map(e=>{let[t,n]=e;return(0,$.jsxs)(`section`,{"aria-label":t,children:[(0,$.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,$.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:ne(e)}),(0,$.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,$.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:F.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,$.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,$.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),u.advisorHistoryReturnsAt,` `,F.format(new Date(e.snoozedUntil))]}):null,(0,$.jsxs)(`details`,{className:`group mt-3`,children:[(0,$.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[u.advisorHistoryEvidence,(0,$.jsx)(J,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1.5 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:e.opportunity.evidence.map(Ne)})]}),t||n?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,$.jsxs)(L,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>R(e),children:[(0,$.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?u.advisorHistoryContinueDiscussion:u.advisorHistoryViewProgress]}):null,n?(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{i(!1),o()},children:[(0,$.jsx)(U,{className:`size-3.5`,"aria-hidden":!0}),u.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),K;return t[9]===G?K=t[10]:(K=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:G}),t[9]=G,t[10]=K),(0,$.jsx)(x,{open:n,onOpenChange:i,children:(0,$.jsxs)(v,{children:[B,(0,$.jsxs)(y,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[V,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(b,{className:`text-base font-semibold text-fg`,children:u.advisorHistoryTitle}),(0,$.jsx)(g,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.advisorHistoryDescription})]}),(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":u.advisorHistoryClose,children:H})})]}),(0,$.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,$.jsx)(T,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":u.advisorHistoryFilterLabel,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`all`,u.advisorHistoryFilterAll],[`adopted`,u.advisorHistoryFilterAdopted],[`other`,u.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,$.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${S===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":S===t,onClick:()=>C(t),children:n},t)})})}),K]})]})})}function Ne(e){return(0,$.jsx)(`li`,{children:e.observation},e.id)}function Pe(e){return e.language}function Fe(e,t){return e.replace(`{{count}}`,String(t))}function Ie(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Fe(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var Le={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function Re(e){let t=(0,Z.c)(50),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,Q.useState)(!1),l;t[0]!==n||t[1]!==i?(l=Ie(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let u=l;if(!u)return null;let d=n.state!==`refreshing`,f=n.state===`ready`?i.findAnother:i.retry,m=`${i.label}:${u.label}`,h;t[3]===u.refreshing?h=t[4]:(h=u.refreshing?(0,$.jsx)(U,{className:`size-3.5 shrink-0 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,$.jsx)(ee,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[3]=u.refreshing,t[4]=h);let g=Le[u.tone],_;t[5]===g?_=t[6]:(_=p(`size-1.5 shrink-0 rounded-full`,g),t[5]=g,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,$.jsx)(`span`,{className:_,"aria-hidden":!0}),t[7]=_,t[8]=v);let y;t[9]!==i.label||t[10]!==u.label?(y=(0,$.jsxs)(`span`,{className:`truncate`,children:[i.label,` · `,u.label]}),t[9]=i.label,t[10]=u.label,t[11]=y):y=t[11];let b;t[12]!==m||t[13]!==h||t[14]!==v||t[15]!==y?(b=(0,$.jsx)(D,{asChild:!0,children:(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`h-9 max-w-56 rounded-lg px-2.5`,"aria-label":m,children:[h,v,y]})}),t[12]=m,t[13]=h,t[14]=v,t[15]=y,t[16]=b):b=t[16];let x;t[17]===u.refreshing?x=t[18]:(x=(0,$.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:u.refreshing?(0,$.jsx)(U,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,$.jsx)(ee,{className:`size-4`,"aria-hidden":!0})}),t[17]=u.refreshing,t[18]=x);let S;t[19]===u.label?S=t[20]:(S=(0,$.jsx)(`p`,{className:`font-semibold text-fg`,children:u.label}),t[19]=u.label,t[20]=S);let C;t[21]===u.detail?C=t[22]:(C=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.detail}),t[21]=u.detail,t[22]=C);let w;t[23]!==S||t[24]!==C?(w=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]}),t[23]=S,t[24]=C,t[25]=w):w=t[25];let T;t[26]!==w||t[27]!==x?(T=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[x,w]}),t[26]=w,t[27]=x,t[28]=T):T=t[28];let E;t[29]===a?E=t[30]:(E=()=>{c(!1),a()},t[29]=a,t[30]=E);let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(re,{className:`size-3.5`,"aria-hidden":!0}),t[31]=k):k=t[31];let A;t[32]!==i.history||t[33]!==E?(A=(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:E,children:[k,i.history]}),t[32]=i.history,t[33]=E,t[34]=A):A=t[34];let j;t[35]!==r||t[36]!==d||t[37]!==o||t[38]!==f?(j=d?(0,$.jsxs)(L,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,$.jsx)(U,{className:`size-3.5`,"aria-hidden":!0}),f]}):null,t[35]=r,t[36]=d,t[37]=o,t[38]=f,t[39]=j):j=t[39];let M;t[40]!==A||t[41]!==j?(M=(0,$.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[A,j]}),t[40]=A,t[41]=j,t[42]=M):M=t[42];let N;t[43]!==T||t[44]!==M?(N=(0,$.jsx)(F,{children:(0,$.jsxs)(Y,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-overlay p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:ze,children:[T,M]})}),t[43]=T,t[44]=M,t[45]=N):N=t[45];let P;return t[46]!==s||t[47]!==N||t[48]!==b?(P=(0,$.jsxs)(O,{open:s,onOpenChange:c,children:[b,N]}),t[46]=s,t[47]=N,t[48]=b,t[49]=P):P=t[49],P}function ze(e){return e.preventDefault()}function Be({taskId:e,language:t,onComplete:n}){let r=t===`zh`,[i,a]=(0,Q.useState)(),[o,s]=(0,Q.useState)(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let t=!0;return s(void 0),a(void 0),he(e).then(e=>{t&&a(e)}).catch(e=>{t&&s(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[e,u]);let f=i?_e(i):[],p=i?.task.phase===`review`&&i.allowedCommands.includes(`close`)&&i.waits.length===0&&f.length>0&&f.every(e=>e.status===`passed`);async function m(e,t=!1){if(!c){l(!0),s(void 0);try{a(await e()),t&&n()}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}let h=i?.receipts[0];return(0,$.jsxs)(`section`,{className:`mt-4 space-y-4 rounded-xl border border-edge bg-surface-panel p-4`,"aria-label":r?`任务验收`:`Task review`,children:[o?(0,$.jsxs)(`div`,{role:`alert`,className:`flex items-center justify-between gap-3 text-sm text-danger`,children:[(0,$.jsx)(`span`,{children:o}),(0,$.jsx)(L,{variant:`ghost`,disabled:c,onClick:()=>d(e=>e+1),children:r?`刷新`:`Refresh`})]}):null,!i&&!o?(0,$.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,$.jsx)(P,{className:`h-5 w-1/3`}),(0,$.jsx)(P,{className:`h-24 w-full`})]}):null,i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r?`执行结果`:`Result`}),h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ve,{content:h.summary,contentKey:`home:${e}:result`,language:t,previewHeight:180}),h.remainingWork.length>0?(0,$.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm text-fg-muted`,children:[r?`尚待完成:`:`Remaining work: `,h.remainingWork.join(`
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,f as a,g as o}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./external-link-DjqjBmc3.js";import{M as l}from"./markdown-view-B58RypQ4.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./messages-DBvKzlCl.js";import{t as p}from"./cn-0WouolD0.js";import{n as m}from"./locale-store-Jnhw2WMv.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{s as S}from"./tasks-PuIUgF9L.js";import{$c as C,An as w,Ao as T,Bu as E,Ds as D,Es as O,Go as k,Kc as A,Kl as ee,Mn as j,Ni as M,Nn as N,Rc as P,Ts as F,Ui as I,Us as te,Wc as L,Wi as ne,Yc as R,Yd as z,al as B,ao as V,cf as H,cu as U,el as W,eu as G,ff as K,gd as re,il as ie,jn as ae,ll as oe,ml as se,oa as ce,ol as q,qc as le,r as ue,rl as de,sf as fe,sl as pe,ta as me,tl as he,uf as J,ws as Y,wu as ge}from"./index-fDaRYOv1.js";import{n as X}from"./tab-completion-input-CxtEp0aP.js";import{n as _e,t as ve}from"./task-expandable-content-HdEeV_0-.js";var Z=n(),Q=e(t(),1);function ye(e,t){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(0),l=(0,Q.useCallback)(async()=>{let t=++c.current;s(null);try{let n=await C(e);t===c.current&&r(n)}catch(e){t===c.current&&s(e instanceof Error?e.message:String(e))}finally{t===c.current&&a(!1)}},[e]);return(0,Q.useEffect)(()=>(l(),()=>{c.current++}),[l,t]),(0,Q.useEffect)(()=>{let e,t=1/0,n=n=>{let r=Date.now()+n;r>=t||(window.clearTimeout(e),t=r,e=window.setTimeout(()=>{e=void 0,t=1/0,l()},n))},r=()=>n(100),i=()=>n(750),a=()=>{document.visibilityState===`visible`&&r()},o=[`task-changed-v2`,`task-updated`,`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`,`home-advisor-updated`,`gateway-realtime-connected`,`realtime-gap`,`focus`],s=[`session-updated`,`session-transcript-updated`];return o.forEach(e=>window.addEventListener(e,r)),s.forEach(e=>window.addEventListener(e,i)),document.addEventListener(`visibilitychange`,a),()=>{o.forEach(e=>window.removeEventListener(e,r)),s.forEach(e=>window.removeEventListener(e,i)),document.removeEventListener(`visibilitychange`,a),window.clearTimeout(e)}},[l]),{home:n,loading:i,loadError:o,setLoadError:s,load:l}}var $=r(),be=12e3;function xe(e){let t=(0,Z.c)(107),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,attachmentsFull:u,voice:d,chat:f,cancelAction:m,onIntentChange:h,onPickFiles:g,onRemoveAttachment:_,onPaste:v,onDragOver:y,onDragLeave:b,onDrop:x,onSubmit:S}=e,C=n===`inline`,w;t[0]!==s||t[1]!==a?(w=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=w):w=t[2];let T=w,E=d.voiceActive&&d.phase!==`error`,D;t[3]!==S||t[4]!==d.voiceActive?(D=e=>{if(d.voiceActive){e.preventDefault();return}S(e)},t[3]=S,t[4]=d.voiceActive,t[5]=D):D=t[5];let O=C?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,k;t[6]===O?k=t[7]:(k=p(`relative`,O),t[6]=O,t[7]=k);let A;t[8]!==C||t[9]!==c||t[10]!==o.dropFiles?(A=c?(0,$.jsx)(`div`,{className:p(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,C&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=C,t[9]=c,t[10]=o.dropFiles,t[11]=A):A=t[11];let M=!C&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,N;t[12]===M?N=t[13]:(N=p(M),t[12]=M,t[13]=N);let P=C?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,F;t[14]!==r||t[15]!==o.intentLabel||t[16]!==P?(F=(0,$.jsx)(`label`,{htmlFor:r,className:P,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=P,t[17]=F):F=t[17];let I;t[18]!==l||t[19]!==f||t[20]!==d.audioLevel||t[21]!==d.cancelVoiceInput||t[22]!==d.confirmVoiceInput||t[23]!==d.elapsedLabel||t[24]!==d.error||t[25]!==d.finalTranscript||t[26]!==d.partialTranscript||t[27]!==d.phase||t[28]!==d.recordedDictation||t[29]!==d.retryVoiceInput||t[30]!==d.settingsRequired||t[31]!==d.voiceActive?(I=d.voiceActive?(0,$.jsx)(j,{phase:d.phase,elapsedLabel:d.elapsedLabel,recordedDictation:d.recordedDictation,audioLevel:d.audioLevel,partialTranscript:d.partialTranscript,finalTranscript:d.finalTranscript,error:d.error,settingsRequired:d.settingsRequired,disabled:l,chat:f,onCancel:d.cancelVoiceInput,onConfirm:d.confirmVoiceInput,onRetry:d.retryVoiceInput}):null,t[18]=l,t[19]=f,t[20]=d.audioLevel,t[21]=d.cancelVoiceInput,t[22]=d.confirmVoiceInput,t[23]=d.elapsedLabel,t[24]=d.error,t[25]=d.finalTranscript,t[26]=d.partialTranscript,t[27]=d.phase,t[28]=d.recordedDictation,t[29]=d.retryVoiceInput,t[30]=d.settingsRequired,t[31]=d.voiceActive,t[32]=I):I=t[32];let te=E&&`hidden`,R=C?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,z;t[33]!==te||t[34]!==R?(z=p(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,te,R),t[33]=te,t[34]=R,t[35]=z):z=t[35];let B;t[36]===h?B=t[37]:(B=e=>h(e.target.value),t[36]=h,t[37]=B);let V=!C,H;t[38]!==r||t[39]!==i||t[40]!==a||t[41]!==o.intentPlaceholder||t[42]!==o.intentSuggestion||t[43]!==h||t[44]!==v||t[45]!==z||t[46]!==B||t[47]!==V?(H=(0,$.jsx)(X,{ref:i,id:r,className:z,value:a,onChange:B,onPaste:v,suggestion:o.intentSuggestion,onAcceptSuggestion:h,onKeyDown:Se,placeholder:o.intentPlaceholder,maxLength:be,autoFocus:V}),t[38]=r,t[39]=i,t[40]=a,t[41]=o.intentPlaceholder,t[42]=o.intentSuggestion,t[43]=h,t[44]=v,t[45]=z,t[46]=B,t[47]=V,t[48]=H):H=t[48];let U=C?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,W;t[49]!==s||t[50]!==_||t[51]!==U?(W=(0,$.jsx)(me,{attachments:s,topPadded:!1,onRemove:_,className:U}),t[49]=s,t[50]=_,t[51]=U,t[52]=W):W=t[52];let G;t[53]!==C||t[54]!==a.length||t[55]!==o.shortcut?(G=C?null:(0,$.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:o.shortcut}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,be.toLocaleString()]})]}),t[53]=C,t[54]=a.length,t[55]=o.shortcut,t[56]=G):G=t[56];let K;t[57]!==I||t[58]!==H||t[59]!==W||t[60]!==G||t[61]!==N||t[62]!==F?(K=(0,$.jsxs)(`div`,{className:N,children:[F,I,H,W,G]}),t[57]=I,t[58]=H,t[59]=W,t[60]=G,t[61]=N,t[62]=F,t[63]=K):K=t[63];let re=C?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,ie;t[64]===re?ie=t[65]:(ie=p(`flex shrink-0 items-center gap-2 border-t`,re),t[64]=re,t[65]=ie);let ae=!C&&`mr-auto`,oe;t[66]===ae?oe=t[67]:(oe=p(`flex items-center gap-1`,ae),t[66]=ae,t[67]=oe);let se=l||u,ce;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(ge,{className:`size-4`,"aria-hidden":!0}),t[68]=ce):ce=t[68];let q;t[69]!==o.attachTitle||t[70]!==g||t[71]!==se?(q=(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:se,title:o.attachTitle,"aria-label":o.attachTitle,onClick:g,children:ce}),t[69]=o.attachTitle,t[70]=g,t[71]=se,t[72]=q):q=t[72];let le;t[73]!==l||t[74]!==f||t[75]!==d.startVoiceInput||t[76]!==d.voiceActive?(le=d.voiceActive?null:(0,$.jsx)(ne,{disabled:l,chat:f,onStart:d.startVoiceInput}),t[73]=l,t[74]=f,t[75]=d.startVoiceInput,t[76]=d.voiceActive,t[77]=le):le=t[77];let ue;t[78]!==oe||t[79]!==q||t[80]!==le?(ue=(0,$.jsxs)(`div`,{className:oe,children:[q,le]}),t[78]=oe,t[79]=q,t[80]=le,t[81]=ue):ue=t[81];let de;t[82]!==m||t[83]!==C||t[84]!==o.shortcut?(de=C?(0,$.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):m,t[82]=m,t[83]=C,t[84]=o.shortcut,t[85]=de):de=t[85];let fe=C?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,pe=!T||l||d.voiceActive,he=C?`size-3.5`:`size-4`,J;t[86]===he?J=t[87]:(J=(0,$.jsx)(ee,{className:he,"aria-hidden":!0}),t[86]=he,t[87]=J);let Y;t[88]!==o.submit||t[89]!==fe||t[90]!==pe||t[91]!==J?(Y=(0,$.jsxs)(L,{type:`submit`,variant:`primary`,className:fe,disabled:pe,children:[J,o.submit]}),t[88]=o.submit,t[89]=fe,t[90]=pe,t[91]=J,t[92]=Y):Y=t[92];let _e;t[93]!==ie||t[94]!==ue||t[95]!==de||t[96]!==Y?(_e=(0,$.jsxs)(`div`,{className:ie,children:[ue,de,Y]}),t[93]=ie,t[94]=ue,t[95]=de,t[96]=Y,t[97]=_e):_e=t[97];let ve;return t[98]!==b||t[99]!==y||t[100]!==x||t[101]!==D||t[102]!==K||t[103]!==_e||t[104]!==k||t[105]!==A?(ve=(0,$.jsxs)(`form`,{onSubmit:D,onDragOver:y,onDragLeave:b,onDrop:x,className:k,children:[A,K,_e]}),t[98]=b,t[99]=y,t[100]=x,t[101]=D,t[102]=K,t[103]=_e,t[104]=k,t[105]=A,t[106]=ve):ve=t[106],ve}function Se(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function Ce(e){let t=(0,Z.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(re,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function we(e){let t=(0,Z.c)(65),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,c,l,u;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.why||t[7]!==i||t[8]!==n.capabilities||t[9]!==n.continuation||t[10]!==n.estimatedMinutes||t[11]!==n.outcome||t[12]!==n.rationale||t[13]!==n.title){let e=n.capabilities.filter(Ee),d;t[20]===r.aiLabel?d=t[21]:(d=(0,$.jsx)(`span`,{children:r.aiLabel}),t[20]=r.aiLabel,t[21]=d);let f;t[22]!==r.minutes||t[23]!==n.estimatedMinutes?(f=n.estimatedMinutes?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[22]=r.minutes,t[23]=n.estimatedMinutes,t[24]=f):f=t[24];let p;t[25]!==d||t[26]!==f?(p=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[d,f]}),t[25]=d,t[26]=f,t[27]=p):p=t[27];let m;t[28]!==r.history||t[29]!==i?(m=(0,$.jsx)(Ce,{label:r.history,onClick:i}),t[28]=r.history,t[29]=i,t[30]=m):m=t[30],t[31]!==m||t[32]!==p?(a=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[p,m]}),t[31]=m,t[32]=p,t[33]=a):a=t[33],t[34]===n.title?o=t[35]:(o=(0,$.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[34]=n.title,t[35]=o),t[36]===n.outcome?s=t[37]:(s=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[36]=n.outcome,t[37]=s);let h;t[38]===r.why?h=t[39]:(h=(0,$.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[38]=r.why,t[39]=h),t[40]!==n.rationale||t[41]!==h?(c=(0,$.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[h,n.rationale]}),t[40]=n.rationale,t[41]=h,t[42]=c):c=t[42],t[43]!==r.automationAction||t[44]!==r.automationHint||t[45]!==n.continuation?(l=n.continuation?.kind===`automation`?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:r.automationHint}),(0,$.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.automationAction})]}):null,t[43]=r.automationAction,t[44]=r.automationHint,t[45]=n.continuation,t[46]=l):l=t[46],u=e.length>0?(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,$.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.why,t[7]=i,t[8]=n.capabilities,t[9]=n.continuation,t[10]=n.estimatedMinutes,t[11]=n.outcome,t[12]=n.rationale,t[13]=n.title,t[14]=a,t[15]=o,t[16]=s,t[17]=c,t[18]=l,t[19]=u}else a=t[14],o=t[15],s=t[16],c=t[17],l=t[18],u=t[19];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(J,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[47]=d):d=t[47];let f;t[48]===r.evidence?f=t[49]:(f=(0,$.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,d]}),t[48]=r.evidence,t[49]=f);let p;t[50]===n.evidence?p=t[51]:(p=n.evidence.map(Te),t[50]=n.evidence,t[51]=p);let m;t[52]===p?m=t[53]:(m=(0,$.jsx)(`ul`,{className:`mt-2 space-y-2 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:p}),t[52]=p,t[53]=m);let h;t[54]!==m||t[55]!==f?(h=(0,$.jsxs)(`details`,{className:`mt-4 group`,children:[f,m]}),t[54]=m,t[55]=f,t[56]=h):h=t[56];let g;return t[57]!==a||t[58]!==h||t[59]!==o||t[60]!==s||t[61]!==c||t[62]!==l||t[63]!==u?(g=(0,$.jsxs)($.Fragment,{children:[a,o,s,c,l,u,h]}),t[57]=a,t[58]=h,t[59]=o,t[60]=s,t[61]=c,t[62]=l,t[63]=u,t[64]=g):g=t[64],g}function Te(e){return(0,$.jsx)(`li`,{children:e.href?(0,$.jsx)(`a`,{href:`#${e.href}`,className:`hover:text-accent hover:underline`,children:e.observation}):e.observation},e.id)}function Ee(e){return e.readiness!==`ready`}function De(e){let t=(0,Z.c)(130),{advisor:n,copy:r,busy:i,onRefresh:a,onAction:o,onFeedback:c,onClarification:l,onOpenHistory:u,preflight:d,receipt:f}=e,[p,m]=(0,Q.useState)(),h;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(h=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=h):h=t[3];let g=h,_;t[4]!==g||t[5]!==p?(_=g.find(e=>e.id===p)??g[0],t[4]=g,t[5]=p,t[6]=_):_=t[6];let v=_,y;t[7]===g[0]?.id?y=t[8]:(y=()=>m(g[0]?.id),t[7]=g[0]?.id,t[8]=y);let b=g[0]?.id,x;if(t[9]!==n.state||t[10]!==b?(x=[n.state,b],t[9]=n.state,t[10]=b,t[11]=x):x=t[11],(0,Q.useEffect)(y,x),n.state===`disabled`)return null;if(f){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(s,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===f.title?n=t[14]:(n=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:f.title}),t[13]=f.title,t[14]=n);let i;t[15]===f.detail?i=t[16]:(i=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.detail}),t[15]=f.detail,t[16]=i);let a;t[17]!==n||t[18]!==i?(a=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=a):a=t[19];let o;t[20]!==r.history||t[21]!==u?(o=(0,$.jsx)(Ce,{label:r.history,onClick:u}),t[20]=r.history,t[21]=u,t[22]=o):o=t[22];let c=`#${f.href}`,l;t[23]!==r.viewProgress||t[24]!==c?(l=(0,$.jsx)(L,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,$.jsx)(`a`,{href:c,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=c,t[25]=l):l=t[25];let d;t[26]!==o||t[27]!==l?(d=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[o,l]}),t[26]=o,t[27]=l,t[28]=d):d=t[28];let p;return t[29]!==d||t[30]!==a?(p=(0,$.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,a,d]})}),t[29]=d,t[30]=a,t[31]=p):p=t[31],p}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let i;t[33]===r.aiLabel?i=t[34]:(i=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=i);let a;t[35]!==r.history||t[36]!==u?(a=(0,$.jsx)(Ce,{label:r.history,onClick:u}),t[35]=r.history,t[36]=u,t[37]=a):a=t[37];let o;t[38]!==i||t[39]!==a?(o=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,a]}),t[38]=i,t[39]=a,t[40]=o):o=t[40];let s;t[41]===n.question.question?s=t[42]:(s=(0,$.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=s);let c;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==l){let e;t[47]!==n.question.question||t[48]!==l?(e=e=>(0,$.jsx)(L,{type:`button`,variant:`secondary`,className:`min-h-11`,onClick:()=>l(n.question.question,e.label),children:e.label},e.id),t[47]=n.question.question,t[48]=l,t[49]=e):e=t[49],c=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=l,t[46]=c}else c=t[46];let d;t[50]===c?d=t[51]:(d=(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:c}),t[50]=c,t[51]=d);let f;return t[52]!==s||t[53]!==d||t[54]!==o?(f=(0,$.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[o,s,d]}),t[52]=s,t[53]=d,t[54]=o,t[55]=f):f=t[55],f}if(!v)return null;let S=d?.opportunityId===v.id?d.value:void 0,C;t[56]!==n.stale||t[57]!==r.refreshing?(C=n.stale?(0,$.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,$.jsx)(U,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[56]=n.stale,t[57]=r.refreshing,t[58]=C):C=t[58];let w;t[59]!==r||t[60]!==u||t[61]!==v?(w=(0,$.jsx)(we,{opportunity:v,copy:r,onOpenHistory:u}),t[59]=r,t[60]=u,t[61]=v,t[62]=w):w=t[62];let T;t[63]!==i||t[64]!==r.configure||t[65]!==r.degradedStart||t[66]!==r.setupHint||t[67]!==r.setupTitle||t[68]!==o||t[69]!==v||t[70]!==S?(T=S?.state===`needs_setup`?(0,$.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsx)(G,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:S.blockers.map(Oe)}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[S.recoveryActions.map(e=>(0,$.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),S.degradedAction?(0,$.jsx)(L,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(v,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[63]=i,t[64]=r.configure,t[65]=r.degradedStart,t[66]=r.setupHint,t[67]=r.setupTitle,t[68]=o,t[69]=v,t[70]=S,t[71]=T):T=t[71];let D;t[72]!==i||t[73]!==r.start||t[74]!==o||t[75]!==v?(D=v.actions.canStart?(0,$.jsxs)(L,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>o(v,`start`),children:[(0,$.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[72]=i,t[73]=r.start,t[74]=o,t[75]=v,t[76]=D):D=t[76];let O;t[77]!==i||t[78]!==r.discuss||t[79]!==o||t[80]!==v?(O=v.actions.canDiscuss?(0,$.jsxs)(L,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(v,`discuss`),children:[(0,$.jsx)(E,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[77]=i,t[78]=r.discuss,t[79]=o,t[80]=v,t[81]=O):O=t[81];let k;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(U,{className:`size-4`,"aria-hidden":!0}),t[82]=k):k=t[82];let A;t[83]!==i||t[84]!==r.refresh||t[85]!==a?(A=(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:a,title:r.refresh,children:[k,r.refresh]}),t[83]=i,t[84]=r.refresh,t[85]=a,t[86]=A):A=t[86];let j;t[87]===r.feedback?j=t[88]:(j=(0,$.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[87]=r.feedback,t[88]=j);let M;t[89]===r.alreadyDone?M=t[90]:(M=[`already_done`,r.alreadyDone],t[89]=r.alreadyDone,t[90]=M);let N;t[91]===r.irrelevant?N=t[92]:(N=[`irrelevant`,r.irrelevant],t[91]=r.irrelevant,t[92]=N);let P;t[93]===r.later?P=t[94]:(P=[`too_early`,r.later],t[93]=r.later,t[94]=P);let F;t[95]===r.sourceIncorrect?F=t[96]:(F=[`source_incorrect`,r.sourceIncorrect],t[95]=r.sourceIncorrect,t[96]=F);let I;t[97]===r.lessLikeThis?I=t[98]:(I=[`less_like_this`,r.lessLikeThis],t[97]=r.lessLikeThis,t[98]=I);let te;t[99]!==M||t[100]!==N||t[101]!==P||t[102]!==F||t[103]!==I?(te=[M,N,P,F,I],t[99]=M,t[100]=N,t[101]=P,t[102]=F,t[103]=I,t[104]=te):te=t[104];let ne=te,R;t[105]!==c||t[106]!==v||t[107]!==ne?(R=(0,$.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:ne.map(e=>{let[t,n]=e;return(0,$.jsx)(`button`,{type:`button`,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>c(v,t),children:n},t)})}),t[105]=c,t[106]=v,t[107]=ne,t[108]=R):R=t[108];let z;t[109]!==j||t[110]!==R?(z=(0,$.jsxs)(`details`,{className:`relative ml-auto`,children:[j,R]}),t[109]=j,t[110]=R,t[111]=z):z=t[111];let B;t[112]!==O||t[113]!==A||t[114]!==z||t[115]!==D?(B=(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[D,O,A,z]}),t[112]=O,t[113]=A,t[114]=z,t[115]=D,t[116]=B):B=t[116];let V;t[117]!==B||t[118]!==C||t[119]!==w||t[120]!==T?(V=(0,$.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[C,w,T,B]}),t[117]=B,t[118]=C,t[119]=w,t[120]=T,t[121]=V):V=t[121];let H;t[122]!==r.alternatives||t[123]!==g||t[124]!==v.id?(H=g.length>1?(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:g.filter(e=>e.id!==v.id).map(e=>(0,$.jsx)(`button`,{type:`button`,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>m(e.id),children:e.title},e.id))})]}):null,t[122]=r.alternatives,t[123]=g,t[124]=v.id,t[125]=H):H=t[125];let W;return t[126]!==r.aiLabel||t[127]!==V||t[128]!==H?(W=(0,$.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:[V,H]}),t[126]=r.aiLabel,t[127]=V,t[128]=H,t[129]=W):W=t[129],W}function Oe(e){return(0,$.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}var ke=new Set([`started`,`discussing`,`completed`]);function Ae(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(je)}),e[0]=t):t=e[0],t}function je(e){return(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,$.jsx)(P,{className:`h-4 w-24 rounded`}),(0,$.jsx)(P,{className:`h-5 w-4/5 rounded`}),(0,$.jsx)(P,{className:`h-4 w-3/5 rounded`})]},e)}function Me(e){let t=(0,Z.c)(11),{open:n,refreshKey:r,onOpenChange:i,onReevaluate:o}=e,s=m(Pe),u=f(s).projectsPage.home,p=a(),[S,C]=(0,Q.useState)(`all`),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],t[0]=w):w=t[0];let[E,D]=(0,Q.useState)(w),[O,k]=(0,Q.useState)(!1),[A,ee]=(0,Q.useState)(),j;t[1]===n?j=t[2]:(j=()=>{if(!n)return;let e=!0;return k(!0),ee(void 0),W().then(t=>{e&&D(t.items)}).catch(t=>{e&&ee(t instanceof Error?t.message:String(t))}).finally(()=>{e&&k(!1)}),()=>{e=!1}},t[1]=n,t[2]=j);let M;t[3]!==n||t[4]!==r?(M=[n,r],t[3]=n,t[4]=r,t[5]=M):M=t[5],(0,Q.useEffect)(j,M);let N=E.filter(e=>S===`all`||(S===`adopted`?ke.has(e.status):!ke.has(e.status))),P=new Intl.DateTimeFormat(s===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),F=new Intl.DateTimeFormat(s===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),I=new Map;for(let e of N){let t=P.format(new Date(e.updatedAt));I.set(t,[...I.get(t)??[],e])}let te=[...I.entries()],ne=e=>e.feedbackKind===`already_done`?u.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?u.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?u.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?u.advisorHistoryStatusLessLikeThis:{available:u.advisorHistoryStatusAvailable,started:u.advisorHistoryStatusStarted,discussing:u.advisorHistoryStatusDiscussing,completed:u.advisorHistoryStatusCompleted,snoozed:u.advisorHistoryStatusSnoozed,dismissed:u.advisorHistoryStatusDismissed,expired:u.advisorHistoryStatusExpired,superseded:u.advisorHistoryStatusSuperseded}[e.status],R=e=>{if(e.href){i(!1),p(l(`/`,e.href));return}e.status===`discussing`&&(i(!1),p(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},B;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=B):B=t[6];let V;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(re,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=V):V=t[7];let H;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),t[8]=H):H=t[8];let G=O?(0,$.jsx)(Ae,{}):A?(0,$.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,$.jsx)(`p`,{children:u.advisorHistoryLoadFailed}),(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>i(!1),children:u.advisorHistoryClose})]}):te.length===0?(0,$.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,$.jsx)(re,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:u.advisorHistoryEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.advisorHistoryEmptyHint})]}):(0,$.jsx)(`div`,{className:`space-y-6`,children:te.map(e=>{let[t,n]=e;return(0,$.jsxs)(`section`,{"aria-label":t,children:[(0,$.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,$.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:ne(e)}),(0,$.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,$.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:F.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,$.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,$.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),u.advisorHistoryReturnsAt,` `,F.format(new Date(e.snoozedUntil))]}):null,(0,$.jsxs)(`details`,{className:`group mt-3`,children:[(0,$.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[u.advisorHistoryEvidence,(0,$.jsx)(J,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1.5 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:e.opportunity.evidence.map(Ne)})]}),t||n?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,$.jsxs)(L,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>R(e),children:[(0,$.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?u.advisorHistoryContinueDiscussion:u.advisorHistoryViewProgress]}):null,n?(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{i(!1),o()},children:[(0,$.jsx)(U,{className:`size-3.5`,"aria-hidden":!0}),u.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),K;return t[9]===G?K=t[10]:(K=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:G}),t[9]=G,t[10]=K),(0,$.jsx)(x,{open:n,onOpenChange:i,children:(0,$.jsxs)(v,{children:[B,(0,$.jsxs)(y,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[V,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(b,{className:`text-base font-semibold text-fg`,children:u.advisorHistoryTitle}),(0,$.jsx)(g,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.advisorHistoryDescription})]}),(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":u.advisorHistoryClose,children:H})})]}),(0,$.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,$.jsx)(T,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":u.advisorHistoryFilterLabel,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`all`,u.advisorHistoryFilterAll],[`adopted`,u.advisorHistoryFilterAdopted],[`other`,u.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,$.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${S===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":S===t,onClick:()=>C(t),children:n},t)})})}),K]})]})})}function Ne(e){return(0,$.jsx)(`li`,{children:e.observation},e.id)}function Pe(e){return e.language}function Fe(e,t){return e.replace(`{{count}}`,String(t))}function Ie(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Fe(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var Le={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function Re(e){let t=(0,Z.c)(50),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,Q.useState)(!1),l;t[0]!==n||t[1]!==i?(l=Ie(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let u=l;if(!u)return null;let d=n.state!==`refreshing`,f=n.state===`ready`?i.findAnother:i.retry,m=`${i.label}:${u.label}`,h;t[3]===u.refreshing?h=t[4]:(h=u.refreshing?(0,$.jsx)(U,{className:`size-3.5 shrink-0 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,$.jsx)(ee,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[3]=u.refreshing,t[4]=h);let g=Le[u.tone],_;t[5]===g?_=t[6]:(_=p(`size-1.5 shrink-0 rounded-full`,g),t[5]=g,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,$.jsx)(`span`,{className:_,"aria-hidden":!0}),t[7]=_,t[8]=v);let y;t[9]!==i.label||t[10]!==u.label?(y=(0,$.jsxs)(`span`,{className:`truncate`,children:[i.label,` · `,u.label]}),t[9]=i.label,t[10]=u.label,t[11]=y):y=t[11];let b;t[12]!==m||t[13]!==h||t[14]!==v||t[15]!==y?(b=(0,$.jsx)(D,{asChild:!0,children:(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`h-9 max-w-56 rounded-lg px-2.5`,"aria-label":m,children:[h,v,y]})}),t[12]=m,t[13]=h,t[14]=v,t[15]=y,t[16]=b):b=t[16];let x;t[17]===u.refreshing?x=t[18]:(x=(0,$.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:u.refreshing?(0,$.jsx)(U,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,$.jsx)(ee,{className:`size-4`,"aria-hidden":!0})}),t[17]=u.refreshing,t[18]=x);let S;t[19]===u.label?S=t[20]:(S=(0,$.jsx)(`p`,{className:`font-semibold text-fg`,children:u.label}),t[19]=u.label,t[20]=S);let C;t[21]===u.detail?C=t[22]:(C=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.detail}),t[21]=u.detail,t[22]=C);let w;t[23]!==S||t[24]!==C?(w=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]}),t[23]=S,t[24]=C,t[25]=w):w=t[25];let T;t[26]!==w||t[27]!==x?(T=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[x,w]}),t[26]=w,t[27]=x,t[28]=T):T=t[28];let E;t[29]===a?E=t[30]:(E=()=>{c(!1),a()},t[29]=a,t[30]=E);let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(re,{className:`size-3.5`,"aria-hidden":!0}),t[31]=k):k=t[31];let A;t[32]!==i.history||t[33]!==E?(A=(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:E,children:[k,i.history]}),t[32]=i.history,t[33]=E,t[34]=A):A=t[34];let j;t[35]!==r||t[36]!==d||t[37]!==o||t[38]!==f?(j=d?(0,$.jsxs)(L,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,$.jsx)(U,{className:`size-3.5`,"aria-hidden":!0}),f]}):null,t[35]=r,t[36]=d,t[37]=o,t[38]=f,t[39]=j):j=t[39];let M;t[40]!==A||t[41]!==j?(M=(0,$.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[A,j]}),t[40]=A,t[41]=j,t[42]=M):M=t[42];let N;t[43]!==T||t[44]!==M?(N=(0,$.jsx)(F,{children:(0,$.jsxs)(Y,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-overlay p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:ze,children:[T,M]})}),t[43]=T,t[44]=M,t[45]=N):N=t[45];let P;return t[46]!==s||t[47]!==N||t[48]!==b?(P=(0,$.jsxs)(O,{open:s,onOpenChange:c,children:[b,N]}),t[46]=s,t[47]=N,t[48]=b,t[49]=P):P=t[49],P}function ze(e){return e.preventDefault()}function Be({taskId:e,language:t,onComplete:n}){let r=t===`zh`,[i,a]=(0,Q.useState)(),[o,s]=(0,Q.useState)(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let t=!0;return s(void 0),a(void 0),he(e).then(e=>{t&&a(e)}).catch(e=>{t&&s(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[e,u]);let f=i?_e(i):[],p=i?.task.phase===`review`&&i.allowedCommands.includes(`close`)&&i.waits.length===0&&f.length>0&&f.every(e=>e.status===`passed`);async function m(e,t=!1){if(!c){l(!0),s(void 0);try{a(await e()),t&&n()}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}let h=i?.receipts[0];return(0,$.jsxs)(`section`,{className:`mt-4 space-y-4 rounded-xl border border-edge bg-surface-panel p-4`,"aria-label":r?`任务验收`:`Task review`,children:[o?(0,$.jsxs)(`div`,{role:`alert`,className:`flex items-center justify-between gap-3 text-sm text-danger`,children:[(0,$.jsx)(`span`,{children:o}),(0,$.jsx)(L,{variant:`ghost`,disabled:c,onClick:()=>d(e=>e+1),children:r?`刷新`:`Refresh`})]}):null,!i&&!o?(0,$.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,$.jsx)(P,{className:`h-5 w-1/3`}),(0,$.jsx)(P,{className:`h-24 w-full`})]}):null,i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r?`执行结果`:`Result`}),h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ve,{content:h.summary,contentKey:`home:${e}:result`,language:t,previewHeight:180}),h.remainingWork.length>0?(0,$.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm text-fg-muted`,children:[r?`尚待完成:`:`Remaining work: `,h.remainingWork.join(`
2
2
  `)]}):null,h.evidence.map((e,t)=>(0,$.jsxs)(`div`,{className:`text-sm text-fg-muted`,children:[e.uri&&/^https?:\/\//.test(e.uri)?(0,$.jsx)(`a`,{href:e.uri,target:`_blank`,rel:`noreferrer`,className:`text-accent-fg hover:underline`,children:e.title}):(0,$.jsx)(`span`,{children:e.title}),e.summary?(0,$.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words`,children:e.summary}):null]},t))]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r?`暂无执行结果,请查看任务详情。`:`No result yet. View the task details.`}),(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r?`验收条件`:`Acceptance criteria`}),f.map((t,n)=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2 border-t border-edge-subtle pt-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 text-sm text-fg`,children:[(0,$.jsx)(`p`,{className:`break-words`,children:t.text}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r?{passed:`已通过`,failed:`未通过`,unverified:`待判定`}[t.status]:{passed:`Passed`,failed:`Failed`,unverified:`Not reviewed`}[t.status]})]}),i.task.phase!==`closed`&&i.task.contract?.acceptancePolicy!==`verified_auto`?(0,$.jsx)(`div`,{className:`flex gap-2`,children:[`passed`,`failed`].map(a=>(0,$.jsx)(L,{variant:`secondary`,disabled:c||t.status===a,onClick:()=>void m(()=>q(e,n,a,i.task.version,i.task.latestContractVersion)),children:r?a===`passed`?`确认通过`:`未通过`:a===`passed`?`Mark passed`:`Mark failed`},a))}):null]},n)),p?null:(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r?`所有验收条件通过且任务无等待事项后,可完成验收。`:`Accept once all criteria pass and the task has no pending waits.`}),(0,$.jsx)(L,{variant:`primary`,disabled:c||!p,onClick:()=>void m(()=>R(e,{type:`close`,resolution:`done`},i.task.version),!0),children:r?`验收完成`:`Accept task`})]}):null]})}async function Ve(e,t=`en`){let n=await he(e),r=n.runs.filter(e=>!e.parentRunId).sort((e,t)=>t.queuedAt-e.queuedAt)[0];if(!n.allowedCommands.includes(`start`)||r?.status!==`failed`)throw Error(t===`zh`?`任务状态已变化,暂时无法重试。请刷新并查看当前状态。`:`Task is no longer available for retry. Refresh and review its current state.`);await R(e,{type:`start`,executor:S.parse({...r.executorRef,kind:r.executorKind})},n.task.version)}function He(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Ue(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(P,{className:`h-10 w-3/5 rounded-xl`}),(0,$.jsx)(P,{className:`h-5 w-4/5 rounded-lg`})]}),(0,$.jsx)(P,{className:`h-64 rounded-2xl`}),(0,$.jsx)(P,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function We(e){let t=(0,Z.c)(50),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:s,locale:c,onAction:l,onComplete:u}=e,[d,f]=o(),p=n.primaryAction?.type===`task_review`?n.primaryAction:void 0,m;t[0]!==p||t[1]!==d?(m=p&&d.get(`reviewTask`)===p.taskId,t[0]=p,t[1]=d,t[2]=m):m=t[2];let h=!!m,g;t[3]!==p||t[4]!==d||t[5]!==f?(g=e=>{let t=new URLSearchParams(d);e&&p?t.set(`reviewTask`,p.taskId):t.delete(`reviewTask`),f(t)},t[3]=p,t[4]=d,t[5]=f,t[6]=g):g=t[6];let _=g,v;t[7]!==a||t[8]!==n.dueAt||t[9]!==c?(v=n.dueAt?`${a} ${M(new Date(n.dueAt),c)}`:null,t[7]=a,t[8]=n.dueAt,t[9]=c,t[10]=v):v=t[10];let y=v,b=n.kind===`failure`?s:y,x;t[11]===b?x=t[12]:(x=b?(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:b})]}):null,t[11]=b,t[12]=x);let S=!n.openAction,C;t[13]!==n.id||t[14]!==n.openAction||t[15]!==l?(C=()=>n.openAction&&l(n.openAction,n.id),t[13]=n.id,t[14]=n.openAction,t[15]=l,t[16]=C):C=t[16];let w;t[17]===n.title?w=t[18]:(w=(0,$.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[17]=n.title,t[18]=w);let T;t[19]===n.summary?T=t[20]:(T=(0,$.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[19]=n.summary,t[20]=T);let E;t[21]!==S||t[22]!==C||t[23]!==w||t[24]!==T?(E=(0,$.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:S,onClick:C,children:[w,T]}),t[21]=S,t[22]=C,t[23]=w,t[24]=T,t[25]=E):E=t[25];let D;t[26]!==n.recommendation||t[27]!==i?(D=n.recommendation?(0,$.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,$.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[26]=n.recommendation,t[27]=i,t[28]=D):D=t[28];let O;t[29]!==r||t[30]!==n.id||t[31]!==n.primaryAction||t[32]!==n.secondaryActions||t[33]!==l||t[34]!==p||t[35]!==h||t[36]!==_?(O=n.primaryAction||n.secondaryActions.length>0?(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,$.jsx)(L,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,"aria-expanded":p?h:void 0,onClick:()=>p?_(!h):l(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,$.jsx)(L,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>l(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[29]=r,t[30]=n.id,t[31]=n.primaryAction,t[32]=n.secondaryActions,t[33]=l,t[34]=p,t[35]=h,t[36]=_,t[37]=O):O=t[37];let k;t[38]!==c||t[39]!==u||t[40]!==p||t[41]!==h||t[42]!==_?(k=h&&p?(0,$.jsx)(Be,{taskId:p.taskId,language:c,onComplete:()=>{_(!1),u()}}):null,t[38]=c,t[39]=u,t[40]=p,t[41]=h,t[42]=_,t[43]=k):k=t[43];let A;return t[44]!==D||t[45]!==O||t[46]!==k||t[47]!==x||t[48]!==E?(A=(0,$.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,children:[x,E,D,O,k]}),t[44]=D,t[45]=O,t[46]=k,t[47]=x,t[48]=E,t[49]=A):A=t[49],A}function Ge(e){let t=(0,Z.c)(26),{item:n,onAction:r}=e,i;t[0]===n.kind?i=t[1]:(i=n.kind===`scheduled`?(0,$.jsx)(K,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`,"aria-hidden":!0}),t[0]=n.kind,t[1]=i);let a=i,o=!n.openAction,s;t[2]!==n.id||t[3]!==n.openAction||t[4]!==r?(s=()=>n.openAction&&r(n.openAction,n.id),t[2]=n.id,t[3]=n.openAction,t[4]=r,t[5]=s):s=t[5];let c;t[6]===a?c=t[7]:(c=(0,$.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:a}),t[6]=a,t[7]=c);let l;t[8]===n.title?l=t[9]:(l=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[8]=n.title,t[9]=l);let u;t[10]===n.summary?u=t[11]:(u=(0,$.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[10]=n.summary,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;t[15]===n.statusLabel?f=t[16]:(f=n.statusLabel?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[15]=n.statusLabel,t[16]=f);let p;t[17]===n.openAction?p=t[18]:(p=n.openAction?(0,$.jsx)(H,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[17]=n.openAction,t[18]=p);let m;return t[19]!==o||t[20]!==s||t[21]!==c||t[22]!==d||t[23]!==f||t[24]!==p?(m=(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:o,onClick:s,children:[c,d,f,p]}),t[19]=o,t[20]=s,t[21]=c,t[22]=d,t[23]=f,t[24]=p,t[25]=m):m=t[25],m}function Ke(){let e=m(e=>e.language),t=f(e),n=t.projectsPage,r=se(e),o=a(),s=i(),c=k(e=>e.setPageHeader),p=k(e=>e.clearPageHeader),{home:S,loading:C,loadError:T,setLoadError:E,load:D}=ye(e,s.key),[O,ee]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(``),P=(0,Q.useRef)(!1),[F,ne]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),[H,U]=(0,Q.useState)(),[W,G]=(0,Q.useState)(!1),[K,re]=(0,Q.useState)(0),[q,me]=(0,Q.useState)(),[he,J]=(0,Q.useState)(),[Y,ge]=(0,Q.useState)(!1),X=I({chat:t.chat}),_e=(0,Q.useRef)(null),ve=te({disabled:Y,chat:t.chat,onTranscript:e=>{M(t=>N(t,e)),window.setTimeout(()=>_e.current?.focus(),0)}}),{phase:Z,voiceActive:be,startVoiceInput:Se,cancelVoiceInput:Ce,confirmVoiceInput:we,retryVoiceInput:Te}=ve;(0,Q.useEffect)(()=>{if(!q)return;let e=window.setTimeout(()=>me(void 0),8e3);return()=>window.clearTimeout(e)},[q]);let Ee=(0,Q.useCallback)(async e=>{if(!(e.length===0||Y)){ge(!0);try{await X.processFiles(e)}finally{ge(!1)}}},[Y,X.processFiles]),Oe=(0,Q.useCallback)(async e=>{let t=ce(e.clipboardData);t.length!==0&&(e.preventDefault(),await Ee(t))},[Ee]),ke=(0,Q.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,X.setIsDragging(!0))},[X.setIsDragging]),Ae=(0,Q.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&X.setIsDragging(!1)},[X.setIsDragging]),je=(0,Q.useCallback)(async e=>{e.preventDefault(),X.setIsDragging(!1),await Ee(Array.from(e.dataTransfer.files))},[X.setIsDragging,Ee]),Ne=(0,Q.useCallback)(e=>{e.preventDefault();let t=X.wireAttachmentsPayload(),n=V(j,t.length>0?ue(t):void 0,{projectScope:`none`});n&&(ee(!1),M(``),X.clearAttachments(),o(n))},[X.clearAttachments,X.wireAttachmentsPayload,j,o]),Pe=X.attachments.length>=10,Fe={attachTitle:Pe?He(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${X.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},Ie=(0,Q.useMemo)(()=>({label:n.home.advisorStatusLabel,ready:n.home.advisorStatusReady,clarification:n.home.advisorStatusClarification,refreshing:n.home.advisorStatusRefreshing,refreshingDetail:n.home.advisorRefreshing,idle:n.home.advisorStatusIdle,idleDetail:n.home.advisorUnavailableTitle,generationFailed:n.home.advisorStatusGenerationFailed,budgetExhausted:n.home.advisorStatusBudgetExhausted,modelUnavailable:n.home.advisorStatusModelUnavailable,generationFailedDetail:n.home.advisorGenerationFailed,budgetExhaustedDetail:n.home.advisorBudgetExhausted,modelUnavailableDetail:n.home.advisorModelUnavailable,history:n.home.advisorHistory,retry:n.home.retry,findAnother:n.home.advisorRefresh}),[n.home]),Le=!!(S&&S.needsUser.length===0&&S.backgroundCount===0),ze=!!(S&&S.needsUser.length===0),Be=ze||O;(0,Q.useEffect)(()=>{!Be&&be&&Ce()},[Ce,Be,be]),(0,Q.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!Be||Y||(e.preventDefault(),Z===`recording`?we():Z===`idle`?(_e.current?.focus(),Se()):Z===`error`&&Te())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!Be||!be||(e.preventDefault(),Ce(),_e.current?.focus())};return window.addEventListener(ae,e),window.addEventListener(w,t),()=>{window.removeEventListener(ae,e),window.removeEventListener(w,t)}},[Y,Ce,Be,we,Te,Se,be,Z]);let Ke=(0,Q.useCallback)(e=>{e||Ce(),ee(e)},[Ce]),qe=(0,Q.useCallback)((t,n)=>{if(t.type===`open`){o(l(`/`,t.href));return}t.type===`task_review`||P.current||(P.current=!0,ne(n),E(null),(async()=>{try{t.type===`retry_task`?await Ve(t.taskId,e):t.type===`connector_decision`?await ie({kind:`connector_approval`,approvalId:t.approvalId},t.decision):t.type===`retry_run`?await B({kind:t.subjectKind,runId:t.runId}):t.type===`acknowledge_run`&&await A({kind:t.subjectKind,runId:t.runId}),await D()}catch(e){E(e instanceof Error?e.message:String(e))}finally{P.current=!1,ne(null)}})())},[e,D,o]),Je=(0,Q.useCallback)(()=>{z(!0),U(void 0),J(void 0),E(null),de(e).then(()=>D()).catch(e=>E(e instanceof Error?e.message:String(e))).finally(()=>z(!1))},[e,D]),Ye=(0,Q.useCallback)((e,t)=>{z(!0),E(null),le(e,t).then(async t=>{if(t.outcome===`needs_setup`){J({opportunityId:e.id,value:t.preflight});return}if(J(void 0),re(e=>e+1),t.outcome===`task`){U({title:n.home.advisorStartedTitle,detail:He(n.home.advisorStartedDetail,{title:e.title}),href:l(`/`,t.href)}),await D();return}o(t.href)}).catch(e=>E(e instanceof Error?e.message:String(e))).finally(()=>z(!1))},[D,o,n.home.advisorStartedDetail,n.home.advisorStartedTitle]),Xe=(0,Q.useCallback)((e,t)=>{z(!0),U(void 0),J(void 0),E(null),pe(e,{kind:t,snoozedUntil:t===`too_early`?Date.now()+4320*6e4:void 0}).then(({idempotencyKey:t})=>(me({opportunityId:e.id,idempotencyKey:t}),re(e=>e+1),D())).catch(e=>E(e instanceof Error?e.message:String(e))).finally(()=>z(!1))},[D]),Ze=(0,Q.useCallback)(()=>{if(!q)return;let e=q;me(void 0),z(!0),E(null),oe(e.opportunityId,e.idempotencyKey).then(()=>(re(e=>e+1),D())).catch(t=>{me(e),E(t instanceof Error?t.message:String(t))}).finally(()=>z(!1))},[q,D]),Qe=(0,Q.useCallback)((e,t)=>{o(`/chat/new?${new URLSearchParams({draft:`${e}\n\n${t}`}).toString()}`)},[o]),$e=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[S?(0,$.jsx)(Re,{advisor:S.advisor,busy:R,copy:Ie,onOpenHistory:()=>G(!0),onRefresh:Je}):null,ze?null:(0,$.jsxs)(L,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>ee(!0),children:[(0,$.jsx)(u,{className:`size-4`,"aria-hidden":!0}),r.newWork]})]}),[R,Ie,r.newWork,S,Je,ze]);(0,Q.useLayoutEffect)(()=>(c({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:$e}),()=>p()),[p,$e,c,n.title]);let et=S?.needsUser.length??0,tt=S?.backgroundCount??0,nt=et>0?He(n.home.attentionTitle,{count:et}):tt>0?n.home.clearTitle:n.home.idleTitle,rt=et>0?tt>0?He(n.home.attentionIntroWithBackground,{count:tt}):n.home.attentionIntro:tt>0?He(n.home.clearIntro,{count:tt}):n.home.idleIntro;return(0,$.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 pb-8 pt-3 sm:px-6 lg:px-8 lg:pb-12 lg:pt-4`,children:[(0,$.jsx)(`input`,{ref:X.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Ee(Array.from(t)),e.target.value=``}}),(0,$.jsx)(x,{open:O,onOpenChange:Ke,children:(0,$.jsxs)(v,{children:[(0,$.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(y,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(b,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,$.jsx)(g,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsx)(xe,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:_e,intent:j,labels:{...Fe,submit:r.submit},attachments:X.attachments,isDragging:X.isDragging,attachmentBusy:Y,attachmentsFull:Pe,voice:ve,chat:t.chat,cancelAction:(0,$.jsx)(_,{asChild:!0,children:(0,$.jsx)(L,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:M,onPickFiles:()=>X.fileInputRef.current?.click(),onRemoveAttachment:X.removeAttachment,onPaste:e=>void Oe(e),onDragOver:ke,onDragLeave:Ae,onDrop:e=>void je(e),onSubmit:Ne})]})]})}),(0,$.jsx)(Me,{open:W,refreshKey:K,onOpenChange:G,onReevaluate:Je}),T?(0,$.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,$.jsx)(`span`,{children:T}),(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void D(),children:n.home.retry})]}):null,C?(0,$.jsx)(Ue,{}):S?(0,$.jsxs)(`div`,{className:Le?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,$.jsxs)(`section`,{className:Le?`w-full text-center`:`max-w-3xl`,children:[(0,$.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:nt}),(0,$.jsx)(`p`,{className:Le?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:rt})]}),ze?(0,$.jsx)(xe,{variant:`inline`,inputId:`home-conversation-intent`,inputRef:_e,intent:j,labels:Fe,attachments:X.attachments,isDragging:X.isDragging,attachmentBusy:Y,attachmentsFull:Pe,voice:ve,chat:t.chat,onIntentChange:M,onPickFiles:()=>X.fileInputRef.current?.click(),onRemoveAttachment:X.removeAttachment,onPaste:e=>void Oe(e),onDragOver:ke,onDragLeave:Ae,onDrop:e=>void je(e),onSubmit:Ne}):null,(0,$.jsx)(De,{advisor:S.advisor,busy:R,copy:{aiLabel:n.home.advisorAiLabel,why:n.home.advisorWhy,evidence:n.home.advisorEvidence,needsSetup:n.home.advisorNeedsSetup,start:n.home.advisorStart,discuss:n.home.advisorDiscuss,refresh:n.home.advisorRefresh,refreshing:n.home.advisorRefreshing,history:n.home.advisorHistory,viewProgress:n.home.advisorViewProgress,alternatives:n.home.advisorAlternatives,feedback:n.home.advisorFeedback,alreadyDone:n.home.advisorAlreadyDone,irrelevant:n.home.advisorIrrelevant,later:n.home.advisorLater,lessLikeThis:n.home.advisorLessLikeThis,sourceIncorrect:n.home.advisorSourceIncorrect,minutes:n.home.advisorMinutes,setupTitle:n.home.advisorSetupTitle,setupHint:n.home.advisorSetupHint,configure:n.home.advisorConfigure,degradedStart:n.home.advisorDegradedStart,automationHint:n.home.advisorAutomationHint,automationAction:n.home.advisorAutomationAction},onRefresh:Je,onAction:Ye,onFeedback:Xe,onClarification:Qe,onOpenHistory:()=>G(!0),preflight:he,receipt:H}),S.needsUser.length>0?(0,$.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,$.jsx)(fe,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:S.needsUser.map(t=>(0,$.jsx)(We,{item:t,busy:F!==null,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:qe,onComplete:()=>void D()},t.id))})]}):null,S.background.length>0?(0,$.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,$.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:He(n.home.backgroundCount,{count:S.backgroundCount})})]}),(0,$.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:S.background.map(e=>(0,$.jsx)(Ge,{item:e,onAction:qe},e.id))})]}):null]}):null,q?(0,$.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-[100] flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,$.jsx)(`span`,{children:n.home.advisorFeedbackSaved}),(0,$.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:Ze,children:n.home.advisorUndo})]}):null]})}export{Ke as HomePage};
@@ -1 +1 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./x-B_N4OPjy.js";import{a as i,r as a}from"./locale-store-Jnhw2WMv.js";import{$i as o,Rc as s}from"./index-DvKDT-RQ.js";var c=t();e();var l=n();function u(e){let t=(0,c.c)(30),{primary:n,value:i,models:a,loading:u,error:d,zh:f,onChange:p}=e,m;if(t[0]!==a||t[1]!==n||t[2]!==i){let e;t[4]!==n||t[5]!==i?(e=e=>e.id!==n&&!i.includes(e.id),t[4]=n,t[5]=i,t[6]=e):e=t[6],m=a.filter(e),t[0]=a,t[1]=n,t[2]=i,t[3]=m}else m=t[3];let h=m,g=f?`回退顺序`:`Fallback order`,_;t[7]===g?_=t[8]:(_=(0,l.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:g}),t[7]=g,t[8]=_);let v=f?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,y;t[9]===v?y=t[10]:(y=(0,l.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:v}),t[9]=v,t[10]=y);let b;t[11]!==_||t[12]!==y?(b=(0,l.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,l.jsxs)(`div`,{children:[_,y]})}),t[11]=_,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==a||t[15]!==p||t[16]!==i||t[17]!==f?(x=i.length>0?(0,l.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:i.map((e,t)=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full bg-surface-base/70 py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,l.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,l.jsx)(`span`,{children:a.find(t=>t.id===e)?.name??e}),(0,l.jsx)(`button`,{type:`button`,"aria-label":f?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>p(i.filter(t=>t!==e)),children:(0,l.jsx)(r,{className:`size-3`})})]},e))}):(0,l.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:f?`未设置回退模型。`:`No fallback models configured.`}),t[14]=a,t[15]=p,t[16]=i,t[17]=f,t[18]=x):x=t[18];let S;t[19]!==h||t[20]!==d||t[21]!==u||t[22]!==p||t[23]!==i||t[24]!==f?(S=u?(0,l.jsx)(s,{className:`mt-3 h-11 w-full max-w-md rounded-lg`}):(0,l.jsx)(o,{value:``,models:h,modelsLoading:u,modelsError:d,placeholder:f?`添加回退模型`:`Add fallback model`,searchPlaceholder:f?`搜索模型或服务商`:`Search models or providers`,noMatches:f?`没有可添加的模型`:`No models available to add`,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:f?`添加回退模型`:`Add fallback model`,onChange:e=>{e&&p([...i,e])}}),t[19]=h,t[20]=d,t[21]=u,t[22]=p,t[23]=i,t[24]=f,t[25]=S):S=t[25];let C;return t[26]!==b||t[27]!==x||t[28]!==S?(C=(0,l.jsxs)(`div`,{children:[b,x,S]}),t[26]=b,t[27]=x,t[28]=S,t[29]=C):C=t[29],C}async function d(){let e=await i(a(`/api/image-generation/catalog`));if(!Array.isArray(e.payload?.providers))throw Error(`Invalid image provider catalog`);return e.payload.providers}async function f(){let e=await i(a(`/api/image-generation/custom-providers`));if(!Array.isArray(e.payload?.providers))throw Error(`Invalid custom image provider list`);return e.payload.providers}async function p(e,t){await i(a(`/api/image-generation/custom-providers/${encodeURIComponent(e)}`),{method:`PUT`,body:JSON.stringify(t)})}async function m(e){await i(a(`/api/image-generation/custom-providers/${encodeURIComponent(e)}`),{method:`DELETE`})}async function h(e,t){await i(a(`/api/image-generation/providers/${encodeURIComponent(e)}/credential`),{method:`PUT`,body:JSON.stringify({apiKey:t})})}async function g(e,t){let n=await i(a(`/api/image-generation/providers/${encodeURIComponent(e)}/test`),{method:`POST`,body:JSON.stringify({modelId:t})});if(!Array.isArray(n.payload?.images))throw Error(`Invalid image generation test response`);return{images:n.payload.images}}export{h as a,p as i,f as n,g as o,d as r,u as s,m as t};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./x-B_N4OPjy.js";import{a as i,r as a}from"./locale-store-Jnhw2WMv.js";import{$i as o,Rc as s}from"./index-fDaRYOv1.js";var c=t();e();var l=n();function u(e){let t=(0,c.c)(30),{primary:n,value:i,models:a,loading:u,error:d,zh:f,onChange:p}=e,m;if(t[0]!==a||t[1]!==n||t[2]!==i){let e;t[4]!==n||t[5]!==i?(e=e=>e.id!==n&&!i.includes(e.id),t[4]=n,t[5]=i,t[6]=e):e=t[6],m=a.filter(e),t[0]=a,t[1]=n,t[2]=i,t[3]=m}else m=t[3];let h=m,g=f?`回退顺序`:`Fallback order`,_;t[7]===g?_=t[8]:(_=(0,l.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:g}),t[7]=g,t[8]=_);let v=f?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,y;t[9]===v?y=t[10]:(y=(0,l.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:v}),t[9]=v,t[10]=y);let b;t[11]!==_||t[12]!==y?(b=(0,l.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,l.jsxs)(`div`,{children:[_,y]})}),t[11]=_,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==a||t[15]!==p||t[16]!==i||t[17]!==f?(x=i.length>0?(0,l.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:i.map((e,t)=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full bg-surface-base/70 py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,l.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,l.jsx)(`span`,{children:a.find(t=>t.id===e)?.name??e}),(0,l.jsx)(`button`,{type:`button`,"aria-label":f?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>p(i.filter(t=>t!==e)),children:(0,l.jsx)(r,{className:`size-3`})})]},e))}):(0,l.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:f?`未设置回退模型。`:`No fallback models configured.`}),t[14]=a,t[15]=p,t[16]=i,t[17]=f,t[18]=x):x=t[18];let S;t[19]!==h||t[20]!==d||t[21]!==u||t[22]!==p||t[23]!==i||t[24]!==f?(S=u?(0,l.jsx)(s,{className:`mt-3 h-11 w-full max-w-md rounded-lg`}):(0,l.jsx)(o,{value:``,models:h,modelsLoading:u,modelsError:d,placeholder:f?`添加回退模型`:`Add fallback model`,searchPlaceholder:f?`搜索模型或服务商`:`Search models or providers`,noMatches:f?`没有可添加的模型`:`No models available to add`,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:f?`添加回退模型`:`Add fallback model`,onChange:e=>{e&&p([...i,e])}}),t[19]=h,t[20]=d,t[21]=u,t[22]=p,t[23]=i,t[24]=f,t[25]=S):S=t[25];let C;return t[26]!==b||t[27]!==x||t[28]!==S?(C=(0,l.jsxs)(`div`,{children:[b,x,S]}),t[26]=b,t[27]=x,t[28]=S,t[29]=C):C=t[29],C}async function d(){let e=await i(a(`/api/image-generation/catalog`));if(!Array.isArray(e.payload?.providers))throw Error(`Invalid image provider catalog`);return e.payload.providers}async function f(){let e=await i(a(`/api/image-generation/custom-providers`));if(!Array.isArray(e.payload?.providers))throw Error(`Invalid custom image provider list`);return e.payload.providers}async function p(e,t){await i(a(`/api/image-generation/custom-providers/${encodeURIComponent(e)}`),{method:`PUT`,body:JSON.stringify(t)})}async function m(e){await i(a(`/api/image-generation/custom-providers/${encodeURIComponent(e)}`),{method:`DELETE`})}async function h(e,t){await i(a(`/api/image-generation/providers/${encodeURIComponent(e)}/credential`),{method:`PUT`,body:JSON.stringify({apiKey:t})})}async function g(e,t){let n=await i(a(`/api/image-generation/providers/${encodeURIComponent(e)}/test`),{method:`POST`,body:JSON.stringify({modelId:t})});if(!Array.isArray(n.payload?.images))throw Error(`Invalid image generation test response`);return{images:n.payload.images}}export{h as a,p as i,f as n,g as o,d as r,u as s,m as t};
@@ -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{t as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./messages-DBvKzlCl.js";import{t as l}from"./cn-0WouolD0.js";import{a as u,n as d,r as f}from"./locale-store-Jnhw2WMv.js";import{a as p,i as m,n as h,o as g,r as _,s as v,t as y}from"./dist-BGTk37IG.js";import{Dd as b,Du as x,On as S,Wc as C,eu as w,hf as T,hu as E,ru as D,uf as O,vs as k,ys as A}from"./index-DvKDT-RQ.js";import{n as j,r as M}from"./settings-page-layout-Dx5S-Msc.js";var N=e(t(),1);async function P(e,t,n){return(await u(f(`/api/imports${e}`),{...t===void 0?{}:{method:`POST`,body:JSON.stringify(t)},signal:n})).data}var F=n();function I(e){return e.kind!==`connection`&&(e.status===`ready`||e.status===`conflict`||e.kind===`project`&&e.status===`existing`)}function L(e,t){let n=e.filter(I),r=n.filter(e=>t.has(e.id)).length;return{checked:n.length>0&&r===n.length,indeterminate:r>0&&r<n.length,selectedCount:r,availableCount:n.length}}function R(e,t,n,r){return n.reduce((t,n)=>z(e,t,n,r),new Set(t))}function z(e,t,n,r){let i=new Set(t);if(!I(n))return i;if(r){if(i.add(n.id),n.parentId&&i.add(n.parentId),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&t.kind===`skill`&&t.suggested&&I(t)&&i.add(t.id)}else if(i.delete(n.id),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&i.delete(t.id);return i}var B=r();function V(e){let t=(0,F.c)(34),{open:n,sourceName:r,inventory:i,selected:a,onSelected:o,busy:u,locked:f,error:E,onClose:D,onRefresh:O,onSubmit:j}=e,M=c(d(ue)).imports,[P,I]=(0,N.useState)(!0),[L,V]=(0,N.useState)(!1),U;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{I(!0),V(!1)},t[0]=U):U=t[0];let fe=i?.id,W;t[1]===fe?W=t[2]:(W=[fe],t[1]=fe,t[2]=W),(0,N.useEffect)(U,W);let G=i?.candidates.filter(le)??[],pe;t[3]===i?.candidates?pe=t[4]:(pe=i?.candidates.filter(ce)??[],t[3]=i?.candidates,t[4]=pe);let K=pe,ge;t[5]===i?.candidates?ge=t[6]:(ge=i?.candidates.filter(se)??[],t[5]=i?.candidates,t[6]=ge);let _e=ge,q;if(t[7]!==i?.candidates){q=new Map;for(let e of i?.candidates??[]){if(!e.parentId)continue;let t=q.get(e.parentId)??[];t.push(e),q.set(e.parentId,t)}t[7]=i?.candidates,t[8]=q}else q=t[8];let ye=q,be=i?.candidates.filter(e=>a.has(e.id))??[],xe=M.selected.replace(`{skills}`,String(be.filter(oe).length)).replace(`{context}`,String(be.filter(ae).length)).replace(`{projects}`,String(be.filter(ie).length)),Se;t[9]!==i||t[10]!==o||t[11]!==a?(Se=(e,t)=>{i&&o(z(i,a,e,t))},t[9]=i,t[10]=o,t[11]=a,t[12]=Se):Se=t[12];let Ce=Se,we;t[13]!==i||t[14]!==o||t[15]!==a?(we=(e,t)=>{i&&o(R(i,a,e,t))},t[13]=i,t[14]=o,t[15]=a,t[16]=we):we=t[16];let J=we,Y;t[17]===D?Y=t[18]:(Y=e=>{e||D()},t[17]=D,t[18]=Y);let X;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,B.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 bg-scrim ${A}`}),t[19]=X):X=t[19];let Z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Z=l(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),760px)] w-[min(calc(100%-2rem),720px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay outline-none`,`max-sm:bottom-0 max-sm:left-0 max-sm:top-auto max-sm:h-[min(92dvh,760px)] max-sm:w-full max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none`,k),t[20]=Z):Z=t[20];let Q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,B.jsx)(s,{"aria-hidden":`true`,className:`h-4 w-4`}),t[21]=Q):Q=t[21];let Te=E&&(0,B.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg`,children:[(0,B.jsx)(`p`,{children:E}),(0,B.jsx)(C,{variant:`secondary`,disabled:f,onClick:O,children:M.refresh})]}),$;t[22]!==E||t[23]!==i?($=!i&&!E&&(0,B.jsx)(S,{sections:2}),t[22]=E,t[23]=i,t[24]=$):$=t[24];let Ee=i&&(0,B.jsxs)(B.Fragment,{children:[!i.complete&&(0,B.jsx)(`p`,{className:`rounded-lg bg-surface-inset p-3 text-sm text-fg-muted`,children:M.incomplete}),G.length>0&&(0,B.jsxs)(me,{icon:w,title:M.personalSetup,description:M.personalSetupHint,items:G,selected:a,open:P,disabled:f,onOpenChange:I,onCheckedChange:e=>J(G,e),children:[(0,B.jsx)(he,{icon:x,title:M.kinds.skill,items:G.filter(re),inventoryId:i.id,selected:a,disabled:f,onToggle:Ce,onToggleAll:e=>J(G.filter(ne),e)}),(0,B.jsx)(he,{icon:T,title:M.kinds.context,items:G.filter(te),inventoryId:i.id,selected:a,disabled:f,onToggle:Ce,onToggleAll:e=>J(G.filter(ee),e)})]}),K.length>0&&(0,B.jsx)(me,{icon:b,title:M.kinds.project,description:M.projectsHint.replace(`{count}`,String(K.length)),items:K,selected:a,open:L,disabled:f,onOpenChange:V,onCheckedChange:e=>J(K,e),children:(0,B.jsx)(ve,{inventoryId:i.id,projects:K,projectChildren:ye,selected:a,disabled:f,onToggle:Ce})}),_e.length>0&&(0,B.jsx)(de,{inventoryId:i.id,items:_e}),!i.candidates.length&&(0,B.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-5 text-sm text-fg-muted`,children:M.noContent}),!!i.notices.length&&(0,B.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer font-medium text-fg`,children:[M.scanNotices,` (`,i.notices.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-3 space-y-2`,children:i.notices.map(H)})]})]}),De;t[25]!==Te||t[26]!==$||t[27]!==Ee?(De=(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4 sm:p-6`,children:[Te,$,Ee]}),t[25]=Te,t[26]=$,t[27]=Ee,t[28]=De):De=t[28];let Oe=C,ke=!i||!a.size||u,Ae=u?M.importing:f?M.retry:M.importCount.replace(`{count}`,String(a.size)),je;return t[29]!==Oe||t[30]!==j||t[31]!==ke||t[32]!==Ae?(je=(0,B.jsx)(Oe,{variant:`primary`,disabled:ke,onClick:j,children:Ae}),t[29]=Oe,t[30]=j,t[31]=ke,t[32]=Ae,t[33]=je):je=t[33],(0,B.jsx)(y,{open:n,onOpenChange:Y,children:(0,B.jsxs)(g,{children:[X,(0,B.jsxs)(_,{className:Z,children:[(0,B.jsx)(`header`,{className:`shrink-0 space-y-2 border-b border-edge p-5 sm:p-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(v,{className:`text-xl font-semibold text-fg`,children:M.chooseTitle.replace(`{source}`,r)}),(0,B.jsx)(m,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:M.chooseHint})]}),(0,B.jsx)(h,{asChild:!0,children:(0,B.jsx)(C,{variant:`ghost`,"aria-label":M.close,className:`h-10 w-10 shrink-0 p-0`,children:Q})})]})}),De,(0,B.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-overlay p-4 sm:px-6 sm:py-5`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,B.jsxs)(`div`,{"aria-live":`polite`,className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:xe}),u&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:M.runningHint}),f&&!u&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:M.retryHint})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2`,children:[(0,B.jsx)(C,{variant:`ghost`,onClick:D,children:u?M.close:M.cancel}),je]})]})})]})]})})}function H(e,t){return(0,B.jsx)(`li`,{className:`break-words`,children:e},t)}function ee(e){return e.kind===`context`}function te(e){return e.kind===`context`}function ne(e){return e.kind===`skill`}function re(e){return e.kind===`skill`}function ie(e){return e.kind===`project`}function ae(e){return e.kind===`context`}function oe(e){return e.kind===`skill`}function se(e){return e.kind===`connection`}function ce(e){return e.kind===`project`}function le(e){return!e.parentId&&(e.kind===`skill`||e.kind===`context`)}function ue(e){return e.language}function de(e){let t=(0,F.c)(13),{inventoryId:n,items:r}=e,a=c(d(fe)).imports,[o,s]=(0,N.useState)(!1),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(U),t[0]=u):u=t[0];let f;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(E,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[1]=f):f=t[1];let p=a.connectionsHint.replace(`{count}`,String(r.length)),m;t[2]===p?m=t[3]:(m=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:p}),t[2]=p,t[3]=m);let h=o&&`rotate-180`,g;t[4]===h?g=t[5]:(g=l(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,h),t[4]=h,t[5]=g);let _;t[6]===g?_=t[7]:(_=(0,B.jsx)(O,{"aria-hidden":`true`,className:g}),t[6]=g,t[7]=_);let v;return t[8]!==n||t[9]!==r||t[10]!==o||t[11]!==a?(v=o&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:[r.map(e=>(0,B.jsx)(W,{inventoryId:n,item:e},e.id)),(0,B.jsx)(C,{asChild:!0,variant:`secondary`,children:(0,B.jsx)(i,{to:`/capabilities/connectors`,children:a.connectionsAction})})]}),t[8]=n,t[9]=r,t[10]=o,t[11]=a,t[12]=v):v=t[12],(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[(0,B.jsx)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:(0,B.jsxs)(C,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":o,onClick:u,children:[f,(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:a.kinds.connection}),m]}),_]})}),v]})}function U(e){return!e}function fe(e){return e.language}function W(e){let t=(0,F.c)(34),{inventoryId:n,item:r}=e,i=d(pe),a;t[0]===i?a=t[1]:(a=c(i),t[0]=i,t[1]=a);let o=a.imports,[s,l]=(0,N.useState)(),[u,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(``),h;t[2]!==n||t[3]!==r.id||t[4]!==s?(h=async function(){if(f(G),!s)try{l(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;m(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=s,t[5]=h):h=t[5];let g=h,_;t[6]===r.name?_=t[7]:(_=(0,B.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=_);let v;t[8]===r.displayPath?v=t[9]:(v=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[8]=r.displayPath,t[9]=v);let y=o.statuses[r.status],b;t[10]===y?b=t[11]:(b=(0,B.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x;t[12]!==_||t[13]!==v||t[14]!==b?(x=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v,b]}),t[12]=_,t[13]=v,t[14]=b,t[15]=x):x=t[15];let w;t[16]===g?w=t[17]:(w=()=>void g(),t[16]=g,t[17]=w);let T;t[18]!==o.preview||t[19]!==w?(T=(0,B.jsx)(C,{variant:`ghost`,className:`h-9 shrink-0 px-2`,onClick:w,children:o.preview}),t[18]=o.preview,t[19]=w,t[20]=T):T=t[20];let E;t[21]!==T||t[22]!==x?(E=(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[x,T]}),t[21]=T,t[22]=x,t[23]=E):E=t[23];let D;t[24]===r.reason?D=t[25]:(D=r.reason&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r.reason}),t[24]=r.reason,t[25]=D);let O;t[26]!==p||t[27]!==u||t[28]!==s?(O=u&&(0,B.jsx)(`div`,{className:`mt-3 rounded-lg bg-surface-inset p-3`,children:p?(0,B.jsx)(`p`,{role:`alert`,className:`text-xs text-fg-muted`,children:p}):s?(0,B.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:s.text}):(0,B.jsx)(S,{sections:1})}),t[26]=p,t[27]=u,t[28]=s,t[29]=O):O=t[29];let k;return t[30]!==E||t[31]!==D||t[32]!==O?(k=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[E,D,O]}),t[30]=E,t[31]=D,t[32]=O,t[33]=k):k=t[33],k}function G(e){return!e}function pe(e){return e.language}function me(e){let t=(0,F.c)(40),{icon:n,title:r,description:i,items:a,selected:o,open:s,disabled:c,onOpenChange:u,onCheckedChange:d,children:f}=e,p;t[0]!==a||t[1]!==o?(p=L(a,o),t[0]=a,t[1]=o,t[2]=p):p=t[2];let m=p,h;t[3]!==u||t[4]!==s?(h=()=>u(!s),t[3]=u,t[4]=s,t[5]=h):h=t[5];let g;t[6]===n?g=t[7]:(g=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[6]=n,t[7]=g);let _;t[8]===r?_=t[9]:(_=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r}),t[8]=r,t[9]=_);let v;t[10]===i?v=t[11]:(v=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:i}),t[10]=i,t[11]=v);let y;t[12]!==_||t[13]!==v?(y=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14];let b=s&&`rotate-180`,x;t[15]===b?x=t[16]:(x=l(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,b),t[15]=b,t[16]=x);let S;t[17]===x?S=t[18]:(S=(0,B.jsx)(O,{"aria-hidden":`true`,className:x}),t[17]=x,t[18]=S);let w;t[19]!==s||t[20]!==h||t[21]!==g||t[22]!==y||t[23]!==S?(w=(0,B.jsxs)(C,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":s,onClick:h,children:[g,y,S]}),t[19]=s,t[20]=h,t[21]=g,t[22]=y,t[23]=S,t[24]=w):w=t[24];let T=c||!m.availableCount,E;t[25]!==d||t[26]!==m.checked||t[27]!==m.indeterminate||t[28]!==T||t[29]!==r?(E=(0,B.jsx)(X,{label:r,checked:m.checked,indeterminate:m.indeterminate,disabled:T,onChange:d}),t[25]=d,t[26]=m.checked,t[27]=m.indeterminate,t[28]=T,t[29]=r,t[30]=E):E=t[30];let D;t[31]!==w||t[32]!==E?(D=(0,B.jsxs)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:[w,E]}),t[31]=w,t[32]=E,t[33]=D):D=t[33];let k;t[34]!==f||t[35]!==s?(k=s&&(0,B.jsx)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:f}),t[34]=f,t[35]=s,t[36]=k):k=t[36];let A;return t[37]!==D||t[38]!==k?(A=(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[D,k]}),t[37]=D,t[38]=k,t[39]=A):A=t[39],A}function he(e){let t=(0,F.c)(34),{icon:n,title:r,items:i,inventoryId:a,selected:o,disabled:s,onToggle:u,onToggleAll:f}=e,p=c(d(_e)).imports,[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(``),[v,y]=(0,N.useState)(60);if(!i.length)return null;let b;t[0]!==i||t[1]!==o?(b=L(i,o),t[0]=i,t[1]=o,t[2]=b):b=t[2];let x=b,S=Y(i,g),w=S.slice(0,v),T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>h(ge),t[3]=T):T=t[3];let E;t[4]===n?E=t[5]:(E=(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5 shrink-0 text-fg-muted`}),t[4]=n,t[5]=E);let D;t[6]!==i.length||t[7]!==r?(D=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg`,children:[r,` (`,i.length,`)`]}),t[6]=i.length,t[7]=r,t[8]=D):D=t[8];let k;t[9]!==x.availableCount||t[10]!==x.selectedCount?(k=(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[x.selectedCount,`/`,x.availableCount]}),t[9]=x.availableCount,t[10]=x.selectedCount,t[11]=k):k=t[11];let A=m&&`rotate-180`,j;t[12]===A?j=t[13]:(j=l(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,A),t[12]=A,t[13]=j);let M;t[14]===j?M=t[15]:(M=(0,B.jsx)(O,{"aria-hidden":`true`,className:j}),t[14]=j,t[15]=M);let P;t[16]!==m||t[17]!==E||t[18]!==D||t[19]!==k||t[20]!==M?(P=(0,B.jsxs)(C,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-1 text-left`,"aria-expanded":m,onClick:T,children:[E,D,k,M]}),t[16]=m,t[17]=E,t[18]=D,t[19]=k,t[20]=M,t[21]=P):P=t[21];let I=s||!x.availableCount,R;t[22]!==f||t[23]!==x.checked||t[24]!==x.indeterminate||t[25]!==I||t[26]!==r?(R=(0,B.jsx)(X,{label:r,checked:x.checked,indeterminate:x.indeterminate,disabled:I,onChange:f}),t[22]=f,t[23]=x.checked,t[24]=x.indeterminate,t[25]=I,t[26]=r,t[27]=R):R=t[27];let z;t[28]!==P||t[29]!==R?(z=(0,B.jsxs)(`div`,{className:`flex min-h-14 items-center gap-2 px-3 py-2`,children:[P,R]}),t[28]=P,t[29]=R,t[30]=z):z=t[30];let V=m&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge p-2`,children:[i.length>8&&(0,B.jsx)(J,{value:g,label:p.searchWithin.replace(`{group}`,r),onChange:e=>{_(e),y(60)}}),(0,B.jsx)(`div`,{className:`space-y-1`,children:w.map(e=>(0,B.jsx)(Z,{inventoryId:a,item:e,checked:o.has(e.id),disabled:s,onChange:t=>u(e,t)},e.id))}),!S.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:p.noMatches}),w.length<S.length&&(0,B.jsx)(C,{variant:`ghost`,className:`w-full`,onClick:()=>y(K),children:p.showMore.replace(`{count}`,String(S.length-w.length))})]}),H;return t[31]!==z||t[32]!==V?(H=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[z,V]}),t[31]=z,t[32]=V,t[33]=H):H=t[33],H}function K(e){return e+60}function ge(e){return!e}function _e(e){return e.language}function ve(e){let t=(0,F.c)(15),{inventoryId:n,projects:r,projectChildren:i,selected:a,disabled:o,onToggle:s}=e,l=c(d(ye)).imports,[u,f]=(0,N.useState)(``),[p,m]=(0,N.useState)(60),h;t[0]===i?h=t[1]:(h=e=>i.get(e.id)??[],t[0]=i,t[1]=h);let g=Y(r,u,h),_=g.slice(0,p),v=r.length>8&&(0,B.jsx)(J,{value:u,label:l.searchWithin.replace(`{group}`,l.kinds.project),onChange:e=>{f(e),m(60)}}),y;t[2]!==o||t[3]!==n||t[4]!==s||t[5]!==i||t[6]!==a?(y=e=>(0,B.jsx)(be,{inventoryId:n,project:e,children:i.get(e.id)??[],selected:a,disabled:o,onToggle:s},e.id),t[2]=o,t[3]=n,t[4]=s,t[5]=i,t[6]=a,t[7]=y):y=t[7];let b=_.map(y),x;t[8]===b?x=t[9]:(x=(0,B.jsx)(`div`,{className:`space-y-2`,children:b}),t[8]=b,t[9]=x);let S=!g.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:l.noMatches}),w=_.length<g.length&&(0,B.jsx)(C,{variant:`ghost`,className:`w-full`,onClick:()=>m(q),children:l.showMore.replace(`{count}`,String(g.length-_.length))}),T;return t[10]!==v||t[11]!==x||t[12]!==S||t[13]!==w?(T=(0,B.jsxs)(`div`,{className:`space-y-2`,children:[v,x,S,w]}),t[10]=v,t[11]=x,t[12]=S,t[13]=w,t[14]=T):T=t[14],T}function q(e){return e+60}function ye(e){return e.language}function be(e){let t=(0,F.c)(52),{inventoryId:n,project:r,children:i,selected:a,disabled:o,onToggle:s}=e,u=c(d(we)).imports,[f,p]=(0,N.useState)(!1),m;if(t[0]!==i||t[1]!==a){let e;t[3]===a?e=t[4]:(e=e=>a.has(e.id),t[3]=a,t[4]=e),m=i.filter(e),t[0]=i,t[1]=a,t[2]=m}else m=t[2];let h=m.length,g=C,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>p(Ce),t[5]=_):_=t[5];let v;t[6]===r.name?v=t[7]:(v=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=v);let y;t[8]===r.displayPath?y=t[9]:(y=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:r.displayPath}),t[8]=r.displayPath,t[9]=y);let b;t[10]!==v||t[11]!==y?(b=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[v,y]}),t[10]=v,t[11]=y,t[12]=b):b=t[12];let x=i.length>0&&(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[u.projectContents.replace(`{skills}`,String(i.filter(Se).length)).replace(`{context}`,String(i.filter(xe).length)),` · `,u.chosenCount.replace(`{count}`,String(h))]}),S=f&&`rotate-180`,w;t[13]===S?w=t[14]:(w=l(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,S),t[13]=S,t[14]=w);let T;t[15]===w?T=t[16]:(T=(0,B.jsx)(O,{"aria-hidden":`true`,className:w}),t[15]=w,t[16]=T);let E;t[17]!==g||t[18]!==f||t[19]!==x||t[20]!==T||t[21]!==_||t[22]!==b?(E=(0,B.jsxs)(g,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-2 text-left`,"aria-expanded":f,onClick:_,children:[b,x,T]}),t[17]=g,t[18]=f,t[19]=x,t[20]=T,t[21]=_,t[22]=b,t[23]=E):E=t[23];let D=r.name,k;t[24]!==r.id||t[25]!==a?(k=a.has(r.id),t[24]=r.id,t[25]=a,t[26]=k):k=t[26];let A;t[27]!==o||t[28]!==r?(A=o||!I(r),t[27]=o,t[28]=r,t[29]=A):A=t[29];let j;t[30]!==s||t[31]!==r?(j=e=>s(r,e.target.checked),t[30]=s,t[31]=r,t[32]=j):j=t[32];let M;t[33]!==r.name||t[34]!==k||t[35]!==A||t[36]!==j?(M=(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":D,checked:k,disabled:A,onChange:j}),t[33]=r.name,t[34]=k,t[35]=A,t[36]=j,t[37]=M):M=t[37];let P;t[38]!==E||t[39]!==M?(P=(0,B.jsxs)(`div`,{className:`flex items-center gap-2 p-2`,children:[E,M]}),t[38]=E,t[39]=M,t[40]=P):P=t[40];let L;t[41]!==i||t[42]!==o||t[43]!==n||t[44]!==s||t[45]!==f||t[46]!==a||t[47]!==u?(L=f&&(0,B.jsx)(`div`,{className:`border-t border-edge p-2`,children:i.length?(0,B.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>(0,B.jsx)(Z,{inventoryId:n,item:e,checked:a.has(e.id),disabled:o,onChange:t=>s(e,t)},e.id))}):(0,B.jsx)(`p`,{className:`p-2 text-xs text-fg-muted`,children:u.directoryOnly})}),t[41]=i,t[42]=o,t[43]=n,t[44]=s,t[45]=f,t[46]=a,t[47]=u,t[48]=L):L=t[48];let R;return t[49]!==P||t[50]!==L?(R=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[P,L]}),t[49]=P,t[50]=L,t[51]=R):R=t[51],R}function xe(e){return e.kind===`context`}function Se(e){return e.kind===`skill`}function Ce(e){return!e}function we(e){return e.language}function J(e){let t=(0,F.c)(13),{value:n,label:r,onChange:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,B.jsx)(D,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-fg-muted`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,B.jsx)(`span`,{className:`sr-only`,children:r}),t[1]=r,t[2]=o);let s=`${r}…`,c;t[3]===i?c=t[4]:(c=e=>i(e.target.value),t[3]=i,t[4]=c);let l;t[5]!==r||t[6]!==s||t[7]!==c||t[8]!==n?(l=(0,B.jsx)(`input`,{type:`search`,autoComplete:`off`,value:n,placeholder:s,"aria-label":r,onChange:c,className:`min-w-0 flex-1 border-0 bg-transparent px-0 py-2 text-sm text-fg placeholder:text-fg-subtle`}),t[5]=r,t[6]=s,t[7]=c,t[8]=n,t[9]=l):l=t[9];let u;return t[10]!==o||t[11]!==l?(u=(0,B.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,children:[a,o,l]}),t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function Y(e,t,n=()=>[]){let r=t.trim().toLocaleLowerCase();if(!r)return e;let i=e=>`${e.name} ${e.description} ${e.displayPath}`.toLocaleLowerCase().includes(r);return e.filter(e=>i(e)||n(e).some(i))}function X(e){let t=(0,F.c)(10),{label:n,checked:r,indeterminate:i,disabled:a,onChange:o}=e,s=(0,N.useRef)(null),c,l;t[0]===i?(c=t[1],l=t[2]):(c=()=>{s.current&&(s.current.indeterminate=i)},l=[i],t[0]=i,t[1]=c,t[2]=l),(0,N.useEffect)(c,l);let u;t[3]===o?u=t[4]:(u=e=>o(e.target.checked),t[3]=o,t[4]=u);let d;return t[5]!==r||t[6]!==a||t[7]!==n||t[8]!==u?(d=(0,B.jsx)(`input`,{ref:s,type:`checkbox`,"aria-label":n,checked:r,disabled:a,onChange:u}),t[5]=r,t[6]=a,t[7]=n,t[8]=u,t[9]=d):d=t[9],d}function Z(e){let t=(0,F.c)(52),{inventoryId:n,item:r,checked:i,disabled:a,onChange:o}=e,s=d(Te),l;t[0]===s?l=t[1]:(l=c(s),t[0]=s,t[1]=l);let u=l.imports,[f,p]=(0,N.useState)(),[m,h]=(0,N.useState)(``),[g,_]=(0,N.useState)(!1),v;t[2]!==n||t[3]!==r.id||t[4]!==f?(v=async function(){if(_(Q),!f)try{p(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;h(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=f,t[5]=v):v=t[5];let y=v,b;t[6]!==a||t[7]!==r?(b=a||!I(r),t[6]=a,t[7]=r,t[8]=b):b=t[8];let x;t[9]===o?x=t[10]:(x=e=>o(e.target.checked),t[9]=o,t[10]=x);let w;t[11]!==i||t[12]!==b||t[13]!==x?(w=(0,B.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:i,disabled:b,onChange:x}),t[11]=i,t[12]=b,t[13]=x,t[14]=w):w=t[14];let T;t[15]===r.name?T=t[16]:(T=(0,B.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:r.name}),t[15]=r.name,t[16]=T);let E;t[17]===r.displayPath?E=t[18]:(E=(0,B.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[17]=r.displayPath,t[18]=E);let D;t[19]!==T||t[20]!==E?(D=(0,B.jsxs)(`span`,{className:`min-w-0`,children:[T,E]}),t[19]=T,t[20]=E,t[21]=D):D=t[21];let O;t[22]!==w||t[23]!==D?(O=(0,B.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-start gap-3 py-1`,children:[w,D]}),t[22]=w,t[23]=D,t[24]=O):O=t[24];let k;t[25]!==r.name||t[26]!==r.status||t[27]!==u||t[28]!==y?(k=r.status!==`blocked`&&(0,B.jsx)(C,{variant:`ghost`,"aria-label":`${u.preview}: ${r.name}`,className:`h-9 shrink-0 px-2`,onClick:()=>void y(),children:u.preview}),t[25]=r.name,t[26]=r.status,t[27]=u,t[28]=y,t[29]=k):k=t[29];let A;t[30]!==O||t[31]!==k?(A=(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[O,k]}),t[30]=O,t[31]=k,t[32]=A):A=t[32];let j;t[33]===r.description?j=t[34]:(j=r.description&&(0,B.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:r.description}),t[33]=r.description,t[34]=j);let M;t[35]!==r.status||t[36]!==r.targetName||t[37]!==u?(M=r.status!==`ready`&&(0,B.jsxs)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:[u.statuses[r.status],r.status===`conflict`?` → ${r.targetName}`:``]}),t[35]=r.status,t[36]=r.targetName,t[37]=u,t[38]=M):M=t[38];let L;t[39]===r.reason?L=t[40]:(L=r.reason&&(0,B.jsx)(`p`,{className:`break-words pl-7 text-xs text-fg-muted`,children:r.reason}),t[39]=r.reason,t[40]=L);let R;t[41]!==f||t[42]!==m||t[43]!==g||t[44]!==u?(R=g&&(0,B.jsx)(`div`,{className:`ml-7 mt-2 rounded-lg border border-edge bg-surface-inset p-3`,children:m?(0,B.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:m}):f?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:f.text}),f.truncated&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:u.previewTruncated})]}):(0,B.jsx)(S,{sections:1})}),t[41]=f,t[42]=m,t[43]=g,t[44]=u,t[45]=R):R=t[45];let z;return t[46]!==A||t[47]!==j||t[48]!==M||t[49]!==L||t[50]!==R?(z=(0,B.jsxs)(`div`,{className:`min-w-0 rounded-lg px-2 py-1.5 hover:bg-surface-hover/60`,children:[A,j,M,L,R]}),t[46]=A,t[47]=j,t[48]=M,t[49]=L,t[50]=R,t[51]=z):z=t[51],z}function Q(e){return!e}function Te(e){return e.language}function $(){let e=c(d(e=>e.language)).imports,[t,n]=(0,N.useState)(),[r,s]=(0,N.useState)(),[l,u]=(0,N.useState)(!1),[f,p]=(0,N.useState)(),[m,h]=(0,N.useState)(new Set),[g,_]=(0,N.useState)(!1),[v,y]=(0,N.useState)(),[b,x]=(0,N.useState)(),[w,T]=(0,N.useState)(``),[E,D]=(0,N.useState)(``),[O,k]=(0,N.useState)(0),A=(0,N.useRef)(null),F=(0,N.useRef)(!1);(0,N.useEffect)(()=>{let e=new AbortController;return T(``),P(`/sources`,void 0,e.signal).then(e=>n(e.sources)).catch(t=>{e.signal.aborted||T(t instanceof Error?t.message:String(t))}),()=>{e.abort(),A.current?.abort()}},[O]);let I=(t?.flatMap(e=>e.lastImport?.status===`running`?[e.lastImport.id]:[])??[]).join(`,`);(0,N.useEffect)(()=>{if(!I)return;let e=new AbortController,t,n=async()=>{for(let t of I.split(`,`))try{let n=await P(`/runs/${t}`,void 0,e.signal);e.signal.aborted||L(n)}catch{}e.signal.aborted||(t=setTimeout(()=>void n(),3e3))};return t=setTimeout(()=>void n(),1500),()=>{e.abort(),clearTimeout(t)}},[I]);function L(e){n(t=>t?.map(t=>t.id===e.source?{...t,lastImport:e}:t)),e.status!==`running`&&y(t=>t?.requestId===e.id?void 0:t)}async function R(e){A.current?.abort();let t=new AbortController;A.current=t,s(e),u(!0),p(void 0),h(new Set),D(``),x(void 0),y(void 0);try{let n=await P(`/sources/${e}/scan`,{},t.signal);t.signal.aborted||(p(n),h(new Set(n.candidates.filter(e=>!e.parentId&&e.suggested).map(e=>e.id))))}catch(e){t.signal.aborted||D(e instanceof Error?e.message:String(e))}}async function z(){if(!f||!m.size||F.current)return;F.current=!0,_(!0),D(``),T(``);let e=v??{inventoryId:f.id,candidateIds:[...m],requestId:crypto.randomUUID(),retryOf:b};y(e);try{L(await P(`/runs`,e)),u(!1)}catch(e){let t=e instanceof Error?e.message:String(e);D(t),T(t);let n=e.body?.code;n&&[`invalid_input`,`inventory_stale`,`invalid_selection`,`missing_parent`,`not_found`,`conflict`].includes(n)&&y(void 0)}finally{F.current=!1,_(!1)}}async function H(e){s(e.source),u(!0),p(void 0),h(new Set),D(``),y(void 0),x(e.id),A.current?.abort();let t=new AbortController;A.current=t;try{let n=await P(`/inventories/${e.inventoryId}`,void 0,t.signal);if(t.signal.aborted)return;let r=new Set(e.items.filter(e=>e.status===`failed`).map(e=>e.candidateId));n.candidates.forEach(e=>{r.has(e.id)&&e.parentId&&r.add(e.parentId)}),p({...n,candidates:n.candidates.filter(e=>r.has(e.id))}),h(r)}catch(e){t.signal.aborted||D(e instanceof Error?e.message:String(e))}}let ee=t?.filter(e=>e.detected||e.lastImport);return(0,B.jsxs)(M,{children:[(0,B.jsx)(j,{title:e.title,subtitle:e.subtitle}),w&&(0,B.jsxs)(`div`,{role:`alert`,className:`rounded-xl bg-danger-soft p-4 text-sm text-danger`,children:[(0,B.jsx)(`p`,{children:w}),!t&&(0,B.jsx)(C,{variant:`ghost`,onClick:()=>k(e=>e+1),children:e.retry})]}),!t&&!w&&(0,B.jsx)(S,{sections:1}),t&&(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-base font-medium text-fg`,children:e.apps}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.detectedHint})]}),ee?.length?(0,B.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:ee.map(t=>(0,B.jsxs)(`article`,{className:`space-y-3 p-5 sm:p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg`,children:(0,B.jsx)(o,{className:`h-5 w-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-fg`,children:t.name}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.includes})]}),(0,B.jsx)(C,{variant:`secondary`,disabled:g||!t.detected||!!v&&r!==t.id||t.lastImport?.status===`running`,onClick:()=>{T(``),v&&r===t.id?u(!0):R(t.id)},children:g&&r===t.id?e.importing:v&&r===t.id?e.retry:t.lastImport?e.importAgain:e.import})]}),t.lastImport&&(0,B.jsxs)(`div`,{role:`status`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(a,{className:`h-4 w-4 shrink-0`}),t.lastImport.status===`running`?e.importing:t.lastImport.issues.length?e.finishedWithIssues:e.finished]}),(0,B.jsxs)(`p`,{children:[e.summary.replace(`{skills}`,String(t.lastImport.skills)).replace(`{context}`,String(t.lastImport.context)).replace(`{projects}`,String(t.lastImport.projects)),t.lastImport.skipped>0&&` · ${e.skipped.replace(`{count}`,String(t.lastImport.skipped))}`]}),!!t.lastImport.issues.length&&(0,B.jsxs)(`details`,{children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer text-fg`,children:[e.details,` (`,t.lastImport.issues.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.lastImport.issues.map((e,t)=>(0,B.jsxs)(`li`,{className:`break-words`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.name}),` — `,e.reason]},t))})]}),t.lastImport.status===`partial`&&(0,B.jsx)(C,{variant:`ghost`,disabled:g||!!v,onClick:()=>void H(t.lastImport),children:e.retryFailed})]})]},t.id))}):(0,B.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/20 p-6 text-sm text-fg-muted`,children:[(0,B.jsx)(`p`,{children:e.empty}),(0,B.jsx)(C,{variant:`ghost`,className:`mt-3`,onClick:()=>k(e=>e+1),children:e.refresh})]}),(0,B.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.footnote}),ee?.some(e=>e.lastImport)&&(0,B.jsxs)(`div`,{className:`flex gap-4 text-sm`,children:[(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/skills`,children:e.openSkills}),(0,B.jsx)(i,{className:`text-accent`,to:`/projects`,children:e.openProjects}),(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/connectors`,children:e.connections})]})]}),(0,B.jsx)(V,{open:l,sourceName:t?.find(e=>e.id===r)?.name??``,inventory:f,selected:m,onSelected:h,busy:g,locked:g||!!v,error:E,onClose:()=>{A.current?.abort(),u(!1)},onRefresh:()=>{r&&R(r)},onSubmit:()=>void z()})]})}export{$ as ImportsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./messages-DBvKzlCl.js";import{t as l}from"./cn-0WouolD0.js";import{a as u,n as d,r as f}from"./locale-store-Jnhw2WMv.js";import{a as p,i as m,n as h,o as g,r as _,s as v,t as y}from"./dist-BGTk37IG.js";import{Dd as b,Du as x,On as S,Wc as C,eu as w,hf as T,hu as E,ru as D,uf as O,vs as k,ys as A}from"./index-fDaRYOv1.js";import{n as j,r as M}from"./settings-page-layout-Dx5S-Msc.js";var N=e(t(),1);async function P(e,t,n){return(await u(f(`/api/imports${e}`),{...t===void 0?{}:{method:`POST`,body:JSON.stringify(t)},signal:n})).data}var F=n();function I(e){return e.kind!==`connection`&&(e.status===`ready`||e.status===`conflict`||e.kind===`project`&&e.status===`existing`)}function L(e,t){let n=e.filter(I),r=n.filter(e=>t.has(e.id)).length;return{checked:n.length>0&&r===n.length,indeterminate:r>0&&r<n.length,selectedCount:r,availableCount:n.length}}function R(e,t,n,r){return n.reduce((t,n)=>z(e,t,n,r),new Set(t))}function z(e,t,n,r){let i=new Set(t);if(!I(n))return i;if(r){if(i.add(n.id),n.parentId&&i.add(n.parentId),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&t.kind===`skill`&&t.suggested&&I(t)&&i.add(t.id)}else if(i.delete(n.id),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&i.delete(t.id);return i}var B=r();function V(e){let t=(0,F.c)(34),{open:n,sourceName:r,inventory:i,selected:a,onSelected:o,busy:u,locked:f,error:E,onClose:D,onRefresh:O,onSubmit:j}=e,M=c(d(ue)).imports,[P,I]=(0,N.useState)(!0),[L,V]=(0,N.useState)(!1),U;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{I(!0),V(!1)},t[0]=U):U=t[0];let fe=i?.id,W;t[1]===fe?W=t[2]:(W=[fe],t[1]=fe,t[2]=W),(0,N.useEffect)(U,W);let G=i?.candidates.filter(le)??[],pe;t[3]===i?.candidates?pe=t[4]:(pe=i?.candidates.filter(ce)??[],t[3]=i?.candidates,t[4]=pe);let K=pe,ge;t[5]===i?.candidates?ge=t[6]:(ge=i?.candidates.filter(se)??[],t[5]=i?.candidates,t[6]=ge);let _e=ge,q;if(t[7]!==i?.candidates){q=new Map;for(let e of i?.candidates??[]){if(!e.parentId)continue;let t=q.get(e.parentId)??[];t.push(e),q.set(e.parentId,t)}t[7]=i?.candidates,t[8]=q}else q=t[8];let ye=q,be=i?.candidates.filter(e=>a.has(e.id))??[],xe=M.selected.replace(`{skills}`,String(be.filter(oe).length)).replace(`{context}`,String(be.filter(ae).length)).replace(`{projects}`,String(be.filter(ie).length)),Se;t[9]!==i||t[10]!==o||t[11]!==a?(Se=(e,t)=>{i&&o(z(i,a,e,t))},t[9]=i,t[10]=o,t[11]=a,t[12]=Se):Se=t[12];let Ce=Se,we;t[13]!==i||t[14]!==o||t[15]!==a?(we=(e,t)=>{i&&o(R(i,a,e,t))},t[13]=i,t[14]=o,t[15]=a,t[16]=we):we=t[16];let J=we,Y;t[17]===D?Y=t[18]:(Y=e=>{e||D()},t[17]=D,t[18]=Y);let X;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,B.jsx)(p,{className:`xopc-dialog-overlay fixed inset-0 bg-scrim ${A}`}),t[19]=X):X=t[19];let Z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Z=l(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),760px)] w-[min(calc(100%-2rem),720px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay outline-none`,`max-sm:bottom-0 max-sm:left-0 max-sm:top-auto max-sm:h-[min(92dvh,760px)] max-sm:w-full max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none`,k),t[20]=Z):Z=t[20];let Q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,B.jsx)(s,{"aria-hidden":`true`,className:`h-4 w-4`}),t[21]=Q):Q=t[21];let Te=E&&(0,B.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg`,children:[(0,B.jsx)(`p`,{children:E}),(0,B.jsx)(C,{variant:`secondary`,disabled:f,onClick:O,children:M.refresh})]}),$;t[22]!==E||t[23]!==i?($=!i&&!E&&(0,B.jsx)(S,{sections:2}),t[22]=E,t[23]=i,t[24]=$):$=t[24];let Ee=i&&(0,B.jsxs)(B.Fragment,{children:[!i.complete&&(0,B.jsx)(`p`,{className:`rounded-lg bg-surface-inset p-3 text-sm text-fg-muted`,children:M.incomplete}),G.length>0&&(0,B.jsxs)(me,{icon:w,title:M.personalSetup,description:M.personalSetupHint,items:G,selected:a,open:P,disabled:f,onOpenChange:I,onCheckedChange:e=>J(G,e),children:[(0,B.jsx)(he,{icon:x,title:M.kinds.skill,items:G.filter(re),inventoryId:i.id,selected:a,disabled:f,onToggle:Ce,onToggleAll:e=>J(G.filter(ne),e)}),(0,B.jsx)(he,{icon:T,title:M.kinds.context,items:G.filter(te),inventoryId:i.id,selected:a,disabled:f,onToggle:Ce,onToggleAll:e=>J(G.filter(ee),e)})]}),K.length>0&&(0,B.jsx)(me,{icon:b,title:M.kinds.project,description:M.projectsHint.replace(`{count}`,String(K.length)),items:K,selected:a,open:L,disabled:f,onOpenChange:V,onCheckedChange:e=>J(K,e),children:(0,B.jsx)(ve,{inventoryId:i.id,projects:K,projectChildren:ye,selected:a,disabled:f,onToggle:Ce})}),_e.length>0&&(0,B.jsx)(de,{inventoryId:i.id,items:_e}),!i.candidates.length&&(0,B.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-5 text-sm text-fg-muted`,children:M.noContent}),!!i.notices.length&&(0,B.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer font-medium text-fg`,children:[M.scanNotices,` (`,i.notices.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-3 space-y-2`,children:i.notices.map(H)})]})]}),De;t[25]!==Te||t[26]!==$||t[27]!==Ee?(De=(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4 sm:p-6`,children:[Te,$,Ee]}),t[25]=Te,t[26]=$,t[27]=Ee,t[28]=De):De=t[28];let Oe=C,ke=!i||!a.size||u,Ae=u?M.importing:f?M.retry:M.importCount.replace(`{count}`,String(a.size)),je;return t[29]!==Oe||t[30]!==j||t[31]!==ke||t[32]!==Ae?(je=(0,B.jsx)(Oe,{variant:`primary`,disabled:ke,onClick:j,children:Ae}),t[29]=Oe,t[30]=j,t[31]=ke,t[32]=Ae,t[33]=je):je=t[33],(0,B.jsx)(y,{open:n,onOpenChange:Y,children:(0,B.jsxs)(g,{children:[X,(0,B.jsxs)(_,{className:Z,children:[(0,B.jsx)(`header`,{className:`shrink-0 space-y-2 border-b border-edge p-5 sm:p-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(v,{className:`text-xl font-semibold text-fg`,children:M.chooseTitle.replace(`{source}`,r)}),(0,B.jsx)(m,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:M.chooseHint})]}),(0,B.jsx)(h,{asChild:!0,children:(0,B.jsx)(C,{variant:`ghost`,"aria-label":M.close,className:`h-10 w-10 shrink-0 p-0`,children:Q})})]})}),De,(0,B.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-overlay p-4 sm:px-6 sm:py-5`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,B.jsxs)(`div`,{"aria-live":`polite`,className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:xe}),u&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:M.runningHint}),f&&!u&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:M.retryHint})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2`,children:[(0,B.jsx)(C,{variant:`ghost`,onClick:D,children:u?M.close:M.cancel}),je]})]})})]})]})})}function H(e,t){return(0,B.jsx)(`li`,{className:`break-words`,children:e},t)}function ee(e){return e.kind===`context`}function te(e){return e.kind===`context`}function ne(e){return e.kind===`skill`}function re(e){return e.kind===`skill`}function ie(e){return e.kind===`project`}function ae(e){return e.kind===`context`}function oe(e){return e.kind===`skill`}function se(e){return e.kind===`connection`}function ce(e){return e.kind===`project`}function le(e){return!e.parentId&&(e.kind===`skill`||e.kind===`context`)}function ue(e){return e.language}function de(e){let t=(0,F.c)(13),{inventoryId:n,items:r}=e,a=c(d(fe)).imports,[o,s]=(0,N.useState)(!1),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(U),t[0]=u):u=t[0];let f;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(E,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[1]=f):f=t[1];let p=a.connectionsHint.replace(`{count}`,String(r.length)),m;t[2]===p?m=t[3]:(m=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:p}),t[2]=p,t[3]=m);let h=o&&`rotate-180`,g;t[4]===h?g=t[5]:(g=l(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,h),t[4]=h,t[5]=g);let _;t[6]===g?_=t[7]:(_=(0,B.jsx)(O,{"aria-hidden":`true`,className:g}),t[6]=g,t[7]=_);let v;return t[8]!==n||t[9]!==r||t[10]!==o||t[11]!==a?(v=o&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:[r.map(e=>(0,B.jsx)(W,{inventoryId:n,item:e},e.id)),(0,B.jsx)(C,{asChild:!0,variant:`secondary`,children:(0,B.jsx)(i,{to:`/capabilities/connectors`,children:a.connectionsAction})})]}),t[8]=n,t[9]=r,t[10]=o,t[11]=a,t[12]=v):v=t[12],(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[(0,B.jsx)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:(0,B.jsxs)(C,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":o,onClick:u,children:[f,(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:a.kinds.connection}),m]}),_]})}),v]})}function U(e){return!e}function fe(e){return e.language}function W(e){let t=(0,F.c)(34),{inventoryId:n,item:r}=e,i=d(pe),a;t[0]===i?a=t[1]:(a=c(i),t[0]=i,t[1]=a);let o=a.imports,[s,l]=(0,N.useState)(),[u,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(``),h;t[2]!==n||t[3]!==r.id||t[4]!==s?(h=async function(){if(f(G),!s)try{l(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;m(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=s,t[5]=h):h=t[5];let g=h,_;t[6]===r.name?_=t[7]:(_=(0,B.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=_);let v;t[8]===r.displayPath?v=t[9]:(v=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[8]=r.displayPath,t[9]=v);let y=o.statuses[r.status],b;t[10]===y?b=t[11]:(b=(0,B.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x;t[12]!==_||t[13]!==v||t[14]!==b?(x=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v,b]}),t[12]=_,t[13]=v,t[14]=b,t[15]=x):x=t[15];let w;t[16]===g?w=t[17]:(w=()=>void g(),t[16]=g,t[17]=w);let T;t[18]!==o.preview||t[19]!==w?(T=(0,B.jsx)(C,{variant:`ghost`,className:`h-9 shrink-0 px-2`,onClick:w,children:o.preview}),t[18]=o.preview,t[19]=w,t[20]=T):T=t[20];let E;t[21]!==T||t[22]!==x?(E=(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[x,T]}),t[21]=T,t[22]=x,t[23]=E):E=t[23];let D;t[24]===r.reason?D=t[25]:(D=r.reason&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r.reason}),t[24]=r.reason,t[25]=D);let O;t[26]!==p||t[27]!==u||t[28]!==s?(O=u&&(0,B.jsx)(`div`,{className:`mt-3 rounded-lg bg-surface-inset p-3`,children:p?(0,B.jsx)(`p`,{role:`alert`,className:`text-xs text-fg-muted`,children:p}):s?(0,B.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:s.text}):(0,B.jsx)(S,{sections:1})}),t[26]=p,t[27]=u,t[28]=s,t[29]=O):O=t[29];let k;return t[30]!==E||t[31]!==D||t[32]!==O?(k=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[E,D,O]}),t[30]=E,t[31]=D,t[32]=O,t[33]=k):k=t[33],k}function G(e){return!e}function pe(e){return e.language}function me(e){let t=(0,F.c)(40),{icon:n,title:r,description:i,items:a,selected:o,open:s,disabled:c,onOpenChange:u,onCheckedChange:d,children:f}=e,p;t[0]!==a||t[1]!==o?(p=L(a,o),t[0]=a,t[1]=o,t[2]=p):p=t[2];let m=p,h;t[3]!==u||t[4]!==s?(h=()=>u(!s),t[3]=u,t[4]=s,t[5]=h):h=t[5];let g;t[6]===n?g=t[7]:(g=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[6]=n,t[7]=g);let _;t[8]===r?_=t[9]:(_=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r}),t[8]=r,t[9]=_);let v;t[10]===i?v=t[11]:(v=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:i}),t[10]=i,t[11]=v);let y;t[12]!==_||t[13]!==v?(y=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14];let b=s&&`rotate-180`,x;t[15]===b?x=t[16]:(x=l(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,b),t[15]=b,t[16]=x);let S;t[17]===x?S=t[18]:(S=(0,B.jsx)(O,{"aria-hidden":`true`,className:x}),t[17]=x,t[18]=S);let w;t[19]!==s||t[20]!==h||t[21]!==g||t[22]!==y||t[23]!==S?(w=(0,B.jsxs)(C,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":s,onClick:h,children:[g,y,S]}),t[19]=s,t[20]=h,t[21]=g,t[22]=y,t[23]=S,t[24]=w):w=t[24];let T=c||!m.availableCount,E;t[25]!==d||t[26]!==m.checked||t[27]!==m.indeterminate||t[28]!==T||t[29]!==r?(E=(0,B.jsx)(X,{label:r,checked:m.checked,indeterminate:m.indeterminate,disabled:T,onChange:d}),t[25]=d,t[26]=m.checked,t[27]=m.indeterminate,t[28]=T,t[29]=r,t[30]=E):E=t[30];let D;t[31]!==w||t[32]!==E?(D=(0,B.jsxs)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:[w,E]}),t[31]=w,t[32]=E,t[33]=D):D=t[33];let k;t[34]!==f||t[35]!==s?(k=s&&(0,B.jsx)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:f}),t[34]=f,t[35]=s,t[36]=k):k=t[36];let A;return t[37]!==D||t[38]!==k?(A=(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[D,k]}),t[37]=D,t[38]=k,t[39]=A):A=t[39],A}function he(e){let t=(0,F.c)(34),{icon:n,title:r,items:i,inventoryId:a,selected:o,disabled:s,onToggle:u,onToggleAll:f}=e,p=c(d(_e)).imports,[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(``),[v,y]=(0,N.useState)(60);if(!i.length)return null;let b;t[0]!==i||t[1]!==o?(b=L(i,o),t[0]=i,t[1]=o,t[2]=b):b=t[2];let x=b,S=Y(i,g),w=S.slice(0,v),T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>h(ge),t[3]=T):T=t[3];let E;t[4]===n?E=t[5]:(E=(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5 shrink-0 text-fg-muted`}),t[4]=n,t[5]=E);let D;t[6]!==i.length||t[7]!==r?(D=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg`,children:[r,` (`,i.length,`)`]}),t[6]=i.length,t[7]=r,t[8]=D):D=t[8];let k;t[9]!==x.availableCount||t[10]!==x.selectedCount?(k=(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[x.selectedCount,`/`,x.availableCount]}),t[9]=x.availableCount,t[10]=x.selectedCount,t[11]=k):k=t[11];let A=m&&`rotate-180`,j;t[12]===A?j=t[13]:(j=l(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,A),t[12]=A,t[13]=j);let M;t[14]===j?M=t[15]:(M=(0,B.jsx)(O,{"aria-hidden":`true`,className:j}),t[14]=j,t[15]=M);let P;t[16]!==m||t[17]!==E||t[18]!==D||t[19]!==k||t[20]!==M?(P=(0,B.jsxs)(C,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-1 text-left`,"aria-expanded":m,onClick:T,children:[E,D,k,M]}),t[16]=m,t[17]=E,t[18]=D,t[19]=k,t[20]=M,t[21]=P):P=t[21];let I=s||!x.availableCount,R;t[22]!==f||t[23]!==x.checked||t[24]!==x.indeterminate||t[25]!==I||t[26]!==r?(R=(0,B.jsx)(X,{label:r,checked:x.checked,indeterminate:x.indeterminate,disabled:I,onChange:f}),t[22]=f,t[23]=x.checked,t[24]=x.indeterminate,t[25]=I,t[26]=r,t[27]=R):R=t[27];let z;t[28]!==P||t[29]!==R?(z=(0,B.jsxs)(`div`,{className:`flex min-h-14 items-center gap-2 px-3 py-2`,children:[P,R]}),t[28]=P,t[29]=R,t[30]=z):z=t[30];let V=m&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge p-2`,children:[i.length>8&&(0,B.jsx)(J,{value:g,label:p.searchWithin.replace(`{group}`,r),onChange:e=>{_(e),y(60)}}),(0,B.jsx)(`div`,{className:`space-y-1`,children:w.map(e=>(0,B.jsx)(Z,{inventoryId:a,item:e,checked:o.has(e.id),disabled:s,onChange:t=>u(e,t)},e.id))}),!S.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:p.noMatches}),w.length<S.length&&(0,B.jsx)(C,{variant:`ghost`,className:`w-full`,onClick:()=>y(K),children:p.showMore.replace(`{count}`,String(S.length-w.length))})]}),H;return t[31]!==z||t[32]!==V?(H=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[z,V]}),t[31]=z,t[32]=V,t[33]=H):H=t[33],H}function K(e){return e+60}function ge(e){return!e}function _e(e){return e.language}function ve(e){let t=(0,F.c)(15),{inventoryId:n,projects:r,projectChildren:i,selected:a,disabled:o,onToggle:s}=e,l=c(d(ye)).imports,[u,f]=(0,N.useState)(``),[p,m]=(0,N.useState)(60),h;t[0]===i?h=t[1]:(h=e=>i.get(e.id)??[],t[0]=i,t[1]=h);let g=Y(r,u,h),_=g.slice(0,p),v=r.length>8&&(0,B.jsx)(J,{value:u,label:l.searchWithin.replace(`{group}`,l.kinds.project),onChange:e=>{f(e),m(60)}}),y;t[2]!==o||t[3]!==n||t[4]!==s||t[5]!==i||t[6]!==a?(y=e=>(0,B.jsx)(be,{inventoryId:n,project:e,children:i.get(e.id)??[],selected:a,disabled:o,onToggle:s},e.id),t[2]=o,t[3]=n,t[4]=s,t[5]=i,t[6]=a,t[7]=y):y=t[7];let b=_.map(y),x;t[8]===b?x=t[9]:(x=(0,B.jsx)(`div`,{className:`space-y-2`,children:b}),t[8]=b,t[9]=x);let S=!g.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:l.noMatches}),w=_.length<g.length&&(0,B.jsx)(C,{variant:`ghost`,className:`w-full`,onClick:()=>m(q),children:l.showMore.replace(`{count}`,String(g.length-_.length))}),T;return t[10]!==v||t[11]!==x||t[12]!==S||t[13]!==w?(T=(0,B.jsxs)(`div`,{className:`space-y-2`,children:[v,x,S,w]}),t[10]=v,t[11]=x,t[12]=S,t[13]=w,t[14]=T):T=t[14],T}function q(e){return e+60}function ye(e){return e.language}function be(e){let t=(0,F.c)(52),{inventoryId:n,project:r,children:i,selected:a,disabled:o,onToggle:s}=e,u=c(d(we)).imports,[f,p]=(0,N.useState)(!1),m;if(t[0]!==i||t[1]!==a){let e;t[3]===a?e=t[4]:(e=e=>a.has(e.id),t[3]=a,t[4]=e),m=i.filter(e),t[0]=i,t[1]=a,t[2]=m}else m=t[2];let h=m.length,g=C,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>p(Ce),t[5]=_):_=t[5];let v;t[6]===r.name?v=t[7]:(v=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=v);let y;t[8]===r.displayPath?y=t[9]:(y=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:r.displayPath}),t[8]=r.displayPath,t[9]=y);let b;t[10]!==v||t[11]!==y?(b=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[v,y]}),t[10]=v,t[11]=y,t[12]=b):b=t[12];let x=i.length>0&&(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[u.projectContents.replace(`{skills}`,String(i.filter(Se).length)).replace(`{context}`,String(i.filter(xe).length)),` · `,u.chosenCount.replace(`{count}`,String(h))]}),S=f&&`rotate-180`,w;t[13]===S?w=t[14]:(w=l(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,S),t[13]=S,t[14]=w);let T;t[15]===w?T=t[16]:(T=(0,B.jsx)(O,{"aria-hidden":`true`,className:w}),t[15]=w,t[16]=T);let E;t[17]!==g||t[18]!==f||t[19]!==x||t[20]!==T||t[21]!==_||t[22]!==b?(E=(0,B.jsxs)(g,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-2 text-left`,"aria-expanded":f,onClick:_,children:[b,x,T]}),t[17]=g,t[18]=f,t[19]=x,t[20]=T,t[21]=_,t[22]=b,t[23]=E):E=t[23];let D=r.name,k;t[24]!==r.id||t[25]!==a?(k=a.has(r.id),t[24]=r.id,t[25]=a,t[26]=k):k=t[26];let A;t[27]!==o||t[28]!==r?(A=o||!I(r),t[27]=o,t[28]=r,t[29]=A):A=t[29];let j;t[30]!==s||t[31]!==r?(j=e=>s(r,e.target.checked),t[30]=s,t[31]=r,t[32]=j):j=t[32];let M;t[33]!==r.name||t[34]!==k||t[35]!==A||t[36]!==j?(M=(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":D,checked:k,disabled:A,onChange:j}),t[33]=r.name,t[34]=k,t[35]=A,t[36]=j,t[37]=M):M=t[37];let P;t[38]!==E||t[39]!==M?(P=(0,B.jsxs)(`div`,{className:`flex items-center gap-2 p-2`,children:[E,M]}),t[38]=E,t[39]=M,t[40]=P):P=t[40];let L;t[41]!==i||t[42]!==o||t[43]!==n||t[44]!==s||t[45]!==f||t[46]!==a||t[47]!==u?(L=f&&(0,B.jsx)(`div`,{className:`border-t border-edge p-2`,children:i.length?(0,B.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>(0,B.jsx)(Z,{inventoryId:n,item:e,checked:a.has(e.id),disabled:o,onChange:t=>s(e,t)},e.id))}):(0,B.jsx)(`p`,{className:`p-2 text-xs text-fg-muted`,children:u.directoryOnly})}),t[41]=i,t[42]=o,t[43]=n,t[44]=s,t[45]=f,t[46]=a,t[47]=u,t[48]=L):L=t[48];let R;return t[49]!==P||t[50]!==L?(R=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[P,L]}),t[49]=P,t[50]=L,t[51]=R):R=t[51],R}function xe(e){return e.kind===`context`}function Se(e){return e.kind===`skill`}function Ce(e){return!e}function we(e){return e.language}function J(e){let t=(0,F.c)(13),{value:n,label:r,onChange:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,B.jsx)(D,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-fg-muted`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,B.jsx)(`span`,{className:`sr-only`,children:r}),t[1]=r,t[2]=o);let s=`${r}…`,c;t[3]===i?c=t[4]:(c=e=>i(e.target.value),t[3]=i,t[4]=c);let l;t[5]!==r||t[6]!==s||t[7]!==c||t[8]!==n?(l=(0,B.jsx)(`input`,{type:`search`,autoComplete:`off`,value:n,placeholder:s,"aria-label":r,onChange:c,className:`min-w-0 flex-1 border-0 bg-transparent px-0 py-2 text-sm text-fg placeholder:text-fg-subtle`}),t[5]=r,t[6]=s,t[7]=c,t[8]=n,t[9]=l):l=t[9];let u;return t[10]!==o||t[11]!==l?(u=(0,B.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,children:[a,o,l]}),t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function Y(e,t,n=()=>[]){let r=t.trim().toLocaleLowerCase();if(!r)return e;let i=e=>`${e.name} ${e.description} ${e.displayPath}`.toLocaleLowerCase().includes(r);return e.filter(e=>i(e)||n(e).some(i))}function X(e){let t=(0,F.c)(10),{label:n,checked:r,indeterminate:i,disabled:a,onChange:o}=e,s=(0,N.useRef)(null),c,l;t[0]===i?(c=t[1],l=t[2]):(c=()=>{s.current&&(s.current.indeterminate=i)},l=[i],t[0]=i,t[1]=c,t[2]=l),(0,N.useEffect)(c,l);let u;t[3]===o?u=t[4]:(u=e=>o(e.target.checked),t[3]=o,t[4]=u);let d;return t[5]!==r||t[6]!==a||t[7]!==n||t[8]!==u?(d=(0,B.jsx)(`input`,{ref:s,type:`checkbox`,"aria-label":n,checked:r,disabled:a,onChange:u}),t[5]=r,t[6]=a,t[7]=n,t[8]=u,t[9]=d):d=t[9],d}function Z(e){let t=(0,F.c)(52),{inventoryId:n,item:r,checked:i,disabled:a,onChange:o}=e,s=d(Te),l;t[0]===s?l=t[1]:(l=c(s),t[0]=s,t[1]=l);let u=l.imports,[f,p]=(0,N.useState)(),[m,h]=(0,N.useState)(``),[g,_]=(0,N.useState)(!1),v;t[2]!==n||t[3]!==r.id||t[4]!==f?(v=async function(){if(_(Q),!f)try{p(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;h(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=f,t[5]=v):v=t[5];let y=v,b;t[6]!==a||t[7]!==r?(b=a||!I(r),t[6]=a,t[7]=r,t[8]=b):b=t[8];let x;t[9]===o?x=t[10]:(x=e=>o(e.target.checked),t[9]=o,t[10]=x);let w;t[11]!==i||t[12]!==b||t[13]!==x?(w=(0,B.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:i,disabled:b,onChange:x}),t[11]=i,t[12]=b,t[13]=x,t[14]=w):w=t[14];let T;t[15]===r.name?T=t[16]:(T=(0,B.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:r.name}),t[15]=r.name,t[16]=T);let E;t[17]===r.displayPath?E=t[18]:(E=(0,B.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[17]=r.displayPath,t[18]=E);let D;t[19]!==T||t[20]!==E?(D=(0,B.jsxs)(`span`,{className:`min-w-0`,children:[T,E]}),t[19]=T,t[20]=E,t[21]=D):D=t[21];let O;t[22]!==w||t[23]!==D?(O=(0,B.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-start gap-3 py-1`,children:[w,D]}),t[22]=w,t[23]=D,t[24]=O):O=t[24];let k;t[25]!==r.name||t[26]!==r.status||t[27]!==u||t[28]!==y?(k=r.status!==`blocked`&&(0,B.jsx)(C,{variant:`ghost`,"aria-label":`${u.preview}: ${r.name}`,className:`h-9 shrink-0 px-2`,onClick:()=>void y(),children:u.preview}),t[25]=r.name,t[26]=r.status,t[27]=u,t[28]=y,t[29]=k):k=t[29];let A;t[30]!==O||t[31]!==k?(A=(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[O,k]}),t[30]=O,t[31]=k,t[32]=A):A=t[32];let j;t[33]===r.description?j=t[34]:(j=r.description&&(0,B.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:r.description}),t[33]=r.description,t[34]=j);let M;t[35]!==r.status||t[36]!==r.targetName||t[37]!==u?(M=r.status!==`ready`&&(0,B.jsxs)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:[u.statuses[r.status],r.status===`conflict`?` → ${r.targetName}`:``]}),t[35]=r.status,t[36]=r.targetName,t[37]=u,t[38]=M):M=t[38];let L;t[39]===r.reason?L=t[40]:(L=r.reason&&(0,B.jsx)(`p`,{className:`break-words pl-7 text-xs text-fg-muted`,children:r.reason}),t[39]=r.reason,t[40]=L);let R;t[41]!==f||t[42]!==m||t[43]!==g||t[44]!==u?(R=g&&(0,B.jsx)(`div`,{className:`ml-7 mt-2 rounded-lg border border-edge bg-surface-inset p-3`,children:m?(0,B.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:m}):f?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:f.text}),f.truncated&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:u.previewTruncated})]}):(0,B.jsx)(S,{sections:1})}),t[41]=f,t[42]=m,t[43]=g,t[44]=u,t[45]=R):R=t[45];let z;return t[46]!==A||t[47]!==j||t[48]!==M||t[49]!==L||t[50]!==R?(z=(0,B.jsxs)(`div`,{className:`min-w-0 rounded-lg px-2 py-1.5 hover:bg-surface-hover/60`,children:[A,j,M,L,R]}),t[46]=A,t[47]=j,t[48]=M,t[49]=L,t[50]=R,t[51]=z):z=t[51],z}function Q(e){return!e}function Te(e){return e.language}function $(){let e=c(d(e=>e.language)).imports,[t,n]=(0,N.useState)(),[r,s]=(0,N.useState)(),[l,u]=(0,N.useState)(!1),[f,p]=(0,N.useState)(),[m,h]=(0,N.useState)(new Set),[g,_]=(0,N.useState)(!1),[v,y]=(0,N.useState)(),[b,x]=(0,N.useState)(),[w,T]=(0,N.useState)(``),[E,D]=(0,N.useState)(``),[O,k]=(0,N.useState)(0),A=(0,N.useRef)(null),F=(0,N.useRef)(!1);(0,N.useEffect)(()=>{let e=new AbortController;return T(``),P(`/sources`,void 0,e.signal).then(e=>n(e.sources)).catch(t=>{e.signal.aborted||T(t instanceof Error?t.message:String(t))}),()=>{e.abort(),A.current?.abort()}},[O]);let I=(t?.flatMap(e=>e.lastImport?.status===`running`?[e.lastImport.id]:[])??[]).join(`,`);(0,N.useEffect)(()=>{if(!I)return;let e=new AbortController,t,n=async()=>{for(let t of I.split(`,`))try{let n=await P(`/runs/${t}`,void 0,e.signal);e.signal.aborted||L(n)}catch{}e.signal.aborted||(t=setTimeout(()=>void n(),3e3))};return t=setTimeout(()=>void n(),1500),()=>{e.abort(),clearTimeout(t)}},[I]);function L(e){n(t=>t?.map(t=>t.id===e.source?{...t,lastImport:e}:t)),e.status!==`running`&&y(t=>t?.requestId===e.id?void 0:t)}async function R(e){A.current?.abort();let t=new AbortController;A.current=t,s(e),u(!0),p(void 0),h(new Set),D(``),x(void 0),y(void 0);try{let n=await P(`/sources/${e}/scan`,{},t.signal);t.signal.aborted||(p(n),h(new Set(n.candidates.filter(e=>!e.parentId&&e.suggested).map(e=>e.id))))}catch(e){t.signal.aborted||D(e instanceof Error?e.message:String(e))}}async function z(){if(!f||!m.size||F.current)return;F.current=!0,_(!0),D(``),T(``);let e=v??{inventoryId:f.id,candidateIds:[...m],requestId:crypto.randomUUID(),retryOf:b};y(e);try{L(await P(`/runs`,e)),u(!1)}catch(e){let t=e instanceof Error?e.message:String(e);D(t),T(t);let n=e.body?.code;n&&[`invalid_input`,`inventory_stale`,`invalid_selection`,`missing_parent`,`not_found`,`conflict`].includes(n)&&y(void 0)}finally{F.current=!1,_(!1)}}async function H(e){s(e.source),u(!0),p(void 0),h(new Set),D(``),y(void 0),x(e.id),A.current?.abort();let t=new AbortController;A.current=t;try{let n=await P(`/inventories/${e.inventoryId}`,void 0,t.signal);if(t.signal.aborted)return;let r=new Set(e.items.filter(e=>e.status===`failed`).map(e=>e.candidateId));n.candidates.forEach(e=>{r.has(e.id)&&e.parentId&&r.add(e.parentId)}),p({...n,candidates:n.candidates.filter(e=>r.has(e.id))}),h(r)}catch(e){t.signal.aborted||D(e instanceof Error?e.message:String(e))}}let ee=t?.filter(e=>e.detected||e.lastImport);return(0,B.jsxs)(M,{children:[(0,B.jsx)(j,{title:e.title,subtitle:e.subtitle}),w&&(0,B.jsxs)(`div`,{role:`alert`,className:`rounded-xl bg-danger-soft p-4 text-sm text-danger`,children:[(0,B.jsx)(`p`,{children:w}),!t&&(0,B.jsx)(C,{variant:`ghost`,onClick:()=>k(e=>e+1),children:e.retry})]}),!t&&!w&&(0,B.jsx)(S,{sections:1}),t&&(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-base font-medium text-fg`,children:e.apps}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.detectedHint})]}),ee?.length?(0,B.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:ee.map(t=>(0,B.jsxs)(`article`,{className:`space-y-3 p-5 sm:p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg`,children:(0,B.jsx)(o,{className:`h-5 w-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-fg`,children:t.name}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.includes})]}),(0,B.jsx)(C,{variant:`secondary`,disabled:g||!t.detected||!!v&&r!==t.id||t.lastImport?.status===`running`,onClick:()=>{T(``),v&&r===t.id?u(!0):R(t.id)},children:g&&r===t.id?e.importing:v&&r===t.id?e.retry:t.lastImport?e.importAgain:e.import})]}),t.lastImport&&(0,B.jsxs)(`div`,{role:`status`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(a,{className:`h-4 w-4 shrink-0`}),t.lastImport.status===`running`?e.importing:t.lastImport.issues.length?e.finishedWithIssues:e.finished]}),(0,B.jsxs)(`p`,{children:[e.summary.replace(`{skills}`,String(t.lastImport.skills)).replace(`{context}`,String(t.lastImport.context)).replace(`{projects}`,String(t.lastImport.projects)),t.lastImport.skipped>0&&` · ${e.skipped.replace(`{count}`,String(t.lastImport.skipped))}`]}),!!t.lastImport.issues.length&&(0,B.jsxs)(`details`,{children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer text-fg`,children:[e.details,` (`,t.lastImport.issues.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.lastImport.issues.map((e,t)=>(0,B.jsxs)(`li`,{className:`break-words`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.name}),` — `,e.reason]},t))})]}),t.lastImport.status===`partial`&&(0,B.jsx)(C,{variant:`ghost`,disabled:g||!!v,onClick:()=>void H(t.lastImport),children:e.retryFailed})]})]},t.id))}):(0,B.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/20 p-6 text-sm text-fg-muted`,children:[(0,B.jsx)(`p`,{children:e.empty}),(0,B.jsx)(C,{variant:`ghost`,className:`mt-3`,onClick:()=>k(e=>e+1),children:e.refresh})]}),(0,B.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.footnote}),ee?.some(e=>e.lastImport)&&(0,B.jsxs)(`div`,{className:`flex gap-4 text-sm`,children:[(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/skills`,children:e.openSkills}),(0,B.jsx)(i,{className:`text-accent`,to:`/projects`,children:e.openProjects}),(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/connectors`,children:e.connections})]})]}),(0,B.jsx)(V,{open:l,sourceName:t?.find(e=>e.id===r)?.name??``,inventory:f,selected:m,onSelected:h,busy:g,locked:g||!!v,error:E,onClose:()=>{A.current?.abort(),u(!1)},onRefresh:()=>{r&&R(r)},onSubmit:()=>void z()})]})}export{$ as ImportsPage};