@xopcai/xopc 0.0.172 → 0.0.174
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-C3Y-bESI.js → activity-store-CyEDJeIt.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CPyev9P7.js → agent-avatar-dicebear-DF7Bol6I.js} +1 -1
- package/dist/gateway/static/root/assets/agents-BVxEFPQ5.js +2 -0
- package/dist/gateway/static/root/assets/{api-B7qEr_Rw.js → api-DYunqroX.js} +1 -1
- package/dist/gateway/static/root/assets/api-DwyUxpgY.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-Br_9-7fs.js → app-management-settings-panel-B4xJyvDu.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-uyLcRPai.js → appearance-settings-B2PQxRiu.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BtIgd82S.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-B19REnR5.js → archive-plugin-DWhBmmjD.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DLWCC4Yi.js → attachment-load-BOpZfa_I.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-ky5S5lly.js → automation-suggestion-card-Byu3I7Rs.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-CG_SCH5b.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CtPEzLlo.js → binary-plugins-6AG1qatz.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CQVR4Xij.js → block-editor-CJhrn98_.js} +5 -5
- package/dist/gateway/static/root/assets/browser-settings-page-CfLqPWZC.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-CimCGbhq.js → browser-workflow-inputs-CBVb4mt9.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-DewuCw3p.js → browser-workflows-page-Cq4XUKbu.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DCJmm6cR.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-B5RTs-Az.js → capability-presets-api-hbW4NAKO.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-CnkAYvWI.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-Czu0YzIZ.js → channel-recipient-api-CzMjHb17.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DtqqFpDn.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-C-5yHbc0.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-Di3gnR_D.js → connector-logo-B9Au6gMZ.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CaHfs8YF.js +2 -0
- package/dist/gateway/static/root/assets/copy-VueTIC2x.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-CvFMKYdb.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C3L6AI8_.js → desktop-pet-settings-CNff5TFb.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-Dvq4iG6P.js → directory-picker-path-field-Bf956uo-.js} +1 -1
- package/dist/gateway/static/root/assets/dreaming-settings-CHM8FE1g.js +3 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BecQjU0J.js → extension-debug-page-ZqM_0eUs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BeVkPSm-.js → extension-page-D4hvXOMM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DMoo2mKx.js → extension-settings-page-GsqxaJjA.js} +1 -1
- package/dist/gateway/static/root/assets/focus-detail-page-CE6uwrl1.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-Bthb3_6v.js → gateway-config-api-B4THmgnS.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-Bh8nPvJQ.js → gateway-settings-CPv-MxGE.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-D3USVm9D.js → gateway-startup-retry-MP3K71pP.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-DAeb82xP.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-CwLSp01r.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-C_2QWBtb.js → goals-config-api-DCcDuIjG.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-DvJQ6_4M.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-DhL643tc.js → goals-settings-o9QMXvNq.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-COVFwp7C.js → heartbeat-settings-DixwpXnH.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-BNQlnwpU.js → image-generation-api-BOGH9FGi.js} +1 -1
- package/dist/gateway/static/root/assets/index-CfXiRNN5.css +1 -0
- package/dist/gateway/static/root/assets/index-eyttVNS_.js +212 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DfdJRJVy.js → keyboard-shortcuts-settings-D4o4ZPF6.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CPcfqn_A.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BvCPOgoi.js → local-apps-page-GzMmpO7G.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BP0vD37A.js → locale-store-CAuhEGCn.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DXABWCZp.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-YO1rDk9m.js → markdown-split-CIX8D1pv.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CU_RRf-q.js → media-plugins-Bp3eIA45.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BiBdO1-O.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-CeFiOK3S.js → notes-page-RVFiYAoO.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DgJzZRX3.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-tiHmRJUA.js → page-tabs-BGAYH3Ef.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CU6XgaCz.js → preview-open-alternatives-BM6pDkHp.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-Dn4_qor4.js → product-open-page-BiMetEmn.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DF7F70Vg.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Cw3jyi5s.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-ChAJsaNY.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-edDUIbXo.js → save-bar-controls-BdjV8MK5.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-DqJO_5Yb.js → schedule-field-ChlqXU46.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CMh0jzy5.js → schema-form-DDKf5ZSH.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BxZIxt7z.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DcDLS0xV.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Bb0Bc3nJ.js → settings-form-section-CPG0KGVs.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DQhADvz1.js → settings-loading-skeleton-DRSDHucM.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-b0M5HukN.js → settings-page-CeB7_xD0.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-hvjtIjvh.js → settings-page-layout-BENrkwd0.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-4Xa9NA7v.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-rbeaOpTg.js → share-preview-page-DIzczJkG.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BpN0o5Cf.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DvF2UAaL.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CGKXpNfy.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-BHo_hgnL.js → system-settings-panel-Dp4d5Q1B.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-C3KnnjcU.js → theme-store-CbGc1laW.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-D-G-uwVJ.js → time-picker-BhgCeDuO.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-DtRnG-YI.js → typed-models-lib-DwPk3OPL.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CWWItX2g.js → use-channel-catalog-CXrEu2dw.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-Dy_fKAK_.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BTnltQHZ.js → voice-api-key-field-DFoA79LB.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BWkjb1NK.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-DLBNFse5.js +1 -0
- package/dist/gateway/static/root/assets/work-page-Bn5RXMIE.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D7vKChFZ.js → workflow-run-setup-panel-BuniGPO0.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-_vFhRrAl.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +3 -1
- package/dist/src/agent/agent-manager.js +4 -3
- package/dist/src/agent/capabilities/definitions.d.ts +2 -1
- package/dist/src/agent/capabilities/definitions.js +3 -1
- package/dist/src/agent/prompt/sections/tooling.js +4 -0
- package/dist/src/agent/service.d.ts +2 -1
- package/dist/src/agent/service.js +26 -0
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/install-target.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.d.ts +64 -0
- package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.js +27 -18
- package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
- package/dist/src/agent/skills/marketplace/search.d.ts +46 -0
- package/dist/src/agent/skills/marketplace/search.js +193 -0
- package/dist/src/agent/skills/skill-tool-gating.js +2 -1
- package/dist/src/agent/tools/delegate-tool.js +2 -0
- package/dist/src/agent/tools/factory.d.ts +4 -2
- package/dist/src/agent/tools/factory.js +11 -5
- package/dist/src/agent/tools/index.d.ts +2 -1
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/skill-install-tool.d.ts +17 -0
- package/dist/src/agent/tools/skill-install-tool.js +76 -8
- package/dist/src/agent/tools/skills-marketplace-search-tool.d.ts +17 -0
- package/dist/src/agent/tools/skills-marketplace-search-tool.js +77 -0
- package/dist/src/browser/providers/cloakbrowser.js +1 -1
- package/dist/src/capabilities/store-connector.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/extensions/api.js +1 -1
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/focuses/candidate-repository.d.ts +15 -0
- package/dist/src/focuses/candidate-repository.js +91 -0
- package/dist/src/focuses/index.d.ts +7 -0
- package/dist/src/focuses/index.js +7 -0
- package/dist/src/focuses/insight-repository.d.ts +22 -0
- package/dist/src/focuses/insight-repository.js +77 -0
- package/dist/src/focuses/prompts.d.ts +2 -0
- package/dist/src/focuses/prompts.js +18 -0
- package/dist/src/focuses/reconciler.d.ts +5 -0
- package/dist/src/focuses/reconciler.js +26 -0
- package/dist/src/focuses/repository.d.ts +61 -0
- package/dist/src/focuses/repository.js +214 -0
- package/dist/src/focuses/run-processor.d.ts +18 -0
- package/dist/src/focuses/run-processor.js +162 -0
- package/dist/src/focuses/service.d.ts +42 -0
- package/dist/src/focuses/service.js +241 -0
- package/dist/src/focuses/types.d.ts +89 -0
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.js +2 -0
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +2 -2
- package/dist/src/gateway/hono/routes/focuses.d.ts +3 -0
- package/dist/src/gateway/hono/routes/focuses.js +319 -0
- package/dist/src/gateway/hono/routes/home.js +15 -17
- package/dist/src/gateway/hono/routes/index.js +2 -0
- package/dist/src/gateway/hono/routes/projects.js +2 -103
- package/dist/src/gateway/hono/routes/work-discovery.js +0 -239
- package/dist/src/gateway/service/marketplace-service.js +1 -1
- package/dist/src/gateway/service.d.ts +1 -1
- package/dist/src/gateway/service.js +15 -11
- package/dist/src/storage/sqlite/migrations/066_first_class_focuses.sql +126 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/work-discovery/index.d.ts +0 -2
- package/dist/src/work-discovery/index.js +1 -3
- package/dist/src/work-discovery/service.d.ts +0 -30
- package/dist/src/work-discovery/service.js +1 -35
- package/dist/src/work-discovery/thread-service.d.ts +5 -0
- package/dist/src/work-discovery/thread-service.js +36 -88
- package/package.json +1 -1
- package/skills/tools/find-skills/SKILL.md +18 -428
- package/dist/gateway/static/root/assets/agents-Bf_kK2Ay.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-DXFCP5-1.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-D8pT1o2O.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Bav_skKN.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BHaYYo9E.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-BgchTh81.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-BP0e62wt.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DBWKfeGe.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CC5kh0de.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-D-ZUNHhn.js +0 -1
- package/dist/gateway/static/root/assets/dreaming-settings-D9i54kWO.js +0 -3
- package/dist/gateway/static/root/assets/goal-create-dialog-Dp0AyDHI.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-CNt7nrdS.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-Bm_NZFiZ.js +0 -2
- package/dist/gateway/static/root/assets/index-C_XSKOH6.css +0 -1
- package/dist/gateway/static/root/assets/index-DUasAutC.js +0 -212
- package/dist/gateway/static/root/assets/local-app-workbench-page-DZwkD1co.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-dNL0Y1dA.js +0 -7
- package/dist/gateway/static/root/assets/messages-BWtP5TFz.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-B8MKxpZb.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-CWBuuX-S.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BJSsLsXH.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DXJDb8vB.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DeHpWgxM.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cf-TEYUd.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BFyfed_g.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-CYnH9sTt.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Cr8_m-jS.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-Chtc1xDO.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-D7qMR26X.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-CpqFZze9.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-t4dXpGC0.js +0 -1
- package/dist/gateway/static/root/assets/work-page-BXwDKiMZ.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-Bos9HyqT.js +0 -11
- package/dist/src/proactive/calendar-signals.d.ts +0 -4
- package/dist/src/proactive/calendar-signals.js +0 -120
- package/dist/src/proactive/focus-service.d.ts +0 -62
- package/dist/src/proactive/focus-service.js +0 -173
- package/dist/src/proactive/index.d.ts +0 -7
- package/dist/src/proactive/index.js +0 -7
- package/dist/src/proactive/insight-repository.d.ts +0 -21
- package/dist/src/proactive/insight-repository.js +0 -109
- package/dist/src/proactive/run-processor.d.ts +0 -19
- package/dist/src/proactive/run-processor.js +0 -146
- package/dist/src/proactive/trial-expiry-reconciler.d.ts +0 -5
- package/dist/src/proactive/trial-expiry-reconciler.js +0 -30
- package/dist/src/proactive/types.d.ts +0 -66
- package/dist/src/proactive/value-score.d.ts +0 -13
- package/dist/src/proactive/value-score.js +0 -30
- package/dist/src/proactive/watch-repository.d.ts +0 -28
- package/dist/src/proactive/watch-repository.js +0 -129
- package/dist/src/work-discovery/governance.d.ts +0 -25
- package/dist/src/work-discovery/governance.js +0 -96
- package/dist/src/work-discovery/thread-repository.d.ts +0 -34
- package/dist/src/work-discovery/thread-repository.js +0 -112
- /package/dist/src/{proactive → focuses}/types.js +0 -0
|
@@ -0,0 +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{f as i,l as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./circle-alert-BEjgurr2.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-BiBdO1-O.js";import{n as u}from"./locale-store-CAuhEGCn.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$t as f,Ac as p,Bo as m,Cl as h,Cs as g,Eu as _,Go as v,Gs as y,Gt as b,Ho as x,Hs as S,Ht as C,Ic as w,Jl as T,Jt as E,Kt as D,Ls as O,Ms as k,Qt as A,Rc as j,Sc as M,Tl as N,To as P,Uo as F,Ut as I,Vo as L,Vs as R,Wo as z,Wt as B,Xt as V,Yl as H,Yt as U,Zt as W,ac as G,an as K,cn as ee,cu as q,dc as te,dn as ne,en as re,gn as ie,hn as J,hu as ae,in as oe,is as Y,ks as X,lc as se,ln as ce,ls as le,nn as ue,nr as de,ns as fe,on as pe,pn as me,pu as he,qo as Z,qt as ge,rn as _e,ro as ve,ru as ye,sn as be,tn as xe,ul as Se,un as Ce,us as we,uu as Te,vt as Ee,xu as De,zo as Oe}from"./index-eyttVNS_.js";import{t as ke}from"./page-tabs-BGAYH3Ef.js";import{t as Ae}from"./time-picker-BhgCeDuO.js";import{D as je,E as Me,t as Ne}from"./connector-logo-B9Au6gMZ.js";var Pe=n(),Q=e(t(),1),$=r();function Fe(e){let t=(0,Pe.c)(104),{value:n,onChange:r,labels:i,language:a,inputClassName:o}=e,s;t[0]===n.timezone?s=t[1]:(s=()=>J.some(e=>e.value===n.timezone)?``:n.timezone,t[0]=n.timezone,t[1]=s);let[l,u]=(0,Q.useState)(s),d;t[2]===n.timezone?d=t[3]:(d=()=>!!n.timezone&&!J.some(e=>e.value===n.timezone),t[2]=n.timezone,t[3]=d);let[f,p]=(0,Q.useState)(d),m;t[4]===n.pronouns?m=t[5]:(m=()=>!!n.pronouns&&!me.some(e=>e.value===n.pronouns),t[4]=n.pronouns,t[5]=m);let[h,_]=(0,Q.useState)(m),v;bb0:{if(f){v=`__custom__`;break bb0}v=J.some(e=>e.value===n.timezone)?n.timezone:`__custom__`}let y=v,b;t[6]!==r||t[7]!==n?(b=e=>r({...n,...e}),t[6]=r,t[7]=n,t[8]=b):b=t[8];let x=b,S;t[9]===a?S=t[10]:(S=(e,t)=>a===`zh`?t:e,t[9]=a,t[10]=S);let C=S,w;t[11]===i.callName?w=t[12]:(w=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.callName}),t[11]=i.callName,t[12]=w);let T;t[13]===x?T=t[14]:(T=e=>x({callName:e.target.value}),t[13]=x,t[14]=T);let E;t[15]!==o||t[16]!==i.callNamePlaceholder||t[17]!==T||t[18]!==n.callName?(E=(0,$.jsx)(`input`,{className:o,value:n.callName,onChange:T,placeholder:i.callNamePlaceholder,autoComplete:`off`}),t[15]=o,t[16]=i.callNamePlaceholder,t[17]=T,t[18]=n.callName,t[19]=E):E=t[19];let D;t[20]!==w||t[21]!==E?(D=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[w,E]}),t[20]=w,t[21]=E,t[22]=D):D=t[22];let O;t[23]===i.pronouns?O=t[24]:(O=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.pronouns}),t[23]=i.pronouns,t[24]=O);let k=h?`__custom__`:n.pronouns,A;t[25]!==x||t[26]!==n.pronouns?(A=e=>{if(e.target.value===`__custom__`){_(!0),me.some(e=>e.value===n.pronouns)&&x({pronouns:``});return}_(!1),x({pronouns:e.target.value})},t[25]=x,t[26]=n.pronouns,t[27]=A):A=t[27];let j;t[28]===i.pronounsPlaceholder?j=t[29]:(j=(0,$.jsx)(Y,{value:``,children:i.pronounsPlaceholder}),t[28]=i.pronounsPlaceholder,t[29]=j);let M;t[30]===C?M=t[31]:(M=me.map(e=>(0,$.jsx)(Y,{value:e.value,children:C(e.labelEn,e.labelZh)},e.value)),t[30]=C,t[31]=M);let N;t[32]===i.custom?N=t[33]:(N=(0,$.jsx)(Y,{value:`__custom__`,children:i.custom}),t[32]=i.custom,t[33]=N);let P;t[34]!==o||t[35]!==k||t[36]!==A||t[37]!==j||t[38]!==M||t[39]!==N?(P=(0,$.jsxs)(fe,{className:o,value:k,onChange:A,children:[j,M,N]}),t[34]=o,t[35]=k,t[36]=A,t[37]=j,t[38]=M,t[39]=N,t[40]=P):P=t[40];let F;t[41]!==o||t[42]!==i.pronounsPlaceholder||t[43]!==h||t[44]!==x||t[45]!==n.pronouns?(F=h?(0,$.jsx)(`input`,{className:c(o,`mt-1 text-xs`),value:n.pronouns,onChange:e=>x({pronouns:e.target.value}),placeholder:i.pronounsPlaceholder,autoComplete:`off`}):null,t[41]=o,t[42]=i.pronounsPlaceholder,t[43]=h,t[44]=x,t[45]=n.pronouns,t[46]=F):F=t[46];let I;t[47]!==O||t[48]!==P||t[49]!==F?(I=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[O,P,F]}),t[47]=O,t[48]=P,t[49]=F,t[50]=I):I=t[50];let L;t[51]===i.timezone?L=t[52]:(L=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[51]=i.timezone,t[52]=L);let R;t[53]===o?R=t[54]:(R=c(o,`min-w-0 flex-1`),t[53]=o,t[54]=R);let z;t[55]===x?z=t[56]:(z=e=>{if(e.target.value===`__custom__`){p(!0);return}p(!1),u(``),x({timezone:e.target.value})},t[55]=x,t[56]=z);let B;t[57]===C?B=t[58]:(B=J.map(e=>(0,$.jsx)(Y,{value:e.value,children:C(e.labelEn,e.labelZh)},e.value)),t[57]=C,t[58]=B);let V;t[59]===i.timezoneCustom?V=t[60]:(V=(0,$.jsx)(Y,{value:`__custom__`,children:i.timezoneCustom}),t[59]=i.timezoneCustom,t[60]=V);let H;t[61]!==R||t[62]!==z||t[63]!==B||t[64]!==V||t[65]!==y?(H=(0,$.jsxs)(fe,{className:R,value:y,onChange:z,children:[B,V]}),t[61]=R,t[62]=z,t[63]=B,t[64]=V,t[65]=y,t[66]=H):H=t[66];let U;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(U=c(`shrink-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,g.press),t[67]=U):U=t[67];let W;t[68]===x?W=t[69]:(W=()=>{let e=ie();if(!e)return;let t=J.some(t=>t.value===e);p(!t),u(t?``:e),x({timezone:e})},t[68]=x,t[69]=W);let G;t[70]!==i.timezoneDetect||t[71]!==W?(G=(0,$.jsx)(`button`,{type:`button`,className:U,onClick:W,children:i.timezoneDetect}),t[70]=i.timezoneDetect,t[71]=W,t[72]=G):G=t[72];let K;t[73]!==H||t[74]!==G?(K=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[H,G]}),t[73]=H,t[74]=G,t[75]=K):K=t[75];let ee;t[76]!==l||t[77]!==o||t[78]!==f||t[79]!==x?(ee=f?(0,$.jsx)(`input`,{className:c(o,`mt-1 font-mono text-xs`),value:l,onChange:e=>{u(e.target.value),x({timezone:e.target.value})},placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null,t[76]=l,t[77]=o,t[78]=f,t[79]=x,t[80]=ee):ee=t[80];let q;t[81]!==L||t[82]!==K||t[83]!==ee?(q=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[L,K,ee]}),t[81]=L,t[82]=K,t[83]=ee,t[84]=q):q=t[84];let te;t[85]===i.notes?te=t[86]:(te=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.notes}),t[85]=i.notes,t[86]=te);let ne;t[87]===o?ne=t[88]:(ne=c(o,`min-h-28 resize-y text-sm leading-relaxed`),t[87]=o,t[88]=ne);let re;t[89]===x?re=t[90]:(re=e=>x({notes:e.target.value}),t[89]=x,t[90]=re);let ae;t[91]!==i.notesPlaceholder||t[92]!==ne||t[93]!==re||t[94]!==n.notes?(ae=(0,$.jsx)(`textarea`,{className:ne,value:n.notes,onChange:re,placeholder:i.notesPlaceholder,rows:5,spellCheck:!0}),t[91]=i.notesPlaceholder,t[92]=ne,t[93]=re,t[94]=n.notes,t[95]=ae):ae=t[95];let oe;t[96]!==te||t[97]!==ae?(oe=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[te,ae]}),t[96]=te,t[97]=ae,t[98]=oe):oe=t[98];let X;return t[99]!==D||t[100]!==I||t[101]!==q||t[102]!==oe?(X=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[D,I,q,oe]}),t[99]=D,t[100]=I,t[101]=q,t[102]=oe,t[103]=X):X=t[103],X}function Ie(e){let t=(0,Pe.c)(57),{open:n,t:r,onOpenChange:i,onNavigate:a}=e,o;t[0]!==r.helpLearningBody||t[1]!==r.helpLearningTitle?(o={icon:De,title:r.helpLearningTitle,body:r.helpLearningBody},t[0]=r.helpLearningBody,t[1]=r.helpLearningTitle,t[2]=o):o=t[2];let s;t[3]!==r.helpSharingBody||t[4]!==r.helpSharingTitle?(s={icon:O,title:r.helpSharingTitle,body:r.helpSharingBody},t[3]=r.helpSharingBody,t[4]=r.helpSharingTitle,t[5]=s):s=t[5];let l;t[6]!==r.helpSourcesBody||t[7]!==r.helpSourcesTitle?(l={icon:H,title:r.helpSourcesTitle,body:r.helpSourcesBody},t[6]=r.helpSourcesBody,t[7]=r.helpSourcesTitle,t[8]=l):l=t[8];let u;t[9]!==r.helpControlBody||t[10]!==r.helpControlTitle?(u={icon:se,title:r.helpControlTitle,body:r.helpControlBody},t[9]=r.helpControlBody,t[10]=r.helpControlTitle,t[11]=u):u=t[11];let d;t[12]!==o||t[13]!==s||t[14]!==l||t[15]!==u?(d=[o,s,l,u],t[12]=o,t[13]=s,t[14]=l,t[15]=u,t[16]=d):d=t[16];let f=d,p;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(F,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,we)}),t[17]=p):p=t[17];let h;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(h=c(`fixed right-3 top-1/2 flex h-[min(44rem,calc(100dvh-1.5rem))] w-[min(30rem,calc(100vw-1.5rem))] -translate-y-1/2 flex-col overflow-hidden`,le,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`),t[18]=h):h=t[18];let g;t[19]===r.helpTitle?g=t[20]:(g=(0,$.jsx)(v,{className:`text-base font-semibold text-fg`,children:r.helpTitle}),t[19]=r.helpTitle,t[20]=g);let _;t[21]===r.helpSubtitle?_=t[22]:(_=(0,$.jsx)(x,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.helpSubtitle}),t[21]=r.helpSubtitle,t[22]=_);let y;t[23]!==g||t[24]!==_?(y=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[23]=g,t[24]=_,t[25]=y):y=t[25];let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[26]=b):b=t[26];let S;t[27]===r.close?S=t[28]:(S=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":r.close,children:b})}),t[27]=r.close,t[28]=S);let C;t[29]!==y||t[30]!==S?(C=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[y,S]}),t[29]=y,t[30]=S,t[31]=C):C=t[31];let w;t[32]===f?w=t[33]:(w=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-2`,children:f.map(Le)}),t[32]=f,t[33]=w);let T;t[34]!==a||t[35]!==i?(T=()=>{i(!1),a(`sources`)},t[34]=a,t[35]=i,t[36]=T):T=t[36];let E;t[37]!==r.tabs.sources||t[38]!==T?(E=(0,$.jsx)(X,{type:`button`,variant:`ghost`,onClick:T,children:r.tabs.sources}),t[37]=r.tabs.sources,t[38]=T,t[39]=E):E=t[39];let D;t[40]!==a||t[41]!==i?(D=()=>{i(!1),a(`privacy`)},t[40]=a,t[41]=i,t[42]=D):D=t[42];let A;t[43]!==r.openPrivacyControls||t[44]!==D?(A=(0,$.jsx)(X,{type:`button`,variant:`secondary`,onClick:D,children:r.openPrivacyControls}),t[43]=r.openPrivacyControls,t[44]=D,t[45]=A):A=t[45];let j;t[46]!==E||t[47]!==A?(j=(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[E,A]}),t[46]=E,t[47]=A,t[48]=j):j=t[48];let M;t[49]!==C||t[50]!==w||t[51]!==j?(M=(0,$.jsxs)(z,{children:[p,(0,$.jsxs)(L,{className:h,children:[C,w,j]})]}),t[49]=C,t[50]=w,t[51]=j,t[52]=M):M=t[52];let N;return t[53]!==i||t[54]!==n||t[55]!==M?(N=(0,$.jsx)(Oe,{open:n,onOpenChange:i,children:M}),t[53]=i,t[54]=n,t[55]=M,t[56]=N):N=t[56],N}function Le(e){let{icon:t,title:n,body:r}=e;return(0,$.jsxs)(`section`,{className:`flex gap-3 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-muted text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r})]})]},n)}function Re(e){let t=(0,Pe.c)(33),{source:n,language:r,busy:i,onOpenChange:a,onConfirm:o}=e,s=l(r).you,[u,d]=(0,Q.useState)(!1),f=n?.accountLabel??(n?.accountCount&&n.accountCount>1&&n.accountOrdinal?s.sourceAccountFallback.replace(`{{index}}`,String(n.accountOrdinal)).replace(`{{count}}`,String(n.accountCount)):void 0),p,h;t[0]===n?(p=t[1],h=t[2]):(p=()=>{n&&d(!1)},h=[n],t[0]=n,t[1]=p,t[2]=h),(0,Q.useEffect)(p,h);let g;t[3]!==i||t[4]!==a?(g=e=>!i&&a(e),t[3]=i,t[4]=a,t[5]=g):g=t[5];let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[6]=_):_=t[6];let b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[7]=b):b=t[7];let C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>d(!1),t[8]=C):C=t[8];let w=u?`border-edge-subtle hover:bg-surface-hover`:`border-accent/40 bg-accent-soft/35`,T;t[9]===w?T=t[10]:(T=c(`flex w-full items-start gap-3 rounded-xl border p-4 text-left`,w),t[9]=w,t[10]=T);let E;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(H,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[11]=E):E=t[11];let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>d(!0),t[12]=D):D=t[12];let O=u?`border-danger/40 bg-danger-soft`:`border-edge-subtle hover:bg-surface-hover`,A;t[13]===O?A=t[14]:(A=c(`flex w-full items-start gap-3 rounded-xl border p-4 text-left disabled:cursor-not-allowed disabled:opacity-55`,O),t[13]=O,t[14]=A);let j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(y,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),t[15]=j):j=t[15];let M=s.disconnectDeleteBody.replace(`{{count}}`,String(n?.derivedUnderstandingCount??0)),N;t[16]===M?N=t[17]:(N=(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:M}),t[16]=M,t[17]=N);let P;t[18]!==i||t[19]!==s.cancel?(P=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:`ghost`,disabled:i,children:s.cancel})}),t[18]=i,t[19]=s.cancel,t[20]=P):P=t[20];let I=u?`border-danger/35 text-danger hover:bg-danger-soft`:void 0,R;t[21]!==u||t[22]!==o?(R=()=>o(u),t[21]=u,t[22]=o,t[23]=R):R=t[23];let B;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0}),t[24]=B):B=t[24];let V=i?s.disconnecting:s.disconnectAction,U;t[25]!==i||t[26]!==I||t[27]!==R||t[28]!==V?(U=(0,$.jsxs)(X,{type:`button`,variant:`secondary`,className:I,disabled:i,onClick:R,children:[B,V]}),t[25]=i,t[26]=I,t[27]=R,t[28]=V,t[29]=U):U=t[29];let W;return t[30]!==P||t[31]!==U?(W=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:[P,U]}),t[30]=P,t[31]=U,t[32]=W):W=t[32],(0,$.jsx)(Oe,{open:n!==null,onOpenChange:g,children:(0,$.jsxs)(z,{children:[_,(0,$.jsxs)(L,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(31rem,calc(100dvh-2rem))] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(v,{className:`text-base font-semibold text-fg`,children:s.disconnectTitle}),(0,$.jsx)(x,{className:`mt-1 text-sm text-fg-muted`,children:s.disconnectBody.replace(`{{source}}`,n?.displayName??``)})]}),(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":s.cancel,disabled:i,children:b})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs leading-5 text-fg-muted`,children:[f?(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:s.disconnectAccount.replace(`{{account}}`,f)}):null,(0,$.jsx)(`p`,{children:s.disconnectImpact.replace(`{{items}}`,String(n?.knowledgeItemCount??0)).replace(`{{understandings}}`,String(n?.derivedUnderstandingCount??0))})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":!u,onClick:C,className:T,children:[E,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:s.disconnectKeepTitle}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:s.disconnectKeepBody})]})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":u,onClick:D,disabled:!n?.derivedUnderstandingCount,className:A,children:[j,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:s.disconnectDeleteTitle}),N]})]})]}),W]})]})})}var ze={"composio-gmail":`gmail`,"composio-googledrive":`google-drive`,"composio-notion":`notion`,"composio-slack":`slack`,memory:`memory`};function Be(e){if(e.branding?.logoUrl)return e.branding;let t=ze[e.id];return t?{...e.branding,logoUrl:`/connector-icons/${t}.svg`}:e.branding}function Ve(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replace(`{{${t}}}`,String(n)),e)}function He(e){return e.status===`active`||e.status===`connected`}function Ue(e,t){return!He(e)||e.learning?.status===`failed`||e.lastSyncStatus===`failed`?{summary:t.sourceNeedsAttention,tone:`attention`,badge:t.attentionTitle}:e.learning?.status===`paused`?{summary:t.sourcePausedSummary,tone:`paused`,badge:t.paused}:e.learning?.status===`queued`||e.learning?.status===`running`?{summary:t.sourceReading,tone:`learning`}:e.learningFunnel.provisionalClaims>0?{summary:Ve(t.sourcePendingReview,{count:e.learningFunnel.provisionalClaims}),tone:`review`}:e.learningFunnel.activeClaims>0?{summary:Ve(t.sourceReliable,{count:e.learningFunnel.activeClaims}),tone:`useful`}:e.learningFunnel.attributedItems>0?{summary:Ve(t.sourceStillLearning,{count:e.learningFunnel.attributedItems}),tone:`learning`}:e.learningFunnel.indexedItems>0?{summary:Ve(t.sourceNoPersonalSignal,{count:e.learningFunnel.indexedItems}),tone:`neutral`}:e.learning?.status===`completed`?{summary:t.sourceNoRecentSignal,tone:`neutral`}:{summary:t.sourcePreparing,tone:`learning`}}function We(e,t){let n=e.id.toLocaleLowerCase();return/(github|gitlab|linear|jira)/.test(n)?t.sourcePurposeWork:/(gmail|outlook|slack|teams)/.test(n)?t.sourcePurposeCommunication:/calendar/.test(n)?t.sourcePurposeSchedule:/(docs|drive|notion|sheets|excel|onedrive|one-drive|local-files)/.test(n)?t.sourcePurposeDocuments:t.sourcePurposeDefault}function Ge(e,t){return e.accountLabel?e.accountLabel:e.accountCount&&e.accountCount>1&&e.accountOrdinal?Ve(t.sourceAccountFallback,{index:e.accountOrdinal,count:e.accountCount}):t.sourceUnknownAccount}function Ke(e){return e.lastSyncAt??e.learning?.updatedAt??e.lastActivityAt??e.lastConnectedAt}function qe(e,t){let n=Date.parse(e);return Number.isFinite(n)?Ee(n,t):e}function Je(e,t){return{attention:0,learning:1,review:2,useful:3,paused:4,neutral:5}[Ue(e,t).tone]}function Ye(e){let t=(0,Pe.c)(173),{source:n,language:r,t:i,busy:a,onOpenChange:o,onLearn:s,onPause:l,onConfigure:u,onDisconnect:d,onViewUnderstanding:f}=e;if(!n)return null;let p;t[0]!==n||t[1]!==i?(p=Ue(n,i),t[0]=n,t[1]=i,t[2]=p):p=t[2];let h=p,g,_,y,b,C,w,T,E,D,O,A,N,P,I,R,B;if(t[3]!==r||t[4]!==o||t[5]!==f||t[6]!==h.summary||t[7]!==h.tone||t[8]!==n||t[9]!==i){let e=Ke(n);b=n.learning?.status===`paused`,C=h.tone===`attention`,y=Oe,T=!0,E=o,_=z,t[26]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[26]=w):w=t[26],g=L,R=`fixed inset-y-0 right-0 z-[131] flex h-dvh w-[min(34rem,100vw)] flex-col overflow-hidden border-l border-edge bg-surface-panel shadow-elevated`;let a=n.displayName,s;t[27]===n?s=t[28]:(s=Be(n),t[27]=n,t[28]=s);let l;t[29]!==n.displayName||t[30]!==s?(l=(0,$.jsx)(Ne,{connector:{displayName:a,branding:s},size:`sm`}),t[29]=n.displayName,t[30]=s,t[31]=l):l=t[31];let u;t[32]===n.displayName?u=t[33]:(u=(0,$.jsx)(v,{className:`truncate text-base font-semibold text-fg`,children:n.displayName}),t[32]=n.displayName,t[33]=u);let d;t[34]!==n||t[35]!==i?(d=Ge(n,i),t[34]=n,t[35]=i,t[36]=d):d=t[36];let p;t[37]===d?p=t[38]:(p=(0,$.jsx)(x,{className:`mt-0.5 truncate text-sm text-fg-muted`,children:d}),t[37]=d,t[38]=p);let S;t[39]!==u||t[40]!==p?(S=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,p]}),t[39]=u,t[40]=p,t[41]=S):S=t[41];let j;t[42]!==l||t[43]!==S?(j=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[l,S]}),t[42]=l,t[43]=S,t[44]=j):j=t[44];let M;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[45]=M):M=t[45];let V;t[46]===i.close?V=t[47]:(V=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":i.close,children:M})}),t[46]=i.close,t[47]=V),t[48]!==j||t[49]!==V?(B=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[j,V]}),t[48]=j,t[49]=V,t[50]=B):B=t[50],P=`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`;let H;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(De,{className:`size-4 text-accent`,"aria-hidden":!0}),t[51]=H):H=t[51];let U;t[52]===i.sourceOutcomeTitle?U=t[53]:(U=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[H,i.sourceOutcomeTitle]}),t[52]=i.sourceOutcomeTitle,t[53]=U);let W=h.tone===`attention`?`border-warning/30 bg-warning-soft text-fg`:`border-edge-subtle bg-surface-muted text-fg`,G;t[54]===W?G=t[55]:(G=c(`mt-3 rounded-xl border px-4 py-3 text-sm leading-6`,W),t[54]=W,t[55]=G);let K;t[56]!==h.summary||t[57]!==G?(K=(0,$.jsx)(`p`,{className:G,children:h.summary}),t[56]=h.summary,t[57]=G,t[58]=K):K=t[58];let ee;t[59]===n.learningFunnel.activeClaims?ee=t[60]:(ee=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.activeClaims}),t[59]=n.learningFunnel.activeClaims,t[60]=ee);let q;t[61]===i.sourceReliableMetric?q=t[62]:(q=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourceReliableMetric}),t[61]=i.sourceReliableMetric,t[62]=q);let te;t[63]!==ee||t[64]!==q?(te=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[ee,q]}),t[63]=ee,t[64]=q,t[65]=te):te=t[65];let ne;t[66]===n.learningFunnel.provisionalClaims?ne=t[67]:(ne=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.provisionalClaims}),t[66]=n.learningFunnel.provisionalClaims,t[67]=ne);let re;t[68]===i.sourcePendingMetric?re=t[69]:(re=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourcePendingMetric}),t[68]=i.sourcePendingMetric,t[69]=re);let ie;t[70]!==ne||t[71]!==re?(ie=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[ne,re]}),t[70]=ne,t[71]=re,t[72]=ie):ie=t[72];let J;t[73]!==te||t[74]!==ie?(J=(0,$.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[te,ie]}),t[73]=te,t[74]=ie,t[75]=J):J=t[75];let oe;t[76]!==f||t[77]!==n.learningFunnel.activeClaims||t[78]!==n.learningFunnel.provisionalClaims||t[79]!==i.sourceViewUnderstanding?(oe=n.learningFunnel.activeClaims>0||n.learningFunnel.provisionalClaims>0?(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`mt-2 px-2`,onClick:f,children:[i.sourceViewUnderstanding,(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0})]}):null,t[76]=f,t[77]=n.learningFunnel.activeClaims,t[78]=n.learningFunnel.provisionalClaims,t[79]=i.sourceViewUnderstanding,t[80]=oe):oe=t[80],t[81]!==U||t[82]!==K||t[83]!==J||t[84]!==oe?(I=(0,$.jsxs)(`section`,{children:[U,K,J,oe]}),t[81]=U,t[82]=K,t[83]=J,t[84]=oe,t[85]=I):I=t[85],D=`border-t border-edge-subtle pt-5`;let Y;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,$.jsx)(ye,{className:`size-4 text-accent`,"aria-hidden":!0}),t[86]=Y):Y=t[86],t[87]===i.sourceRecentRunTitle?O=t[88]:(O=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[Y,i.sourceRecentRunTitle]}),t[87]=i.sourceRecentRunTitle,t[88]=O);let se;t[89]!==n.learningFunnel.activeClaims||t[90]!==n.learningFunnel.attributedItems||t[91]!==n.learningFunnel.indexedItems||t[92]!==i.sourceRecentRunSummary?(se=Ve(i.sourceRecentRunSummary,{indexed:n.learningFunnel.indexedItems,attributed:n.learningFunnel.attributedItems,claims:n.learningFunnel.activeClaims}),t[89]=n.learningFunnel.activeClaims,t[90]=n.learningFunnel.attributedItems,t[91]=n.learningFunnel.indexedItems,t[92]=i.sourceRecentRunSummary,t[93]=se):se=t[93],t[94]===se?A=t[95]:(A=(0,$.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:se}),t[94]=se,t[95]=A),N=e?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:Ve(i.sourceUpdatedAt,{time:qe(e,r)})}):null,t[3]=r,t[4]=o,t[5]=f,t[6]=h.summary,t[7]=h.tone,t[8]=n,t[9]=i,t[10]=g,t[11]=_,t[12]=y,t[13]=b,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D,t[19]=O,t[20]=A,t[21]=N,t[22]=P,t[23]=I,t[24]=R,t[25]=B}else g=t[10],_=t[11],y=t[12],b=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18],O=t[19],A=t[20],N=t[21],P=t[22],I=t[23],R=t[24],B=t[25];let V;t[96]!==D||t[97]!==O||t[98]!==A||t[99]!==N?(V=(0,$.jsxs)(`section`,{className:D,children:[O,A,N]}),t[96]=D,t[97]=O,t[98]=A,t[99]=N,t[100]=V):V=t[100];let H;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(se,{className:`size-4 text-accent`,"aria-hidden":!0}),t[101]=H):H=t[101];let U;t[102]===i.sourceAccessTitle?U=t[103]:(U=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[H,i.sourceAccessTitle]}),t[102]=i.sourceAccessTitle,t[103]=U);let W;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(he,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[104]=W):W=t[104];let K;t[105]===i.sourceReadAccess?K=t[106]:(K=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[W,(0,$.jsx)(`span`,{children:i.sourceReadAccess})]}),t[105]=i.sourceReadAccess,t[106]=K);let ee;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(he,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[107]=ee):ee=t[107];let q;t[108]===i.sourceMemoryAccess?q=t[109]:(q=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[ee,(0,$.jsx)(`span`,{children:i.sourceMemoryAccess})]}),t[108]=i.sourceMemoryAccess,t[109]=q);let ne;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(se,{className:`mt-1 size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[110]=ne):ne=t[110];let re=n.access.write?i.sourceWriteAccess:i.sourceNoWriteAccess,ie;t[111]===re?ie=t[112]:(ie=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[ne,(0,$.jsx)(`span`,{children:re})]}),t[111]=re,t[112]=ie);let J;t[113]!==K||t[114]!==q||t[115]!==ie?(J=(0,$.jsxs)(`ul`,{className:`mt-3 space-y-2 text-sm leading-6 text-fg-muted`,children:[K,q,ie]}),t[113]=K,t[114]=q,t[115]=ie,t[116]=J):J=t[116];let oe;t[117]!==U||t[118]!==J?(oe=(0,$.jsxs)(`section`,{className:`border-t border-edge-subtle pt-5`,children:[U,J]}),t[117]=U,t[118]=J,t[119]=oe):oe=t[119];let Y;t[120]!==V||t[121]!==oe||t[122]!==P||t[123]!==I?(Y=(0,$.jsxs)(`div`,{className:P,children:[I,V,oe]}),t[120]=V,t[121]=oe,t[122]=P,t[123]=I,t[124]=Y):Y=t[124];let ce;t[125]===i.sourceManagementTitle?ce=t[126]:(ce=(0,$.jsx)(`p`,{className:`mb-2 px-1 text-xs font-medium text-fg-subtle`,children:i.sourceManagementTitle}),t[125]=i.sourceManagementTitle,t[126]=ce);let le;t[127]!==a||t[128]!==b||t[129]!==C||t[130]!==s||t[131]!==l||t[132]!==n||t[133]!==i.sourcePauseLearning||t[134]!==i.sourceResumeLearning||t[135]!==i.sourceRetryLearning?(le=He(n)?b||C?(0,$.jsxs)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>s(n),children:[a?(0,$.jsx)(M,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(G,{className:`size-4`,"aria-hidden":!0}),C?i.sourceRetryLearning:i.sourceResumeLearning]}):(0,$.jsxs)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>l(n),children:[(0,$.jsx)(j,{className:`size-4`,"aria-hidden":!0}),i.sourcePauseLearning]}):null,t[127]=a,t[128]=b,t[129]=C,t[130]=s,t[131]=l,t[132]=n,t[133]=i.sourcePauseLearning,t[134]=i.sourceResumeLearning,t[135]=i.sourceRetryLearning,t[136]=le):le=t[136];let ue;t[137]!==u||t[138]!==n?(ue=()=>u(n),t[137]=u,t[138]=n,t[139]=ue):ue=t[139];let de;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t[140]=de):de=t[140];let fe;t[141]!==i.sourceConnectionSettings||t[142]!==ue?(fe=(0,$.jsxs)(X,{type:`button`,variant:`secondary`,onClick:ue,children:[de,i.sourceConnectionSettings]}),t[141]=i.sourceConnectionSettings,t[142]=ue,t[143]=fe):fe=t[143];let pe;t[144]!==d||t[145]!==n?(pe=()=>d(n),t[144]=d,t[145]=n,t[146]=pe):pe=t[146];let me;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0}),t[147]=me):me=t[147];let Z;t[148]!==i.disconnect||t[149]!==pe?(Z=(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`ml-auto text-danger hover:bg-danger-soft hover:text-danger`,onClick:pe,children:[me,i.disconnect]}),t[148]=i.disconnect,t[149]=pe,t[150]=Z):Z=t[150];let ge;t[151]!==le||t[152]!==fe||t[153]!==Z?(ge=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[le,fe,Z]}),t[151]=le,t[152]=fe,t[153]=Z,t[154]=ge):ge=t[154];let _e;t[155]!==ce||t[156]!==ge?(_e=(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:[ce,ge]}),t[155]=ce,t[156]=ge,t[157]=_e):_e=t[157];let ve;t[158]!==g||t[159]!==Y||t[160]!==_e||t[161]!==R||t[162]!==B?(ve=(0,$.jsxs)(g,{className:R,children:[B,Y,_e]}),t[158]=g,t[159]=Y,t[160]=_e,t[161]=R,t[162]=B,t[163]=ve):ve=t[163];let be;t[164]!==_||t[165]!==w||t[166]!==ve?(be=(0,$.jsxs)(_,{children:[w,ve]}),t[164]=_,t[165]=w,t[166]=ve,t[167]=be):be=t[167];let xe;return t[168]!==y||t[169]!==T||t[170]!==E||t[171]!==be?(xe=(0,$.jsx)(y,{open:T,onOpenChange:E,children:be}),t[168]=y,t[169]=T,t[170]=E,t[171]=be,t[172]=xe):xe=t[172],xe}function Xe(e){let t=(0,Pe.c)(69),{sources:n,language:r,t:i,busyId:a,onAddSource:o,onLearn:l,onPause:u,onConfigure:d,onDisconnect:f,onViewUnderstanding:m}=e,[h,g]=(0,Q.useState)(null),_;if(t[0]!==n||t[1]!==i){let e=n.filter(Qe),r=new Map;for(let t of e){let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}let a;t[3]===i?a=t[4]:(a=(e,t)=>Math.min(...e.accounts.map(e=>Je(e,i)))-Math.min(...t.accounts.map(e=>Je(e,i)))||e.source.displayName.localeCompare(t.source.displayName),t[3]=i,t[4]=a),_=[...r.values()].map(e=>({source:e[0],accounts:e.sort((e,t)=>Je(e,i)-Je(t,i)||Ge(e,i).localeCompare(Ge(t,i)))})).sort(a),t[0]=n,t[1]=i,t[2]=_}else _=t[2];let v=_,y,b,x,S,C,w,T,E,D;if(t[5]!==v||t[6]!==h||t[7]!==n||t[8]!==i.sourceConnectedSummary||t[9]!==i.sourcesSubtitle||t[10]!==i.sourcesTitle){let e=v.reduce(Ze,0),r;t[20]!==h||t[21]!==n?(r=h?n.find(e=>e.instanceId===h)??null:null,t[20]=h,t[21]=n,t[22]=r):r=t[22],y=r,w=`you-panel-sources`,T=`tabpanel`,E=`you-tab-sources`,D=`space-y-5`,C=`flex flex-wrap items-start justify-between gap-3`,t[23]===i.sourcesTitle?b=t[24]:(b=(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.sourcesTitle}),t[23]=i.sourcesTitle,t[24]=b),t[25]===i.sourcesSubtitle?x=t[26]:(x=(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:i.sourcesSubtitle}),t[25]=i.sourcesSubtitle,t[26]=x),S=v.length>0?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:Ve(i.sourceConnectedSummary,{accounts:e,sources:v.length})}):null,t[5]=v,t[6]=h,t[7]=n,t[8]=i.sourceConnectedSummary,t[9]=i.sourcesSubtitle,t[10]=i.sourcesTitle,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D}else y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],D=t[19];let O;t[27]!==b||t[28]!==x||t[29]!==S?(O=(0,$.jsxs)(`div`,{children:[b,x,S]}),t[27]=b,t[28]=x,t[29]=S,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(p,{className:`size-4`,"aria-hidden":!0}),t[31]=k):k=t[31];let A;t[32]!==o||t[33]!==i.addSource?(A=(0,$.jsxs)(X,{type:`button`,variant:`primary`,onClick:o,children:[k,i.addSource]}),t[32]=o,t[33]=i.addSource,t[34]=A):A=t[34];let j;t[35]!==O||t[36]!==A||t[37]!==C?(j=(0,$.jsxs)(`div`,{className:C,children:[O,A]}),t[35]=O,t[36]=A,t[37]=C,t[38]=j):j=t[38];let M;t[39]!==v||t[40]!==r||t[41]!==o||t[42]!==i?(M=v.length>0?(0,$.jsx)(`div`,{className:`space-y-3`,children:v.map(e=>{let{source:t,accounts:n}=e;return(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3.5 sm:px-5`,children:[(0,$.jsx)(Ne,{connector:{displayName:t.displayName,branding:Be(t)},size:`sm`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.displayName}),n.length>1?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Ve(i.sourceAccountCount,{count:n.length})}):null]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:We(t,i)})]})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:n.map(e=>{let t=Ue(e,i),n=Ke(e);return(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 sm:px-5`,onClick:()=>g(e.instanceId??null),children:[(0,$.jsx)(`span`,{className:c(`size-2 shrink-0 rounded-full`,t.tone===`attention`?`bg-warning`:t.tone===`useful`?`bg-success`:t.tone===`learning`?`bg-accent`:`bg-fg-subtle/50`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:Ge(e,i)}),t.badge?(0,$.jsx)(`span`,{className:c(`rounded-full px-2 py-0.5 text-[11px] font-medium`,t.tone===`attention`?`bg-warning-soft text-fg`:`bg-surface-muted text-fg-muted`),children:t.badge}):null]}),(0,$.jsx)(`span`,{className:c(`mt-1 block text-xs leading-5`,t.tone===`attention`?`text-fg`:`text-fg-muted`),children:t.summary})]}),n?(0,$.jsx)(`span`,{className:`hidden shrink-0 text-xs text-fg-subtle sm:block`,children:Ve(i.sourceUpdatedAt,{time:qe(n,r)})}):null,(0,$.jsx)(ae,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]},e.instanceId)})})]},t.id)})}):(0,$.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center`,children:[(0,$.jsx)(s,{className:`mx-auto size-5 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:i.noSources}),(0,$.jsxs)(X,{type:`button`,variant:`secondary`,className:`mt-4`,onClick:o,children:[(0,$.jsx)(p,{className:`size-4`,"aria-hidden":!0}),i.addSource]})]}),t[39]=v,t[40]=r,t[41]=o,t[42]=i,t[43]=M):M=t[43];let N=y?a===`source-learning:${y.instanceId}`:!1,P;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{e||g(null)},t[44]=P):P=t[44];let F;t[45]===d?F=t[46]:(F=e=>{g(null),d(e)},t[45]=d,t[46]=F);let I;t[47]===f?I=t[48]:(I=e=>{g(null),f(e)},t[47]=f,t[48]=I);let L;t[49]===m?L=t[50]:(L=()=>{g(null),m()},t[49]=m,t[50]=L);let R;t[51]!==r||t[52]!==l||t[53]!==u||t[54]!==y||t[55]!==i||t[56]!==N||t[57]!==F||t[58]!==I||t[59]!==L?(R=(0,$.jsx)(Ye,{source:y,language:r,t:i,busy:N,onOpenChange:P,onLearn:l,onPause:u,onConfigure:F,onDisconnect:I,onViewUnderstanding:L}),t[51]=r,t[52]=l,t[53]=u,t[54]=y,t[55]=i,t[56]=N,t[57]=F,t[58]=I,t[59]=L,t[60]=R):R=t[60];let z;return t[61]!==j||t[62]!==M||t[63]!==R||t[64]!==w||t[65]!==T||t[66]!==E||t[67]!==D?(z=(0,$.jsxs)(`div`,{id:w,role:T,"aria-labelledby":E,className:D,children:[j,M,R]}),t[61]=j,t[62]=M,t[63]=R,t[64]=w,t[65]=T,t[66]=E,t[67]=D,t[68]=z):z=t[68],z}function Ze(e,t){return e+t.accounts.length}function Qe(e){return e.installed}var $e=new Set([`overview`,`memory`,`collaboration`,`sources`,`privacy`]);function et(e){return e&&$e.has(e)?e:`overview`}var tt=[`collaboration`,`priorities`,`boundaries`,`people`,`current`,`basics`],nt=[`relationship`,`routine`,`long_term_goal`],rt=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/50 focus:ring-2 focus:ring-accent/20`;function it(e,t){return e.replace(`{{count}}`,String(t))}function at(e){let t=(0,Pe.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`span`,{className:`inline-flex rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function ot(e,t){let n=Date.parse(e);return Number.isFinite(n)?Ee(n,t):e}function st(){let e=(0,Pe.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(ve,{className:`h-24 rounded-2xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[t,(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,$.jsx)(ve,{className:`h-64 rounded-2xl`}),(0,$.jsx)(ve,{className:`h-64 rounded-2xl`})]})]}),e[1]=n):n=e[1],n}function ct(e,t){return e.origin===`connected_source`?t.origins.connected_source.replace(`{{source}}`,e.sourceName):t.origins[e.origin]}function lt(e){let t=(0,Pe.c)(19),{item:n,language:r,t:i,busy:a,onConfirm:s,onReject:l,onUpdate:u,onForget:d}=e,[f,p]=(0,Q.useState)(!1),[m,g]=(0,Q.useState)(n.statement),[_,v]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),S=n.status!==`active`,C=S?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,T;t[0]===C?T=t[1]:(T=c(`rounded-xl border p-3.5`,C),t[0]=C,t[1]=T);let E;t[2]!==a||t[3]!==m||t[4]!==f||t[5]!==_||t[6]!==b||t[7]!==n||t[8]!==r||t[9]!==S||t[10]!==s||t[11]!==d||t[12]!==l||t[13]!==u||t[14]!==i?(E=f?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:c(rt,`min-h-20 resize-y`),value:m,onChange:e=>g(e.target.value),placeholder:i.updatePlaceholder}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>{g(n.statement),p(!1)},children:i.cancel}),(0,$.jsx)(X,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:a||!m.trim(),onClick:()=>{u(m.trim()),p(!1)},children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(G,{className:`size-3 text-accent`,"aria-hidden":!0}),ct(n,i)]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.stability[n.stability]}),n.evidenceCount>0?(0,$.jsx)(`span`,{children:it(i.evidenceCount,n.evidenceCount)}):null,n.latestEvidenceAt?(0,$.jsx)(`span`,{children:i.observedAt.replace(`{{time}}`,ot(n.latestEvidenceAt,r))}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[S?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:s,children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:l,children:[(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>p(!0),children:[(0,$.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}),i.change]}),(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:b,onClick:()=>{if(_){v(null);return}x(!0),U(n.id).then(e=>v(e.history)).finally(()=>x(!1))},children:[(0,$.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),i.history]}),(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:d,children:[(0,$.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),i.forget]})]})]}),(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer font-medium text-fg-muted`,children:i.viewEvidence}),(0,$.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),(0,$.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourceName})]}),n.sourcePath?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidencePath}),(0,$.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourcePath})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceUpdated}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:ot(n.updatedAt,r)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSupport}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:it(i.evidenceCount,n.evidenceCount)})]}),n.evidenceBasis?(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceRule}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:i.evidenceRuleValue.replace(`{{events}}`,String(n.evidenceBasis.eventCount)).replace(`{{days}}`,String(n.evidenceBasis.activeDays)).replace(`{{window}}`,String(n.evidenceBasis.windowDays))})]}):null,n.confidence===void 0?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),(0,$.jsxs)(`dd`,{className:`mt-0.5 text-fg-muted`,children:[Math.round(n.confidence*100),`%`]})]}),n.validTo?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceValidUntil}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:ot(n.validTo,r)})]}):null,n.expiresAt?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceExpires}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:ot(n.expiresAt,r)})]}):null]})]}),_?(0,$.jsxs)(`div`,{className:`mt-2 space-y-2 border-t border-edge pt-2`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.historyTitle}),_.map(e=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-xs`,children:[(0,$.jsx)(`p`,{className:`min-w-0 text-fg-muted`,children:e.statement}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-subtle`,children:ot(e.updatedAt,r)})]},e.id))]}):null]}),t[2]=a,t[3]=m,t[4]=f,t[5]=_,t[6]=b,t[7]=n,t[8]=r,t[9]=S,t[10]=s,t[11]=d,t[12]=l,t[13]=u,t[14]=i,t[15]=E):E=t[15];let D;return t[16]!==T||t[17]!==E?(D=(0,$.jsx)(`article`,{className:T,children:E}),t[16]=T,t[17]=E,t[18]=D):D=t[18],D}function ut(e){let t=(0,Pe.c)(86),{claim:n,language:r,t:i,busy:a,onDecision:s}=e,l=typeof n.value.label==`string`?n.value.label:``,u;if(t[0]!==n.class||t[1]!==n.value.hour||t[2]!==n.value.weekday||t[3]!==l||t[4]!==r||t[5]!==i.claimProject||t[6]!==i.claimRelationship||t[7]!==i.claimRoutine){let e=r===`zh`?[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`]:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];u=n.class===`relationship`?i.claimRelationship.replace(`{{label}}`,l):n.class===`project`?i.claimProject.replace(`{{label}}`,l):i.claimRoutine.replace(`{{weekday}}`,e[Number(n.value.weekday)]??``).replace(`{{hour}}`,String(n.value.hour).padStart(2,`0`)),t[0]=n.class,t[1]=n.value.hour,t[2]=n.value.weekday,t[3]=l,t[4]=r,t[5]=i.claimProject,t[6]=i.claimRelationship,t[7]=i.claimRoutine,t[8]=u}else u=t[8];let d=u,f;t[9]===n.evidence?f=t[10]:(f=new Set(n.evidence.map(dt)),t[9]=n.evidence,t[10]=f);let p;t[11]===f?p=t[12]:(p=[...f],t[11]=f,t[12]=p);let m=p,h=n.state===`provisional`||n.state===`stale`,g=h?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,_;t[13]===g?_=t[14]:(_=c(`rounded-xl border p-3.5`,g),t[13]=g,t[14]=_);let v=i.claimClasses[n.class],y;t[15]===v?y=t[16]:(y=(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-fg-subtle`,children:v}),t[15]=v,t[16]=y);let b;t[17]===d?b=t[18]:(b=(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-6 text-fg`,children:d}),t[17]=d,t[18]=b);let x;t[19]!==y||t[20]!==b?(x=(0,$.jsxs)(`div`,{children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21];let S=i.claimStates[n.state],C;t[22]===S?C=t[23]:(C=(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:S}),t[22]=S,t[23]=C);let w;t[24]!==C||t[25]!==x?(w=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[x,C]}),t[24]=C,t[25]=x,t[26]=w):w=t[26];let T;t[27]!==n.activeDayCount||t[28]!==n.independentEvidenceCount||t[29]!==i.claimEvidence?(T=i.claimEvidence.replace(`{{events}}`,String(n.independentEvidenceCount)).replace(`{{days}}`,String(n.activeDayCount)),t[27]=n.activeDayCount,t[28]=n.independentEvidenceCount,t[29]=i.claimEvidence,t[30]=T):T=t[30];let E;t[31]===T?E=t[32]:(E=(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:T}),t[31]=T,t[32]=E);let D;t[33]!==n.lastReinforcedAt||t[34]!==r||t[35]!==i.observedAt?(D=i.observedAt.replace(`{{time}}`,ot(n.lastReinforcedAt,r)),t[33]=n.lastReinforcedAt,t[34]=r,t[35]=i.observedAt,t[36]=D):D=t[36];let O;t[37]===D?O=t[38]:(O=(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:D}),t[37]=D,t[38]=O);let A;t[39]!==a||t[40]!==h||t[41]!==s||t[42]!==i.confirm||t[43]!==i.notTrue?(A=h?(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>s(`confirm`),children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>s(`reject`),children:[(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,t[39]=a,t[40]=h,t[41]=s,t[42]=i.confirm,t[43]=i.notTrue,t[44]=A):A=t[44];let j;t[45]!==O||t[46]!==A?(j=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[O,A]}),t[45]=O,t[46]=A,t[47]=j):j=t[47];let M;t[48]===i.viewEvidence?M=t[49]:(M=(0,$.jsx)(`summary`,{className:`cursor-pointer font-medium`,children:i.viewEvidence}),t[48]=i.viewEvidence,t[49]=M);let N;t[50]===i.evidenceSource?N=t[51]:(N=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),t[50]=i.evidenceSource,t[51]=N);let P=m.join(`, `),F;t[52]===P?F=t[53]:(F=(0,$.jsx)(`dd`,{className:`mt-0.5 break-all`,children:P}),t[52]=P,t[53]=F);let I;t[54]!==N||t[55]!==F?(I=(0,$.jsxs)(`div`,{children:[N,F]}),t[54]=N,t[55]=F,t[56]=I):I=t[56];let L;t[57]===i.evidenceConfidence?L=t[58]:(L=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),t[57]=i.evidenceConfidence,t[58]=L);let R;t[59]===n.confidence?R=t[60]:(R=Math.round(n.confidence*100),t[59]=n.confidence,t[60]=R);let z;t[61]===R?z=t[62]:(z=(0,$.jsxs)(`dd`,{className:`mt-0.5`,children:[R,`%`]}),t[61]=R,t[62]=z);let B;t[63]!==L||t[64]!==z?(B=(0,$.jsxs)(`div`,{children:[L,z]}),t[63]=L,t[64]=z,t[65]=B):B=t[65];let V;t[66]===i.evidenceRule?V=t[67]:(V=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceRule}),t[66]=i.evidenceRule,t[67]=V);let H;t[68]===i.claimRule?H=t[69]:(H=(0,$.jsx)(`dd`,{className:`mt-0.5`,children:i.claimRule}),t[68]=i.claimRule,t[69]=H);let U;t[70]!==V||t[71]!==H?(U=(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[V,H]}),t[70]=V,t[71]=H,t[72]=U):U=t[72];let W;t[73]!==I||t[74]!==B||t[75]!==U?(W=(0,$.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[I,B,U]}),t[73]=I,t[74]=B,t[75]=U,t[76]=W):W=t[76];let G;t[77]!==M||t[78]!==W?(G=(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[M,W]}),t[77]=M,t[78]=W,t[79]=G):G=t[79];let K;return t[80]!==w||t[81]!==E||t[82]!==j||t[83]!==G||t[84]!==_?(K=(0,$.jsxs)(`article`,{className:_,children:[w,E,j,G]}),t[80]=w,t[81]=E,t[82]=j,t[83]=G,t[84]=_,t[85]=K):K=t[85],K}function dt(e){return e.sourceInstanceId}function ft(e){let t=(0,Pe.c)(70),{playbook:n,busy:r,t:i,onToggleGroup:a,onCreate:o,onUpdate:s,onDelete:l,onRollback:u}=e,[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(``),_=n.enabled?`border-edge-subtle bg-surface-panel`:`border-edge-subtle bg-surface-muted`,v;t[0]===_?v=t[1]:(v=c(`rounded-xl border p-4`,_),t[0]=_,t[1]=v);let b=i.playbookNames[n.id],x;t[2]===b?x=t[3]:(x=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:b}),t[2]=b,t[3]=x);let S;t[4]!==n.rules||t[5]!==i.playbookRuleCount?(S=it(i.playbookRuleCount,n.rules.filter(ht).length),t[4]=n.rules,t[5]=i.playbookRuleCount,t[6]=S):S=t[6];let C;t[7]===S?C=t[8]:(C=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:S}),t[7]=S,t[8]=C);let T;t[9]!==x||t[10]!==C?(T=(0,$.jsxs)(`div`,{children:[x,C]}),t[9]=x,t[10]=C,t[11]=T):T=t[11];let E=n.enabled?i.pausePlaybook:i.resumePlaybook,D;t[12]!==r||t[13]!==a||t[14]!==E?(D=(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:r,onClick:a,children:E}),t[12]=r,t[13]=a,t[14]=E,t[15]=D):D=t[15];let O;t[16]!==T||t[17]!==D?(O=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,D]}),t[16]=T,t[17]=D,t[18]=O):O=t[18];let k;t[19]!==r||t[20]!==p||t[21]!==h||t[22]!==l||t[23]!==u||t[24]!==s||t[25]!==n.rules||t[26]!==i.cancel||t[27]!==i.deleteRule||t[28]!==i.disableRule||t[29]!==i.edit||t[30]!==i.enableRule||t[31]!==i.moveDown||t[32]!==i.moveUp||t[33]!==i.rollbackRule||t[34]!==i.ruleChannelContext||t[35]!==i.ruleContextAny||t[36]!==i.ruleHistory||t[37]!==i.ruleSupportContext||t[38]!==i.ruleSupportNeeds||t[39]!==i.save?(k=n.rules.map((e,t)=>(0,$.jsx)(`li`,{className:c(`rounded-lg border border-edge-subtle p-2.5`,!e.enabled&&`opacity-60`),children:p===e.id?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:c(rt,`min-h-16 resize-y`),value:h,onChange:e=>g(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-7 px-2`,onClick:()=>m(null),children:i.cancel}),(0,$.jsx)(X,{type:`button`,variant:`primary`,className:`h-7 px-2`,disabled:!h.trim(),onClick:()=>{s(e.id,{statement:h.trim()}),m(null)},children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-1`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleSupportContext,(0,$.jsxs)(fe,{value:e.context.supportNeed??``,disabled:r,onChange:t=>s(e.id,{context:{supportNeed:t.target.value||null}}),children:[(0,$.jsx)(Y,{value:``,children:i.ruleContextAny}),[`listen`,`clarify`,`advise`,`act`,`unknown`].map(e=>(0,$.jsx)(Y,{value:e,children:i.ruleSupportNeeds[e]},e))]})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleChannelContext,(0,$.jsxs)(fe,{value:e.context.channel??``,disabled:r,onChange:t=>s(e.id,{context:{channel:t.target.value||null}}),children:[(0,$.jsx)(Y,{value:``,children:i.ruleContextAny}),[`webchat`,`telegram`,`weixin`,`feishu`,`cli`].map(mt)]})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1`,children:[(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===0,onClick:()=>s(e.id,{order:n.rules[t-1].order-1}),children:i.moveUp}),(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===n.rules.length-1,onClick:()=>s(e.id,{order:n.rules[t+1].order+1}),children:i.moveDown}),(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>s(e.id,{enabled:!e.enabled}),children:e.enabled?i.disableRule:i.enableRule}),(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>{m(e.id),g(e.statement)},children:[(0,$.jsx)(w,{className:`size-3`,"aria-hidden":!0}),i.edit]}),(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-7 px-2 text-danger`,disabled:r,onClick:()=>l(e.id),children:[(0,$.jsx)(y,{className:`size-3`,"aria-hidden":!0}),i.deleteRule]})]}),e.versions.length>1?(0,$.jsxs)(`details`,{className:`mt-2 border-t border-edge-subtle pt-2`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-[11px] text-fg-subtle`,children:i.ruleHistory}),(0,$.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.versions.filter(pt).map(t=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 text-[11px]`,children:[(0,$.jsx)(`p`,{className:`line-clamp-2 text-fg-muted`,children:t.statement}),(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-7 shrink-0 px-2`,disabled:r,onClick:()=>u(e.id,t.id),children:i.rollbackRule})]},t.id))})]}):null]})},e.id)),t[19]=r,t[20]=p,t[21]=h,t[22]=l,t[23]=u,t[24]=s,t[25]=n.rules,t[26]=i.cancel,t[27]=i.deleteRule,t[28]=i.disableRule,t[29]=i.edit,t[30]=i.enableRule,t[31]=i.moveDown,t[32]=i.moveUp,t[33]=i.rollbackRule,t[34]=i.ruleChannelContext,t[35]=i.ruleContextAny,t[36]=i.ruleHistory,t[37]=i.ruleSupportContext,t[38]=i.ruleSupportNeeds,t[39]=i.save,t[40]=k):k=t[40];let A;t[41]===k?A=t[42]:(A=(0,$.jsx)(`ul`,{className:`mt-3 space-y-2`,children:k}),t[41]=k,t[42]=A);let j;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>f(e.target.value),t[43]=j):j=t[43];let M;t[44]!==d||t[45]!==i.newRulePlaceholder?(M=(0,$.jsx)(`input`,{className:rt,value:d,onChange:j,placeholder:i.newRulePlaceholder}),t[44]=d,t[45]=i.newRulePlaceholder,t[46]=M):M=t[46];let N;t[47]!==r||t[48]!==d?(N=r||!d.trim(),t[47]=r,t[48]=d,t[49]=N):N=t[49];let P;t[50]!==d||t[51]!==o?(P=()=>{o(d.trim()),f(``)},t[50]=d,t[51]=o,t[52]=P):P=t[52];let F;t[53]!==i.addRule||t[54]!==N||t[55]!==P?(F=(0,$.jsx)(X,{type:`button`,variant:`secondary`,disabled:N,onClick:P,children:i.addRule}),t[53]=i.addRule,t[54]=N,t[55]=P,t[56]=F):F=t[56];let I;t[57]!==M||t[58]!==F?(I=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[M,F]}),t[57]=M,t[58]=F,t[59]=I):I=t[59];let L=i.playbookRuleExamples[n.id],R;t[60]===L?R=t[61]:(R=(0,$.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-5 text-fg-subtle`,children:L}),t[60]=L,t[61]=R);let z;t[62]!==I||t[63]!==R?(z=(0,$.jsxs)(`div`,{className:`mt-3`,children:[I,R]}),t[62]=I,t[63]=R,t[64]=z):z=t[64];let B;return t[65]!==O||t[66]!==A||t[67]!==v||t[68]!==z?(B=(0,$.jsxs)(`article`,{className:v,children:[O,A,z]}),t[65]=O,t[66]=A,t[67]=v,t[68]=z,t[69]=B):B=t[69],B}function pt(e){return!e.current}function mt(e){return(0,$.jsx)(Y,{value:e,children:e},e)}function ht(e){return e.enabled}function gt(e){let t=(0,Pe.c)(46),{suggestion:n,draft:r,busy:i,onDraftChange:a,onSave:o,onLater:s,t:l}=e,u;t[0]!==n||t[1]!==l.meetSuggestedTitle||t[2]!==l.meetTitle?(u=n?l.meetSuggestedTitle.replace(`{{name}}`,n.value):l.meetTitle,t[0]=n,t[1]=l.meetSuggestedTitle,t[2]=l.meetTitle,t[3]=u):u=t[3];let d;t[4]===u?d=t[5]:(d=(0,$.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-fg`,children:u}),t[4]=u,t[5]=d);let f=n?l.meetSuggestedBody:l.meetBody,p;t[6]===f?p=t[7]:(p=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:f}),t[6]=f,t[7]=p);let m;t[8]===l.callName?m=t[9]:(m=(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:`you-call-name`,children:l.callName}),t[8]=l.callName,t[9]=m);let h;t[10]===a?h=t[11]:(h=e=>a(e.target.value),t[10]=a,t[11]=h);let g;t[12]!==i||t[13]!==r||t[14]!==o?(g=e=>{e.key===`Enter`&&r.trim()&&!i&&o()},t[12]=i,t[13]=r,t[14]=o,t[15]=g):g=t[15];let _=l.meetPlaceholder,v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=c(rt,`h-10 flex-1 bg-surface-base/90`),t[16]=v):v=t[16];let y;t[17]!==r||t[18]!==l.meetPlaceholder||t[19]!==h||t[20]!==g?(y=(0,$.jsx)(`input`,{id:`you-call-name`,value:r,maxLength:80,onChange:h,onKeyDown:g,placeholder:_,className:v}),t[17]=r,t[18]=l.meetPlaceholder,t[19]=h,t[20]=g,t[21]=y):y=t[21];let b;t[22]!==i||t[23]!==r?(b=i||!r.trim(),t[22]=i,t[23]=r,t[24]=b):b=t[24];let x=i?l.meetSaving:l.meetSave,S;t[25]!==o||t[26]!==b||t[27]!==x?(S=(0,$.jsx)(X,{type:`button`,variant:`primary`,className:`h-10 shrink-0`,disabled:b,onClick:o,children:x}),t[25]=o,t[26]=b,t[27]=x,t[28]=S):S=t[28];let C;t[29]!==y||t[30]!==S||t[31]!==m?(C=(0,$.jsxs)(`div`,{className:`mt-5 flex max-w-xl flex-col gap-2 sm:flex-row`,children:[m,y,S]}),t[29]=y,t[30]=S,t[31]=m,t[32]=C):C=t[32];let w;t[33]!==n||t[34]!==l.meetSource?(w=n?(0,$.jsxs)(`p`,{className:`mt-3 flex items-start gap-1.5 text-xs leading-5 text-fg-subtle`,children:[(0,$.jsx)(se,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:l.meetSource})]}):null,t[33]=n,t[34]=l.meetSource,t[35]=w):w=t[35];let T;t[36]!==i||t[37]!==s||t[38]!==l.meetLater?(T=(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`mt-3 text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:s,children:l.meetLater}),t[36]=i,t[37]=s,t[38]=l.meetLater,t[39]=T):T=t[39];let E;return t[40]!==C||t[41]!==w||t[42]!==T||t[43]!==d||t[44]!==p?(E=(0,$.jsx)(`section`,{className:`relative overflow-hidden rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/80 via-surface-panel to-surface-panel p-5 sm:p-6`,children:(0,$.jsxs)(`div`,{className:`relative max-w-2xl`,children:[d,p,C,w,T]})}),t[40]=C,t[41]=w,t[42]=T,t[43]=d,t[44]=p,t[45]=E):E=t[45],E}function _t(){let e=u(e=>e.language),t=l(e).you,n=a(),[r,s]=i(),p=et(r.get(`tab`)),m=P(e=>e.setPageHeader),h=P(e=>e.clearPageHeader),{data:g,error:v,isLoading:y,mutate:x}=d(`/api/you`,V),[S,O]=(0,Q.useState)(null),[k,j]=(0,Q.useState)(!1),[M,F]=(0,Q.useState)(``),[L,z]=(0,Q.useState)(`preference`),[U,G]=(0,Q.useState)(!1),[te,J]=(0,Q.useState)(null),[le,me]=(0,Q.useState)(!1),[he,ve]=(0,Q.useState)(null),[ye,we]=(0,Q.useState)(!1),[Ee,Oe]=(0,Q.useState)(``),[Ne,Pe]=(0,Q.useState)(!1),[Le,ze]=(0,Q.useState)(null),[Be,Ve]=(0,Q.useState)(!1),[He,Ue]=(0,Q.useState)(!1),[We,Ge]=(0,Q.useState)(!1),[Ke,qe]=(0,Q.useState)(null),[Je,Ye]=(0,Q.useState)(!1),[Ze,Qe]=(0,Q.useState)(null),[$e,dt]=(0,Q.useState)(null),[pt,mt]=(0,Q.useState)(!1),[ht,_t]=(0,Q.useState)(null),[vt,yt]=(0,Q.useState)(null),bt=(0,Q.useRef)(null),xt=(0,Q.useRef)(null),St=(0,Q.useRef)(null),Ct=g?.profile??{callName:``,pronouns:``,timezone:``,notes:``},wt=(0,Q.useMemo)(()=>g?.understanding.filter(e=>e.status===`active`)??[],[g]),Tt=(0,Q.useMemo)(()=>g?.understanding.filter(e=>e.status!==`active`)??[],[g]),Et=(0,Q.useMemo)(()=>g?.connectedClaims.filter(e=>e.state!==`rejected`)??[],[g]),Dt=(0,Q.useMemo)(()=>Et.filter(e=>e.state!==`active`),[Et]),Ot=(0,Q.useMemo)(()=>new Map(tt.map(e=>[e,wt.filter(t=>t.facet===e)])),[wt]),kt=Le??g?.controls??null,At=g?.sources.filter(e=>e.installed&&e.enabled)??[],jt=At.filter(e=>[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status));(0,Q.useEffect)(()=>{let e=()=>{x()};return window.addEventListener(`connector-learning-updated`,e),()=>window.removeEventListener(`connector-learning-updated`,e)},[x]),(0,Q.useEffect)(()=>{if(p!==`memory`||!vt)return;let e=requestAnimationFrame(()=>{(vt===`profile`?bt:xt).current?.scrollIntoView({behavior:`smooth`,block:`start`}),yt(null)});return()=>cancelAnimationFrame(e)},[vt,p]);async function Mt(e){if(!(!g||We)){Ge(!0);try{let n=await pe(e);await x({...g,relationship:n.relationship},{revalidate:!1}),Z({type:`success`,title:t.collaborationTitle,message:t.saved})}catch{Z({type:`error`,title:t.supportModeTitle,message:t.saveError})}finally{Ge(!1)}}}async function Nt(e,n){O(`claim:${e.id}`);try{let t=await _e(e.id,n);await x(e=>e&&{...e,connectedClaims:e.connectedClaims.map(e=>e.id===t.id?t:e)},{revalidate:!1})}catch{Z({type:`error`,title:t.connectedClaimsTitle,message:t.saveError})}finally{O(null)}}let Pt=e=>{let t=new URLSearchParams;e!==`overview`&&t.set(`tab`,e),s(t,{replace:!0})},Ft=e=>{yt(e),Pt(`memory`)},It=e=>{let t=new URLSearchParams({connector:e.id});e.instanceId&&t.set(`instance`,e.instanceId),n(`/connectors?${t.toString()}`)},Lt=async e=>{if(e.instanceId){O(`source-learning:${e.instanceId}`);try{e.learning?.status===`paused`?await Me(e.instanceId,!1):await je(e.instanceId),await x(),Z({type:`success`,title:e.displayName,message:t.sourceLearningStarted})}catch(n){Z({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{O(null)}}},Rt=async e=>{if(e.instanceId){O(`source-learning:${e.instanceId}`);try{await Me(e.instanceId,!0),await x()}catch(n){Z({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{O(null)}}};(0,Q.useLayoutEffect)(()=>(m({startExtra:null,main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.subtitle})]}),end:(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2.5 text-xs`,onClick:()=>Ye(!0),children:[(0,$.jsx)(Te,{className:`size-3.5`,"aria-hidden":!0}),t.howItWorks]})}),()=>h()),[h,m,t.howItWorks,t.subtitle,t.title]),(0,Q.useEffect)(()=>{!g||g.profile.callName||Oe(g.profileSetup.callNameSuggestion?.value??``)},[g,g?.profile.callName,g?.profileSetup.callNameSuggestion?.id]);async function zt(e,n,r){O(e.id);try{let t=await be(e.id,{action:n,content:r});await x(r=>r&&{...r,understanding:n===`reject`?r.understanding.filter(t=>t.id!==e.id):r.understanding.map(n=>n.id===e.id?t:n)},{revalidate:!1}),x()}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{O(null)}}async function Bt(e,n){O(`consent:${e}`);try{await b(e,n),await x(),Z({type:`success`,title:t.title,message:t.saved})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{O(null)}}async function Vt(){let e=M.trim();if(e){O(`understanding:new`);try{await B({content:e,kind:L}),F(``),j(!1),G(!1),await x(),Z({type:`success`,title:t.understandingTitle,message:t.saved})}catch{Z({type:`error`,title:t.understandingTitle,message:t.saveError})}finally{O(null)}}}async function Ht(){if(Tt.length){O(`understanding:batch`);try{await C(Tt.map(e=>e.id),`confirm`),await x()}catch{Z({type:`error`,title:t.reviewTitle,message:t.saveError})}finally{O(null)}}}async function Ut(e,n){O(`conflict:${e}`);try{await f(e,n),await x()}catch{Z({type:`error`,title:t.conflictsTitle,message:t.saveError})}finally{O(null)}}async function Wt(e){O(`grant:${e}`);try{await re(e),await x()}catch{Z({type:`error`,title:t.grantsTitle,message:t.saveError})}finally{O(null)}}async function Gt(r,i){O(`insight:${r.id}`);try{let t=await oe(r.id,{action:i,uiLocale:e});await x(),i===`apply`&&t.href&&n(t.href)}catch{Z({type:`error`,title:t.insightsTitle,message:t.saveError})}finally{O(null)}}async function Kt(e){O(`playbook:${e.id}`);try{await ue(e.id,!e.enabled),await x()}catch{Z({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{O(null)}}async function qt(e,n){O(`playbook:${e}`);try{await n(),await x()}catch{Z({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{O(null)}}async function Jt(){if(te){O(te.id);try{await W(te.id);let e=te.id;J(null),await x(t=>t&&{...t,understanding:t.understanding.filter(t=>t.id!==e)},{revalidate:!1}),x()}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{O(null)}}}async function Yt(){if(he){we(!0);try{let e=await ce(he);me(!1),ve(null),await x(t=>t&&{...t,...e},{revalidate:!1})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{we(!1)}}}async function Xt(){let e=Ee.trim();if(!(!e||Ne)){Pe(!0);try{let t=await ce({callName:e,timezone:Ct.timezone||ie()});await x(e=>e&&{...e,...t},{revalidate:!1})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{Pe(!1)}}}async function Zt(){if(!Ne){Pe(!0);try{let e=await Ce(`snooze`);await x(t=>t&&{...t,profileSetup:e.profileSetup},{revalidate:!1})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{Pe(!1)}}}function Qt(){ve(Ct),me(!0),Ft(`profile`)}function $t(e,t=!1){z(e),G(t),j(!0),Pt(`memory`)}function en(){j(!1),G(!1),F(``)}async function tn(e){if(!Be){ze(e),Ve(!0);try{ze(await ee(e)),await x(),Z({type:`success`,title:t.privacyTitle,message:t.saved})}catch{ze(null),Z({type:`error`,title:t.privacyTitle,message:t.saveError})}finally{Ve(!1)}}}async function nn(e){if(!(He||e===g?.trust.defaultActionLevel)){Ue(!0);try{let n=await ne(e);await x(e=>e&&{...e,trust:n},{revalidate:!1}),Z({type:`success`,title:t.trustTitle,message:t.saved})}catch{Z({type:`error`,title:t.trustTitle,message:t.saveError})}finally{Ue(!1),qe(null)}}}async function rn(e){if(!(!$e?.instanceId||pt)){mt(!0);try{let n=await ge($e.instanceId,e);dt(null),await x(),Z({type:`success`,title:t.sourcesTitle,message:e?t.disconnectDeleted.replace(`{{count}}`,String(n.deletedUnderstandingCount)):t.disconnectSuccess})}catch{Z({type:`error`,title:t.sourcesTitle,message:t.saveError})}finally{mt(!1)}}}async function an(){if(!ht){_t(`export`);try{let e=await E(),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`xopc-about-you-${e.exportedAt.slice(0,10)}.json`,n.click(),URL.revokeObjectURL(t)}catch{Z({type:`error`,title:t.transferTitle,message:t.saveError})}finally{_t(null)}}}async function on(e){if(!(!e||ht)){_t(`import`);try{if(e.size>2*1024*1024)throw Error(`file too large`);let n=await A(JSON.parse(await e.text()));await x(),Ft(`review`),Z({type:`success`,title:t.transferTitle,message:t.importSuccess.replace(`{{count}}`,String(n.importedCount)).replace(`{{skipped}}`,String(n.skippedCount))})}catch{Z({type:`error`,title:t.transferTitle,message:t.importError})}finally{St.current&&(St.current.value=``),Qe(null),_t(null)}}}function sn(){Qe(null),St.current&&(St.current.value=``)}return(0,$.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ke,{items:[{id:`overview`,label:t.tabs.overview,icon:N},{id:`memory`,label:t.tabs.memory,icon:De,count:Tt.length+Dt.length||void 0},{id:`collaboration`,label:t.tabs.collaboration,icon:_},{id:`sources`,label:t.tabs.sources,icon:H},{id:`privacy`,label:t.tabs.privacy,icon:se}],activeTab:p,onChange:Pt,ariaLabel:t.title,tabIdPrefix:`you-tab`,panelIdPrefix:`you-panel`,className:`pr-8 sm:pr-1`,buttonClassName:`px-2.5 sm:px-3`}),(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-y-1 right-0 w-8 bg-gradient-to-l from-surface-panel to-transparent sm:hidden`,"aria-hidden":!0})]}),y?(0,$.jsx)(st,{}):v||!g?(0,$.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t.loadError}):null,g&&p===`overview`?(0,$.jsxs)(`div`,{id:`you-panel-overview`,role:`tabpanel`,"aria-labelledby":`you-tab-overview`,className:`space-y-4`,children:[!Ct.callName&&g.profileSetup.shouldPrompt?(0,$.jsx)(gt,{suggestion:g.profileSetup.callNameSuggestion,draft:Ee,busy:Ne,onDraftChange:Oe,onSave:()=>void Xt(),onLater:()=>void Zt(),t}):null,Tt.length>0||Dt.length>0||jt.length>0||!Ct.callName?(0,$.jsxs)(`section`,{className:`rounded-2xl border border-warning/25 bg-warning-soft/35 p-5`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.attentionTitle}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[Tt.length+Dt.length>0?(0,$.jsxs)(X,{type:`button`,variant:`secondary`,onClick:()=>Ft(`review`),children:[it(t.reviewCount,Tt.length+Dt.length),(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0})]}):null,jt.length>0?(0,$.jsxs)(X,{type:`button`,variant:`secondary`,onClick:()=>Pt(`sources`),children:[it(t.sourceIssues,jt.length),(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0})]}):null,Ct.callName?null:(0,$.jsxs)(X,{type:`button`,variant:`secondary`,onClick:Qt,children:[t.completeProfile,(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0})]})]})]}):null,(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-4`,children:(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>Pt(`memory`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:wt.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.knownSummary})]}),(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>Pt(`sources`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:At.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.connectedSources})]}),(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>Ft(`review`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:Tt.length+Dt.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.waitingReview})]})]})}),g.insights.length>0?(0,$.jsxs)(`section`,{className:`rounded-2xl border border-accent/15 bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(Se,{className:`size-4 text-accent`,"aria-hidden":!0}),t.insightsTitle]}),(0,$.jsx)(at,{children:t.confirmedContextBadge})]}),(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-2`,children:g.insights.map(e=>(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.insight}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:e.evidenceCount>1?it(t.insightEvidence,e.evidenceCount):t.insightReason}),(0,$.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:S===`insight:${e.id}`,onClick:()=>void Gt(e,`dismiss`),children:t.notNow}),(0,$.jsx)(X,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:S===`insight:${e.id}`,onClick:()=>void Gt(e,`apply`),children:t.insightActions[e.action]})]})]},e.id))})]}):null,(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(q,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.profileHint})]}),(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>Ft(`profile`),children:(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Ct.callName||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Ct.timezone||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Ct.pronouns||`—`})]}),Ct.notes?(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,$.jsx)(`dd`,{className:`mt-1 line-clamp-2 text-sm leading-6 text-fg`,children:Ct.notes})]}):null]})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(De,{className:`size-4 text-accent`,"aria-hidden":!0}),t.understandingTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.understandingHint})]}),(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>Pt(`memory`),children:(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[wt.slice(0,4).map(e=>(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5 text-sm leading-5 text-fg`,children:e.statement},e.id)),wt.length===0?(0,$.jsx)(`p`,{className:`py-5 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]})]})]})]}):null,g&&p===`memory`?(0,$.jsxs)(`div`,{id:`you-panel-memory`,role:`tabpanel`,"aria-labelledby":`you-tab-memory`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.memoryTitle}),(0,$.jsx)(at,{children:t.sharedAgentsBadge})]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.memoryHint})]}),(0,$.jsxs)(`section`,{ref:bt,id:`you-profile-card`,className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(q,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,$.jsx)(at,{children:t.onlyYouEditBadge})]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.profileHint})]}),le?null:(0,$.jsxs)(X,{type:`button`,variant:`secondary`,onClick:Qt,children:[(0,$.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}),t.edit]})]}),le&&he?(0,$.jsxs)(`div`,{className:`mt-5`,children:[(0,$.jsx)(Fe,{value:he,onChange:ve,language:e,inputClassName:rt,labels:{callName:t.callName,callNamePlaceholder:t.meetPlaceholder,pronouns:t.pronouns,pronounsPlaceholder:t.pronounsPlaceholder,timezone:t.timezone,timezoneCustom:t.timezoneCustom,timezoneDetect:t.timezoneDetect,custom:t.custom,notes:t.notes,notesPlaceholder:t.notesPlaceholder}}),(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,$.jsx)(X,{type:`button`,variant:`ghost`,onClick:()=>{me(!1),ve(null)},children:t.cancel}),(0,$.jsx)(X,{type:`button`,variant:`primary`,disabled:ye,onClick:()=>void Yt(),children:ye?t.saving:t.save})]})]}):(0,$.jsxs)(`dl`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Ct.callName||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Ct.timezone||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Ct.pronouns||`—`})]}),(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,$.jsx)(`dd`,{className:`mt-1 whitespace-pre-wrap text-sm leading-6 text-fg`,children:Ct.notes||`—`})]})]})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.structuredContextTitle}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":k&&!U&&L===`preference`,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&!U&&L===`preference`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>$t(`preference`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addPreference}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addPreferenceHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":k&&!U&&L===`boundary`,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&!U&&L===`boundary`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>$t(`boundary`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addBoundary}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addBoundaryHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":k&&!U&&L===`current_state`,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&!U&&L===`current_state`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>$t(`current_state`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addCurrentFocus}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addCurrentFocusHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":k&&U,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&U?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>$t(`relationship`,!0),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addOther}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addOtherHint})]})]}),k?(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:U?t.addOther:L===`preference`?t.addPreference:L===`boundary`?t.addBoundary:t.addCurrentFocus}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:U?t.addOtherHint:L===`preference`?t.addPreferenceHint:L===`boundary`?t.addBoundaryHint:t.addCurrentFocusHint})]}),U?null:(0,$.jsx)(at,{children:t.understandingKinds[L]})]}),(0,$.jsx)(`textarea`,{className:c(rt,`mt-3 min-h-24 resize-y`),value:M,onChange:e=>F(e.target.value),placeholder:t.understandingPlaceholders[L],autoFocus:!0}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end justify-between gap-3`,children:[U?(0,$.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[t.understandingKind,(0,$.jsx)(fe,{value:L,onChange:e=>z(e.target.value),children:nt.map(e=>(0,$.jsx)(Y,{value:e,children:t.understandingKinds[e]},e))})]}):(0,$.jsx)(`span`,{}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(X,{type:`button`,variant:`ghost`,onClick:en,children:t.cancel}),(0,$.jsx)(X,{type:`button`,variant:`primary`,disabled:!M.trim()||S===`understanding:new`,onClick:()=>void Vt(),children:t.add})]})]})]}):null]}),g.conflictGroups.some(e=>e.unresolved)?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.conflictsHint}),(0,$.jsx)(`div`,{className:`mt-3 space-y-3`,children:g.conflictGroups.filter(e=>e.unresolved).map(n=>(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-xl border border-warning/35 bg-warning-soft/25`,children:n.records.filter(e=>e.storedStatus!==`archived`&&e.storedStatus!==`rejected`).map(r=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:r.statement}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[ct(r,t),` · `,ot(r.updatedAt,e)]})]}),(0,$.jsx)(X,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2.5`,disabled:S===`conflict:${n.id}`,onClick:()=>void Ut(n.id,r.id),children:t.useThis})]},r.id))},n.id))})]}):null,g.consentRequests.length>0?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.consentTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.consentHint})]}),g.consentRequests.map(e=>(0,$.jsxs)(`article`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/20 p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.consentPurpose.replace(`{{purpose}}`,e.purpose)}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,$.jsx)(X,{type:`button`,variant:`ghost`,disabled:S===`consent:${e.id}`,onClick:()=>void Bt(e.id,`deny`),children:t.consentDeny}),(0,$.jsx)(X,{type:`button`,variant:`secondary`,disabled:S===`consent:${e.id}`,onClick:()=>void Bt(e.id,`once`),children:t.consentOnce}),(0,$.jsx)(X,{type:`button`,variant:`secondary`,disabled:S===`consent:${e.id}`,onClick:()=>void Bt(e.id,`session`),children:t.consentSession}),(0,$.jsx)(X,{type:`button`,variant:`primary`,disabled:S===`consent:${e.id}`,onClick:()=>void Bt(e.id,`always`),children:t.consentAlways})]})]},e.id))]}):null,(0,$.jsxs)(`div`,{ref:xt,className:`space-y-6 scroll-mt-6`,children:[Et.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.connectedClaimsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.connectedClaimsHint})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:Et.map(n=>(0,$.jsx)(ut,{claim:n,language:e,t,busy:S===`claim:${n.id}`,onDecision:e=>void Nt(n,e)},n.id))})]}):null,Tt.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.reviewTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.reviewHint})]}),(0,$.jsx)(X,{type:`button`,variant:`secondary`,disabled:S===`understanding:batch`,onClick:()=>void Ht(),children:t.reviewAll})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:Tt.map(n=>(0,$.jsx)(lt,{item:n,language:e,t,busy:S===n.id,onConfirm:()=>void zt(n,`confirm`),onReject:()=>void zt(n,`reject`),onUpdate:e=>void zt(n,`update`,e),onForget:()=>J(n)},n.id))})]}):wt.length>0||Et.some(e=>e.state===`active`)?(0,$.jsxs)(`div`,{className:`rounded-2xl border border-success/20 bg-success-soft p-6 text-center`,children:[(0,$.jsx)(o,{className:`mx-auto size-5 text-success`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-2 text-sm font-semibold text-fg`,children:t.nothingToReview}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.nothingToReviewHint})]}):null]}),tt.map(n=>{let r=Ot.get(n)??[];return r.length===0?null:(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.facets[n]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:r.map(n=>(0,$.jsx)(lt,{item:n,language:e,t,busy:S===n.id,onConfirm:()=>void zt(n,`confirm`),onReject:()=>void zt(n,`reject`),onUpdate:e=>void zt(n,`update`,e),onForget:()=>J(n)},n.id))})]},n)}),g.understanding.length===0&&Et.length===0?(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]}):null,g&&p===`collaboration`?(0,$.jsxs)(`div`,{id:`you-panel-collaboration`,role:`tabpanel`,"aria-labelledby":`you-tab-collaboration`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.collaborationTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.collaborationHint})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(N,{className:`size-4 text-accent`,"aria-hidden":!0}),t.supportModeTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.supportModeHint})]}),(0,$.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:t.supportModeTitle}),(0,$.jsx)(fe,{value:g.relationship.supportMode,disabled:We,onChange:e=>void Mt({supportMode:e.target.value}),children:Object.entries(t.supportModes).map(([e,t])=>(0,$.jsx)(Y,{value:e,children:t},e))})]})]}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 border-t border-edge-subtle pt-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:g.relationship.proactiveEnabled,disabled:We,onChange:e=>void Mt({proactiveEnabled:e.target.checked})}),t.proactiveEnabled]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,$.jsx)(Ae,{value:g.relationship.quietStart??``,disabled:We,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietStart,onChange:e=>void Mt({quietStart:e||null})})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,$.jsx)(Ae,{value:g.relationship.quietEnd??``,disabled:We,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietEnd,onChange:e=>void Mt({quietEnd:e||null})})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.blockedTopics,(0,$.jsx)(`input`,{className:rt,defaultValue:g.relationship.blockedTopics.join(`, `),disabled:We,onBlur:e=>void Mt({blockedTopics:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})})]})]}),(0,$.jsx)(`p`,{className:`mt-3 text-right text-xs text-fg-subtle`,children:We?t.saving:t.autoSaveHint})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(_,{className:`size-4 text-accent`,"aria-hidden":!0}),t.playbooksTitle]}),(0,$.jsx)(at,{children:t.affectsAgentsBadge})]}),g.playbooks.length>0?(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 xl:grid-cols-3`,children:g.playbooks.map(e=>(0,$.jsx)(ft,{playbook:e,busy:S===`playbook:${e.id}`,t,onToggleGroup:()=>void Kt(e),onCreate:t=>void qt(e.id,()=>I(e.id,t,(e.rules.at(-1)?.order??0)+10)),onUpdate:(t,n)=>void qt(e.id,()=>K(e.id,t,n)),onDelete:t=>void qt(e.id,()=>D(e.id,t)),onRollback:(t,n)=>void qt(e.id,()=>xe(e.id,t,n))},e.id))}):(0,$.jsx)(`p`,{className:`mt-4 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.emptyPlaybooks})]})]}):null,g&&p===`sources`?(0,$.jsx)(Xe,{sources:g.sources,language:e,t,busyId:S,onAddSource:()=>n(`/connectors?personalContext=1`),onLearn:e=>void Lt(e),onPause:e=>void Rt(e),onConfigure:It,onDisconnect:dt,onViewUnderstanding:()=>Pt(`memory`)}):null,g&&p===`privacy`&&kt?(0,$.jsxs)(`div`,{id:`you-panel-privacy`,role:`tabpanel`,"aria-labelledby":`you-tab-privacy`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.privacyTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.privacyHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-2`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.controlTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.controlHint}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-3 rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.learningMode,(0,$.jsx)(fe,{value:kt.mode,disabled:Be,onChange:e=>void tn({...kt,mode:e.target.value}),children:Object.entries(t.learningModes).map(([e,t])=>(0,$.jsx)(Y,{value:e,children:t},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.sensitive,(0,$.jsx)(fe,{value:kt.sensitiveWritePolicy,disabled:Be,onChange:e=>void tn({...kt,sensitiveWritePolicy:e.target.value}),children:Object.entries(t.sensitiveOptions).map(([e,t])=>(0,$.jsx)(Y,{value:e,children:t},e))}),(0,$.jsx)(`span`,{className:`font-normal leading-5 text-fg-subtle`,children:t.sensitiveOptionHints[kt.sensitiveWritePolicy]})]}),(0,$.jsx)(`p`,{className:`text-right text-xs text-fg-subtle`,children:Be?t.saving:t.autoSaveHint})]})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.trustTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.trustHint}),(0,$.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:g.trust.levels.map(e=>(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":e===g.trust.defaultActionLevel,disabled:He,onClick:()=>{e!==g.trust.defaultActionLevel&&(e===`auto`?qe(e):nn(e))},className:c(`rounded-xl border p-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-70`,e===g.trust.defaultActionLevel?`border-accent/35 bg-accent-soft/35`:`border-edge-subtle bg-surface-panel hover:border-accent/25 hover:bg-surface-hover`),children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:t.trustLevels[e]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustLevelHints[e]}),e===g.trust.defaultActionLevel?(0,$.jsx)(`span`,{className:`mt-2 inline-block rounded-full bg-accent-soft px-2 py-0.5 text-[11px] text-accent-fg`,children:t.defaultTrust}):null]},e))})]})]}),(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(se,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.sharingTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.sharingHint})]})]})}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.grantsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.grantsHint}),g.referenceGrants.length>0?(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:g.referenceGrants.map(n=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm text-fg`,children:n.statement}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[n.grantScope?t.grantScopes[n.grantScope]:``,n.expiresAt?` · ${ot(n.expiresAt,e)}`:``]})]}),(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2.5`,disabled:S===`grant:${n.id}`,onClick:()=>void Wt(n.id),children:t.revoke})]},n.id))}):(0,$.jsx)(`p`,{className:`mt-3 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.noGrants})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.transferTitle}),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,$.jsxs)(X,{type:`button`,variant:`secondary`,disabled:ht!==null,onClick:()=>void an(),children:[(0,$.jsx)(T,{className:`size-4`,"aria-hidden":!0}),ht===`export`?t.exporting:t.exportAction]}),(0,$.jsxs)(X,{type:`button`,variant:`secondary`,disabled:ht!==null,onClick:()=>St.current?.click(),children:[(0,$.jsx)(R,{className:`size-4`,"aria-hidden":!0}),ht===`import`?t.importing:t.importAction]}),(0,$.jsx)(`input`,{ref:St,type:`file`,accept:`application/json,.json`,className:`sr-only`,onChange:e=>Qe(e.target.files?.[0]??null)})]})]})]}):null,(0,$.jsx)(de,{open:te!==null,title:t.forgetTitle,description:t.forgetBody,confirmLabel:t.forget,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void Jt(),onCancel:()=>J(null)}),(0,$.jsx)(de,{open:Ke===`auto`,title:t.autoConfirmTitle,description:t.autoConfirmBody,confirmLabel:t.autoConfirmAction,cancelLabel:t.cancel,onConfirm:()=>void nn(`auto`),onCancel:()=>qe(null)}),(0,$.jsx)(de,{open:Ze!==null,title:t.importConfirmTitle,description:t.importConfirmBody.replace(`{{name}}`,Ze?.name??``),confirmLabel:t.importConfirmAction,cancelLabel:t.cancel,onConfirm:()=>{let e=Ze;Qe(null),on(e)},onCancel:sn}),(0,$.jsx)(Re,{source:$e,language:e,busy:pt,onOpenChange:e=>{e||dt(null)},onConfirm:e=>void rn(e)}),(0,$.jsx)(Ie,{open:Je,t,onOpenChange:Ye,onNavigate:Pt})]})}export{_t as UserContextPage};
|
|
@@ -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"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-
|
|
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"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-CAuhEGCn.js";import{bs as o,to as s}from"./index-eyttVNS_.js";e();var c=t();function l(){return{enabled:!0,provider:`xopc-local`,alibaba:{model:`paraformer-v2`},openai:{model:`whisper-1`},providers:{"xopc-local":{model:`sensevoice-small`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function u(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function p(e,t,n){let r=d(e.providers)?e.providers:void 0,i=r&&d(r[t])?r[t]:void 0;return{...n,...i??{}}}function m(e){let t=l();if(!d(e))return t;let n=f(e.provider),r=p(e,`alibaba`,t.alibaba??{}),i=p(e,`openai`,t.openai??{}),a=t.fallback??{enabled:!1,order:[`xopc-local`]};if(d(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):a.order;a={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:a.enabled,order:t.length?t:a.order}}let o=d(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,d(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,alibaba:r,openai:i,...o?{providers:o}:{},fallback:a}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=u();if(!d(e))return t;let n=h(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i=t[`tts-local-cli`]??{},a=d(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,d(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,...a?{providers:a}:{},alibaba:p(e,`alibaba`,t.alibaba??{}),openai:p(e,`openai`,t.openai??{}),edge:p(e,`edge`,t.edge??{}),minimax:p(e,`minimax`,t.minimax??{}),"tts-local-cli":p(e,`tts-local-cli`,i)}}function _(e){let{alibaba:t,openai:n,providers:r,...i}=e,a={...r??{}};return t&&(a.alibaba={...a.alibaba??{},...t}),n&&(a.openai={...a.openai??{},...n}),{...i,...Object.keys(a).length>0?{providers:a}:{}}}function v(e){let{alibaba:t,openai:n,edge:r,minimax:i,"tts-local-cli":a,providers:o,...s}=e,c={...o??{}};return t&&(c.alibaba={...c.alibaba??{},...t}),n&&(c.openai={...c.openai??{},...n}),r&&(c.edge={...c.edge??{},...r}),i&&(c.minimax={...c.minimax??{},...i}),a&&(c[`tts-local-cli`]={...c[`tts-local-cli`]??{},...a}),{...s,...Object.keys(c).length>0?{providers:c}:{}}}function y(e){let t=d(e)?e:{},n=d(t.voice)?t.voice:{},r=d(n.input)?n.input:{},i=d(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:m(t.stt),tts:g(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:a,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}}}}}async function b(){return y((await a(i(`/api/config`))).payload?.config??{})}async function x(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:_(e.stt),tts:v(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await a(i(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),s()}async function S(){let e=await a(i(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function C(){let e=await a(i(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function w(){let e=await a(i(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function T(){let e=await a(i(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function E(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function D(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function O(e){let t=await a(i(`/api/voice/tts-test`),{method:`POST`,body:JSON.stringify(e)});if(t.ok===!1){let e=typeof t.error==`string`?t.error:t.error?.message;throw Error(e||`TTS test failed`)}if(!t.payload||typeof t.payload.audio!=`string`||!t.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return t.payload}async function k(e){let t=await a(i(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}var A=n();function j(e){let t=(0,c.c)(15),{kind:n,providerId:i,fieldId:a,value:s,onChange:l,labels:u,placeholder:d,className:f}=e,p=d===void 0?`sk-...`:d,m;t[0]!==n||t[1]!==i?(m=()=>k({kind:n,provider:i}).then(M),t[0]=n,t[1]=i,t[2]=m):m=t[2];let h=m,g;t[3]===f?g=t[4]:(g=r(`flex min-w-0 flex-col gap-1.5`,f),t[3]=f,t[4]=g);let _;t[5]!==a||t[6]!==u||t[7]!==l||t[8]!==p||t[9]!==h||t[10]!==s?(_=(0,A.jsx)(o,{id:a,value:s,onChange:l,placeholder:p,labels:u,reveal:h,loadFailedLabel:u.loadFailed,maskedHelp:u.maskedHelp,notInConfigFile:u.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=u,t[7]=l,t[8]=p,t[9]=h,t[10]=s,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,A.jsx)(`div`,{className:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function M(e){return e.apiKey??null}export{b as a,y as c,O as d,C as i,x as l,T as n,w as o,S as r,E as s,j as t,D as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./messages-BiBdO1-O.js";import{n as ee}from"./locale-store-CAuhEGCn.js";import{Al as te,Ao as ne,As as re,At as ie,Do as ae,Eo as s,Fo as oe,Io as se,Lo as c,Mo as ce,Ms as l,No as le,Oo as ue,Pl as u,Po as de,Pt as fe,Rl as pe,Ro as me,Ul as he,_u as ge,hu as d,jo as f,ko as _e,ks as p,lc as m,ro as h,ru as ve,tl as g}from"./index-eyttVNS_.js";import{l as ye,t as be}from"./api-DwyUxpgY.js";var _=e(t(),1),v=new Set([`completed`,`failed`,`canceled`]);function xe(){return new Promise(e=>window.setTimeout(e,1200))}async function Se(e,t){let n=[],r=t.wait??xe;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!v.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var y=n(),Ce=[`folder_structure`,`recent_progress`,`next_steps`];function b(e){return e instanceof Error?e.message:String(e)}function x(){let e=ee(e=>e.language),t=o(e).onboarding.workDiscovery,n=o(e).chat.workingDirectory,v=i(),[xe]=r(),x=xe.get(`new`)===`1`,[S,C]=(0,_.useState)(`loading`),[w,T]=(0,_.useState)(null),[E,D]=(0,_.useState)(null),[O,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)(null),[we,M]=(0,_.useState)(!1),[N,P]=(0,_.useState)(``),[F,I]=(0,_.useState)(!1),[L,R]=(0,_.useState)(()=>new Set),[z,Te]=(0,_.useState)(!1),[B,Ee]=(0,_.useState)([]),[V,De]=(0,_.useState)(()=>new Set),[Oe,H]=(0,_.useState)([]),[ke,Ae]=(0,_.useState)(!1),[U,W]=(0,_.useState)({current:0,total:0}),G=(0,_.useRef)(!1),K=(0,_.useCallback)(e=>{s.getState().updateDirectoryRun(e),D(e),e.status===`completed`?(R(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),C(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?C(`error`):C(`running`)},[]),je=async()=>{k(!0),j(null);try{let e=await ue();if(!e.length){j(t.noCandidates);return}Ee(e),De(new Set([e[0].rootPath])),C(`candidates`)}catch(e){j(b(e))}finally{k(!1)}},Me=e=>{De(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ne=(0,_.useCallback)((e,t,n)=>{s.getState().updateDirectoryRun(e),D(e),W({current:t+1,total:n}),H(n=>{let r=[...n];return r[t]=e,r}),C(`running`)},[]),Pe=(0,_.useCallback)(e=>{H(t=>t.map(t=>t?.id===e.id?e:t))},[]),Fe=async()=>{let e=B.filter(e=>V.has(e.rootPath));if(!e.length)return;k(!0),j(null),H([]),W({current:1,total:e.length}),Ae(!0),G.current=!1;let n=!1;try{let r=await Se(e,{grantDirectory:ce,startRun:se,fetchRun:f,shouldStop:()=>G.current,onRun:(e,t,r)=>{Ne(e,t,r),n||(n=!0,s.getState().scanPersonalContext(e.id))},onError:(n,r,i)=>{W({current:i+1,total:e.length}),j(t.folderAnalysisFailed.replace(`{{folder}}`,r.displayName).replace(`{{error}}`,b(n)))}});if(G.current)return;let i=r.find(e=>e.status===`completed`)??r.at(-1);i?K(i):C(`candidates`)}catch(e){j(b(e)),C(`candidates`)}finally{Ae(!1),k(!1)}},q=fe({onPicked:(0,_.useCallback)(async e=>{k(!0),j(null);try{T(await le(e)),C(`consent`)}catch(e){j(b(e)),C(`intro`)}finally{k(!1)}},[])});(0,_.useEffect)(()=>{let e=!1;return ne().then(async({enabled:t,state:n})=>{if(!e){if(!t){v(`/chat`,{replace:!0});return}if(!x&&n.activeRunId)try{let t=await f(n.activeRunId);e||K(t);return}catch{}e||C(`intro`)}}).catch(t=>{e||(j(b(t)),C(`intro`))}),()=>{e=!0}},[K,v,x]),(0,_.useEffect)(()=>{if(!E||S!==`running`||ke)return;let e=!1,t=async()=>{try{let t=await f(E.id);e||K(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===E.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[K,ke,S,E]);let J=async()=>{k(!0);try{await _e()}finally{v(`/chat`,{replace:!0})}},Ie=async()=>{if(w){k(!0),j(null),H([]),W({current:0,total:0});try{await ce(w.canonicalRootPath);let e=await se(w.canonicalRootPath);K(e),s.getState().scanPersonalContext(e.id)}catch(e){j(b(e)),C(`consent`)}finally{k(!1)}}},Y=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;v(`/chat/${encodeURIComponent(e)}${n}`)},Le=e=>{D(e),Te(!1),M(!1),I(!1),R(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?C(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?C(`error`):C(`running`)},Re=async()=>{E&&(G.current=!0,K(await ae(E.id)))},X=async(t,n)=>{if(!E)return;await oe(E.id,t.id).catch(()=>{});let r=n?`${e===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${t.actionPrompt}`:t.actionPrompt;Y(E.sessionKey,r)},ze=async()=>{if(E){k(!0),j(null);try{let e=E.result?.profileCandidates??[],t=await c((e.length>0?await me(E.id,e.map(e=>({id:e.id,status:L.has(e.id)?`accepted`:`rejected`}))):E).id,`confirmed`);D(t),Pe(t),C(`recommendation`)}catch(e){j(b(e))}finally{k(!1)}}},Z=async e=>{if(!(!E||!N.trim())){k(!0),j(null);try{let t=await c(E.id,e,N.trim());D(t),Y(t.sessionKey,N.trim())}catch(e){j(b(e)),k(!1)}}},Be=async()=>{if(E){k(!0);try{Y((await c(E.id,`dismissed`)).sessionKey)}catch(e){j(b(e)),k(!1)}}},Ve=async()=>{let e=E?.result?.workThreads?.find(e=>e.horizon===`current`)??E?.result?.workThreads?.[0];if(e){k(!0),j(null);try{let t=await ye(e.id,`accept`);t&&await be(t.id,`progress`,!0),Te(!0)}catch(e){j(b(e))}finally{k(!1)}}},Q=E?.result?.suggestions.find(e=>e.id===E.result?.primarySuggestionId)??E?.result?.suggestions[0],He=E?.result?.suggestions.filter(e=>e.id!==Q?.id)??[],Ue=e=>e===`command`?t.riskCommand:e===`file_write`?t.riskFileWrite:t.riskAnalysis,We=Oe.filter(e=>e?.status===`completed`),$=We.length>1?(0,y.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,y.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:t.analysisResults}),(0,y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:We.map(e=>{let t=B.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,y.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===E?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>Le(e),children:t},e.id)})})]}):null;return(0,y.jsxs)(`div`,{className:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,y.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[(0,y.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,y.jsx)(re,{className:`size-11`})}),S===`loading`?(0,y.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,y.jsx)(h,{className:`mx-auto h-8 w-64`}),(0,y.jsx)(h,{className:`mx-auto h-4 w-full max-w-lg`}),(0,y.jsx)(h,{className:`mx-auto size-4/5 max-w-md`}),(0,y.jsx)(h,{className:`mt-8 h-12 w-full rounded-xl`})]}):null,S===`intro`?(0,y.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,y.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.title}),(0,y.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:t.subtitle})]}),(0,y.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[(0,y.jsxs)(p,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void je(),disabled:O||q.picking,children:[O?(0,y.jsx)(g,{className:`size-4 animate-spin`}):(0,y.jsx)(m,{className:`size-4`}),t.quickScan]}),(0,y.jsxs)(p,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:q.pick,disabled:O||q.picking,children:[q.picking?(0,y.jsx)(g,{className:`size-4 animate-spin`}):(0,y.jsx)(u,{className:`size-4`}),t.chooseFolderManually]}),(0,y.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,y.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`span`,{children:t.quickScanNote})]}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null]}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void J(),disabled:O,children:t.skip})]}):null,S===`candidates`?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-candidates-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.candidatesTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.candidatesSubtitle})]}),(0,y.jsx)(`div`,{className:`mt-7 space-y-2`,children:B.map((e,n)=>{let r=V.has(e.rootPath);return(0,y.jsxs)(`button`,{type:`button`,"aria-pressed":r,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${r?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Me(e.rootPath),children:[(0,y.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${r?`border-accent bg-accent text-white`:`border-edge bg-surface-base text-transparent`}`,children:(0,y.jsx)(a,{className:`size-3.5`})}),(0,y.jsx)(u,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),n===0?(0,y.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:t.recommendedCandidate}):null]}),(0,y.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,y.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,y.jsx)(`span`,{children:e.projectKind===`coding`?t.codingProject:e.projectKind===`general`?t.generalProject:t.unknownProject}),e.branch?(0,y.jsx)(`span`,{children:t.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,y.jsx)(`span`,{children:t.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,y.jsxs)(`div`,{className:`mt-5 flex items-start gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,y.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`span`,{children:t.multiFolderPrivacyNote})]}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(p,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O||V.size===0,onClick:()=>void Fe(),children:[O?(0,y.jsx)(g,{className:`mr-2 size-4 animate-spin`}):null,t.analyzeSelected.replace(`{{count}}`,String(V.size))]}),(0,y.jsx)(p,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:q.pick,children:t.chooseFolderManually})]}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>C(`intro`),children:t.back})]}):null,S===`consent`&&w?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.selectedTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.selectedSubtitle})]}),(0,y.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,y.jsx)(u,{className:`size-5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:w.displayName}),(0,y.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:w.canonicalRootPath})]}),(0,y.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:w.projectKind===`coding`?t.codingProject:w.projectKind===`general`?t.generalProject:t.unknownProject})]}),(0,y.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.localFingerprint}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:w.fingerprint.branch?t.branchValue.replace(`{{branch}}`,w.fingerprint.branch):t.noGitBranch})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.recentActivity}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:t.changedFiles.replace(`{{count}}`,String(w.fingerprint.changedFileCount))})]}),w.fingerprint.recentAreas.length>0?(0,y.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.recentAreas}),(0,y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:w.fingerprint.recentAreas.map(e=>(0,y.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,y.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(pe,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.willRead}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.willReadValue})]})]}),(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.willIgnore}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.willIgnoreValue})]})]}),(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:w.remoteModel?t.providerDisclosure.replace(`{{provider}}`,w.provider):t.localDisclosure})]})]})]}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(p,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void Ie(),children:[O?(0,y.jsx)(g,{className:`mr-2 size-4 animate-spin`}):null,t.startAnalysis]}),(0,y.jsx)(p,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:q.pick,children:t.changeFolder})]}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void J(),children:t.skip})]}):null,S===`running`&&E?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.analyzingTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.analyzingSubtitle}),U.total>1?(0,y.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:t.analyzingFolderProgress.replace(`{{current}}`,String(U.current)).replace(`{{total}}`,String(U.total))}):null]}),(0,y.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:Ce.map((e,n)=>{let r=Math.max(0,Ce.indexOf(E.stage??`folder_structure`)),i=n<r,o=n===r;return(0,y.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,y.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${i?`bg-accent text-white`:o?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:i?(0,y.jsx)(a,{className:`size-4`}):o?(0,y.jsx)(g,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,y.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,y.jsx)(`span`,{className:o||i?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:t.stages[e]})]},e)})}),(0,y.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:E.rootPath}),(0,y.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,y.jsx)(p,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>v(`/chat`),children:t.continueInBackground}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void Re(),children:t.cancelAnalysis})]})]}):null,S===`recognition`&&E?.result?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:t.recognitionEyebrow}),(0,y.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:E.result.lowConfidence?t.lowConfidenceTitle:t.recognitionTitle})]}),$,(0,y.jsxs)(`div`,{className:`mt-7 rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/45 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,y.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:E.result.projectSummary}),(0,y.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:E.result.currentState}),!E.result.lowConfidence&&Q?.evidence.length?(0,y.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:Q.evidence.slice(0,3).map((e,t)=>(0,y.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,y.jsx)(te,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`span`,{children:[e.path?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${Q.id}-recognition-${t}`))}):null]}),E.result.workThreads?.length?(0,y.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.workThreadsTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.workThreadsSubtitle}),(0,y.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:E.result.workThreads.map(e=>(0,y.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:e.horizon===`current`?t.workThreadCurrent:e.horizon===`ongoing`?t.workThreadOngoing:t.workThreadLongTerm}),(0,y.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,y.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,E.result.profileCandidates?.length?(0,y.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.profileCandidatesTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.profileCandidatesSubtitle}),(0,y.jsx)(`div`,{className:`mt-3 space-y-2`,children:E.result.profileCandidates.map(e=>(0,y.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,y.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:L.has(e.id),onChange:()=>R(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,y.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,E.result.lowConfidence?(0,y.jsxs)(`div`,{className:`mt-5`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:E.result.contextQuestion}),(0,y.jsx)(`textarea`,{value:N,onChange:e=>P(e.target.value),placeholder:t.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,y.jsx)(p,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:O||!N.trim(),onClick:()=>void Z(`different_goal`),children:t.continueWithCorrection})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(p,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void ze(),children:[O?(0,y.jsx)(g,{className:`size-4 animate-spin`}):(0,y.jsx)(a,{className:`size-4`}),t.confirmUnderstanding]}),(0,y.jsx)(p,{variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:()=>M(e=>!e),children:t.notQuiteRight})]}),we?(0,y.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:t.correctionLabel}),(0,y.jsx)(`textarea`,{id:`work-discovery-correction`,value:N,onChange:e=>P(e.target.value),placeholder:t.correctionPlaceholder,className:`mt-2 min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,y.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,y.jsx)(p,{variant:`ghost`,disabled:O||!N.trim(),onClick:()=>void Z(`different_goal`),children:t.differentGoal}),(0,y.jsx)(p,{variant:`primary`,disabled:O||!N.trim(),onClick:()=>void Z(`corrected`),children:t.useCorrection})]})]}):null]}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.jsx)(`button`,{type:`button`,disabled:O,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void Be(),children:t.openConversation})]}):null,S===`recommendation`&&E?.result&&Q?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:t.understandingConfirmed}),(0,y.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:t.primaryRecommendationTitle})]}),$,(0,y.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,y.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,y.jsx)(d,{className:`size-5`})}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:Q.title}),(0,y.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Q.rationale}),(0,y.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:[(0,y.jsx)(ve,{className:`size-3.5`}),t.estimatedMinutes.replace(`{{count}}`,String(Q.estimatedMinutes))]}),(0,y.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ue(Q.risk)})]}),(0,y.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.expectedOutcome}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:Q.expectedOutcome})]}),(0,y.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,y.jsx)(p,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:t.startRecommendedAction}),(0,y.jsx)(p,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void X(Q,!0),children:t.explainFirst})]})]})]})}),E.result.workThreads?.length?(0,y.jsx)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:(0,y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,y.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:z?(0,y.jsx)(a,{className:`size-4`}):(0,y.jsx)(he,{className:`size-4`})}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:z?t.focusActive:t.focusTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:z?t.focusActiveDescription:t.focusDescription}),z?null:(0,y.jsxs)(p,{className:`mt-3 h-9`,variant:`secondary`,disabled:O,onClick:()=>void Ve(),children:[O?(0,y.jsx)(g,{className:`size-4 animate-spin`}):(0,y.jsx)(he,{className:`size-4`}),t.activateFocus]})]})]})}):null,He.length>0?(0,y.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>I(e=>!e),children:[t.otherDirections,(0,y.jsx)(ge,{className:`size-4 transition-transform ${F?`rotate-180`:``}`})]}),F?(0,y.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:He.map(e=>(0,y.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void X(e,!0),children:[(0,y.jsx)(d,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,y.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedOutcome})]})]},e.id))}):null]}):null,(0,y.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,y.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(E.sessionKey),children:t.doSomethingElse}),(0,y.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{M(!0),C(`recognition`)},children:t.correctUnderstanding})]})]}):null,S===`error`&&E?(0,y.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,y.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,y.jsx)(l,{className:`size-5`})}),(0,y.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:t.errorTitle}),(0,y.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:E.errorMessage}),(0,y.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsx)(p,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void de(E.id).then(K),children:t.retry}),(0,y.jsx)(p,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{D(null),T(null),C(`intro`)},children:t.chooseDifferent})]}),(0,y.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(E.sessionKey),children:t.openConversation})]}):null]}),q.hasNativePicker?null:(0,y.jsx)(ie,{open:q.modalOpen,onOpenChange:q.setModalOpen,initialAbsolutePath:w?.canonicalRootPath,onConfirm:q.confirmPick,wd:n})]})}export{x as WorkDiscoveryPage};
|
|
@@ -0,0 +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{d as i,l as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-BiBdO1-O.js";import{n as ee}from"./locale-store-CAuhEGCn.js";import{A as te,Ac as ne,Al as re,Fa as ie,Gs as ae,Jl as oe,Nu as l,Rl as u,Sc as se,To as d,Wl as ce,Xc as f,Ys as p,a as m,bu as h,f as le,is as g,ks as _,l as ue,m as de,ns as fe,o as pe,p as me,pu as v,s as he,u as y,vt as b,xc as x,zc as S}from"./index-eyttVNS_.js";var C=n(),w=e(t(),1),T=r();function ge(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function E(e){return e?b(new Date(e)):``}function _e(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function ve(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:e.kind===`note`?`/notes/${encodeURIComponent(e.targetId)}`:`#`}function D(e){let t=(0,C.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,T.jsx)(`dt`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a=r||`-`,o;t[2]===a?o=t[3]:(o=(0,T.jsx)(`dd`,{className:`min-w-0 break-words text-sm text-fg`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,T.jsxs)(`div`,{className:`grid gap-1`,children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function ye(e){let t=(0,C.c)(9),{events:n,t:r}=e;if(!n.length){let e;return t[0]===r.detail.noActivity?e=t[1]:(e=(0,T.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:r.detail.noActivity}),t[0]=r.detail.noActivity,t[1]=e),e}let i;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,T.jsx)(`article`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r.eventTypes[e.type]??e.type}),(0,T.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:E(e.createdAt)})]})},e.id),t[5]=r,t[6]=e),i=n.map(e),t[2]=n,t[3]=r,t[4]=i}else i=t[4];let a;return t[7]===i?a=t[8]:(a=(0,T.jsx)(`div`,{className:`grid gap-3`,children:i}),t[7]=i,t[8]=a),a}function O(e){return new Set(e.toLowerCase().split(/[^a-z0-9\u4e00-\u9fff]+/).filter(e=>e.length>=2))}function k(e,t,n){let r=t?.projectKind,i=[e.title,e.description,e.nextAction,e.blockedReason,e.status,e.priority,t?.name,t?.description,r].filter(Boolean).join(` `),a=[n.title,n.description,n.metadata.whenToUse,...n.metadata.tags??[]].filter(Boolean).join(` `),o=O(i),s=0;for(let e of O(a))o.has(e)&&(s+=3);let c=a.toLowerCase();return(e.status===`blocked`||e.status===`needs_input`)&&/debug|diagnos|review|audit|fix|检查|排查|修复/.test(c)&&(s+=8),e.status===`in_review`&&/review|audit|check|验收|评审|检查/.test(c)&&(s+=6),e.attachments?.length&&/analy|extract|summar|review|整理|分析|总结/.test(c)&&(s+=5),r===`coding`&&/code|repo|test|pr|review|代码|仓库|测试/.test(c)&&(s+=5),s}function A(e,t,n){return[...n].sort((n,r)=>k(e,t,r)-k(e,t,n)||n.title.localeCompare(r.title))}function j(){let{workItemId:e=``}=i(),t=a(),n=c(ee(e=>e.language)).projectDetailPage.workItems,[r,b]=(0,w.useState)(null),[C,O]=(0,w.useState)(null),[j,M]=(0,w.useState)([]),[N,be]=(0,w.useState)([]),[P,F]=(0,w.useState)(``),[I,L]=(0,w.useState)(``),[R,z]=(0,w.useState)(!0),[B,V]=(0,w.useState)(!1),[H,U]=(0,w.useState)(null),W=(0,w.useRef)(null),G=d(e=>e.setPageHeader),K=d(e=>e.clearPageHeader),q=(0,w.useMemo)(()=>r?`/projects/${encodeURIComponent(r.projectId)}/work-items`:`/projects`,[r]),J=(0,w.useCallback)(async()=>{if(e){z(!0),U(null);try{let[t,n]=await Promise.all([ue(e),y(e).catch(()=>({events:[]}))]);b(t.item),L(t.item.nextAction||t.item.title),M(n.events);let[r,i]=await Promise.all([ie(t.item.projectId).catch(()=>null),te().catch(()=>[])]),a=A(t.item,r,i);O(r),be(a),F(e=>e||a[0]?.id||``)}catch(e){U(e instanceof Error?e.message:String(e))}finally{z(!1)}}},[e]);(0,w.useEffect)(()=>{J()},[J]);let Y=(0,w.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await le(r.id);b(e.item),t(`/chat/${encodeURIComponent(e.session.key)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),X=(0,w.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await m(r.id);b(e.item),t(`/goals/${encodeURIComponent(e.goal.id)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),Z=(0,w.useCallback)(async e=>{M((await y(e).catch(()=>({events:[]}))).events)},[]),xe=(0,w.useCallback)(async()=>{if(!(!r||!P)){V(!0),U(null);try{let e=await me(r.id,{definitionId:P,goal:I.trim()||r.nextAction||r.title});b(e.item),await Z(e.item.id),t(`/workflows?run=${encodeURIComponent(e.runId)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t,Z,P,I]),Se=(0,w.useCallback)(async e=>{if(!(!r||!e.length)){V(!0),U(null);try{let t=await de(r.id,e);b(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),Ce=(0,w.useCallback)(async e=>{if(r){V(!0),U(null);try{let t=await pe(r.id,e.id);b(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),we=(0,w.useCallback)(async e=>{if(r){U(null);try{await he(r.id,e)}catch(e){U(e instanceof Error?e.message:String(e))}}},[r]),Q=(0,w.useMemo)(()=>r?N.filter(e=>k(r,C,e)>0).slice(0,3):[],[r,C,N]),$=(0,w.useMemo)(()=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(_,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void J(),children:[(0,T.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden sm:inline`,children:n.refreshShort})]}),r?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.startChat})]}),(0,T.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.createGoal})]})]}):null]}),[B,X,Y,r,J,n.detail.createGoal,n.detail.startChat,n.refreshShort]);return(0,w.useLayoutEffect)(()=>(G({startExtra:(0,T.jsx)(o,{to:q,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":C?.name?n.detail.backToProject.replace(`{{name}}`,C.name):n.detail.backToProjects,children:(0,T.jsx)(l,{className:`size-4`,"aria-hidden":!0})}),main:(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(h,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,T.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r?.title??(R?n.detail.loading:n.detail.notFound)})]}),r?(0,T.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[n.statuses[r.status],` · `,n.priorities[r.priority],` · `,C?.name||r.projectId,` · `,n.updated,`: `,E(r.updatedAt)]}):null]}),end:$}),()=>K()),[K,$,r,R,C?.name,q,G,n,C]),R?(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,T.jsx)(`div`,{className:`h-8 w-40 animate-pulse rounded-md bg-surface-hover`}),(0,T.jsx)(`div`,{className:`mt-5 h-44 animate-pulse rounded-xl bg-surface-hover`})]}):H||!r?(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,children:[(0,T.jsxs)(o,{to:`/projects`,className:`inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,T.jsx)(l,{className:`size-4`,"aria-hidden":!0}),n.detail.backToProjects]}),(0,T.jsx)(`div`,{className:`mt-5 rounded-lg border border-danger/30 bg-danger-soft px-4 py-3 text-sm text-danger`,children:H||n.detail.notFound})]}):(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface sm:px-5`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(h,{className:`size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,T.jsx)(`h1`,{className:`min-w-0 break-words text-lg font-semibold leading-7 text-fg`,children:r.title})]}),(0,T.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs`,children:[(0,T.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 font-medium`,ge(r.status)),children:n.statuses[r.status]}),(0,T.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.priorities[r.priority]}),r.archivedAt?(0,T.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.detail.archived}):null]})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,T.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startChat]}),(0,T.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),n.detail.createGoal]})]})]}),(0,T.jsxs)(`dl`,{className:`mt-5 grid gap-4 border-t border-edge pt-4 sm:grid-cols-2`,children:[(0,T.jsx)(D,{label:n.create.descriptionLabel,value:r.description||n.detail.noDescription}),(0,T.jsx)(D,{label:n.nextAction,value:r.nextAction||n.noNextAction}),(0,T.jsx)(D,{label:n.blockedReason,value:r.blockedReason||n.detail.noBlockedReason}),(0,T.jsx)(D,{label:n.updated,value:E(r.updatedAt)})]})]}),(0,T.jsxs)(`div`,{className:`mt-4 grid min-h-0 gap-4 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,T.jsxs)(`section`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,T.jsx)(u,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.activity})]}),(0,T.jsx)(ye,{events:j,t:n})]}),(0,T.jsxs)(`aside`,{className:`grid content-start gap-4`,children:[(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,T.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,T.jsx)(re,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`truncate`,children:n.detail.workflowTitle})]})}),(0,T.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.detail.workflowHint}),(0,T.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,T.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowTemplate,(0,T.jsxs)(fe,{className:`h-9 rounded-md border border-edge bg-surface-base px-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:P,disabled:B||N.length===0,onChange:e=>F(e.target.value),children:[N.length===0?(0,T.jsx)(g,{value:``,children:n.detail.noWorkflowTemplates}):null,N.map(e=>(0,T.jsx)(g,{value:e.id,children:e.title},e.id))]})]}),Q.length?(0,T.jsxs)(`div`,{className:`grid gap-1`,children:[(0,T.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n.detail.recommendedWorkflows}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Q.map(e=>(0,T.jsx)(`button`,{type:`button`,className:s(`min-w-0 rounded-md border px-2 py-1 text-left text-xs transition-colors`,P===e.id?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),disabled:B,onClick:()=>F(e.id),children:(0,T.jsx)(`span`,{className:`block max-w-48 truncate`,children:e.title})},e.id))})]}):null,(0,T.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowGoal,(0,T.jsx)(`textarea`,{className:`min-h-20 resize-y rounded-md border border-edge bg-surface-base p-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:I,disabled:B,onChange:e=>L(e.target.value)})]}),(0,T.jsxs)(_,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3 text-xs`,disabled:B||!P,onClick:xe,children:[(0,T.jsx)(x,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startWorkflow]}),N.length?null:(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.detail.noWorkflowTemplates})]})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,T.jsx)(S,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`truncate`,children:n.attachments.title})]}),(0,T.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:()=>W.current?.click(),children:[(0,T.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),n.attachments.add]}),(0,T.jsx)(`input`,{ref:W,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{Se(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),(0,T.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.attachments?.length?r.attachments.map(e=>(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-base p-2 text-sm`,children:[(0,T.jsx)(u,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`div`,{className:`truncate font-medium text-fg`,children:e.fileName}),(0,T.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[e.mimeType,` · `,_e(e.size)]})]}),(0,T.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:n.attachments.download,"aria-label":n.attachments.download,disabled:B,onClick:()=>void we(e),children:(0,T.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0})}),(0,T.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:n.attachments.remove,"aria-label":n.attachments.remove,disabled:B,onClick:()=>void Ce(e),children:(0,T.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0})})]},e.id)):(0,T.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.attachments.empty})})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.links}),(0,T.jsx)(`div`,{className:`mt-3 grid gap-1 text-sm`,children:r.links?.length?r.links.map(e=>(0,T.jsxs)(o,{to:ve(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,T.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,T.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[n.linkKinds[e.kind],(0,T.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,T.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.detail.noLinks})})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.project}),(0,T.jsxs)(o,{to:q,className:`mt-2 inline-flex min-w-0 items-center gap-2 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,T.jsx)(v,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:C?.name||r.projectId})]})]})]})]})]})}export{j as WorkItemDetailPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./circle-alert-BEjgurr2.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-BiBdO1-O.js";import{n as u,o as d,r as f,s as p}from"./locale-store-CAuhEGCn.js";import{n as m}from"./activity-store-CyEDJeIt.js";import{Ac as h,Bo as g,Ci as _,Ei as v,Fl as y,Gl as b,Go as x,Gs as S,Ho as C,Mc as w,Ms as T,Mu as E,Qc as D,Rc as O,Ru as k,Si as A,Ti as j,To as M,Ul as N,Uo as P,Va as F,Vo as I,Wo as L,Ws as R,ac as z,hc as B,hu as V,ks as H,pu as U,ro as W,ru as ee,tl as G,tt as te,vl as ne,vt as K,vu as re,wi as q,xi as ie,zo as ae}from"./index-eyttVNS_.js";import{a as oe,d as se,l as ce,n as le,s as ue,t as de}from"./api-DwyUxpgY.js";import{t as fe}from"./copy-VueTIC2x.js";var J=e(t(),1),Y=n();function pe(e){try{return decodeURIComponent(e).trim()||null}catch{return null}}function X(e){if(!e)return null;let t=e.split(/[?#]/,1)[0],n=/^\/goals\/([^/]+)\/?$/.exec(t);if(n){let e=pe(n[1]);return e?{kind:`goal`,id:e}:null}let r=/^\/chat\/([^/]+)\/?$/.exec(t);if(r){let e=pe(r[1]);return!e||e===`new`?null:{kind:`session`,id:e}}return null}async function me(e,t){let n=e.kind===`goal`?`/api/goals/${encodeURIComponent(e.id)}`:`/api/sessions/${encodeURIComponent(e.id)}?limit=1`;try{return(await d(f(n),{signal:t})).status===404?`missing`:`available`}catch(e){if(t?.aborted)throw e;return`available`}}var Z=r(),Q=3,he={info:{Icon:ne,className:`text-accent-fg bg-accent-soft`},success:{Icon:U,className:`text-success bg-success-soft`},warning:{Icon:R,className:`text-warning bg-warning-soft`},error:{Icon:s,className:`text-danger bg-danger-soft`}};function ge(e,t){let n=Math.max(0,Math.round((Date.now()-e)/1e3));if(n<60)return t===`zh`?`刚刚`:`Just now`;let r=Math.round(n/60);if(r<60)return t===`zh`?`${r} 分钟前`:`${r}m ago`;let i=Math.round(r/60);if(i<24)return t===`zh`?`${i} 小时前`:`${i}h ago`;let a=Math.round(i/24);return t===`zh`?`${a} 天前`:`${a}d ago`}function _e(e){let t=(0,Y.c)(55),{item:n,targetAvailability:r}=e,i=u($),o;t[0]===i?o=t[1]:(o=l(i),t[0]=i,t[1]=o);let s=o.projectsPage.workHome,d=m(ve),{Icon:f,className:p}=he[n.tone],h;t[2]===p?h=t[3]:(h=c(`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg`,p),t[2]=p,t[3]=h);let g;t[4]!==f||t[5]!==n.status?(g=n.status===`running`?(0,Z.jsx)(G,{className:`size-3.5 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Z.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[4]=f,t[5]=n.status,t[6]=g):g=t[6];let _;t[7]!==h||t[8]!==g?(_=(0,Z.jsx)(`div`,{className:h,children:g}),t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]===n.title?v=t[11]:(v=(0,Z.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=v);let y;t[12]!==s.activityUnread||t[13]!==n.read?(y=n.read?null:(0,Z.jsx)(`span`,{className:`mt-1.5 size-1.5 shrink-0 rounded-full bg-accent`,"aria-label":s.activityUnread}),t[12]=s.activityUnread,t[13]=n.read,t[14]=y):y=t[14];let b;t[15]!==v||t[16]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[v,y]}),t[15]=v,t[16]=y,t[17]=b):b=t[17];let x;t[18]===n.message?x=t[19]:(x=n.message?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.message}):null,t[18]=n.message,t[19]=x);let S;t[20]===n.source?S=t[21]:(S=n.source?(0,Z.jsx)(`span`,{className:`max-w-48 truncate`,children:n.source}):null,t[20]=n.source,t[21]=S);let C;t[22]!==n.updatedAt||t[23]!==i?(C=ge(n.updatedAt,i),t[22]=n.updatedAt,t[23]=i,t[24]=C):C=t[24];let w;t[25]===C?w=t[26]:(w=(0,Z.jsx)(`span`,{children:C}),t[25]=C,t[26]=w);let E;t[27]===n.occurrences?E=t[28]:(E=n.occurrences>1?(0,Z.jsxs)(`span`,{children:[`×`,n.occurrences]}):null,t[27]=n.occurrences,t[28]=E);let D;t[29]!==s.activityCheckingRelated||t[30]!==s.activityRelatedMissing||t[31]!==s.activityViewRelated||t[32]!==n.href||t[33]!==r?(D=n.href&&r===`available`?(0,Z.jsxs)(a,{to:n.href,className:`inline-flex items-center gap-0.5 font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[s.activityViewRelated,(0,Z.jsx)(V,{className:`size-3`,"aria-hidden":!0})]}):n.href&&r===`checking`?(0,Z.jsx)(W,{className:`h-3 w-20 rounded`,"aria-label":s.activityCheckingRelated}):n.href&&r===`missing`?(0,Z.jsx)(`span`,{className:`font-medium text-fg-subtle`,role:`status`,children:s.activityRelatedMissing}):null,t[29]=s.activityCheckingRelated,t[30]=s.activityRelatedMissing,t[31]=s.activityViewRelated,t[32]=n.href,t[33]=r,t[34]=D):D=t[34];let O;t[35]!==w||t[36]!==E||t[37]!==D||t[38]!==S?(O=(0,Z.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] text-fg-subtle`,children:[S,w,E,D]}),t[35]=w,t[36]=E,t[37]=D,t[38]=S,t[39]=O):O=t[39];let k;t[40]!==O||t[41]!==b||t[42]!==x?(k=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,x,O]}),t[40]=O,t[41]=b,t[42]=x,t[43]=k):k=t[43];let A;t[44]!==n.id||t[45]!==d?(A=()=>d(n.id),t[44]=n.id,t[45]=d,t[46]=A):A=t[46];let j;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),t[47]=j):j=t[47];let M;t[48]!==s.activityRemove||t[49]!==A?(M=(0,Z.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-hover hover:text-fg group-hover:opacity-100 focus:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":s.activityRemove,onClick:A,children:j}),t[48]=s.activityRemove,t[49]=A,t[50]=M):M=t[50];let N;return t[51]!==k||t[52]!==M||t[53]!==_?(N=(0,Z.jsxs)(`article`,{className:`group flex items-start gap-3 border-t border-edge-subtle px-1 py-3 first:border-t-0`,children:[_,k,M]}),t[51]=k,t[52]=M,t[53]=_,t[54]=N):N=t[54],N}function ve(e){return e.remove}function $(e){return e.language}function ye(){let e=(0,Y.c)(12),t=l(u(Ae)).projectsPage.workHome,n=m(ke),r=m(Oe),i=m(De),[a,s]=(0,J.useState)(!1),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},e[0]=c):c=e[0];let[d,f]=(0,J.useState)(c),p;e[1]===n?p=e[2]:(p=n.filter(Ee),e[1]=n,e[2]=p);let h=p.length,g;e[3]===n?g=e[4]:(g=n.filter(Te),e[3]=n,e[4]=g);let _=g.length,v;e[5]!==a||e[6]!==n?(v=a?n:n.slice(0,Q),e[5]=a,e[6]=n,e[7]=v):v=e[7];let y=v,b,x;e[8]===n?(b=e[9],x=e[10]):(b=()=>{let e=new AbortController,t=new Map(n.flatMap(we));return f(Object.fromEntries([...t.keys()].map(Ce))),Promise.all([...t].map(async t=>{let[n,r]=t,i=await me(r,e.signal);e.signal.aborted||f(e=>({...e,[n]:i}))})).catch(Se),()=>e.abort()},x=[n],e[8]=n,e[9]=b,e[10]=x),(0,J.useEffect)(b,x);let C;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(k,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),e[11]=C):C=e[11],(0,Z.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,"aria-labelledby":`workbench-activity-title`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C,(0,Z.jsx)(`h2`,{id:`workbench-activity-title`,className:`text-sm font-semibold text-fg`,children:t.activityTitle}),h>0?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:[(0,Z.jsx)(G,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),h,` `,t.running]}):_>0?(0,Z.jsxs)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[_,` `,t.activityNew]}):null]})}),a&&n.length>0?(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[_>0?(0,Z.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:r,children:[(0,Z.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),t.activityMarkRead]}):null,n.some(xe)?(0,Z.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-fg-muted`,onClick:i,children:[(0,Z.jsx)(S,{className:`size-3.5`,"aria-hidden":!0}),t.activityClearFinished]}):null]}):null]}),n.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 px-1`,children:[y.map(e=>(0,Z.jsx)(_e,{item:e,targetAvailability:e.href&&X(e.href)?d[e.href]??`checking`:`available`},e.id)),n.length>Q?(0,Z.jsx)(`div`,{className:`border-t border-edge-subtle py-2 text-center`,children:(0,Z.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>s(be),children:a?t.activityShowLess:t.activityShowAll.replace(`{{count}}`,String(n.length))})}):null]}):(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-sm text-fg-muted`,children:[(0,Z.jsx)(ee,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`p`,{children:t.activityEmpty})]})]})}function be(e){return!e}function xe(e){return e.status===`done`}function Se(){}function Ce(e){return[e,`checking`]}function we(e){let t=X(e.href);return e.href&&t?[[e.href,t]]:[]}function Te(e){return!e.read}function Ee(e){return e.status===`running`}function De(e){return e.clearFinished}function Oe(e){return e.markAllRead}function ke(e){return e.items}function Ae(e){return e.language}function je(e){let t=(0,Y.c)(32),{focus:n,kind:r,language:i,busy:a,onMonitor:o}=e,s;t[0]===i?s=t[1]:(s=fe(i),t[0]=i,t[1]=s);let c=s,l;if(t[2]!==a||t[3]!==c.disabled||t[4]!==c.enableExternal||t[5]!==c.enableProgress||t[6]!==c.enabled||t[7]!==c.external||t[8]!==c.failed||t[9]!==c.lastRun||t[10]!==c.neverRun||t[11]!==c.nextRun||t[12]!==c.progress||t[13]!==c.queued||t[14]!==c.running||t[15]!==n.monitors||t[16]!==n.status||t[17]!==r||t[18]!==o){let e;t[20]===r?e=t[21]:(e=e=>e.kind===r,t[20]=r,t[21]=e);let i=n.monitors.find(e),s=i?.enabled===!0,u=r===`progress`?c.progress:c.external,d=r===`progress`?c.enableProgress:c.enableExternal,f=i?.runState===`running`?c.running:i?.runState===`queued`?c.queued:i?.runState===`failed`?c.failed:s?c.enabled:c.disabled,p=`size-1.5 shrink-0 rounded-full ${s?`bg-success`:`bg-fg-subtle/40`}`,m;t[22]===p?m=t[23]:(m=(0,Z.jsx)(`span`,{className:p,"aria-hidden":!0}),t[22]=p,t[23]=m);let h;t[24]!==m||t[25]!==u?(h=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-xs font-medium text-fg`,children:[m,u]}),t[24]=m,t[25]=u,t[26]=h):h=t[26];let g;t[27]===f?g=t[28]:(g=(0,Z.jsx)(`span`,{className:`shrink-0 text-[11px] text-fg-subtle`,children:f}),t[27]=f,t[28]=g);let _;t[29]!==h||t[30]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[h,g]}),t[29]=h,t[30]=g,t[31]=_):_=t[31],l=(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-base/70 px-3 py-2.5`,children:[_,s?(0,Z.jsxs)(`p`,{className:`mt-1.5 text-[11px] text-fg-subtle`,children:[i?.lastRunAt?`${c.lastRun} ${K(new Date(i.lastRunAt))}`:c.neverRun,i?.nextRunAt?` · ${c.nextRun} ${K(new Date(i.nextRunAt))}`:``]}):(0,Z.jsx)(H,{type:`button`,variant:`ghost`,className:`mt-1 h-7 px-0 text-xs text-accent`,disabled:a||n.status!==`active`,onClick:()=>o(r,!0),children:d})]}),t[2]=a,t[3]=c.disabled,t[4]=c.enableExternal,t[5]=c.enableProgress,t[6]=c.enabled,t[7]=c.external,t[8]=c.failed,t[9]=c.lastRun,t[10]=c.neverRun,t[11]=c.nextRun,t[12]=c.progress,t[13]=c.queued,t[14]=c.running,t[15]=n.monitors,t[16]=n.status,t[17]=r,t[18]=o,t[19]=l}else l=t[19];return l}function Me(e){let t=(0,Y.c)(61),{focus:n,language:r,busy:a,onMonitor:o,onStatus:s,onDelete:c}=e,l;t[0]===r?l=t[1]:(l=fe(r),t[0]=r,t[1]=l);let u=l,d=i(),f;t[2]!==n.id||t[3]!==d?(f=()=>d(`/work/focuses/${encodeURIComponent(n.id)}`),t[2]=n.id,t[3]=d,t[4]=f):f=t[4];let p;t[5]===n.title?p=t[6]:(p=(0,Z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[5]=n.title,t[6]=p);let m;t[7]===n.summary?m=t[8]:(m=(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.summary}),t[7]=n.summary,t[8]=m);let h;t[9]!==f||t[10]!==p||t[11]!==m?(h=(0,Z.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:f,children:[p,m]}),t[9]=f,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(b,{className:`size-4`,"aria-hidden":!0}),t[13]=g):g=t[13];let y;t[14]===a?y=t[15]:(y=(0,Z.jsx)(v,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,disabled:a,children:g})}),t[14]=a,t[15]=y);let x;t[16]!==n.status||t[17]!==s?(x=()=>s(n.status===`paused`?`active`:`paused`),t[16]=n.status,t[17]=s,t[18]=x):x=t[18];let C;t[19]===n.status?C=t[20]:(C=n.status===`paused`?(0,Z.jsx)(w,{className:`size-4`}):(0,Z.jsx)(O,{className:`size-4`}),t[19]=n.status,t[20]=C);let T=n.status===`paused`?u.resume:u.pause,E;t[21]!==T||t[22]!==x||t[23]!==C?(E=(0,Z.jsxs)(A,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:x,children:[C,T]}),t[21]=T,t[22]=x,t[23]=C,t[24]=E):E=t[24];let D;t[25]===s?D=t[26]:(D=()=>s(`completed`),t[25]=s,t[26]=D);let k;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(U,{className:`size-4`}),t[27]=k):k=t[27];let M;t[28]!==u.complete||t[29]!==D?(M=(0,Z.jsxs)(A,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:D,children:[k,u.complete]}),t[28]=u.complete,t[29]=D,t[30]=M):M=t[30];let N;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(j,{className:`my-1 h-px bg-edge-subtle`}),t[31]=N):N=t[31];let P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(S,{className:`size-4`}),t[32]=P):P=t[32];let F;t[33]!==u.remove||t[34]!==c?(F=(0,Z.jsxs)(A,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none focus:bg-surface-hover`,onSelect:c,children:[P,u.remove]}),t[33]=u.remove,t[34]=c,t[35]=F):F=t[35];let I;t[36]!==E||t[37]!==M||t[38]!==F?(I=(0,Z.jsx)(_,{children:(0,Z.jsxs)(ie,{align:`end`,sideOffset:4,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,children:[E,M,N,F]})}),t[36]=E,t[37]=M,t[38]=F,t[39]=I):I=t[39];let L;t[40]!==I||t[41]!==y?(L=(0,Z.jsxs)(q,{children:[y,I]}),t[40]=I,t[41]=y,t[42]=L):L=t[42];let R;t[43]!==L||t[44]!==h?(R=(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[h,L]}),t[43]=L,t[44]=h,t[45]=R):R=t[45];let z;t[46]!==a||t[47]!==n||t[48]!==r||t[49]!==o?(z=(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:[(0,Z.jsx)(je,{focus:n,kind:`progress`,language:r,busy:a,onMonitor:o}),(0,Z.jsx)(je,{focus:n,kind:`external_changes`,language:r,busy:a,onMonitor:o})]}),t[46]=a,t[47]=n,t[48]=r,t[49]=o,t[50]=z):z=t[50];let B;t[51]!==n.id||t[52]!==d?(B=()=>d(`/work/focuses/${encodeURIComponent(n.id)}`),t[51]=n.id,t[52]=d,t[53]=B):B=t[53];let V;t[54]!==u.details||t[55]!==B?(V=(0,Z.jsxs)(`button`,{type:`button`,className:`mt-3 text-xs font-medium text-accent hover:underline`,onClick:B,children:[u.details,` →`]}),t[54]=u.details,t[55]=B,t[56]=V):V=t[56];let H;return t[57]!==R||t[58]!==z||t[59]!==V?(H=(0,Z.jsxs)(`article`,{className:`group rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:border-edge-strong`,children:[R,z,V]}),t[57]=R,t[58]=z,t[59]=V,t[60]=H):H=t[60],H}function Ne(e){return p(f(`/api/home${e?`?locale=${encodeURIComponent(e)}`:``}`))}function Pe(e,t){return p(f(`/api/home/decisions/respond`),{method:`POST`,body:JSON.stringify({...e,decision:t})})}function Fe(e){return e===`zh`?{newWork:`交给 xopc`,dialogTitle:`现在想完成什么?`,dialogDescription:`发送后会直接进入对话,xopc 会立即开始处理。`,intentLabel:`告诉 xopc 你要做什么`,intentPlaceholder:`例如:整理这周的会议记录,提炼待办并给出下周优先级`,submit:`进入对话`,needsAttention:`等你决定`,running:`xopc 正在处理`,continue:`继续推进`,recent:`最近对话`,focuses:`持续关注`,projects:`长期项目`,emptyRunning:`当前没有正在处理的对话`,emptyContinue:`还没有需要继续推进的事项`,openChat:`打开对话`}:{newWork:`Ask xopc`,dialogTitle:`What do you want to get done?`,dialogDescription:`You will enter a conversation immediately and xopc will start working.`,intentLabel:`Tell xopc what you need`,intentPlaceholder:`For example: summarize this week’s meeting notes and suggest next week’s priorities`,submit:`Open conversation`,needsAttention:`Needs your decision`,running:`xopc is working`,continue:`Continue`,recent:`Recent conversations`,focuses:`Ongoing focuses`,projects:`Long-term projects`,emptyRunning:`No conversations are running`,emptyContinue:`No ongoing items yet`,openChat:`Open conversation`}}function Ie(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Le(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:K(n)}function Re(e){let t=(0,Y.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function ze(){let e=(0,Y.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,Z.jsx)(W,{className:`h-20 rounded-2xl`}),(0,Z.jsx)(W,{className:`h-72 rounded-2xl`}),(0,Z.jsx)(W,{className:`h-44 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Be(e){let t=(0,Y.c)(19),{item:n,statusLabel:r}=e,i=`/work-items/${encodeURIComponent(n.id)}`,o;t[0]===n.title?o=t[1]:(o=(0,Z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=o);let s;t[2]===n.projectName?s=t[3]:(s=(0,Z.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.projectName}),t[2]=n.projectName,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:r}),t[7]=r,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;t[12]!==n.blockedReason||t[13]!==n.nextAction?(d=n.blockedReason||n.nextAction?(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.blockedReason||n.nextAction}):null,t[12]=n.blockedReason,t[13]=n.nextAction,t[14]=d):d=t[14];let f;return t[15]!==i||t[16]!==u||t[17]!==d?(f=(0,Z.jsxs)(a,{to:i,className:`group block rounded-lg px-1 py-2.5 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,d]}),t[15]=i,t[16]=u,t[17]=d,t[18]=f):f=t[18],f}function Ve(e){let t=(0,Y.c)(15),{chat:n,statusLabel:r}=e,i=`/chat/${encodeURIComponent(n.key)}`,o;t[0]===n.name?o=t[1]:(o=(0,Z.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:n.name}),t[0]=n.name,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,Z.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;t[7]===n.updatedAt?l=t[8]:(l=Le(n.updatedAt,``),t[7]=n.updatedAt,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==i||t[12]!==c||t[13]!==u?(d=(0,Z.jsxs)(a,{to:i,className:`group block rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[c,u]}),t[11]=i,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function He(e){let t=(0,Y.c)(27),{item:n,kindLabel:r,reasonLabel:i,approveLabel:o,denyLabel:s,busy:c,onRespond:l}=e,u;t[0]===n.title?u=t[1]:(u=(0,Z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=u);let d=n.projectName||r,f;t[2]===d?f=t[3]:(f=(0,Z.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==u||t[5]!==f?(p=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[u,f]}),t[4]=u,t[5]=f,t[6]=p):p=t[6];let m;t[7]===i?m=t[8]:(m=(0,Z.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[p,m]}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===n.detail?g=t[13]:(g=n.detail?(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.detail}):null,t[12]=n.detail,t[13]=g);let _;t[14]!==n.href||t[15]!==h||t[16]!==g?(_=(0,Z.jsxs)(a,{to:n.href,className:`group block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[h,g]}),t[14]=n.href,t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]!==o||t[19]!==c||t[20]!==s||t[21]!==n.response||t[22]!==l?(v=n.response?(0,Z.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-warning/20 pt-3`,children:[(0,Z.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`deny`),children:s}),(0,Z.jsx)(H,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`approve`),children:o})]}):null,t[18]=o,t[19]=c,t[20]=s,t[21]=n.response,t[22]=l,t[23]=v):v=t[23];let y;return t[24]!==_||t[25]!==v?(y=(0,Z.jsxs)(`article`,{className:`rounded-xl border border-warning/35 bg-warning-soft/25 p-3.5 transition-colors hover:bg-warning-soft/40`,children:[_,v]}),t[24]=_,t[25]=v,t[26]=y):y=t[26],y}function Ue(e){let t=(0,Y.c)(19),{project:n,openLabel:r,noDescription:i}=e,o=`/projects/${encodeURIComponent(n.id)}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(y,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===n.name?c=t[2]:(c=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[s,(0,Z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.name})]}),t[1]=n.name,t[2]=c);let l;t[3]===r?l=t[4]:(l=(0,Z.jsx)(E,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-label":r}),t[3]=r,t[4]=l);let u;t[5]!==c||t[6]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d=n.description||n.brief||i,f;t[8]===d?f=t[9]:(f=(0,Z.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-5 text-fg-muted`,children:d}),t[8]=d,t[9]=f);let p=n.lastActiveAt??n.updatedAt,m;t[10]===p?m=t[11]:(m=Le(p,``),t[10]=p,t[11]=m);let h;t[12]===m?h=t[13]:(h=(0,Z.jsx)(`p`,{className:`mt-auto pt-3 text-[11px] text-fg-subtle`,children:m}),t[12]=m,t[13]=h);let g;return t[14]!==o||t[15]!==h||t[16]!==u||t[17]!==f?(g=(0,Z.jsxs)(a,{to:o,className:`group flex min-h-32 flex-col rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,f,h]}),t[14]=o,t[15]=h,t[16]=u,t[17]=f,t[18]=g):g=t[18],g}function We(){let e=u(e=>e.language),t=l(e),n=t.projectsPage,r=fe(e),o=Fe(e),c=i(),d=M(e=>e.setPageHeader),f=M(e=>e.clearPageHeader),[p,m]=(0,J.useState)(null),[_,v]=(0,J.useState)([]),[y,b]=(0,J.useState)([]),[S,w]=(0,J.useState)([]),[E,O]=(0,J.useState)(!0),[k,A]=(0,J.useState)(null),[j,R]=(0,J.useState)(``),[V,U]=(0,J.useState)(!1),[W,G]=(0,J.useState)(``),[ne,K]=(0,J.useState)(null),[q,ie]=(0,J.useState)(null),[Y,pe]=(0,J.useState)(null),X=(0,J.useCallback)(async()=>{O(!0),A(null);try{let[t,n,r,i]=await Promise.all([Ne(e),F({limit:100,sortBy:`updatedAt`,sortOrder:`desc`}),ue(),oe()]);m(t),v(n.items),b(r),w(i)}catch(e){A(e instanceof Error?e.message:String(e))}finally{O(!1)}},[e]);(0,J.useEffect)(()=>{X()},[X]),(0,J.useEffect)(()=>{let e=()=>void X(),t=[`session-created`,`session-updated`,`session-transcript-updated`,`agent-run-started`,`agent-run-ended`,`focus-created`,`focus-updated`,`focus-deleted`,`focus-monitor-updated`,`focus-run-updated`,`focus-insight-updated`,`focus-candidate-updated`];return t.forEach(t=>window.addEventListener(t,e)),()=>t.forEach(t=>window.removeEventListener(t,e))},[X]);let me=(0,J.useMemo)(()=>{let e=j.trim().toLocaleLowerCase(),t=_.filter(e=>e.status!==`archived`);return e?t.filter(t=>[t.name,t.description,t.brief].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e))):t.slice(0,6)},[_,j]),Q=(0,J.useMemo)(()=>p?.decisions??[],[p]),he=(0,J.useMemo)(()=>p?.work.current.filter(e=>e.status!==`needs_input`&&e.status!==`in_review`&&e.status!==`blocked`).slice(0,10)??[],[p]),ge=(0,J.useCallback)(e=>{e.preventDefault();let t=W.trim();t&&(G(``),U(!1),c({pathname:`/chat/new`,search:`?${new URLSearchParams({draft:t,autoSend:`1`}).toString()}`},{state:{forceNewChat:!0}}))},[c,W]),_e=(0,J.useMemo)(()=>(0,Z.jsxs)(H,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>U(!0),children:[(0,Z.jsx)(h,{className:`size-4`,"aria-hidden":!0}),o.newWork]}),[o.newWork]),ve=(0,J.useCallback)(async(e,t)=>{if(e.response){K(e.id),A(null);try{await Pe(e.response,t),await X()}catch(e){A(e instanceof Error?e.message:String(e))}finally{K(null)}}},[X]),$=(0,J.useCallback)(async(e,t,n=r.operationDone)=>{ie(e),A(null),pe(null);try{await t();let[e,r]=await Promise.all([ue(),oe()]);b(e),w(r),pe(n)}catch(e){A(e instanceof Error?e.message:String(e))}finally{ie(null)}},[r.operationDone]);return(0,J.useLayoutEffect)(()=>(d({startExtra:null,main:(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.workHome.subtitle})]}),end:_e}),()=>f()),[f,_e,d,n.title,n.workHome.subtitle]),(0,Z.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[1200px] flex-1 flex-col gap-7 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,Z.jsx)(ae,{open:V,onOpenChange:U,children:(0,Z.jsxs)(L,{children:[(0,Z.jsx)(P,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Z.jsxs)(I,{className:`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-panel shadow-float focus:outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(x,{className:`text-base font-semibold text-fg`,children:o.dialogTitle}),(0,Z.jsx)(C,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:o.dialogDescription})]}),(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(H,{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,Z.jsx)(T,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Z.jsxs)(`form`,{onSubmit:ge,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,children:[(0,Z.jsx)(`label`,{htmlFor:`new-work-outcome`,className:`mb-2 shrink-0 text-sm font-medium text-fg`,children:o.intentLabel}),(0,Z.jsx)(`textarea`,{id:`new-work-outcome`,className:`min-h-32 w-full flex-1 resize-none rounded-xl border border-edge bg-surface-base p-3 text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,value:W,onChange:e=>G(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},placeholder:o.intentPlaceholder,maxLength:12e3,autoFocus:!0}),(0,Z.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,Z.jsx)(`span`,{children:n.workHome.submitShortcut}),(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[W.length.toLocaleString(),` / `,12e3.toLocaleString()]})]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(H,{type:`button`,variant:`ghost`,children:n.cancel})}),(0,Z.jsxs)(H,{type:`submit`,variant:`primary`,className:`min-w-32`,disabled:!W.trim(),children:[(0,Z.jsx)(z,{className:`size-4`,"aria-hidden":!0}),o.submit]})]})]})]})]})}),k?(0,Z.jsxs)(`div`,{className:`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,Z.jsx)(`span`,{children:k}),(0,Z.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void X(),children:n.workHome.retry})]}):null,E?(0,Z.jsx)(ze,{}):p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{className:`border-b border-edge-subtle pb-5`,children:[(0,Z.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:n.workHome.briefingTitle}),(0,Z.jsx)(`h2`,{className:`mt-1 text-xl font-semibold tracking-tight text-fg`,children:p.decisions.length>0?Ie(n.workHome.todaySummary,{attention:p.decisions.length,moving:p.briefing.progress.movingCount+p.chats.running.length}):Ie(n.workHome.todaySummaryClear,{moving:p.briefing.progress.movingCount+p.chats.running.length})}),p.briefing.summary?(0,Z.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.briefing.summary}):null]}),Y?(0,Z.jsx)(`div`,{role:`status`,className:`rounded-xl border border-success/25 bg-success-soft px-4 py-3 text-sm text-success`,children:Y}):null,p.work.current.length===0&&p.workflowRuns.active.length===0&&p.decisions.length===0&&p.chats.running.length===0&&p.chats.recent.length===0&&p.upcomingAutomations.length===0&&y.length===0?(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,Z.jsx)(D,{className:`mx-auto size-6 text-accent`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.workHome.emptyTitle}),(0,Z.jsx)(`p`,{className:`mx-auto mt-1 max-w-lg text-sm leading-6 text-fg-muted`,children:n.workHome.emptyBody}),(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,Z.jsx)(H,{type:`button`,variant:`primary`,onClick:()=>c(`/chat/new`),children:n.workHome.startChat}),(0,Z.jsx)(H,{type:`button`,variant:`secondary`,onClick:()=>U(!0),children:o.newWork})]})]}):null,(0,Z.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-6`,children:[Q.length>0?(0,Z.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(s,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.needsAttention}),(0,Z.jsx)(Re,{children:Q.length.toLocaleString()})]}),(0,Z.jsx)(`div`,{className:`mt-4 space-y-2`,children:Q.map(e=>(0,Z.jsx)(He,{item:e,kindLabel:n.workHome.decisionKinds[e.kind],reasonLabel:n.workHome.decisionReasons[e.reason],approveLabel:n.workHome.approve,denyLabel:n.workHome.deny,busy:ne===e.id,onRespond:t=>void ve(e,t)},e.id))})]}):(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,Z.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full bg-success-soft text-xs text-success`,"aria-hidden":!0,children:`✓`}),n.workHome.nothingNeedsYou]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(z,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.running}),(0,Z.jsx)(Re,{children:(p.chats.running.length+p.workflowRuns.active.length).toLocaleString()})]}),(0,Z.jsxs)(`div`,{className:`mt-4 divide-y divide-edge-subtle px-1`,children:[p.chats.running.map(e=>(0,Z.jsx)(`div`,{className:`py-1`,children:(0,Z.jsx)(Ve,{chat:e,statusLabel:n.workHome.running})},e.key)),p.workflowRuns.active.map(e=>(0,Z.jsxs)(a,{to:te(e.id),className:`flex items-center justify-between gap-3 rounded-lg px-2 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-accent`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.title})]}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.workHome.running})]},e.id)),p.chats.running.length===0&&p.workflowRuns.active.length===0?(0,Z.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:o.emptyRunning}):null]})]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(ee,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.continue}),(0,Z.jsx)(Re,{children:he.length.toLocaleString()})]}),(0,Z.jsxs)(`div`,{className:`mt-4 divide-y divide-edge-subtle px-1`,children:[he.map(e=>(0,Z.jsx)(`div`,{className:`py-1`,children:(0,Z.jsx)(Be,{item:e,statusLabel:t.projectDetailPage.workItems.statuses[e.status]})},e.id)),he.length===0?(0,Z.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:o.emptyContinue}):null]})]}),p.chats.recent.length>0?(0,Z.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.recent})}),(0,Z.jsx)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:p.chats.recent.slice(0,6).map(e=>(0,Z.jsx)(Ve,{chat:e,statusLabel:o.openChat},e.key))})]}):null]}),(0,Z.jsxs)(`aside`,{className:`min-w-0 space-y-4`,"aria-label":n.workHome.nowTitle,children:[(0,Z.jsx)(`div`,{className:`px-1`,children:(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.nowTitle})}),p.upcomingAutomations.length>0?(0,Z.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(re,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.workHome.scheduled})]}),(0,Z.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle`,children:p.upcomingAutomations.slice(0,3).map(e=>(0,Z.jsxs)(a,{to:`/automations`,className:`flex items-center justify-between gap-3 rounded-lg px-1 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.name||e.action}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:Le(e.nextRunAt,n.never)})]},e.id))})]}):null,(0,Z.jsx)(ye,{}),p.briefing.wins.length>0?(0,Z.jsxs)(a,{to:p.briefing.wins[0].href,className:`flex items-center justify-between gap-3 rounded-xl px-2 py-2 text-sm text-fg-muted hover:bg-surface-hover/55 hover:text-fg`,children:[(0,Z.jsx)(`span`,{children:Ie(n.workHome.completedSummary,{count:p.briefing.wins.length})}),(0,Z.jsxs)(`span`,{className:`shrink-0 text-xs font-medium text-accent`,children:[n.workHome.viewLatestResult,` →`]})]}):null]})]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(N,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.focuses}),(0,Z.jsx)(Re,{children:y.length.toLocaleString()})]}),y.length>0?(0,Z.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2`,children:y.slice(0,6).map(t=>(0,Z.jsx)(Me,{focus:t,language:e,busy:q===t.id,onMonitor:(e,n)=>void $(t.id,async()=>{await de(t.id,e,n)},n?r.monitorStarted:r.monitorStopped),onStatus:e=>void $(t.id,async()=>{await se(t.id,{status:e})}),onDelete:()=>{window.confirm(r.deleteConfirm)&&$(t.id,()=>le(t.id))}},t.id))}):(0,Z.jsxs)(`div`,{className:`py-8 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.empty}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.emptyHint})]})]}),S.length>0?(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-5`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.candidates}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.candidatesHint}),(0,Z.jsx)(`div`,{className:`mt-4 space-y-2`,children:S.map(e=>(0,Z.jsxs)(`article`,{className:`flex flex-col gap-3 rounded-xl bg-surface-panel p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.summary})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,Z.jsx)(H,{variant:`ghost`,className:`h-8 text-xs`,disabled:q===e.id,onClick:()=>void $(e.id,async()=>{await ce(e.id,`dismiss`)}),children:r.dismiss}),(0,Z.jsx)(H,{variant:`primary`,className:`h-8 text-xs`,disabled:q===e.id,onClick:()=>void $(e.id,async()=>{await ce(e.id,`accept`)}),children:r.accept})]})]},e.id))})]}):null]}):null,(0,Z.jsxs)(`section`,{className:`border-t border-edge-subtle pt-7`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.projects}),(0,Z.jsx)(a,{to:`/projects`,className:`text-xs font-medium text-accent hover:underline`,children:n.management.viewAll})]}),_.filter(e=>e.status!==`archived`).length>6?(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsxs)(`label`,{className:`relative block min-w-0`,children:[(0,Z.jsx)(B,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{className:`h-9 w-52 rounded-lg border border-edge bg-surface-panel pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:j,onChange:e=>R(e.target.value),placeholder:n.searchPlaceholder,"aria-label":n.searchPlaceholder})]})}):null,(0,Z.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:me.map(e=>(0,Z.jsx)(Ue,{project:e,openLabel:n.workHome.openSpace,noDescription:n.noDescription},e.id))}),!E&&me.length===0?(0,Z.jsx)(`p`,{className:`py-8 text-center text-sm text-fg-muted`,children:n.workHome.noSpaces}):null]})]})}export{We as WorkPage};
|