@xopcai/xopc 0.0.145 → 0.0.146
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/{agent-avatar-dicebear-BEUxdhZx.js → agent-avatar-dicebear-gBVDdd-Q.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-1bpT0xRO.js → agents-BLp5ItD3.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CRHSZJWi.js → app-management-settings-panel-Dd5dmRWY.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BunADYJb.js → appearance-settings-D89pY61C.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Cc4JgVUQ.js → apps-page-CgOy905b.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-B6vTkH2A.js → archive-plugin-BZj1tk3p.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BjZXzaNv.js → attachment-load-18eo6l3m.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-ZDA-Stg1.js → automation-suggestion-card-F1g3MckR.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-mb0fdVpq.js → automations-page-Bdj0A_IC.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DYZfLvPz.js → binary-plugins-jOYMquLP.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C3MUlYC9.js → block-editor-CD77nXJU.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-Bb0xhaMN.js → browser-settings-page-D73ClpC2.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-BV76yN9a.js → capability-presets-api-DZwIrY_P.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-CUcGKZqC.js → capability-presets-settings-panel-Dw2uinRX.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-BlSDMGdy.js → channels-settings-g9TZdnQh.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-logo-BVFNT2zW.js → connector-logo-g9f07qO6.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-CMgAFGvb.js → connectors-page-CJLsXBB0.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-_jUmoXd3.js → desktop-pet-DwPVWi3D.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DwGOy4AQ.js → desktop-pet-settings-Dm1N7RRX.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-akvF0F-u.js → directory-picker-path-field-hZghTKie.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-BLetQiYY.js → dreaming-settings-B_LcHWcv.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-Cof2ncxE.js → extension-debug-page-BqguEetG.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CwWktRNz.js → extension-page-otKJCjKP.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CuggWOIl.js → extension-settings-page-ifHzMfT-.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-B7sxIbza.js → gateway-config-api-BQX5GGl2.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DIv0eKMf.js → gateway-settings-BfXo0j0O.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-C4Kw0mfS.js → goal-create-dialog-C_Qw_QgW.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-BMmzYpZL.js → goal-detail-page-BnUrr9_O.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-B0jm5JaA.js → goals-config-api-DQJ5mBXB.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-CGeT77PC.js → goals-page-BgDCoiG0.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-N5_iL7es.js → goals-settings-CQX8zWKe.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-XzH3lbRR.js → heartbeat-settings-yy_Pt_24.js} +1 -1
- package/dist/gateway/static/root/assets/{index-I-ZCenVw.js → index-BJGusbyV.js} +6 -6
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-D1rVyDdf.js +1 -0
- package/dist/gateway/static/root/assets/{logs-page-BSh1t8cD.js → logs-page-C35Xa_mx.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-5rJx5flj.js → markdown-split-BYasrWPk.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DYXccwAd.js → media-plugins--cJpmHc2.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-panel-BNpTenAI.js → models-hub-panel-CqehWxbT.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BgLyndCO.js → notes-page-Digm3EgB.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-teklkhcE.js → notes-workbench-CCuL7qlg.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-6Al9_sGz.js → page-tabs-CGVMJEW0.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cm3G72Hv.js → preview-open-alternatives-BBAkU4xW.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-CCB_dKoh.js → project-detail-page-DTWPEtSE.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-VOAFAHYj.js → projects-page-NnJpsIAD.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-USYu64Ru.js → remote-access-hub-wbk1GCvg.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-BYtfzu_F.js → save-bar-controls-D4B469dh.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-CvIRc6yK.js → schedule-field-Vy4OjH0i.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CQuKx0n7.js → schema-form-CPYzgmby.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-oGC8O5h_.js → sessions-page-Do0ZNuqM.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-HeYP_JCr.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-CF3HHM-t.js → settings-collapsible-section-BB5y9vwh.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-CwWjoRN6.js → settings-form-section-BfzJkVHd.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-aUFmJa13.js → settings-loading-skeleton-DM8iH25s.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B2UUU9TF.js → settings-page-h5Alz_fA.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DqpbTWqI.js → settings-page-layout-DjbdpK2j.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-Ck9keROI.js → setup-status-panel-bjbH7U6x.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BOhlPsS1.js → share-preview-page-DxozU_zz.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-BYLsCuqj.js → shares-settings-Cl_bE9gQ.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-BNHUyVML.js → skill-reload-api-DcqbKYgB.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-CpXbQH4n.js → skills-page-D_Xkjxtr.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CWxSvuwD.js → system-settings-panel-DNi9Ofuj.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-qROAvqTw.js → typed-models-lib-B6Nw3iFM.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-DbNEK4Yp.js → user-context-page-BtU2sQoK.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-fields-editor-CWxc0ghP.js → user-profile-fields-editor-DVBShNYF.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-DW-Up6vt.js → user-profile-settings-panel-CC0sf3vS.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-D53uRXVr.js → utils-DnsuE4YP.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-Cs7MOrg0.js → voice-api-key-field-BIcSMf0O.js} +1 -1
- package/dist/gateway/static/root/assets/{work-item-detail-page-D1ziG1Pp.js → work-item-detail-page-ChCKymS7.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D_x9ELJp.js → workflow-run-setup-panel-DXc_pbVG.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-DHGV_n6i.js → workflows-page-CheHRVox.js} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -1
- package/dist/src/agent/memory/dreaming/config.js +1 -1
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/package.json +2 -1
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-x_v0nrIi.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D4rP66R1.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-BQ_8x0bT.js";import{t as i}from"./messages-Cb1VMeqP.js";import{n as a}from"./locale-store-CiM-D9jA.js";import{Ds as o,Ot as s,Uo as c,Vs as l,ni as u,ti as d,tl as f,uo as p}from"./index-I-ZCenVw.js";import{n as m,t as h}from"./settings-page-layout-DqpbTWqI.js";import{r as g,t as _}from"./settings-form-section-CwWjoRN6.js";var v=e(t(),1),y=n();async function b(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function x(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function S(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function C(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function w(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var T=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function E(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||T.has(e)?t===`unknown`:!1}function D(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:T.has(e)?t===`denied`:!0}var O=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function k(e){return e===`linux`?O:O.filter(t=>!t.platforms||t.platforms.includes(e))}function A(e,t){let n=i(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function j(e,t,n){let r=i(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var M={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function N(){let e=a(e=>e.language),t=i(e).systemSettings,[n,T]=(0,v.useReducer)(s,M),{behavior:O,perms:N,loadError:P,permFeedback:F,permBusy:I,refreshing:L}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,v.useCallback)(async e=>{if(R){T({type:`patch`,patch:{loadError:null}});try{T({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){T({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,v.useCallback)(async()=>{if(!(L||I)){T({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{T({type:`patch`,patch:{refreshing:!1}})}}},[z,I,L]);if((0,v.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!F||!e.has(F))return;let n=window.setTimeout(()=>{T({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[F,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,v.useEffect)(()=>{p()&&R&&z()},[R,z]),!p()||!R)return(0,y.jsxs)(h,{gap:`gap-3`,children:[(0,y.jsx)(m,{title:t.title}),(0,y.jsxs)(`div`,{className:g(),children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.desktopOnlyTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.desktopOnlyBody})]})]});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);T({type:`patch`,patch:{behavior:t}}),(e.notifyEnabled!==void 0||e.notifySoundEnabled!==void 0)&&d()}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}T({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await u(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){T({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{T({type:`patch`,patch:{permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?T({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):T({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await b();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:x(e,n,t.permFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:S(e,t.accessibilityFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:C(e,t.notificationsFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:w(e,t.screenFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},J=O?O.platform===`win32`?t.permissionsHintWin:O.platform===`linux`?t.permissionsHintLinux:O.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,y.jsxs)(h,{gap:`gap-6`,children:[(0,y.jsx)(m,{title:t.title}),P?(0,y.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:P}):null,F?(0,y.jsx)(`p`,{className:r(`text-sm`,F===t.refreshDone||F===t.openSettingsDone||F===t.permFeedback.granted||F===t.permFeedback.alreadyGranted||F===t.accessibilityFeedback.granted||F===t.accessibilityFeedback.alreadyGranted||F===t.notificationsFeedback.granted||F===t.notificationsFeedback.alreadyGranted||F===t.screenFeedback.granted||F===t.screenFeedback.alreadyGranted||F===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:F}):null,(0,y.jsxs)(_,{children:[(0,y.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,y.jsx)(o,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O||I,checked:!!O?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),O&&N?(0,y.jsxs)(`section`,{className:g(),children:[(0,y.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),O.platform===`darwin`&&!O.packaged?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,y.jsxs)(`button`,{type:`button`,disabled:L||I,"aria-busy":L,className:r(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,c.press),onClick:()=>void B(),children:[(0,y.jsx)(l,{className:r(`size-3.5`,L&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),L?t.refreshing:t.refresh]})]}),(0,y.jsx)(`ul`,{className:`space-y-3`,children:k(O.platform).map(({key:n,pane:i})=>{let a=A(e,N[n]),o=t.perm[n],s=N[n]===`unknown`?j(e,n,O.platform):null;return o?(0,y.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:o.title}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:o.desc}),(0,y.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),s?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:s}):null]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void q(),children:t.requestAccess}):null,D(n,N[n],O.platform)?(0,y.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,c.press),onClick:()=>void U(i),children:[t.openSettings,(0,y.jsx)(f,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{N as SystemSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-BQ_8x0bT.js";import{t as i}from"./messages-Cb1VMeqP.js";import{n as a}from"./locale-store-CiM-D9jA.js";import{Ds as o,Ot as s,Uo as c,Vs as l,ni as u,ti as d,tl as f,uo as p}from"./index-BJGusbyV.js";import{n as m,t as h}from"./settings-page-layout-DjbdpK2j.js";import{r as g,t as _}from"./settings-form-section-BfzJkVHd.js";var v=e(t(),1),y=n();async function b(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function x(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function S(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function C(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function w(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var T=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function E(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||T.has(e)?t===`unknown`:!1}function D(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:T.has(e)?t===`denied`:!0}var O=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function k(e){return e===`linux`?O:O.filter(t=>!t.platforms||t.platforms.includes(e))}function A(e,t){let n=i(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function j(e,t,n){let r=i(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var M={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function N(){let e=a(e=>e.language),t=i(e).systemSettings,[n,T]=(0,v.useReducer)(s,M),{behavior:O,perms:N,loadError:P,permFeedback:F,permBusy:I,refreshing:L}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,v.useCallback)(async e=>{if(R){T({type:`patch`,patch:{loadError:null}});try{T({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){T({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,v.useCallback)(async()=>{if(!(L||I)){T({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{T({type:`patch`,patch:{refreshing:!1}})}}},[z,I,L]);if((0,v.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!F||!e.has(F))return;let n=window.setTimeout(()=>{T({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[F,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,v.useEffect)(()=>{p()&&R&&z()},[R,z]),!p()||!R)return(0,y.jsxs)(h,{gap:`gap-3`,children:[(0,y.jsx)(m,{title:t.title}),(0,y.jsxs)(`div`,{className:g(),children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.desktopOnlyTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.desktopOnlyBody})]})]});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);T({type:`patch`,patch:{behavior:t}}),(e.notifyEnabled!==void 0||e.notifySoundEnabled!==void 0)&&d()}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}T({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await u(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){T({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{T({type:`patch`,patch:{permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?T({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):T({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await b();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:x(e,n,t.permFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:S(e,t.accessibilityFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:C(e,t.notificationsFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:w(e,t.screenFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},J=O?O.platform===`win32`?t.permissionsHintWin:O.platform===`linux`?t.permissionsHintLinux:O.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,y.jsxs)(h,{gap:`gap-6`,children:[(0,y.jsx)(m,{title:t.title}),P?(0,y.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:P}):null,F?(0,y.jsx)(`p`,{className:r(`text-sm`,F===t.refreshDone||F===t.openSettingsDone||F===t.permFeedback.granted||F===t.permFeedback.alreadyGranted||F===t.accessibilityFeedback.granted||F===t.accessibilityFeedback.alreadyGranted||F===t.notificationsFeedback.granted||F===t.notificationsFeedback.alreadyGranted||F===t.screenFeedback.granted||F===t.screenFeedback.alreadyGranted||F===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:F}):null,(0,y.jsxs)(_,{children:[(0,y.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,y.jsx)(o,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O||I,checked:!!O?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),O&&N?(0,y.jsxs)(`section`,{className:g(),children:[(0,y.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),O.platform===`darwin`&&!O.packaged?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,y.jsxs)(`button`,{type:`button`,disabled:L||I,"aria-busy":L,className:r(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,c.press),onClick:()=>void B(),children:[(0,y.jsx)(l,{className:r(`size-3.5`,L&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),L?t.refreshing:t.refresh]})]}),(0,y.jsx)(`ul`,{className:`space-y-3`,children:k(O.platform).map(({key:n,pane:i})=>{let a=A(e,N[n]),o=t.perm[n],s=N[n]===`unknown`?j(e,n,O.platform):null;return o?(0,y.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:o.title}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:o.desc}),(0,y.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),s?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:s}):null]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void q(),children:t.requestAccess}):null,D(n,N[n],O.platform)?(0,y.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,c.press),onClick:()=>void U(i),children:[t.openSettings,(0,y.jsx)(f,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{N as SystemSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cn-BQ_8x0bT.js";import{Jo as t,Ko as n,qo as r}from"./index-
|
|
1
|
+
import{t as e}from"./cn-BQ_8x0bT.js";import{Jo as t,Ko as n,qo as r}from"./index-BJGusbyV.js";function i(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,t,`dark:border-edge`)}function a(){return e(r,n)}var o=`h-auto shrink-0 px-2.5 py-1.5 text-xs font-medium`,s=/^[a-z][a-z0-9_-]{0,63}$/;function c(e){let t=e.trim(),n=t.indexOf(`/`);return n>0&&n<t.length-1}function l(e){let t=e&&typeof e==`object`&&!Array.isArray(e)&&`roles`in e?Object.entries(e.roles??{}).map(([e,t])=>({id:e,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}})):e;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e,r=typeof t.id==`string`?t.id.trim():``,i=typeof t.model==`string`?t.model.trim():``;if(!r||!i)continue;let a=typeof t.description==`string`?t.description.trim():``,o=Array.isArray(t.fallbacks)?t.fallbacks.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[];n.push({id:r,model:i,fallbacks:o,description:a})}return n}function u(e,t){let n=new Set([t.toLowerCase()]),r=[];for(let t of e){let e=t.trim(),i=e.toLowerCase();!e||!c(e)||n.has(i)||(n.add(i),r.push(e))}return r}function d(e){let t=new Map;for(let n of e){let e=n.id.trim(),r=n.model.trim();if(!e||!s.test(e)||!r||!c(r))continue;let i=n.description.trim(),a=u(n.fallbacks??[],r);t.set(e,{model:r,...a.length>0?{fallbacks:a}:{},...i?{description:i}:{}})}return t.size===0?null:{roles:Object.fromEntries(t.entries())}}function f(e,t){let n=new Set;for(let r of e){let e=r.id.trim(),i=r.model.trim(),a=r.fallbacks??[];if(!(!e&&!i&&!r.description.trim()&&a.every(e=>!e.trim()))){if(!e||!s.test(e))return t.invalidId;if(n.has(e))return t.duplicateId;if(n.add(e),!i||!c(i)||a.some(e=>e.trim()&&!c(e)))return t.invalidModel}}return null}function p(e){return e.length===0?`—`:e.map(e=>`${e.id} -> ${e.model}${e.fallbacks?.length?` (+${e.fallbacks.length})`:``}`).join(`, `)}function m(e){return(e??[]).map(e=>({id:e.id,model:e.model,fallbacks:e.fallbacks??[],description:e.description?.trim()??``}))}export{f as a,a as c,m as i,p as n,o,l as r,i as s,d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as o}from"./cn-BQ_8x0bT.js";import{t as s}from"./check-BODqo66o.js";import{t as c}from"./messages-Cb1VMeqP.js";import{n as l}from"./locale-store-CiM-D9jA.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$s as d,Ba as f,Bt as p,Dl as m,Do as h,Gt as g,Ht as _,In as v,Jt as y,Kt as b,Ll as x,Nl as S,Os as C,Qo as w,Tc as T,To as E,Ut as D,Vt as O,Wt as k,Xt as A,Yo as j,Yt as M,_o as ee,al as te,bl as ne,do as re,fo as N,go as ie,ho as ae,il as P,js as F,lo as oe,mo as I,ms as se,os as ce,po as L,qt as le,ss as R,tn as ue,us as z,vo as B,ws as de,zc as fe,zt as pe}from"./index-I-ZCenVw.js";import{t as me}from"./page-tabs-6Al9_sGz.js";import{t as he}from"./user-profile-fields-editor-CWxc0ghP.js";import{t as ge}from"./connector-logo-BVFNT2zW.js";var V=e(t(),1),H=n(),U={"composio-gmail":`gmail`,"composio-googledrive":`google-drive`,"composio-notion":`notion`,"composio-slack":`slack`,memory:`memory`};function _e(e){if(e.branding?.logoUrl)return e.branding;let t=U[e.id];return t?{...e.branding,logoUrl:`/connector-icons/${t}.svg`}:e.branding}var W=r();function ve(e){let t=(0,H.c)(33),{source:n,language:r,busy:i,onOpenChange:a,onConfirm:s}=e,l=c(r).you,[u,d]=(0,V.useState)(!1),f,p;t[0]===n?(f=t[1],p=t[2]):(f=()=>{n&&d(!1)},p=[n],t[0]=n,t[1]=f,t[2]=p),(0,V.useEffect)(f,p);let m;t[3]!==i||t[4]!==a?(m=e=>!i&&a(e),t[3]=i,t[4]=a,t[5]=m):m=t[5];let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,W.jsx)(ae,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[6]=h):h=t[6];let g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,W.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[7]=g):g=t[7];let _;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>d(!1),t[8]=_):_=t[8];let v=u?`border-edge-subtle hover:bg-surface-hover`:`border-accent/40 bg-accent-soft/35`,y;t[9]===v?y=t[10]:(y=o(`flex w-full items-start gap-3 rounded-xl border p-4 text-left`,v),t[9]=v,t[10]=y);let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,W.jsx)(te,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[11]=b):b=t[11];let x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>d(!0),t[12]=x):x=t[12];let S=u?`border-danger/40 bg-danger-soft`:`border-edge-subtle hover:bg-surface-hover`,C;t[13]===S?C=t[14]:(C=o(`flex w-full items-start gap-3 rounded-xl border p-4 text-left disabled:cursor-not-allowed disabled:opacity-55`,S),t[13]=S,t[14]=C);let T;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,W.jsx)(z,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),t[15]=T):T=t[15];let E=l.disconnectDeleteBody.replace(`{{count}}`,String(n?.derivedUnderstandingCount??0)),D;t[16]===E?D=t[17]:(D=(0,W.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:E}),t[16]=E,t[17]=D);let O;t[18]!==i||t[19]!==l.cancel?(O=(0,W.jsx)(N,{asChild:!0,children:(0,W.jsx)(j,{type:`button`,variant:`ghost`,disabled:i,children:l.cancel})}),t[18]=i,t[19]=l.cancel,t[20]=O):O=t[20];let k=u?`border-danger/35 text-danger hover:bg-danger-soft`:void 0,A;t[21]!==u||t[22]!==s?(A=()=>s(u),t[21]=u,t[22]=s,t[23]=A):A=t[23];let M;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,W.jsx)(R,{className:`size-4`,"aria-hidden":!0}),t[24]=M):M=t[24];let ne=i?l.disconnecting:l.disconnectAction,P;t[25]!==i||t[26]!==k||t[27]!==A||t[28]!==ne?(P=(0,W.jsxs)(j,{type:`button`,variant:`secondary`,className:k,disabled:i,onClick:A,children:[M,ne]}),t[25]=i,t[26]=k,t[27]=A,t[28]=ne,t[29]=P):P=t[29];let F;return t[30]!==O||t[31]!==P?(F=(0,W.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:[O,P]}),t[30]=O,t[31]=P,t[32]=F):F=t[32],(0,W.jsx)(re,{open:n!==null,onOpenChange:m,children:(0,W.jsxs)(ie,{children:[h,(0,W.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,W.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(ee,{className:`text-base font-semibold text-fg`,children:l.disconnectTitle}),(0,W.jsx)(I,{className:`mt-1 text-sm text-fg-muted`,children:l.disconnectBody.replace(`{{source}}`,n?.displayName??``)})]}),(0,W.jsx)(N,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":l.cancel,disabled:i,children:g})})]}),(0,W.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-5`,children:[(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":!u,onClick:_,className:y,children:[b,(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectKeepTitle}),(0,W.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:l.disconnectKeepBody})]})]}),(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":u,onClick:x,disabled:!n?.derivedUnderstandingCount,className:C,children:[T,(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectDeleteTitle}),D]})]})]}),F]})]})})}var ye=new Set([`overview`,`understanding`,`sources`,`controls`]),be=[`collaboration`,`priorities`,`boundaries`,`people`,`current`,`basics`],xe=`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 G(e,t){return e.replace(`{{count}}`,String(t))}function K(e,t){let n=Date.parse(e);return Number.isFinite(n)?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}).format(n):e}function Se(e){return e===`review`?`understanding`:e===`privacy`?`controls`:e&&ye.has(e)?e:`overview`}function Ce(){let e=(0,H.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsx)(f,{className:`h-24 rounded-2xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[t,(0,W.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,W.jsx)(f,{className:`h-64 rounded-2xl`}),(0,W.jsx)(f,{className:`h-64 rounded-2xl`})]})]}),e[1]=n):n=e[1],n}function we(e,t){return e.origin===`connected_source`?t.origins.connected_source.replace(`{{source}}`,e.sourceName):t.origins[e.origin]}function Te(e){let t=(0,H.c)(17),{item:n,language:r,t:i,busy:a,onConfirm:c,onReject:l,onUpdate:u,onForget:f}=e,[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(n.statement),_=n.status!==`active`,v=_?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,y;t[0]===v?y=t[1]:(y=o(`rounded-xl border p-3.5`,v),t[0]=v,t[1]=y);let b;t[2]!==a||t[3]!==h||t[4]!==p||t[5]!==n||t[6]!==r||t[7]!==_||t[8]!==c||t[9]!==f||t[10]!==l||t[11]!==u||t[12]!==i?(b=p?(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(`textarea`,{className:o(xe,`min-h-20 resize-y`),value:h,onChange:e=>g(e.target.value),placeholder:i.updatePlaceholder,autoFocus:!0}),(0,W.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,W.jsx)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>{g(n.statement),m(!1)},children:i.cancel}),(0,W.jsx)(j,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:a||!h.trim(),onClick:()=>{u(h.trim()),m(!1)},children:i.save})]})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,W.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(de,{className:`size-3 text-accent`,"aria-hidden":!0}),we(n,i)]}),(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.stability[n.stability]}),n.evidenceCount>1?(0,W.jsx)(`span`,{children:G(i.evidenceCount,n.evidenceCount)}):null,n.latestEvidenceAt?(0,W.jsx)(`span`,{children:i.observedAt.replace(`{{time}}`,K(n.latestEvidenceAt,r))}):null]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[_?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:c,children:[(0,W.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,W.jsxs)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:l,children:[(0,W.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,(0,W.jsxs)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>m(!0),children:[(0,W.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),i.change]}),(0,W.jsxs)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:f,children:[(0,W.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),i.forget]})]})]}),(0,W.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer font-medium text-fg-muted`,children:i.viewEvidence}),(0,W.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),(0,W.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourceName})]}),n.sourcePath?(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidencePath}),(0,W.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourcePath})]}):null,(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceUpdated}),(0,W.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:K(n.updatedAt,r)})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSupport}),(0,W.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:G(i.evidenceCount,n.evidenceCount)})]})]})]})]}),t[2]=a,t[3]=h,t[4]=p,t[5]=n,t[6]=r,t[7]=_,t[8]=c,t[9]=f,t[10]=l,t[11]=u,t[12]=i,t[13]=b):b=t[13];let x;return t[14]!==y||t[15]!==b?(x=(0,W.jsx)(`article`,{className:y,children:b}),t[14]=y,t[15]=b,t[16]=x):x=t[16],x}function Ee(e){let t=(0,H.c)(76),{source:n,language:r,t:i,onConfigure:a,onDisconnect:s}=e,c=n.installed?n.enabled?i.connected:i.paused:i.available,l;t[0]!==n.lastHealthStatus||t[1]!==i.healthIssue||t[2]!==i.healthOk||t[3]!==i.sourceHealth?(l=n.lastHealthStatus?i.sourceHealth.replace(`{{status}}`,n.lastHealthStatus===`ok`?i.healthOk:i.healthIssue):null,t[0]=n.lastHealthStatus,t[1]=i.healthIssue,t[2]=i.healthOk,t[3]=i.sourceHealth,t[4]=l):l=t[4];let u=l,d=`${i.manageSources}: ${n.displayName}`,f;t[5]===a?f=t[6]:(f=e=>{e.target===e.currentTarget&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),a()))},t[5]=a,t[6]=f);let p=n.displayName,m;t[7]===n?m=t[8]:(m=_e(n),t[7]=n,t[8]=m);let h;t[9]!==n.displayName||t[10]!==m?(h=(0,W.jsx)(ge,{connector:{displayName:p,branding:m},size:`sm`}),t[9]=n.displayName,t[10]=m,t[11]=h):h=t[11];let g;t[12]===n.displayName?g=t[13]:(g=(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.displayName}),t[12]=n.displayName,t[13]=g);let _;t[14]===n.description?_=t[15]:(_=(0,W.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.description}),t[14]=n.description,t[15]=_);let v;t[16]!==g||t[17]!==_?(v=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[16]=g,t[17]=_,t[18]=v):v=t[18];let y;t[19]!==h||t[20]!==v?(y=(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[h,v]}),t[19]=h,t[20]=v,t[21]=y):y=t[21];let b=n.installed&&n.enabled?`bg-success-soft text-fg`:`bg-surface-hover text-fg-muted`,x;t[22]===b?x=t[23]:(x=o(`shrink-0 rounded-full px-2 py-1 text-[11px] font-medium`,b),t[22]=b,t[23]=x);let S;t[24]!==c||t[25]!==x?(S=(0,W.jsx)(`span`,{className:x,children:c}),t[24]=c,t[25]=x,t[26]=S):S=t[26];let C;t[27]!==y||t[28]!==S?(C=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[y,S]}),t[27]=y,t[28]=S,t[29]=C):C=t[29];let w;t[30]!==n.access.context||t[31]!==i.sourceContext?(w=n.access.context?(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceContext}):null,t[30]=n.access.context,t[31]=i.sourceContext,t[32]=w):w=t[32];let T;t[33]!==n.access.memory||t[34]!==i.sourceMemory?(T=n.access.memory?(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceMemory}):null,t[33]=n.access.memory,t[34]=i.sourceMemory,t[35]=T):T=t[35];let E;t[36]!==n.access.read||t[37]!==i.sourceRead?(E=n.access.read?(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceRead}):null,t[36]=n.access.read,t[37]=i.sourceRead,t[38]=E):E=t[38];let D;t[39]!==n.access.write||t[40]!==i.sourceWrite?(D=n.access.write?(0,W.jsx)(`span`,{className:`rounded-full bg-warning-soft px-2 py-0.5 text-fg`,children:i.sourceWrite}):null,t[39]=n.access.write,t[40]=i.sourceWrite,t[41]=D):D=t[41];let O;t[42]!==w||t[43]!==T||t[44]!==E||t[45]!==D?(O=(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[w,T,E,D]}),t[42]=w,t[43]=T,t[44]=E,t[45]=D,t[46]=O):O=t[46];let k;t[47]!==u||t[48]!==r||t[49]!==n.derivedUnderstandingCount||t[50]!==n.installed||t[51]!==n.knowledgeItemCount||t[52]!==n.lastActivityAt||t[53]!==n.lastSyncAt||t[54]!==n.lastSyncError||t[55]!==n.lastSyncStatus||t[56]!==i.sourceDerivedCount||t[57]!==i.sourceKnowledgeCount||t[58]!==i.sourceLastSync||t[59]!==i.sourceLastUsed||t[60]!==i.sourceNeverUsed||t[61]!==i.sourceSyncFailed?(k=n.installed?(0,W.jsxs)(`div`,{className:`mt-3 space-y-1 border-t border-edge-subtle pt-3 text-xs text-fg-muted`,children:[u?(0,W.jsx)(`p`,{children:u}):null,(0,W.jsx)(`p`,{children:n.lastActivityAt?i.sourceLastUsed.replace(`{{time}}`,K(n.lastActivityAt,r)):i.sourceNeverUsed}),n.lastSyncAt?(0,W.jsx)(`p`,{children:i.sourceLastSync.replace(`{{time}}`,K(n.lastSyncAt,r))}):null,n.lastSyncStatus===`failed`&&n.lastSyncError?(0,W.jsx)(`p`,{className:`text-danger`,children:i.sourceSyncFailed.replace(`{{error}}`,n.lastSyncError)}):null,(0,W.jsx)(`p`,{children:i.sourceKnowledgeCount.replace(`{{count}}`,String(n.knowledgeItemCount))}),(0,W.jsx)(`p`,{children:i.sourceDerivedCount.replace(`{{count}}`,String(n.derivedUnderstandingCount))})]}):null,t[47]=u,t[48]=r,t[49]=n.derivedUnderstandingCount,t[50]=n.installed,t[51]=n.knowledgeItemCount,t[52]=n.lastActivityAt,t[53]=n.lastSyncAt,t[54]=n.lastSyncError,t[55]=n.lastSyncStatus,t[56]=i.sourceDerivedCount,t[57]=i.sourceKnowledgeCount,t[58]=i.sourceLastSync,t[59]=i.sourceLastUsed,t[60]=i.sourceNeverUsed,t[61]=i.sourceSyncFailed,t[62]=k):k=t[62];let A;t[63]!==s||t[64]!==n.installed||t[65]!==n.instanceId||t[66]!==i.disconnect?(A=n.installed&&n.instanceId?(0,W.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,W.jsx)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-danger hover:bg-danger-soft hover:text-danger`,onClick:e=>{e.stopPropagation(),s()},children:i.disconnect})}):null,t[63]=s,t[64]=n.installed,t[65]=n.instanceId,t[66]=i.disconnect,t[67]=A):A=t[67];let M;return t[68]!==a||t[69]!==C||t[70]!==O||t[71]!==d||t[72]!==k||t[73]!==A||t[74]!==f?(M=(0,W.jsxs)(`article`,{role:`button`,tabIndex:0,"aria-label":d,className:`cursor-pointer rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:border-accent/30 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:a,onKeyDown:f,children:[C,O,k,A]}),t[68]=a,t[69]=C,t[70]=O,t[71]=d,t[72]=k,t[73]=A,t[74]=f,t[75]=M):M=t[75],M}function De(e){let t=(0,H.c)(46),{suggestion:n,draft:r,busy:i,onDraftChange:a,onSave:s,onLater:c,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,W.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,W.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,W.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]!==s?(g=e=>{e.key===`Enter`&&r.trim()&&!i&&s()},t[12]=i,t[13]=r,t[14]=s,t[15]=g):g=t[15];let _=l.meetPlaceholder,v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=o(xe,`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,W.jsx)(`input`,{id:`you-call-name`,value:r,maxLength:80,autoFocus:!0,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]!==s||t[26]!==b||t[27]!==x?(S=(0,W.jsx)(j,{type:`button`,variant:`primary`,className:`h-10 shrink-0`,disabled:b,onClick:s,children:x}),t[25]=s,t[26]=b,t[27]=x,t[28]=S):S=t[28];let w;t[29]!==y||t[30]!==S||t[31]!==m?(w=(0,W.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]=w):w=t[32];let T;t[33]!==n||t[34]!==l.meetSource?(T=n?(0,W.jsxs)(`p`,{className:`mt-3 flex items-start gap-1.5 text-xs leading-5 text-fg-subtle`,children:[(0,W.jsx)(C,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,W.jsx)(`span`,{children:l.meetSource})]}):null,t[33]=n,t[34]=l.meetSource,t[35]=T):T=t[35];let E;t[36]!==i||t[37]!==c||t[38]!==l.meetLater?(E=(0,W.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:c,children:l.meetLater}),t[36]=i,t[37]=c,t[38]=l.meetLater,t[39]=E):E=t[39];let D;return t[40]!==w||t[41]!==T||t[42]!==E||t[43]!==d||t[44]!==p?(D=(0,W.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,W.jsxs)(`div`,{className:`relative max-w-2xl`,children:[d,p,w,T,E]})}),t[40]=w,t[41]=T,t[42]=E,t[43]=d,t[44]=p,t[45]=D):D=t[45],D}function Oe(){let e=l(e=>e.language),t=c(e).you,n=a(),[r,f]=i(),w=Se(r.get(`tab`)),ee=oe(e=>e.setPageHeader),re=oe(e=>e.clearPageHeader),{data:N,error:ie,isLoading:ae,mutate:I}=u(`/api/you`,O),[L,R]=(0,V.useState)(null),[z,de]=(0,V.useState)(null),[ge,H]=(0,V.useState)(!1),[U,_e]=(0,V.useState)(null),[ye,K]=(0,V.useState)(!1),[we,Oe]=(0,V.useState)(``),[ke,Ae]=(0,V.useState)(!1),[je,Me]=(0,V.useState)(null),[Ne,Pe]=(0,V.useState)(!1),[Fe,Ie]=(0,V.useState)(!1),[Le,Re]=(0,V.useState)(null),[ze,Be]=(0,V.useState)(null),[Ve,He]=(0,V.useState)(!1),[q,Ue]=(0,V.useState)(null),We=(0,V.useRef)(null),Ge=(0,V.useRef)(null),J=N?.profile??{callName:``,pronouns:``,timezone:``,notes:``},Y=(0,V.useMemo)(()=>N?.understanding.filter(e=>e.status===`active`)??[],[N]),X=(0,V.useMemo)(()=>N?.understanding.filter(e=>e.status!==`active`)??[],[N]),Ke=(0,V.useMemo)(()=>new Map(be.map(e=>[e,Y.filter(t=>t.facet===e)])),[Y]),Z=je??N?.controls??null,qe=N?.sources.filter(e=>e.installed&&e.enabled)??[],Je=qe.filter(e=>[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status)),Q=(e,t)=>{let n=new URLSearchParams(r);e===`overview`?n.delete(`tab`):n.set(`tab`,e),t?n.set(`status`,t):n.delete(`status`),f(n,{replace:!0})},Ye=e=>{let t=new URLSearchParams({connector:e.id});e.instanceId&&t.set(`instance`,e.instanceId),n(`/connectors?${t.toString()}`)};(0,V.useLayoutEffect)(()=>(ee({startExtra:null,main:(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,W.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.subtitle})]}),end:null}),()=>re()),[re,ee,t.subtitle,t.title]),(0,V.useEffect)(()=>{!N||N.profile.callName||Oe(N.profileSetup.callNameSuggestion?.value??``)},[N,N?.profile.callName,N?.profileSetup.callNameSuggestion?.id]);async function $(e,n,r){R(e.id);try{let t=await b(e.id,{action:n,content:r});await I(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}),I()}catch{B({type:`error`,title:t.title,message:t.saveError})}finally{R(null)}}async function Xe(r,i){R(`insight:${r.id}`);try{let t=await g(r.id,{action:i,uiLocale:e});await I(),i===`apply`&&t.href&&n(t.href)}catch{B({type:`error`,title:t.insightsTitle,message:t.saveError})}finally{R(null)}}async function Ze(e){R(`playbook:${e.id}`);try{await k(e.id,!e.enabled),await I()}catch{B({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{R(null)}}async function Qe(){if(z){R(z.id);try{await _(z.id);let e=z.id;de(null),await I(t=>t&&{...t,understanding:t.understanding.filter(t=>t.id!==e)},{revalidate:!1}),I()}catch{B({type:`error`,title:t.title,message:t.saveError})}finally{R(null)}}}async function $e(){if(U){K(!0);try{let e=await y(U);H(!1),_e(null),await I(t=>t&&{...t,...e},{revalidate:!1})}catch{B({type:`error`,title:t.title,message:t.saveError})}finally{K(!1)}}}async function et(){let e=we.trim();if(!(!e||ke)){Ae(!0);try{let t=await y({callName:e,timezone:J.timezone||ue()});await I(e=>e&&{...e,...t},{revalidate:!1})}catch{B({type:`error`,title:t.title,message:t.saveError})}finally{Ae(!1)}}}async function tt(){if(!ke){Ae(!0);try{let e=await M(`snooze`);await I(t=>t&&{...t,profileSetup:e.profileSetup},{revalidate:!1})}catch{B({type:`error`,title:t.title,message:t.saveError})}finally{Ae(!1)}}}function nt(){_e(J),H(!0),requestAnimationFrame(()=>We.current?.scrollIntoView({behavior:`smooth`,block:`center`}))}async function rt(){if(Z){Pe(!0);try{Me(await le(Z)),await I(),B({type:`success`,title:t.title,message:t.saved})}catch{B({type:`error`,title:t.title,message:t.saveError})}finally{Pe(!1)}}}async function it(e){if(!(Fe||e===N?.trust.defaultActionLevel)){Ie(!0);try{let t=await A(e);await I(e=>e&&{...e,trust:t},{revalidate:!1})}catch{B({type:`error`,title:t.trustTitle,message:t.saveError})}finally{Ie(!1),Re(null)}}}async function at(e){if(!(!ze?.instanceId||Ve)){He(!0);try{let n=await pe(ze.instanceId,e);Be(null),await I(),B({type:`success`,title:t.sourcesTitle,message:e?t.disconnectDeleted.replace(`{{count}}`,String(n.deletedUnderstandingCount)):t.disconnectSuccess})}catch{B({type:`error`,title:t.sourcesTitle,message:t.saveError})}finally{He(!1)}}}async function ot(){if(!q){Ue(`export`);try{let e=await p(),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.agentId}-${e.exportedAt.slice(0,10)}.json`,n.click(),URL.revokeObjectURL(t)}catch{B({type:`error`,title:t.transferTitle,message:t.saveError})}finally{Ue(null)}}}async function st(e){if(!(!e||q)){Ue(`import`);try{if(e.size>2*1024*1024)throw Error(`file too large`);let n=await D(JSON.parse(await e.text()));await I(),Q(`understanding`,`review`),B({type:`success`,title:t.transferTitle,message:t.importSuccess.replace(`{{count}}`,String(n.importedCount)).replace(`{{skipped}}`,String(n.skippedCount))})}catch{B({type:`error`,title:t.transferTitle,message:t.importError})}finally{Ge.current&&(Ge.current.value=``),Ue(null)}}}return(0,W.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,W.jsx)(me,{items:[{id:`overview`,label:t.tabs.overview,icon:fe},{id:`understanding`,label:t.tabs.understanding,icon:S,count:X.length||void 0},{id:`sources`,label:t.tabs.sources,icon:te},{id:`controls`,label:t.tabs.controls,icon:F}],activeTab:w,onChange:Q,ariaLabel:t.title,tabIdPrefix:`you-tab`,panelIdPrefix:`you-panel`}),ae?(0,W.jsx)(Ce,{}):ie||!N?(0,W.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t.loadError}):null,N&&w===`overview`?(0,W.jsxs)(`div`,{id:`you-panel-overview`,role:`tabpanel`,"aria-labelledby":`you-tab-overview`,className:`space-y-4`,children:[!J.callName&&N.profileSetup.shouldPrompt?(0,W.jsx)(De,{suggestion:N.profileSetup.callNameSuggestion,draft:we,busy:ke,onDraftChange:Oe,onSave:()=>void et(),onLater:()=>void tt(),t}):null,X.length>0||Je.length>0||!J.callName?(0,W.jsxs)(`section`,{className:`rounded-2xl border border-warning/25 bg-warning-soft/35 p-5`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.attentionTitle}),(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[X.length>0?(0,W.jsxs)(j,{type:`button`,variant:`secondary`,onClick:()=>Q(`understanding`,`review`),children:[G(t.reviewCount,X.length),(0,W.jsx)(m,{className:`size-4`,"aria-hidden":!0})]}):null,Je.length>0?(0,W.jsxs)(j,{type:`button`,variant:`secondary`,onClick:()=>Q(`sources`),children:[G(t.sourceIssues,Je.length),(0,W.jsx)(m,{className:`size-4`,"aria-hidden":!0})]}):null,J.callName?null:(0,W.jsxs)(j,{type:`button`,variant:`secondary`,onClick:nt,children:[t.completeProfile,(0,W.jsx)(m,{className:`size-4`,"aria-hidden":!0})]})]})]}):(0,W.jsxs)(`section`,{className:`rounded-2xl border border-success/20 bg-success-soft p-4 text-sm text-fg`,children:[(0,W.jsx)(s,{className:`mr-2 inline size-4 text-success`,"aria-hidden":!0}),t.upToDate]}),(0,W.jsxs)(`section`,{className:`rounded-2xl border border-accent/15 bg-gradient-to-br from-accent-soft/55 via-surface-panel to-surface-panel p-5`,children:[(0,W.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight text-fg`,children:t.heroTitle}),(0,W.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.heroBody}),(0,W.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-3`,children:[(0,W.jsxs)(`button`,{type:`button`,className:`rounded-xl bg-surface-base/80 p-3 text-left`,onClick:()=>Q(`understanding`),children:[(0,W.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:Y.length}),(0,W.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.knownSummary})]}),(0,W.jsxs)(`button`,{type:`button`,className:`rounded-xl bg-surface-base/80 p-3 text-left`,onClick:()=>Q(`sources`),children:[(0,W.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:qe.length}),(0,W.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.connectedSources})]}),(0,W.jsxs)(`button`,{type:`button`,className:`rounded-xl bg-surface-base/80 p-3 text-left`,onClick:()=>Q(`controls`),children:[(0,W.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.trustLevels[N.trust.defaultActionLevel]}),(0,W.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.currentTrust})]})]})]}),N.insights.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl border border-accent/15 bg-surface-base p-5`,children:[(0,W.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,W.jsx)(T,{className:`size-4 text-accent`,"aria-hidden":!0}),t.insightsTitle]}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.insightsHint}),(0,W.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-2`,children:N.insights.map(e=>(0,W.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,W.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.insight}),(0,W.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:e.evidenceCount>1?G(t.insightEvidence,e.evidenceCount):t.insightReason}),(0,W.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,W.jsx)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:L===`insight:${e.id}`,onClick:()=>void Xe(e,`dismiss`),children:t.notNow}),(0,W.jsx)(j,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:L===`insight:${e.id}`,onClick:()=>void Xe(e,`apply`),children:t.insightActions[e.action]})]})]},e.id))})]}):null,(0,W.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,W.jsxs)(`section`,{ref:We,id:`you-profile-card`,className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,W.jsx)(ne,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.profileHint})]}),ge?null:(0,W.jsxs)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:nt,children:[(0,W.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),t.edit]})]}),ge&&U?(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsx)(he,{value:U,onChange:_e,language:e,inputClassName:xe,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,W.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,W.jsx)(j,{type:`button`,variant:`ghost`,onClick:()=>{H(!1),_e(null)},children:t.cancel}),(0,W.jsx)(j,{type:`button`,variant:`primary`,disabled:ye,onClick:()=>void $e(),children:ye?t.saving:t.save})]})]}):(0,W.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,W.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:J.callName||`—`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,W.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:J.timezone||`—`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,W.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:J.pronouns||`—`})]}),J.notes?(0,W.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,W.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,W.jsx)(`dd`,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg`,children:J.notes})]}):null]})]}),(0,W.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,W.jsx)(S,{className:`size-4 text-accent`,"aria-hidden":!0}),t.understandingTitle]}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.understandingHint})]}),(0,W.jsx)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>Q(`understanding`),children:(0,W.jsx)(m,{className:`size-4`,"aria-hidden":!0})})]}),(0,W.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[Y.slice(0,4).map(e=>(0,W.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5 text-sm leading-5 text-fg`,children:e.statement},e.id)),Y.length===0?(0,W.jsx)(`p`,{className:`py-5 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]})]})]}),N.playbooks.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,W.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,W.jsx)(x,{className:`size-4 text-accent`,"aria-hidden":!0}),t.playbooksTitle]}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.playbooksHint}),(0,W.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-3`,children:N.playbooks.map(e=>(0,W.jsxs)(`article`,{className:o(`rounded-xl border p-4`,e.enabled?`border-edge-subtle bg-surface-panel`:`border-edge-subtle bg-surface-muted opacity-75`),children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.playbookNames[e.id]}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:G(t.playbookRuleCount,e.rules.length)})]}),(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px]`,children:e.enabled?t.playbookActive:t.playbookPaused})]}),(0,W.jsx)(`ul`,{className:`mt-3 space-y-2`,children:e.rules.slice(0,4).map(e=>(0,W.jsxs)(`li`,{className:`text-xs leading-5 text-fg-muted`,children:[`• `,e.statement]},e.id))}),(0,W.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,W.jsx)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:L===`playbook:${e.id}`,onClick:()=>void Ze(e),children:e.enabled?t.pausePlaybook:t.resumePlaybook})})]},e.id))})]}):null]}):null,N&&w===`understanding`?(0,W.jsxs)(`div`,{id:`you-panel-understanding`,role:`tabpanel`,"aria-labelledby":`you-tab-understanding`,className:`space-y-6`,children:[(0,W.jsx)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs text-fg-muted`,children:t.memoryScope.replace(`{{agent}}`,N.scope.agentId)}),X.length>0?(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.reviewTitle}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.reviewHint}),(0,W.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:X.map(n=>(0,W.jsx)(Te,{item:n,language:e,t,busy:L===n.id,onConfirm:()=>void $(n,`confirm`),onReject:()=>void $(n,`reject`),onUpdate:e=>void $(n,`update`,e),onForget:()=>de(n)},n.id))})]}):Y.length>0?(0,W.jsxs)(`div`,{className:`rounded-2xl border border-success/20 bg-success-soft p-6 text-center`,children:[(0,W.jsx)(s,{className:`mx-auto size-5 text-success`,"aria-hidden":!0}),(0,W.jsx)(`h2`,{className:`mt-2 text-sm font-semibold text-fg`,children:t.nothingToReview}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.nothingToReviewHint})]}):null,be.map(n=>{let r=Ke.get(n)??[];return r.length===0?null:(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.facets[n]}),(0,W.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:r.map(n=>(0,W.jsx)(Te,{item:n,language:e,t,busy:L===n.id,onConfirm:()=>void $(n,`confirm`),onReject:()=>void $(n,`reject`),onUpdate:e=>void $(n,`update`,e),onForget:()=>de(n)},n.id))})]},n)}),N.understanding.length===0?(0,W.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]}):null,N&&w===`sources`?(0,W.jsxs)(`div`,{id:`you-panel-sources`,role:`tabpanel`,"aria-labelledby":`you-tab-sources`,className:`space-y-5`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.sourcesTitle}),(0,W.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.sourcesHint})]}),(0,W.jsxs)(j,{type:`button`,variant:`primary`,onClick:()=>n(`/connectors?tab=connected&personalContext=1`),children:[t.manageSources,(0,W.jsx)(m,{className:`size-4`,"aria-hidden":!0})]})]}),N.sourceRecommendations.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl border border-accent/20 bg-accent-soft/25 p-5`,children:[(0,W.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,W.jsx)(se,{className:`size-4 text-accent`,"aria-hidden":!0}),t.recommendationsTitle]}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.recommendationsHint}),(0,W.jsx)(`div`,{className:`mt-3 grid gap-2 lg:grid-cols-3`,children:N.sourceRecommendations.map(e=>(0,W.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:border-accent/30 hover:bg-surface-hover`,onClick:()=>Ye({id:e.sourceId}),children:[(0,W.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:e.sourceName}),(0,W.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.recommendationReason.replace(`{{goal}}`,e.goalTitle)})]},e.sourceId))})]}):null,(0,W.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:N.sources.map(n=>(0,W.jsx)(Ee,{source:n,language:e,t,onConfigure:()=>Ye(n),onDisconnect:()=>Be(n)},n.id))}),N.sources.length===0?(0,W.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.noSources}):null]}):null,N&&w===`controls`&&Z?(0,W.jsxs)(`div`,{id:`you-panel-controls`,role:`tabpanel`,"aria-labelledby":`you-tab-controls`,className:`space-y-6`,children:[(0,W.jsx)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs leading-5 text-fg-muted`,children:t.scopeSummary.replace(`{{agent}}`,N.scope.agentId)}),(0,W.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-2`,children:[(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.controlTitle}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.controlHint}),(0,W.jsxs)(`div`,{className:`mt-4 space-y-3 rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,W.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.learningMode,(0,W.jsx)(E,{value:Z.mode,onChange:e=>Me({...Z,mode:e.target.value}),children:Object.entries(t.learningModes).map(([e,t])=>(0,W.jsx)(h,{value:e,children:t},e))})]}),(0,W.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.sensitive,(0,W.jsx)(E,{value:Z.sensitiveWritePolicy,onChange:e=>Me({...Z,sensitiveWritePolicy:e.target.value}),children:Object.entries(t.sensitiveOptions).map(([e,t])=>(0,W.jsx)(h,{value:e,children:t},e))})]}),(0,W.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.sharing,(0,W.jsx)(E,{value:Z.crossAgentSharing,onChange:e=>Me({...Z,crossAgentSharing:e.target.value}),children:Object.entries(t.sharingOptions).map(([e,t])=>(0,W.jsx)(h,{value:e,children:t},e))})]}),(0,W.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl bg-accent-soft/40 p-3 text-xs leading-5 text-fg-muted`,children:[(0,W.jsx)(C,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,W.jsx)(`span`,{children:t.transientPromise})]}),(0,W.jsx)(`div`,{className:`flex justify-end pt-2`,children:(0,W.jsx)(j,{type:`button`,variant:`primary`,disabled:Ne,onClick:()=>void rt(),children:Ne?t.saving:t.save})})]})]}),(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.trustTitle}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.trustHint}),(0,W.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:N.trust.levels.map(e=>(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":e===N.trust.defaultActionLevel,disabled:Fe,onClick:()=>e===`auto`?Re(e):void it(e),className:o(`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===N.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,W.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:t.trustLevels[e]}),(0,W.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustLevelHints[e]}),e===N.trust.defaultActionLevel?(0,W.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,W.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-subtle`,children:t.autoOptInPromise})]})]}),(0,W.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.transferTitle}),(0,W.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.transferHint}),(0,W.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,W.jsxs)(j,{type:`button`,variant:`secondary`,disabled:q!==null,onClick:()=>void ot(),children:[(0,W.jsx)(P,{className:`size-4`,"aria-hidden":!0}),q===`export`?t.exporting:t.exportAction]}),(0,W.jsxs)(j,{type:`button`,variant:`secondary`,disabled:q!==null,onClick:()=>Ge.current?.click(),children:[(0,W.jsx)(ce,{className:`size-4`,"aria-hidden":!0}),q===`import`?t.importing:t.importAction]}),(0,W.jsx)(`input`,{ref:Ge,type:`file`,accept:`application/json,.json`,className:`sr-only`,onChange:e=>void st(e.target.files?.[0])})]}),(0,W.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-subtle`,children:t.importPromise})]})]}):null,(0,W.jsx)(v,{open:z!==null,title:t.forgetTitle,description:t.forgetBody,confirmLabel:t.forget,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void Qe(),onCancel:()=>de(null)}),(0,W.jsx)(v,{open:Le===`auto`,title:t.autoConfirmTitle,description:t.autoConfirmBody,confirmLabel:t.autoConfirmAction,cancelLabel:t.cancel,onConfirm:()=>void it(`auto`),onCancel:()=>Re(null)}),(0,W.jsx)(ve,{source:ze,language:e,busy:Ve,onOpenChange:e=>{e||Be(null)},onConfirm:e=>void at(e)})]})}export{Oe as UserContextPage};
|
|
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}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as o}from"./cn-BQ_8x0bT.js";import{t as s}from"./check-BODqo66o.js";import{t as c}from"./messages-Cb1VMeqP.js";import{n as l}from"./locale-store-CiM-D9jA.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$s as d,Ba as f,Bt as p,Dl as m,Do as h,Gt as g,Ht as _,In as v,Jt as y,Kt as b,Ll as x,Nl as S,Os as C,Qo as w,Tc as T,To as E,Ut as D,Vt as O,Wt as k,Xt as A,Yo as j,Yt as M,_o as ee,al as te,bl as ne,do as re,fo as N,go as ie,ho as ae,il as P,js as F,lo as oe,mo as I,ms as se,os as ce,po as L,qt as le,ss as R,tn as ue,us as z,vo as B,ws as de,zc as fe,zt as pe}from"./index-BJGusbyV.js";import{t as me}from"./page-tabs-CGVMJEW0.js";import{t as he}from"./user-profile-fields-editor-DVBShNYF.js";import{t as ge}from"./connector-logo-g9f07qO6.js";var V=e(t(),1),H=n(),U={"composio-gmail":`gmail`,"composio-googledrive":`google-drive`,"composio-notion":`notion`,"composio-slack":`slack`,memory:`memory`};function _e(e){if(e.branding?.logoUrl)return e.branding;let t=U[e.id];return t?{...e.branding,logoUrl:`/connector-icons/${t}.svg`}:e.branding}var W=r();function ve(e){let t=(0,H.c)(33),{source:n,language:r,busy:i,onOpenChange:a,onConfirm:s}=e,l=c(r).you,[u,d]=(0,V.useState)(!1),f,p;t[0]===n?(f=t[1],p=t[2]):(f=()=>{n&&d(!1)},p=[n],t[0]=n,t[1]=f,t[2]=p),(0,V.useEffect)(f,p);let m;t[3]!==i||t[4]!==a?(m=e=>!i&&a(e),t[3]=i,t[4]=a,t[5]=m):m=t[5];let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,W.jsx)(ae,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[6]=h):h=t[6];let g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,W.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[7]=g):g=t[7];let _;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>d(!1),t[8]=_):_=t[8];let v=u?`border-edge-subtle hover:bg-surface-hover`:`border-accent/40 bg-accent-soft/35`,y;t[9]===v?y=t[10]:(y=o(`flex w-full items-start gap-3 rounded-xl border p-4 text-left`,v),t[9]=v,t[10]=y);let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,W.jsx)(te,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[11]=b):b=t[11];let x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>d(!0),t[12]=x):x=t[12];let S=u?`border-danger/40 bg-danger-soft`:`border-edge-subtle hover:bg-surface-hover`,C;t[13]===S?C=t[14]:(C=o(`flex w-full items-start gap-3 rounded-xl border p-4 text-left disabled:cursor-not-allowed disabled:opacity-55`,S),t[13]=S,t[14]=C);let T;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,W.jsx)(z,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),t[15]=T):T=t[15];let E=l.disconnectDeleteBody.replace(`{{count}}`,String(n?.derivedUnderstandingCount??0)),D;t[16]===E?D=t[17]:(D=(0,W.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:E}),t[16]=E,t[17]=D);let O;t[18]!==i||t[19]!==l.cancel?(O=(0,W.jsx)(N,{asChild:!0,children:(0,W.jsx)(j,{type:`button`,variant:`ghost`,disabled:i,children:l.cancel})}),t[18]=i,t[19]=l.cancel,t[20]=O):O=t[20];let k=u?`border-danger/35 text-danger hover:bg-danger-soft`:void 0,A;t[21]!==u||t[22]!==s?(A=()=>s(u),t[21]=u,t[22]=s,t[23]=A):A=t[23];let M;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,W.jsx)(R,{className:`size-4`,"aria-hidden":!0}),t[24]=M):M=t[24];let ne=i?l.disconnecting:l.disconnectAction,P;t[25]!==i||t[26]!==k||t[27]!==A||t[28]!==ne?(P=(0,W.jsxs)(j,{type:`button`,variant:`secondary`,className:k,disabled:i,onClick:A,children:[M,ne]}),t[25]=i,t[26]=k,t[27]=A,t[28]=ne,t[29]=P):P=t[29];let F;return t[30]!==O||t[31]!==P?(F=(0,W.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:[O,P]}),t[30]=O,t[31]=P,t[32]=F):F=t[32],(0,W.jsx)(re,{open:n!==null,onOpenChange:m,children:(0,W.jsxs)(ie,{children:[h,(0,W.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,W.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(ee,{className:`text-base font-semibold text-fg`,children:l.disconnectTitle}),(0,W.jsx)(I,{className:`mt-1 text-sm text-fg-muted`,children:l.disconnectBody.replace(`{{source}}`,n?.displayName??``)})]}),(0,W.jsx)(N,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":l.cancel,disabled:i,children:g})})]}),(0,W.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-5`,children:[(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":!u,onClick:_,className:y,children:[b,(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectKeepTitle}),(0,W.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:l.disconnectKeepBody})]})]}),(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":u,onClick:x,disabled:!n?.derivedUnderstandingCount,className:C,children:[T,(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectDeleteTitle}),D]})]})]}),F]})]})})}var ye=new Set([`overview`,`understanding`,`sources`,`controls`]),be=[`collaboration`,`priorities`,`boundaries`,`people`,`current`,`basics`],xe=`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 G(e,t){return e.replace(`{{count}}`,String(t))}function K(e,t){let n=Date.parse(e);return Number.isFinite(n)?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}).format(n):e}function Se(e){return e===`review`?`understanding`:e===`privacy`?`controls`:e&&ye.has(e)?e:`overview`}function Ce(){let e=(0,H.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsx)(f,{className:`h-24 rounded-2xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[t,(0,W.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,W.jsx)(f,{className:`h-64 rounded-2xl`}),(0,W.jsx)(f,{className:`h-64 rounded-2xl`})]})]}),e[1]=n):n=e[1],n}function we(e,t){return e.origin===`connected_source`?t.origins.connected_source.replace(`{{source}}`,e.sourceName):t.origins[e.origin]}function Te(e){let t=(0,H.c)(17),{item:n,language:r,t:i,busy:a,onConfirm:c,onReject:l,onUpdate:u,onForget:f}=e,[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(n.statement),_=n.status!==`active`,v=_?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,y;t[0]===v?y=t[1]:(y=o(`rounded-xl border p-3.5`,v),t[0]=v,t[1]=y);let b;t[2]!==a||t[3]!==h||t[4]!==p||t[5]!==n||t[6]!==r||t[7]!==_||t[8]!==c||t[9]!==f||t[10]!==l||t[11]!==u||t[12]!==i?(b=p?(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(`textarea`,{className:o(xe,`min-h-20 resize-y`),value:h,onChange:e=>g(e.target.value),placeholder:i.updatePlaceholder,autoFocus:!0}),(0,W.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,W.jsx)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>{g(n.statement),m(!1)},children:i.cancel}),(0,W.jsx)(j,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:a||!h.trim(),onClick:()=>{u(h.trim()),m(!1)},children:i.save})]})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,W.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(de,{className:`size-3 text-accent`,"aria-hidden":!0}),we(n,i)]}),(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.stability[n.stability]}),n.evidenceCount>1?(0,W.jsx)(`span`,{children:G(i.evidenceCount,n.evidenceCount)}):null,n.latestEvidenceAt?(0,W.jsx)(`span`,{children:i.observedAt.replace(`{{time}}`,K(n.latestEvidenceAt,r))}):null]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[_?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:c,children:[(0,W.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,W.jsxs)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:l,children:[(0,W.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,(0,W.jsxs)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>m(!0),children:[(0,W.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),i.change]}),(0,W.jsxs)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:f,children:[(0,W.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),i.forget]})]})]}),(0,W.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer font-medium text-fg-muted`,children:i.viewEvidence}),(0,W.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),(0,W.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourceName})]}),n.sourcePath?(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidencePath}),(0,W.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourcePath})]}):null,(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceUpdated}),(0,W.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:K(n.updatedAt,r)})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSupport}),(0,W.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:G(i.evidenceCount,n.evidenceCount)})]})]})]})]}),t[2]=a,t[3]=h,t[4]=p,t[5]=n,t[6]=r,t[7]=_,t[8]=c,t[9]=f,t[10]=l,t[11]=u,t[12]=i,t[13]=b):b=t[13];let x;return t[14]!==y||t[15]!==b?(x=(0,W.jsx)(`article`,{className:y,children:b}),t[14]=y,t[15]=b,t[16]=x):x=t[16],x}function Ee(e){let t=(0,H.c)(76),{source:n,language:r,t:i,onConfigure:a,onDisconnect:s}=e,c=n.installed?n.enabled?i.connected:i.paused:i.available,l;t[0]!==n.lastHealthStatus||t[1]!==i.healthIssue||t[2]!==i.healthOk||t[3]!==i.sourceHealth?(l=n.lastHealthStatus?i.sourceHealth.replace(`{{status}}`,n.lastHealthStatus===`ok`?i.healthOk:i.healthIssue):null,t[0]=n.lastHealthStatus,t[1]=i.healthIssue,t[2]=i.healthOk,t[3]=i.sourceHealth,t[4]=l):l=t[4];let u=l,d=`${i.manageSources}: ${n.displayName}`,f;t[5]===a?f=t[6]:(f=e=>{e.target===e.currentTarget&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),a()))},t[5]=a,t[6]=f);let p=n.displayName,m;t[7]===n?m=t[8]:(m=_e(n),t[7]=n,t[8]=m);let h;t[9]!==n.displayName||t[10]!==m?(h=(0,W.jsx)(ge,{connector:{displayName:p,branding:m},size:`sm`}),t[9]=n.displayName,t[10]=m,t[11]=h):h=t[11];let g;t[12]===n.displayName?g=t[13]:(g=(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.displayName}),t[12]=n.displayName,t[13]=g);let _;t[14]===n.description?_=t[15]:(_=(0,W.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.description}),t[14]=n.description,t[15]=_);let v;t[16]!==g||t[17]!==_?(v=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[16]=g,t[17]=_,t[18]=v):v=t[18];let y;t[19]!==h||t[20]!==v?(y=(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[h,v]}),t[19]=h,t[20]=v,t[21]=y):y=t[21];let b=n.installed&&n.enabled?`bg-success-soft text-fg`:`bg-surface-hover text-fg-muted`,x;t[22]===b?x=t[23]:(x=o(`shrink-0 rounded-full px-2 py-1 text-[11px] font-medium`,b),t[22]=b,t[23]=x);let S;t[24]!==c||t[25]!==x?(S=(0,W.jsx)(`span`,{className:x,children:c}),t[24]=c,t[25]=x,t[26]=S):S=t[26];let C;t[27]!==y||t[28]!==S?(C=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[y,S]}),t[27]=y,t[28]=S,t[29]=C):C=t[29];let w;t[30]!==n.access.context||t[31]!==i.sourceContext?(w=n.access.context?(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceContext}):null,t[30]=n.access.context,t[31]=i.sourceContext,t[32]=w):w=t[32];let T;t[33]!==n.access.memory||t[34]!==i.sourceMemory?(T=n.access.memory?(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceMemory}):null,t[33]=n.access.memory,t[34]=i.sourceMemory,t[35]=T):T=t[35];let E;t[36]!==n.access.read||t[37]!==i.sourceRead?(E=n.access.read?(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.sourceRead}):null,t[36]=n.access.read,t[37]=i.sourceRead,t[38]=E):E=t[38];let D;t[39]!==n.access.write||t[40]!==i.sourceWrite?(D=n.access.write?(0,W.jsx)(`span`,{className:`rounded-full bg-warning-soft px-2 py-0.5 text-fg`,children:i.sourceWrite}):null,t[39]=n.access.write,t[40]=i.sourceWrite,t[41]=D):D=t[41];let O;t[42]!==w||t[43]!==T||t[44]!==E||t[45]!==D?(O=(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[w,T,E,D]}),t[42]=w,t[43]=T,t[44]=E,t[45]=D,t[46]=O):O=t[46];let k;t[47]!==u||t[48]!==r||t[49]!==n.derivedUnderstandingCount||t[50]!==n.installed||t[51]!==n.knowledgeItemCount||t[52]!==n.lastActivityAt||t[53]!==n.lastSyncAt||t[54]!==n.lastSyncError||t[55]!==n.lastSyncStatus||t[56]!==i.sourceDerivedCount||t[57]!==i.sourceKnowledgeCount||t[58]!==i.sourceLastSync||t[59]!==i.sourceLastUsed||t[60]!==i.sourceNeverUsed||t[61]!==i.sourceSyncFailed?(k=n.installed?(0,W.jsxs)(`div`,{className:`mt-3 space-y-1 border-t border-edge-subtle pt-3 text-xs text-fg-muted`,children:[u?(0,W.jsx)(`p`,{children:u}):null,(0,W.jsx)(`p`,{children:n.lastActivityAt?i.sourceLastUsed.replace(`{{time}}`,K(n.lastActivityAt,r)):i.sourceNeverUsed}),n.lastSyncAt?(0,W.jsx)(`p`,{children:i.sourceLastSync.replace(`{{time}}`,K(n.lastSyncAt,r))}):null,n.lastSyncStatus===`failed`&&n.lastSyncError?(0,W.jsx)(`p`,{className:`text-danger`,children:i.sourceSyncFailed.replace(`{{error}}`,n.lastSyncError)}):null,(0,W.jsx)(`p`,{children:i.sourceKnowledgeCount.replace(`{{count}}`,String(n.knowledgeItemCount))}),(0,W.jsx)(`p`,{children:i.sourceDerivedCount.replace(`{{count}}`,String(n.derivedUnderstandingCount))})]}):null,t[47]=u,t[48]=r,t[49]=n.derivedUnderstandingCount,t[50]=n.installed,t[51]=n.knowledgeItemCount,t[52]=n.lastActivityAt,t[53]=n.lastSyncAt,t[54]=n.lastSyncError,t[55]=n.lastSyncStatus,t[56]=i.sourceDerivedCount,t[57]=i.sourceKnowledgeCount,t[58]=i.sourceLastSync,t[59]=i.sourceLastUsed,t[60]=i.sourceNeverUsed,t[61]=i.sourceSyncFailed,t[62]=k):k=t[62];let A;t[63]!==s||t[64]!==n.installed||t[65]!==n.instanceId||t[66]!==i.disconnect?(A=n.installed&&n.instanceId?(0,W.jsx)(`div`,{className:`mt-3 flex justify-end border-t border-edge-subtle pt-3`,children:(0,W.jsx)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-danger hover:bg-danger-soft hover:text-danger`,onClick:e=>{e.stopPropagation(),s()},children:i.disconnect})}):null,t[63]=s,t[64]=n.installed,t[65]=n.instanceId,t[66]=i.disconnect,t[67]=A):A=t[67];let M;return t[68]!==a||t[69]!==C||t[70]!==O||t[71]!==d||t[72]!==k||t[73]!==A||t[74]!==f?(M=(0,W.jsxs)(`article`,{role:`button`,tabIndex:0,"aria-label":d,className:`cursor-pointer rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:border-accent/30 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:a,onKeyDown:f,children:[C,O,k,A]}),t[68]=a,t[69]=C,t[70]=O,t[71]=d,t[72]=k,t[73]=A,t[74]=f,t[75]=M):M=t[75],M}function De(e){let t=(0,H.c)(46),{suggestion:n,draft:r,busy:i,onDraftChange:a,onSave:s,onLater:c,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,W.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,W.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,W.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]!==s?(g=e=>{e.key===`Enter`&&r.trim()&&!i&&s()},t[12]=i,t[13]=r,t[14]=s,t[15]=g):g=t[15];let _=l.meetPlaceholder,v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=o(xe,`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,W.jsx)(`input`,{id:`you-call-name`,value:r,maxLength:80,autoFocus:!0,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]!==s||t[26]!==b||t[27]!==x?(S=(0,W.jsx)(j,{type:`button`,variant:`primary`,className:`h-10 shrink-0`,disabled:b,onClick:s,children:x}),t[25]=s,t[26]=b,t[27]=x,t[28]=S):S=t[28];let w;t[29]!==y||t[30]!==S||t[31]!==m?(w=(0,W.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]=w):w=t[32];let T;t[33]!==n||t[34]!==l.meetSource?(T=n?(0,W.jsxs)(`p`,{className:`mt-3 flex items-start gap-1.5 text-xs leading-5 text-fg-subtle`,children:[(0,W.jsx)(C,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,W.jsx)(`span`,{children:l.meetSource})]}):null,t[33]=n,t[34]=l.meetSource,t[35]=T):T=t[35];let E;t[36]!==i||t[37]!==c||t[38]!==l.meetLater?(E=(0,W.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:c,children:l.meetLater}),t[36]=i,t[37]=c,t[38]=l.meetLater,t[39]=E):E=t[39];let D;return t[40]!==w||t[41]!==T||t[42]!==E||t[43]!==d||t[44]!==p?(D=(0,W.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,W.jsxs)(`div`,{className:`relative max-w-2xl`,children:[d,p,w,T,E]})}),t[40]=w,t[41]=T,t[42]=E,t[43]=d,t[44]=p,t[45]=D):D=t[45],D}function Oe(){let e=l(e=>e.language),t=c(e).you,n=a(),[r,f]=i(),w=Se(r.get(`tab`)),ee=oe(e=>e.setPageHeader),re=oe(e=>e.clearPageHeader),{data:N,error:ie,isLoading:ae,mutate:I}=u(`/api/you`,O),[L,R]=(0,V.useState)(null),[z,de]=(0,V.useState)(null),[ge,H]=(0,V.useState)(!1),[U,_e]=(0,V.useState)(null),[ye,K]=(0,V.useState)(!1),[we,Oe]=(0,V.useState)(``),[ke,Ae]=(0,V.useState)(!1),[je,Me]=(0,V.useState)(null),[Ne,Pe]=(0,V.useState)(!1),[Fe,Ie]=(0,V.useState)(!1),[Le,Re]=(0,V.useState)(null),[ze,Be]=(0,V.useState)(null),[Ve,He]=(0,V.useState)(!1),[q,Ue]=(0,V.useState)(null),We=(0,V.useRef)(null),Ge=(0,V.useRef)(null),J=N?.profile??{callName:``,pronouns:``,timezone:``,notes:``},Y=(0,V.useMemo)(()=>N?.understanding.filter(e=>e.status===`active`)??[],[N]),X=(0,V.useMemo)(()=>N?.understanding.filter(e=>e.status!==`active`)??[],[N]),Ke=(0,V.useMemo)(()=>new Map(be.map(e=>[e,Y.filter(t=>t.facet===e)])),[Y]),Z=je??N?.controls??null,qe=N?.sources.filter(e=>e.installed&&e.enabled)??[],Je=qe.filter(e=>[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status)),Q=(e,t)=>{let n=new URLSearchParams(r);e===`overview`?n.delete(`tab`):n.set(`tab`,e),t?n.set(`status`,t):n.delete(`status`),f(n,{replace:!0})},Ye=e=>{let t=new URLSearchParams({connector:e.id});e.instanceId&&t.set(`instance`,e.instanceId),n(`/connectors?${t.toString()}`)};(0,V.useLayoutEffect)(()=>(ee({startExtra:null,main:(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,W.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.subtitle})]}),end:null}),()=>re()),[re,ee,t.subtitle,t.title]),(0,V.useEffect)(()=>{!N||N.profile.callName||Oe(N.profileSetup.callNameSuggestion?.value??``)},[N,N?.profile.callName,N?.profileSetup.callNameSuggestion?.id]);async function $(e,n,r){R(e.id);try{let t=await b(e.id,{action:n,content:r});await I(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}),I()}catch{B({type:`error`,title:t.title,message:t.saveError})}finally{R(null)}}async function Xe(r,i){R(`insight:${r.id}`);try{let t=await g(r.id,{action:i,uiLocale:e});await I(),i===`apply`&&t.href&&n(t.href)}catch{B({type:`error`,title:t.insightsTitle,message:t.saveError})}finally{R(null)}}async function Ze(e){R(`playbook:${e.id}`);try{await k(e.id,!e.enabled),await I()}catch{B({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{R(null)}}async function Qe(){if(z){R(z.id);try{await _(z.id);let e=z.id;de(null),await I(t=>t&&{...t,understanding:t.understanding.filter(t=>t.id!==e)},{revalidate:!1}),I()}catch{B({type:`error`,title:t.title,message:t.saveError})}finally{R(null)}}}async function $e(){if(U){K(!0);try{let e=await y(U);H(!1),_e(null),await I(t=>t&&{...t,...e},{revalidate:!1})}catch{B({type:`error`,title:t.title,message:t.saveError})}finally{K(!1)}}}async function et(){let e=we.trim();if(!(!e||ke)){Ae(!0);try{let t=await y({callName:e,timezone:J.timezone||ue()});await I(e=>e&&{...e,...t},{revalidate:!1})}catch{B({type:`error`,title:t.title,message:t.saveError})}finally{Ae(!1)}}}async function tt(){if(!ke){Ae(!0);try{let e=await M(`snooze`);await I(t=>t&&{...t,profileSetup:e.profileSetup},{revalidate:!1})}catch{B({type:`error`,title:t.title,message:t.saveError})}finally{Ae(!1)}}}function nt(){_e(J),H(!0),requestAnimationFrame(()=>We.current?.scrollIntoView({behavior:`smooth`,block:`center`}))}async function rt(){if(Z){Pe(!0);try{Me(await le(Z)),await I(),B({type:`success`,title:t.title,message:t.saved})}catch{B({type:`error`,title:t.title,message:t.saveError})}finally{Pe(!1)}}}async function it(e){if(!(Fe||e===N?.trust.defaultActionLevel)){Ie(!0);try{let t=await A(e);await I(e=>e&&{...e,trust:t},{revalidate:!1})}catch{B({type:`error`,title:t.trustTitle,message:t.saveError})}finally{Ie(!1),Re(null)}}}async function at(e){if(!(!ze?.instanceId||Ve)){He(!0);try{let n=await pe(ze.instanceId,e);Be(null),await I(),B({type:`success`,title:t.sourcesTitle,message:e?t.disconnectDeleted.replace(`{{count}}`,String(n.deletedUnderstandingCount)):t.disconnectSuccess})}catch{B({type:`error`,title:t.sourcesTitle,message:t.saveError})}finally{He(!1)}}}async function ot(){if(!q){Ue(`export`);try{let e=await p(),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.agentId}-${e.exportedAt.slice(0,10)}.json`,n.click(),URL.revokeObjectURL(t)}catch{B({type:`error`,title:t.transferTitle,message:t.saveError})}finally{Ue(null)}}}async function st(e){if(!(!e||q)){Ue(`import`);try{if(e.size>2*1024*1024)throw Error(`file too large`);let n=await D(JSON.parse(await e.text()));await I(),Q(`understanding`,`review`),B({type:`success`,title:t.transferTitle,message:t.importSuccess.replace(`{{count}}`,String(n.importedCount)).replace(`{{skipped}}`,String(n.skippedCount))})}catch{B({type:`error`,title:t.transferTitle,message:t.importError})}finally{Ge.current&&(Ge.current.value=``),Ue(null)}}}return(0,W.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,W.jsx)(me,{items:[{id:`overview`,label:t.tabs.overview,icon:fe},{id:`understanding`,label:t.tabs.understanding,icon:S,count:X.length||void 0},{id:`sources`,label:t.tabs.sources,icon:te},{id:`controls`,label:t.tabs.controls,icon:F}],activeTab:w,onChange:Q,ariaLabel:t.title,tabIdPrefix:`you-tab`,panelIdPrefix:`you-panel`}),ae?(0,W.jsx)(Ce,{}):ie||!N?(0,W.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t.loadError}):null,N&&w===`overview`?(0,W.jsxs)(`div`,{id:`you-panel-overview`,role:`tabpanel`,"aria-labelledby":`you-tab-overview`,className:`space-y-4`,children:[!J.callName&&N.profileSetup.shouldPrompt?(0,W.jsx)(De,{suggestion:N.profileSetup.callNameSuggestion,draft:we,busy:ke,onDraftChange:Oe,onSave:()=>void et(),onLater:()=>void tt(),t}):null,X.length>0||Je.length>0||!J.callName?(0,W.jsxs)(`section`,{className:`rounded-2xl border border-warning/25 bg-warning-soft/35 p-5`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.attentionTitle}),(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[X.length>0?(0,W.jsxs)(j,{type:`button`,variant:`secondary`,onClick:()=>Q(`understanding`,`review`),children:[G(t.reviewCount,X.length),(0,W.jsx)(m,{className:`size-4`,"aria-hidden":!0})]}):null,Je.length>0?(0,W.jsxs)(j,{type:`button`,variant:`secondary`,onClick:()=>Q(`sources`),children:[G(t.sourceIssues,Je.length),(0,W.jsx)(m,{className:`size-4`,"aria-hidden":!0})]}):null,J.callName?null:(0,W.jsxs)(j,{type:`button`,variant:`secondary`,onClick:nt,children:[t.completeProfile,(0,W.jsx)(m,{className:`size-4`,"aria-hidden":!0})]})]})]}):(0,W.jsxs)(`section`,{className:`rounded-2xl border border-success/20 bg-success-soft p-4 text-sm text-fg`,children:[(0,W.jsx)(s,{className:`mr-2 inline size-4 text-success`,"aria-hidden":!0}),t.upToDate]}),(0,W.jsxs)(`section`,{className:`rounded-2xl border border-accent/15 bg-gradient-to-br from-accent-soft/55 via-surface-panel to-surface-panel p-5`,children:[(0,W.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight text-fg`,children:t.heroTitle}),(0,W.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.heroBody}),(0,W.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-3`,children:[(0,W.jsxs)(`button`,{type:`button`,className:`rounded-xl bg-surface-base/80 p-3 text-left`,onClick:()=>Q(`understanding`),children:[(0,W.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:Y.length}),(0,W.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.knownSummary})]}),(0,W.jsxs)(`button`,{type:`button`,className:`rounded-xl bg-surface-base/80 p-3 text-left`,onClick:()=>Q(`sources`),children:[(0,W.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:qe.length}),(0,W.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.connectedSources})]}),(0,W.jsxs)(`button`,{type:`button`,className:`rounded-xl bg-surface-base/80 p-3 text-left`,onClick:()=>Q(`controls`),children:[(0,W.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.trustLevels[N.trust.defaultActionLevel]}),(0,W.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.currentTrust})]})]})]}),N.insights.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl border border-accent/15 bg-surface-base p-5`,children:[(0,W.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,W.jsx)(T,{className:`size-4 text-accent`,"aria-hidden":!0}),t.insightsTitle]}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.insightsHint}),(0,W.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-2`,children:N.insights.map(e=>(0,W.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,W.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.insight}),(0,W.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:e.evidenceCount>1?G(t.insightEvidence,e.evidenceCount):t.insightReason}),(0,W.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,W.jsx)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:L===`insight:${e.id}`,onClick:()=>void Xe(e,`dismiss`),children:t.notNow}),(0,W.jsx)(j,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:L===`insight:${e.id}`,onClick:()=>void Xe(e,`apply`),children:t.insightActions[e.action]})]})]},e.id))})]}):null,(0,W.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,W.jsxs)(`section`,{ref:We,id:`you-profile-card`,className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,W.jsx)(ne,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.profileHint})]}),ge?null:(0,W.jsxs)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:nt,children:[(0,W.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),t.edit]})]}),ge&&U?(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsx)(he,{value:U,onChange:_e,language:e,inputClassName:xe,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,W.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,W.jsx)(j,{type:`button`,variant:`ghost`,onClick:()=>{H(!1),_e(null)},children:t.cancel}),(0,W.jsx)(j,{type:`button`,variant:`primary`,disabled:ye,onClick:()=>void $e(),children:ye?t.saving:t.save})]})]}):(0,W.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,W.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:J.callName||`—`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,W.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:J.timezone||`—`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,W.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:J.pronouns||`—`})]}),J.notes?(0,W.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,W.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,W.jsx)(`dd`,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg`,children:J.notes})]}):null]})]}),(0,W.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,W.jsx)(S,{className:`size-4 text-accent`,"aria-hidden":!0}),t.understandingTitle]}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.understandingHint})]}),(0,W.jsx)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>Q(`understanding`),children:(0,W.jsx)(m,{className:`size-4`,"aria-hidden":!0})})]}),(0,W.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[Y.slice(0,4).map(e=>(0,W.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5 text-sm leading-5 text-fg`,children:e.statement},e.id)),Y.length===0?(0,W.jsx)(`p`,{className:`py-5 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]})]})]}),N.playbooks.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,W.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,W.jsx)(x,{className:`size-4 text-accent`,"aria-hidden":!0}),t.playbooksTitle]}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.playbooksHint}),(0,W.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-3`,children:N.playbooks.map(e=>(0,W.jsxs)(`article`,{className:o(`rounded-xl border p-4`,e.enabled?`border-edge-subtle bg-surface-panel`:`border-edge-subtle bg-surface-muted opacity-75`),children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.playbookNames[e.id]}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:G(t.playbookRuleCount,e.rules.length)})]}),(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px]`,children:e.enabled?t.playbookActive:t.playbookPaused})]}),(0,W.jsx)(`ul`,{className:`mt-3 space-y-2`,children:e.rules.slice(0,4).map(e=>(0,W.jsxs)(`li`,{className:`text-xs leading-5 text-fg-muted`,children:[`• `,e.statement]},e.id))}),(0,W.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,W.jsx)(j,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:L===`playbook:${e.id}`,onClick:()=>void Ze(e),children:e.enabled?t.pausePlaybook:t.resumePlaybook})})]},e.id))})]}):null]}):null,N&&w===`understanding`?(0,W.jsxs)(`div`,{id:`you-panel-understanding`,role:`tabpanel`,"aria-labelledby":`you-tab-understanding`,className:`space-y-6`,children:[(0,W.jsx)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs text-fg-muted`,children:t.memoryScope.replace(`{{agent}}`,N.scope.agentId)}),X.length>0?(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.reviewTitle}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.reviewHint}),(0,W.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:X.map(n=>(0,W.jsx)(Te,{item:n,language:e,t,busy:L===n.id,onConfirm:()=>void $(n,`confirm`),onReject:()=>void $(n,`reject`),onUpdate:e=>void $(n,`update`,e),onForget:()=>de(n)},n.id))})]}):Y.length>0?(0,W.jsxs)(`div`,{className:`rounded-2xl border border-success/20 bg-success-soft p-6 text-center`,children:[(0,W.jsx)(s,{className:`mx-auto size-5 text-success`,"aria-hidden":!0}),(0,W.jsx)(`h2`,{className:`mt-2 text-sm font-semibold text-fg`,children:t.nothingToReview}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.nothingToReviewHint})]}):null,be.map(n=>{let r=Ke.get(n)??[];return r.length===0?null:(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.facets[n]}),(0,W.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:r.map(n=>(0,W.jsx)(Te,{item:n,language:e,t,busy:L===n.id,onConfirm:()=>void $(n,`confirm`),onReject:()=>void $(n,`reject`),onUpdate:e=>void $(n,`update`,e),onForget:()=>de(n)},n.id))})]},n)}),N.understanding.length===0?(0,W.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]}):null,N&&w===`sources`?(0,W.jsxs)(`div`,{id:`you-panel-sources`,role:`tabpanel`,"aria-labelledby":`you-tab-sources`,className:`space-y-5`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.sourcesTitle}),(0,W.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.sourcesHint})]}),(0,W.jsxs)(j,{type:`button`,variant:`primary`,onClick:()=>n(`/connectors?tab=connected&personalContext=1`),children:[t.manageSources,(0,W.jsx)(m,{className:`size-4`,"aria-hidden":!0})]})]}),N.sourceRecommendations.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl border border-accent/20 bg-accent-soft/25 p-5`,children:[(0,W.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,W.jsx)(se,{className:`size-4 text-accent`,"aria-hidden":!0}),t.recommendationsTitle]}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.recommendationsHint}),(0,W.jsx)(`div`,{className:`mt-3 grid gap-2 lg:grid-cols-3`,children:N.sourceRecommendations.map(e=>(0,W.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:border-accent/30 hover:bg-surface-hover`,onClick:()=>Ye({id:e.sourceId}),children:[(0,W.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:e.sourceName}),(0,W.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.recommendationReason.replace(`{{goal}}`,e.goalTitle)})]},e.sourceId))})]}):null,(0,W.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:N.sources.map(n=>(0,W.jsx)(Ee,{source:n,language:e,t,onConfigure:()=>Ye(n),onDisconnect:()=>Be(n)},n.id))}),N.sources.length===0?(0,W.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.noSources}):null]}):null,N&&w===`controls`&&Z?(0,W.jsxs)(`div`,{id:`you-panel-controls`,role:`tabpanel`,"aria-labelledby":`you-tab-controls`,className:`space-y-6`,children:[(0,W.jsx)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs leading-5 text-fg-muted`,children:t.scopeSummary.replace(`{{agent}}`,N.scope.agentId)}),(0,W.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-2`,children:[(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.controlTitle}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.controlHint}),(0,W.jsxs)(`div`,{className:`mt-4 space-y-3 rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,W.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.learningMode,(0,W.jsx)(E,{value:Z.mode,onChange:e=>Me({...Z,mode:e.target.value}),children:Object.entries(t.learningModes).map(([e,t])=>(0,W.jsx)(h,{value:e,children:t},e))})]}),(0,W.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.sensitive,(0,W.jsx)(E,{value:Z.sensitiveWritePolicy,onChange:e=>Me({...Z,sensitiveWritePolicy:e.target.value}),children:Object.entries(t.sensitiveOptions).map(([e,t])=>(0,W.jsx)(h,{value:e,children:t},e))})]}),(0,W.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.sharing,(0,W.jsx)(E,{value:Z.crossAgentSharing,onChange:e=>Me({...Z,crossAgentSharing:e.target.value}),children:Object.entries(t.sharingOptions).map(([e,t])=>(0,W.jsx)(h,{value:e,children:t},e))})]}),(0,W.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl bg-accent-soft/40 p-3 text-xs leading-5 text-fg-muted`,children:[(0,W.jsx)(C,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,W.jsx)(`span`,{children:t.transientPromise})]}),(0,W.jsx)(`div`,{className:`flex justify-end pt-2`,children:(0,W.jsx)(j,{type:`button`,variant:`primary`,disabled:Ne,onClick:()=>void rt(),children:Ne?t.saving:t.save})})]})]}),(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.trustTitle}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.trustHint}),(0,W.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:N.trust.levels.map(e=>(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":e===N.trust.defaultActionLevel,disabled:Fe,onClick:()=>e===`auto`?Re(e):void it(e),className:o(`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===N.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,W.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:t.trustLevels[e]}),(0,W.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustLevelHints[e]}),e===N.trust.defaultActionLevel?(0,W.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,W.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-subtle`,children:t.autoOptInPromise})]})]}),(0,W.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.transferTitle}),(0,W.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.transferHint}),(0,W.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,W.jsxs)(j,{type:`button`,variant:`secondary`,disabled:q!==null,onClick:()=>void ot(),children:[(0,W.jsx)(P,{className:`size-4`,"aria-hidden":!0}),q===`export`?t.exporting:t.exportAction]}),(0,W.jsxs)(j,{type:`button`,variant:`secondary`,disabled:q!==null,onClick:()=>Ge.current?.click(),children:[(0,W.jsx)(ce,{className:`size-4`,"aria-hidden":!0}),q===`import`?t.importing:t.importAction]}),(0,W.jsx)(`input`,{ref:Ge,type:`file`,accept:`application/json,.json`,className:`sr-only`,onChange:e=>void st(e.target.files?.[0])})]}),(0,W.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-subtle`,children:t.importPromise})]})]}):null,(0,W.jsx)(v,{open:z!==null,title:t.forgetTitle,description:t.forgetBody,confirmLabel:t.forget,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void Qe(),onCancel:()=>de(null)}),(0,W.jsx)(v,{open:Le===`auto`,title:t.autoConfirmTitle,description:t.autoConfirmBody,confirmLabel:t.autoConfirmAction,cancelLabel:t.cancel,onConfirm:()=>void it(`auto`),onCancel:()=>Re(null)}),(0,W.jsx)(ve,{source:ze,language:e,busy:Ve,onOpenChange:e=>{e||Be(null)},onConfirm:e=>void at(e)})]})}export{Oe as UserContextPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{Do as a,Qt as ee,To as te,Uo as ne,en as o,tn as re}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{Do as a,Qt as ee,To as te,Uo as ne,en as o,tn as re}from"./index-BJGusbyV.js";var ie=n(),ae=e(t(),1),s=r();function c(e){let t=(0,ie.c)(104),{value:n,onChange:r,labels:c,language:l,inputClassName:u}=e,d;t[0]===n.timezone?d=t[1]:(d=()=>o.some(e=>e.value===n.timezone)?``:n.timezone,t[0]=n.timezone,t[1]=d);let[f,p]=(0,ae.useState)(d),m;t[2]===n.timezone?m=t[3]:(m=()=>!!n.timezone&&!o.some(e=>e.value===n.timezone),t[2]=n.timezone,t[3]=m);let[h,g]=(0,ae.useState)(m),_;t[4]===n.pronouns?_=t[5]:(_=()=>!!n.pronouns&&!ee.some(e=>e.value===n.pronouns),t[4]=n.pronouns,t[5]=_);let[v,oe]=(0,ae.useState)(_),se;bb0:{if(h){se=`__custom__`;break bb0}se=o.some(e=>e.value===n.timezone)?n.timezone:`__custom__`}let ce=se,y;t[6]!==r||t[7]!==n?(y=e=>r({...n,...e}),t[6]=r,t[7]=n,t[8]=y):y=t[8];let b=y,x;t[9]===l?x=t[10]:(x=(e,t)=>l===`zh`?t:e,t[9]=l,t[10]=x);let S=x,C;t[11]===c.callName?C=t[12]:(C=(0,s.jsx)(`span`,{className:`font-medium text-fg`,children:c.callName}),t[11]=c.callName,t[12]=C);let w;t[13]===b?w=t[14]:(w=e=>b({callName:e.target.value}),t[13]=b,t[14]=w);let T;t[15]!==u||t[16]!==c.callNamePlaceholder||t[17]!==w||t[18]!==n.callName?(T=(0,s.jsx)(`input`,{className:u,value:n.callName,onChange:w,placeholder:c.callNamePlaceholder,autoComplete:`off`}),t[15]=u,t[16]=c.callNamePlaceholder,t[17]=w,t[18]=n.callName,t[19]=T):T=t[19];let E;t[20]!==C||t[21]!==T?(E=(0,s.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[C,T]}),t[20]=C,t[21]=T,t[22]=E):E=t[22];let D;t[23]===c.pronouns?D=t[24]:(D=(0,s.jsx)(`span`,{className:`font-medium text-fg`,children:c.pronouns}),t[23]=c.pronouns,t[24]=D);let O=v?`__custom__`:n.pronouns,k;t[25]!==b||t[26]!==n.pronouns?(k=e=>{if(e.target.value===`__custom__`){oe(!0),ee.some(e=>e.value===n.pronouns)&&b({pronouns:``});return}oe(!1),b({pronouns:e.target.value})},t[25]=b,t[26]=n.pronouns,t[27]=k):k=t[27];let A;t[28]===c.pronounsPlaceholder?A=t[29]:(A=(0,s.jsx)(a,{value:``,children:c.pronounsPlaceholder}),t[28]=c.pronounsPlaceholder,t[29]=A);let j;t[30]===S?j=t[31]:(j=ee.map(e=>(0,s.jsx)(a,{value:e.value,children:S(e.labelEn,e.labelZh)},e.value)),t[30]=S,t[31]=j);let M;t[32]===c.custom?M=t[33]:(M=(0,s.jsx)(a,{value:`__custom__`,children:c.custom}),t[32]=c.custom,t[33]=M);let N;t[34]!==u||t[35]!==O||t[36]!==k||t[37]!==A||t[38]!==j||t[39]!==M?(N=(0,s.jsxs)(te,{className:u,value:O,onChange:k,children:[A,j,M]}),t[34]=u,t[35]=O,t[36]=k,t[37]=A,t[38]=j,t[39]=M,t[40]=N):N=t[40];let P;t[41]!==u||t[42]!==c.pronounsPlaceholder||t[43]!==v||t[44]!==b||t[45]!==n.pronouns?(P=v?(0,s.jsx)(`input`,{className:i(u,`mt-1 text-xs`),value:n.pronouns,onChange:e=>b({pronouns:e.target.value}),placeholder:c.pronounsPlaceholder,autoComplete:`off`}):null,t[41]=u,t[42]=c.pronounsPlaceholder,t[43]=v,t[44]=b,t[45]=n.pronouns,t[46]=P):P=t[46];let F;t[47]!==D||t[48]!==N||t[49]!==P?(F=(0,s.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[D,N,P]}),t[47]=D,t[48]=N,t[49]=P,t[50]=F):F=t[50];let I;t[51]===c.timezone?I=t[52]:(I=(0,s.jsx)(`span`,{className:`font-medium text-fg`,children:c.timezone}),t[51]=c.timezone,t[52]=I);let L;t[53]===u?L=t[54]:(L=i(u,`min-w-0 flex-1`),t[53]=u,t[54]=L);let R;t[55]===b?R=t[56]:(R=e=>{if(e.target.value===`__custom__`){g(!0);return}g(!1),p(``),b({timezone:e.target.value})},t[55]=b,t[56]=R);let z;t[57]===S?z=t[58]:(z=o.map(e=>(0,s.jsx)(a,{value:e.value,children:S(e.labelEn,e.labelZh)},e.value)),t[57]=S,t[58]=z);let B;t[59]===c.timezoneCustom?B=t[60]:(B=(0,s.jsx)(a,{value:`__custom__`,children:c.timezoneCustom}),t[59]=c.timezoneCustom,t[60]=B);let V;t[61]!==L||t[62]!==R||t[63]!==z||t[64]!==B||t[65]!==ce?(V=(0,s.jsxs)(te,{className:L,value:ce,onChange:R,children:[z,B]}),t[61]=L,t[62]=R,t[63]=z,t[64]=B,t[65]=ce,t[66]=V):V=t[66];let H;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(H=i(`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`,ne.press),t[67]=H):H=t[67];let U;t[68]===b?U=t[69]:(U=()=>{let e=re();if(!e)return;let t=o.some(t=>t.value===e);g(!t),p(t?``:e),b({timezone:e})},t[68]=b,t[69]=U);let W;t[70]!==c.timezoneDetect||t[71]!==U?(W=(0,s.jsx)(`button`,{type:`button`,className:H,onClick:U,children:c.timezoneDetect}),t[70]=c.timezoneDetect,t[71]=U,t[72]=W):W=t[72];let G;t[73]!==V||t[74]!==W?(G=(0,s.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[V,W]}),t[73]=V,t[74]=W,t[75]=G):G=t[75];let K;t[76]!==f||t[77]!==u||t[78]!==h||t[79]!==b?(K=h?(0,s.jsx)(`input`,{className:i(u,`mt-1 font-mono text-xs`),value:f,onChange:e=>{p(e.target.value),b({timezone:e.target.value})},placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null,t[76]=f,t[77]=u,t[78]=h,t[79]=b,t[80]=K):K=t[80];let q;t[81]!==I||t[82]!==G||t[83]!==K?(q=(0,s.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[I,G,K]}),t[81]=I,t[82]=G,t[83]=K,t[84]=q):q=t[84];let J;t[85]===c.notes?J=t[86]:(J=(0,s.jsx)(`span`,{className:`font-medium text-fg`,children:c.notes}),t[85]=c.notes,t[86]=J);let Y;t[87]===u?Y=t[88]:(Y=i(u,`min-h-28 resize-y text-sm leading-relaxed`),t[87]=u,t[88]=Y);let X;t[89]===b?X=t[90]:(X=e=>b({notes:e.target.value}),t[89]=b,t[90]=X);let Z;t[91]!==c.notesPlaceholder||t[92]!==Y||t[93]!==X||t[94]!==n.notes?(Z=(0,s.jsx)(`textarea`,{className:Y,value:n.notes,onChange:X,placeholder:c.notesPlaceholder,rows:5,spellCheck:!0}),t[91]=c.notesPlaceholder,t[92]=Y,t[93]=X,t[94]=n.notes,t[95]=Z):Z=t[95];let Q;t[96]!==J||t[97]!==Z?(Q=(0,s.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[J,Z]}),t[96]=J,t[97]=Z,t[98]=Q):Q=t[98];let $;return t[99]!==E||t[100]!==F||t[101]!==q||t[102]!==Q?($=(0,s.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[E,F,q,Q]}),t[99]=E,t[100]=F,t[101]=q,t[102]=Q,t[103]=$):$=t[103],$}export{c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-Cb1VMeqP.js";import{n as a}from"./locale-store-CiM-D9jA.js";import{Ba as o,Dr as s,Ls as c,Mc as l,Mr as u,Yo as d,in as f,on as p,tn as m,yl as h}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-Cb1VMeqP.js";import{n as a}from"./locale-store-CiM-D9jA.js";import{Ba as o,Dr as s,Ls as c,Mc as l,Mr as u,Yo as d,in as f,on as p,tn as m,yl as h}from"./index-BJGusbyV.js";import{n as g,t as _}from"./settings-page-layout-DjbdpK2j.js";import{n as v,t as y}from"./settings-form-section-BfzJkVHd.js";import{t as b}from"./utils-DnsuE4YP.js";import{t as x}from"./user-profile-fields-editor-DVBShNYF.js";var S=n(),C=e(t(),1),w=r(),T={callName:``,pronouns:``,timezone:``,notes:``};function E(e){if(e.timezone)return e;let t=m();return t?{...e,timezone:t}:e}function D(){let e=(0,S.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsxs)(`div`,{className:`grid gap-2`,children:[(0,w.jsx)(o,{className:`h-4 w-24`}),(0,w.jsx)(o,{className:`h-10 rounded-lg`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,w.jsxs)(`div`,{className:`grid gap-2`,children:[(0,w.jsx)(o,{className:`h-4 w-24`}),(0,w.jsx)(o,{className:`h-10 rounded-lg`})]}),e[1]=n):n=e[1];let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,w.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"aria-hidden":`true`,children:[t,n,(0,w.jsxs)(`div`,{className:`grid gap-2 sm:col-span-2`,children:[(0,w.jsx)(o,{className:`h-4 w-28`}),(0,w.jsx)(o,{className:`h-28 rounded-lg`})]})]}),e[2]=r):r=e[2],r}function O(){let e=a(e=>e.language),t=i(e).userProfileSettings,n=b(),[r,o]=(0,C.useState)(T),[m,S]=(0,C.useState)(JSON.stringify(T)),[O,k]=(0,C.useState)(!0),[A,j]=(0,C.useState)(!1),[M,N]=(0,C.useState)(!1),[P,F]=(0,C.useState)(null);(0,C.useEffect)(()=>{let e=!1;return k(!0),F(null),s().then(t=>{if(e)return;let n=E(f(t));o(n),S(JSON.stringify(n))}).catch(n=>{e||F(n instanceof Error?n.message:t.loadError)}).finally(()=>{e||k(!1)}),()=>{e=!0}},[t.loadError]);let I=JSON.stringify(r)!==m;async function L(){j(!0),F(null);try{await u(p(r)),S(JSON.stringify(r)),N(!0)}catch(e){F(e instanceof Error?e.message:t.saveError)}finally{j(!1)}}return(0,w.jsxs)(_,{gap:`gap-6`,children:[(0,w.jsx)(g,{title:t.title,subtitle:t.subtitle,actions:(0,w.jsxs)(d,{type:`button`,variant:`primary`,disabled:O||A||!I,onClick:()=>void L(),children:[(0,w.jsx)(c,{className:`size-4`,"aria-hidden":!0}),A?t.saving:M?t.saved:t.save]})}),(0,w.jsxs)(y,{children:[(0,w.jsx)(v,{icon:h,title:t.sectionTitle,subtitle:t.sectionSubtitle}),O?(0,w.jsx)(D,{}):(0,w.jsx)(x,{value:r,onChange:e=>{o(e),N(!1)},labels:t,language:e,inputClassName:n}),(0,w.jsxs)(`div`,{className:`mt-4 flex items-start gap-2 rounded-lg bg-accent-soft/30 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,w.jsx)(l,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,w.jsx)(`span`,{children:t.note})]}),P?(0,w.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:P}):null]})]})}export{O as UserProfileSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cn-BQ_8x0bT.js";import{Jo as t}from"./index-
|
|
1
|
+
import{t as e}from"./cn-BQ_8x0bT.js";import{Jo as t}from"./index-BJGusbyV.js";function n(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,t,`dark:border-edge`)}function r(e){return[e.channel,e.accountId,e.peerKind,e.peerId].filter(e=>typeof e==`string`&&e.length>0).join(` · `)||e.channel}function i(e,t,n,r){let i=e.trim(),a=t.trim();if(a)return{channel:i,peerId:a};if(n!=null){let e=r[n];if(!e)return{channel:i};let t={channel:i};e.accountId?.trim()&&(t.accountId=e.accountId.trim()),e.peerKind?.trim()&&(t.peerKind=e.peerKind.trim());let a=e.peerId?.trim()||e.chatId?.trim();return a&&(t.peerId=a),t}return{channel:i}}export{i as n,r,n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as a}from"./cn-BQ_8x0bT.js";import{d as o,i as s,o as c}from"./locale-store-CiM-D9jA.js";import{o as l}from"./vendor-swr-BIWyz7Rc.js";import{Bo as u,Do as d,Ft as f,It as p,Jo as m,Ls as h,Ra as g,To as _,Yo as v,gc as y,kl as b,tl as ee,wn as x,za as S}from"./index-I-ZCenVw.js";var C=`/api/image/providers`;async function te(){return(await s(o(`/api/image/providers`)))?.payload?.providers??[]}var w=e(t(),1),ne=n();function T(){return{apiKey:``,region:``,baseUrl:``,imageBaseUrl:``}}function re(e){return e?.apiKey?`••••••••••••`:``}function E(e,t){let n=(()=>{if(!e||typeof e!=`object`||!(`providersConfig`in e))return;let t=e.providersConfig;if(!(!t||typeof t!=`object`||Array.isArray(t)))return t})(),r={};for(let e of t){let t=n?.[e];r[e]={apiKey:re(t),region:t?.region??``,baseUrl:t?.baseUrl??``,imageBaseUrl:t?.imageBaseUrl??``}}return r}function D(e,t,n){let r=e[n].trim();if(r!==t[n].trim())return r||null}function O(e,t){let n=e.trim(),r=t.trim();if(n!==r&&!(x(n)&&x(r)))return n||(r?null:void 0)}function ie(e,t,n){let r={};for(let i of e){let e=t[i]??T(),a=n[i]??T();if(JSON.stringify(e)===JSON.stringify(a))continue;let o={},s=O(e.apiKey,a.apiKey);s!==void 0&&(o.apiKey=s);let c=D(e,a,`region`);c!==void 0&&(o.region=c);let l=D(e,a,`baseUrl`);l!==void 0&&(o.baseUrl=l);let u=D(e,a,`imageBaseUrl`);u!==void 0&&(o.imageBaseUrl=u),Object.keys(o).length>0&&(r[i]=o)}return r}async function k(e){let t=await s(o(`/api/image/providers/${encodeURIComponent(e)}/reveal-api-key`),{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!t.ok||!t.payload)throw Error(t.error?.message??`Reveal failed`);return t.payload}async function ae(e){Object.keys(e).length!==0&&(await s(o(`/api/config`),{method:`PATCH`,body:JSON.stringify({providersConfig:e})}),await g())}var A=r();function oe(e){let t=(0,ne.c)(18),{providerId:n,value:r,onChange:i,labels:a,apiKeyLinks:o,apiKeyLinkLabels:s}=e,c;t[0]===n?c=t[1]:(c=()=>k(n).then(j),t[0]=n,t[1]=c);let l=c,d=`img-cred-key-${n}`,f;t[2]!==a.apiKeyLabel||t[3]!==d?(f=(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:d,children:a.apiKeyLabel}),t[2]=a.apiKeyLabel,t[3]=d,t[4]=f):f=t[4];let m;t[5]!==s||t[6]!==o?(m=o.length>0?(0,A.jsx)(`div`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,A.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[p(e.kind,s),(0,A.jsx)(ee,{className:`size-3`,"aria-hidden":!0})]},`${e.kind}-${e.href}`))}):null,t[5]=s,t[6]=o,t[7]=m):m=t[7];let h=`img-cred-key-${n}`,g;t[8]!==a||t[9]!==i||t[10]!==l||t[11]!==h||t[12]!==r?(g=(0,A.jsx)(u,{id:h,value:r,onChange:i,placeholder:a.optionalPlaceholder,labels:a,reveal:l,loadFailedLabel:a.loadFailed,maskedHelp:a.maskedHelp,notInConfigFile:a.notInConfigFile}),t[8]=a,t[9]=i,t[10]=l,t[11]=h,t[12]=r,t[13]=g):g=t[13];let _;return t[14]!==f||t[15]!==m||t[16]!==g?(_=(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[f,m,g]}),t[14]=f,t[15]=m,t[16]=g,t[17]=_):_=t[17],_}function j(e){return e.apiKey??null}function M(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,m)}function se(){return a(M(),`appearance-none bg-[length:1rem] bg-[right_0.5rem_center] bg-no-repeat pr-9`)}var N=`__custom__`;function ce(e,t){if(!e.region.trim()&&!e.imageBaseUrl.trim())return``;let n=e.region.trim().toLowerCase();return t.some(e=>e.value===n)?n:N}function le(e,t){let n=e.baseUrl.trim().replace(/\/+$/,``);if(!n)return``;let r=t.map(e=>e.value.replace(/\/+$/,``)).indexOf(n);return r>=0?t[r].value:N}function ue(e,t,n){return t===`beijing`?e.dashscopeRegion_beijing:t===`singapore`?e.dashscopeRegion_singapore:t===`us`?e.dashscopeRegion_us:n}function de(e,t){return t===`minimax`?e.minimaxClusterLabel:t===`fal`?e.falQueueBaseLabel:e.baseUrlLabel}function fe(e,t){return t===`minimax`?e.minimaxClusterHint:t===`fal`?e.falQueueBaseHint:null}function pe(e,t){return JSON.stringify(e)!==JSON.stringify(t)}function me(e,t){return t===1?e.modelCountOne:e.modelCountMany.replace(`{count}`,String(t))}function P(e){let t=(0,ne.c)(76),{summaries:n,credDraft:r,credBaseline:o,credDirty:s,credSaving:c,credError:l,credSavedFlash:u,credNoopFlash:p,updateCredRow:m,onDiscardCredentials:g,onSaveCredentials:x,extensionIds:S,showExtensionLinks:C,showImageModelsLink:te,hideActions:re,language:E,apiKeyLinkLabels:D,messages:O}=e,ie=re===void 0?!1:re,k;t[0]===n?k=t[1]:(k=n.some(ye),t[0]=n,t[1]=k);let ae=k,j;t[2]===n?j=t[3]:(j=n.some(ve),t[2]=n,t[3]=j);let P=j,[F,be]=(0,w.useState)(_e),[I,L]=(0,w.useState)(ge),R;if(t[4]!==o||t[5]!==r||t[6]!==n){R=new Set;for(let e of n)pe(r[e.id]??T(),o[e.id]??T())&&R.add(e.id);t[4]=o,t[5]=r,t[6]=n,t[7]=R}else R=t[7];let z=R,B;t[8]!==z||t[9]!==I||t[10]!==F?(B=e=>I.has(e)?!1:F.has(e)?!0:z.has(e),t[8]=z,t[9]=I,t[10]=F,t[11]=B):B=t[11];let V=B,H;t[12]===V?H=t[13]:(H=e=>{if(V(e)){L(t=>new Set(t).add(e)),be(t=>{let n=new Set(t);return n.delete(e),n});return}L(t=>{let n=new Set(t);return n.delete(e),n}),be(t=>new Set(t).add(e))},t[12]=V,t[13]=H);let U=H;if(n.length===0)return null;let W;t[14]===O.credentialsIntro?W=t[15]:(W=(0,A.jsx)(`p`,{children:O.credentialsIntro}),t[14]=O.credentialsIntro,t[15]=W);let G;t[16]!==ae||t[17]!==O.regionHint?(G=ae?(0,A.jsx)(`p`,{className:`text-fg-subtle`,children:O.regionHint}):null,t[16]=ae,t[17]=O.regionHint,t[18]=G):G=t[18];let K;t[19]!==P||t[20]!==O.endpointPresetsHint?(K=P?(0,A.jsx)(`p`,{className:`text-fg-subtle`,children:O.endpointPresetsHint}):null,t[19]=P,t[20]=O.endpointPresetsHint,t[21]=K):K=t[21];let q;t[22]!==te||t[23]!==O.imageModelsLinkTitle||t[24]!==O.openImageModelsPage?(q=te?(0,A.jsx)(`p`,{children:(0,A.jsx)(i,{to:`/settings/credentials?tab=image-models`,className:`font-medium text-accent hover:underline`,title:O.imageModelsLinkTitle,children:O.openImageModelsPage})}):null,t[22]=te,t[23]=O.imageModelsLinkTitle,t[24]=O.openImageModelsPage,t[25]=q):q=t[25];let J;t[26]!==W||t[27]!==G||t[28]!==K||t[29]!==q?(J=(0,A.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs leading-relaxed text-fg-muted`,children:[W,G,K,q]}),t[26]=W,t[27]=G,t[28]=K,t[29]=q,t[30]=J):J=t[30];let Y;t[31]===l?Y=t[32]:(Y=l?(0,A.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:l}):null,t[31]=l,t[32]=Y);let X;t[33]!==s||t[34]!==p||t[35]!==u||t[36]!==c||t[37]!==ie||t[38]!==g||t[39]!==x||t[40]!==O.credentialsNothingToSave||t[41]!==O.credentialsSaved||t[42]!==O.discardCredentials||t[43]!==O.saveCredentials||t[44]!==O.savingCredentials?(X=ie?null:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[u?(0,A.jsx)(`span`,{className:`text-sm text-fg-muted`,children:O.credentialsSaved}):null,p?(0,A.jsx)(`span`,{className:`text-sm text-fg-muted`,children:O.credentialsNothingToSave}):null,(0,A.jsx)(v,{type:`button`,variant:`secondary`,onClick:g,disabled:!s||c,children:O.discardCredentials}),(0,A.jsx)(v,{type:`button`,variant:`primary`,onClick:x,disabled:!s||c,children:c?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(y,{className:`size-3.5 animate-spin`}),(0,A.jsx)(`span`,{className:`ml-1.5`,children:O.savingCredentials})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(h,{className:`size-3.5`}),(0,A.jsx)(`span`,{className:`ml-1.5`,children:O.saveCredentials})]})})]}),t[33]=s,t[34]=p,t[35]=u,t[36]=c,t[37]=ie,t[38]=g,t[39]=x,t[40]=O.credentialsNothingToSave,t[41]=O.credentialsSaved,t[42]=O.discardCredentials,t[43]=O.saveCredentials,t[44]=O.savingCredentials,t[45]=X):X=t[45];let Z;if(t[46]!==D||t[47]!==o||t[48]!==r||t[49]!==S||t[50]!==V||t[51]!==E||t[52]!==C||t[53]!==n||t[54]!==O||t[55]!==U||t[56]!==m){let e;t[58]!==D||t[59]!==o||t[60]!==r||t[61]!==S||t[62]!==V||t[63]!==E||t[64]!==C||t[65]!==O||t[66]!==U||t[67]!==m?(e=e=>{let t=r[e.id]??T(),n=e.ui,s=C&&S.has(e.id)?`/settings/ext/${encodeURIComponent(e.id)}`:null,c=pe(t,o[e.id]??T()),l=V(e.id),u=e.label??e.id,p=me(O,e.models.length);return(0,A.jsxs)(`section`,{className:a(`overflow-hidden rounded-xl bg-surface-panel/80 shadow-surface transition-colors`,c&&`ring-1 ring-accent/50`),children:[(0,A.jsxs)(`button`,{type:`button`,className:`flex w-full items-start justify-between gap-3 px-4 py-3 text-left hover:bg-surface-hover/70`,"aria-expanded":l,"aria-controls":`img-provider-credentials-${e.id}`,onClick:()=>U(e.id),children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`truncate text-sm font-semibold text-fg`,children:u}),(0,A.jsx)(`span`,{className:`rounded-full bg-surface-subtle px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.id}),c?(0,A.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:O.unsavedChanges}):null,e.configured?(0,A.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:O.configured}):(0,A.jsx)(`span`,{className:`rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-[11px] font-medium text-amber-700 dark:text-amber-300`,children:O.missingKey})]}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[(0,A.jsx)(`span`,{children:p}),e.defaultModel?(0,A.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,A.jsxs)(`span`,{className:`text-fg-muted`,children:[O.defaultModel,`:`]}),` `,e.id,`/`,e.defaultModel]}):null]})]}),(0,A.jsx)(b,{className:a(`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform`,l?`rotate-180`:`rotate-0`),"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`sr-only`,children:l?O.collapseProvider:O.expandProvider})]}),l?(0,A.jsxs)(`div`,{id:`img-provider-credentials-${e.id}`,className:`bg-surface-base/45 px-4 py-4`,children:[s?(0,A.jsxs)(i,{to:s,className:`mb-3 inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,title:O.extensionSettingsLinkTitle,children:[(0,A.jsx)(ee,{className:`size-3`}),O.openExtensionSettings]}):null,e.models.length>0?(0,A.jsxs)(`p`,{className:`mb-3 text-xs leading-relaxed text-fg-subtle`,children:[(0,A.jsxs)(`span`,{className:`text-fg-muted`,children:[O.modelsLabel,`:`]}),` `,e.models.map(t=>`${e.id}/${t}`).join(`, `)]}):null,(0,A.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,A.jsx)(oe,{providerId:e.id,value:t.apiKey,onChange:t=>m(e.id,{apiKey:t}),apiKeyLinks:f(e.id,E),apiKeyLinkLabels:D,labels:{apiKeyLabel:O.apiKeyLabel,optionalPlaceholder:O.optionalPlaceholder,maskedHelp:O.apiKeyMaskedHelp,copy:O.apiKeyCopy,copied:O.apiKeyCopied,show:O.apiKeyShow,hide:O.apiKeyHide,notInConfigFile:O.apiKeyNotInConfigFile,loadFailed:O.apiKeyRevealFailed}}),n?.regions?.length?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`img-cred-region-preset-${e.id}`,children:O.regionLabel}),(0,A.jsxs)(_,{id:`img-cred-region-preset-${e.id}`,className:se(),value:ce(t,n.regions),onChange:t=>{let r=t.target.value;if(r===``){m(e.id,{region:``,imageBaseUrl:``});return}if(r===N){m(e.id,{region:``,imageBaseUrl:``});return}let i=n.regions.find(e=>e.value===r);i&&m(e.id,{region:i.value,imageBaseUrl:i.imageBaseUrl})},children:[(0,A.jsx)(d,{value:``,children:O.regionPresetDefault}),n.regions.map(e=>(0,A.jsx)(d,{value:e.value,children:ue(O,e.value,e.label)},e.value)),(0,A.jsx)(d,{value:N,children:O.regionPresetCustom})]}),ce(t,n.regions)===N?(0,A.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[(0,A.jsx)(`input`,{type:`text`,className:M(),value:t.region,placeholder:`region`,onChange:t=>m(e.id,{region:t.target.value})}),(0,A.jsx)(`input`,{type:`url`,className:M(),value:t.imageBaseUrl,placeholder:O.imageBaseUrlLabel,onChange:t=>m(e.id,{imageBaseUrl:t.target.value})})]}):null]}):null,n?.baseUrlPresets?.length?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`img-cred-base-preset-${e.id}`,children:de(O,n.baseUrlPresetKind)}),fe(O,n.baseUrlPresetKind)?(0,A.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:fe(O,n.baseUrlPresetKind)}):null,(0,A.jsxs)(_,{id:`img-cred-base-preset-${e.id}`,className:se(),value:le(t,n.baseUrlPresets),onChange:t=>{let n=t.target.value;if(n===``){m(e.id,{baseUrl:``});return}if(n===N){m(e.id,{baseUrl:``});return}m(e.id,{baseUrl:n.replace(/\/+$/,``)})},children:[(0,A.jsx)(d,{value:``,children:O.baseUrlPresetDefault}),n.baseUrlPresets.map(he),(0,A.jsx)(d,{value:N,children:O.baseUrlPresetCustom})]}),le(t,n.baseUrlPresets)===N?(0,A.jsx)(`input`,{type:`url`,className:a(M(),`mt-2`),value:t.baseUrl,placeholder:`https://…`,onChange:t=>m(e.id,{baseUrl:t.target.value})}):null]}):null,n?.regions?.length&&ce(t,n.regions)!==N?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`img-cred-imgbase-ro-${e.id}`,children:O.imageBaseUrlLabel}),(0,A.jsx)(`input`,{id:`img-cred-imgbase-ro-${e.id}`,type:`url`,readOnly:!0,className:a(M(),`cursor-not-allowed opacity-90`),value:t.imageBaseUrl,title:O.imageBaseUrlPresetHint}),(0,A.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:O.imageBaseUrlPresetHint})]}):null]})]}):null]},e.id)},t[58]=D,t[59]=o,t[60]=r,t[61]=S,t[62]=V,t[63]=E,t[64]=C,t[65]=O,t[66]=U,t[67]=m,t[68]=e):e=t[68],Z=n.map(e),t[46]=D,t[47]=o,t[48]=r,t[49]=S,t[50]=V,t[51]=E,t[52]=C,t[53]=n,t[54]=O,t[55]=U,t[56]=m,t[57]=Z}else Z=t[57];let Q;t[69]===Z?Q=t[70]:(Q=(0,A.jsx)(`div`,{className:`flex flex-col gap-4`,children:Z}),t[69]=Z,t[70]=Q);let $;return t[71]!==J||t[72]!==Y||t[73]!==X||t[74]!==Q?($=(0,A.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[J,Y,X,Q]}),t[71]=J,t[72]=Y,t[73]=X,t[74]=Q,t[75]=$):$=t[75],$}function he(e){return(0,A.jsx)(d,{value:e.value,children:e.label},e.value)}function ge(){return new Set}function _e(){return new Set}function ve(e){return(e.ui?.baseUrlPresets?.length??0)>0}function ye(e){return(e.ui?.regions?.length??0)>0}function F(e){let t=S(c(e=>!!e.token)),n=t.data,r=(0,w.useMemo)(()=>e.map(e=>e.id),[e]),i=(0,w.useRef)(!1),[a,s]=(0,w.useState)(null),[u,d]=(0,w.useState)(!1),[f,p]=(0,w.useState)(null),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),v=(0,w.useMemo)(()=>E(n?.payload?.config,r),[n?.payload?.config,r]),y=a??v,b=v;return{gwSwr:t,credDraft:y,credBaseline:b,credDirty:(0,w.useMemo)(()=>JSON.stringify(y)!==JSON.stringify(b),[y,b]),credSaving:u,credError:f,credSavedFlash:m,credNoopFlash:g,updateCredRow:(0,w.useCallback)((e,t)=>{i.current=!0,s(n=>{let r=n??v,i=r[e]??T();return{...r,[e]:{...i,...t}}})},[v]),onDiscardCredentials:(0,w.useCallback)(()=>{i.current=!1,s(null),p(null),h(!1),_(!1)},[]),saveCredentials:(0,w.useCallback)(async e=>{let n=ie(r,y,b);if(Object.keys(n).length===0){_(!0),window.setTimeout(()=>_(!1),2200);return}d(!0),p(null),h(!1);try{await ae(n),await t.mutate?.(),l(o(C)),i.current=!1,s(null),h(!0),window.setTimeout(()=>h(!1),2e3)}catch(t){p(t instanceof Error?t.message:e)}finally{d(!1)}},[r,y,b,t])}}function be(){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 I(){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 L(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function R(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function z(e,t,n){let r=L(e.providers)?e.providers:void 0,i=r&&L(r[t])?r[t]:void 0;return{...n,...i??{}}}function B(e){let t=be();if(!L(e))return t;let n=R(e.provider),r=z(e,`alibaba`,t.alibaba??{}),i=z(e,`openai`,t.openai??{}),a=t.fallback??{enabled:!1,order:[`xopc-local`]};if(L(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=L(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,L(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,alibaba:r,openai:i,...o?{providers:o}:{},fallback:a}}function V(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function H(e){let t=I();if(!L(e))return t;let n=V(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i=t[`tts-local-cli`]??{},a=L(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,L(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:z(e,`alibaba`,t.alibaba??{}),openai:z(e,`openai`,t.openai??{}),edge:z(e,`edge`,t.edge??{}),minimax:z(e,`minimax`,t.minimax??{}),"tts-local-cli":z(e,`tts-local-cli`,i)}}function U(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 W(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 G(e){let t=L(e)?e:{},n=L(t.voice)?t.voice:{},r=L(n.input)?n.input:{},i=L(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:B(t.stt),tts:H(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 K(){return G((await s(o(`/api/config`))).payload?.config??{})}async function q(e){await s(o(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:U(e.stt),tts:W(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await s(o(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),g()}async function J(){let e=await s(o(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function Y(){let e=await s(o(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function X(){let e=await s(o(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function Z(){let e=await s(o(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function Q(e){await s(o(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function $(e){await s(o(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function xe(e){let t=await s(o(`/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 Se(e){let t=await s(o(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}function Ce(e){let t=(0,ne.c)(15),{kind:n,providerId:r,fieldId:i,value:o,onChange:s,labels:c,placeholder:l,className:d}=e,f=l===void 0?`sk-...`:l,p;t[0]!==n||t[1]!==r?(p=()=>Se({kind:n,provider:r}).then(we),t[0]=n,t[1]=r,t[2]=p):p=t[2];let m=p,h;t[3]===d?h=t[4]:(h=a(`flex min-w-0 flex-col gap-1.5`,d),t[3]=d,t[4]=h);let g;t[5]!==i||t[6]!==c||t[7]!==s||t[8]!==f||t[9]!==m||t[10]!==o?(g=(0,A.jsx)(u,{id:i,value:o,onChange:s,placeholder:f,labels:c,reveal:m,loadFailedLabel:c.loadFailed,maskedHelp:c.maskedHelp,notInConfigFile:c.notInConfigFile,inputClassName:`text-xs`}),t[5]=i,t[6]=c,t[7]=s,t[8]=f,t[9]=m,t[10]=o,t[11]=g):g=t[11];let _;return t[12]!==h||t[13]!==g?(_=(0,A.jsx)(`div`,{className:h,children:g}),t[12]=h,t[13]=g,t[14]=_):_=t[14],_}function we(e){return e.apiKey??null}export{K as a,G as c,xe as d,F as f,C as h,Y as i,q as l,te as m,Z as n,X as o,P as p,J as r,Q as s,Ce as t,$ as u};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as a}from"./cn-BQ_8x0bT.js";import{d as o,i as s,o as c}from"./locale-store-CiM-D9jA.js";import{o as l}from"./vendor-swr-BIWyz7Rc.js";import{Bo as u,Do as d,Ft as f,It as p,Jo as m,Ls as h,Ra as g,To as _,Yo as v,gc as y,kl as b,tl as ee,wn as x,za as S}from"./index-BJGusbyV.js";var C=`/api/image/providers`;async function te(){return(await s(o(`/api/image/providers`)))?.payload?.providers??[]}var w=e(t(),1),ne=n();function T(){return{apiKey:``,region:``,baseUrl:``,imageBaseUrl:``}}function re(e){return e?.apiKey?`••••••••••••`:``}function E(e,t){let n=(()=>{if(!e||typeof e!=`object`||!(`providersConfig`in e))return;let t=e.providersConfig;if(!(!t||typeof t!=`object`||Array.isArray(t)))return t})(),r={};for(let e of t){let t=n?.[e];r[e]={apiKey:re(t),region:t?.region??``,baseUrl:t?.baseUrl??``,imageBaseUrl:t?.imageBaseUrl??``}}return r}function D(e,t,n){let r=e[n].trim();if(r!==t[n].trim())return r||null}function O(e,t){let n=e.trim(),r=t.trim();if(n!==r&&!(x(n)&&x(r)))return n||(r?null:void 0)}function ie(e,t,n){let r={};for(let i of e){let e=t[i]??T(),a=n[i]??T();if(JSON.stringify(e)===JSON.stringify(a))continue;let o={},s=O(e.apiKey,a.apiKey);s!==void 0&&(o.apiKey=s);let c=D(e,a,`region`);c!==void 0&&(o.region=c);let l=D(e,a,`baseUrl`);l!==void 0&&(o.baseUrl=l);let u=D(e,a,`imageBaseUrl`);u!==void 0&&(o.imageBaseUrl=u),Object.keys(o).length>0&&(r[i]=o)}return r}async function k(e){let t=await s(o(`/api/image/providers/${encodeURIComponent(e)}/reveal-api-key`),{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!t.ok||!t.payload)throw Error(t.error?.message??`Reveal failed`);return t.payload}async function ae(e){Object.keys(e).length!==0&&(await s(o(`/api/config`),{method:`PATCH`,body:JSON.stringify({providersConfig:e})}),await g())}var A=r();function oe(e){let t=(0,ne.c)(18),{providerId:n,value:r,onChange:i,labels:a,apiKeyLinks:o,apiKeyLinkLabels:s}=e,c;t[0]===n?c=t[1]:(c=()=>k(n).then(j),t[0]=n,t[1]=c);let l=c,d=`img-cred-key-${n}`,f;t[2]!==a.apiKeyLabel||t[3]!==d?(f=(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:d,children:a.apiKeyLabel}),t[2]=a.apiKeyLabel,t[3]=d,t[4]=f):f=t[4];let m;t[5]!==s||t[6]!==o?(m=o.length>0?(0,A.jsx)(`div`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,A.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[p(e.kind,s),(0,A.jsx)(ee,{className:`size-3`,"aria-hidden":!0})]},`${e.kind}-${e.href}`))}):null,t[5]=s,t[6]=o,t[7]=m):m=t[7];let h=`img-cred-key-${n}`,g;t[8]!==a||t[9]!==i||t[10]!==l||t[11]!==h||t[12]!==r?(g=(0,A.jsx)(u,{id:h,value:r,onChange:i,placeholder:a.optionalPlaceholder,labels:a,reveal:l,loadFailedLabel:a.loadFailed,maskedHelp:a.maskedHelp,notInConfigFile:a.notInConfigFile}),t[8]=a,t[9]=i,t[10]=l,t[11]=h,t[12]=r,t[13]=g):g=t[13];let _;return t[14]!==f||t[15]!==m||t[16]!==g?(_=(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[f,m,g]}),t[14]=f,t[15]=m,t[16]=g,t[17]=_):_=t[17],_}function j(e){return e.apiKey??null}function M(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,m)}function se(){return a(M(),`appearance-none bg-[length:1rem] bg-[right_0.5rem_center] bg-no-repeat pr-9`)}var N=`__custom__`;function ce(e,t){if(!e.region.trim()&&!e.imageBaseUrl.trim())return``;let n=e.region.trim().toLowerCase();return t.some(e=>e.value===n)?n:N}function le(e,t){let n=e.baseUrl.trim().replace(/\/+$/,``);if(!n)return``;let r=t.map(e=>e.value.replace(/\/+$/,``)).indexOf(n);return r>=0?t[r].value:N}function ue(e,t,n){return t===`beijing`?e.dashscopeRegion_beijing:t===`singapore`?e.dashscopeRegion_singapore:t===`us`?e.dashscopeRegion_us:n}function de(e,t){return t===`minimax`?e.minimaxClusterLabel:t===`fal`?e.falQueueBaseLabel:e.baseUrlLabel}function fe(e,t){return t===`minimax`?e.minimaxClusterHint:t===`fal`?e.falQueueBaseHint:null}function pe(e,t){return JSON.stringify(e)!==JSON.stringify(t)}function me(e,t){return t===1?e.modelCountOne:e.modelCountMany.replace(`{count}`,String(t))}function P(e){let t=(0,ne.c)(76),{summaries:n,credDraft:r,credBaseline:o,credDirty:s,credSaving:c,credError:l,credSavedFlash:u,credNoopFlash:p,updateCredRow:m,onDiscardCredentials:g,onSaveCredentials:x,extensionIds:S,showExtensionLinks:C,showImageModelsLink:te,hideActions:re,language:E,apiKeyLinkLabels:D,messages:O}=e,ie=re===void 0?!1:re,k;t[0]===n?k=t[1]:(k=n.some(ye),t[0]=n,t[1]=k);let ae=k,j;t[2]===n?j=t[3]:(j=n.some(ve),t[2]=n,t[3]=j);let P=j,[F,be]=(0,w.useState)(_e),[I,L]=(0,w.useState)(ge),R;if(t[4]!==o||t[5]!==r||t[6]!==n){R=new Set;for(let e of n)pe(r[e.id]??T(),o[e.id]??T())&&R.add(e.id);t[4]=o,t[5]=r,t[6]=n,t[7]=R}else R=t[7];let z=R,B;t[8]!==z||t[9]!==I||t[10]!==F?(B=e=>I.has(e)?!1:F.has(e)?!0:z.has(e),t[8]=z,t[9]=I,t[10]=F,t[11]=B):B=t[11];let V=B,H;t[12]===V?H=t[13]:(H=e=>{if(V(e)){L(t=>new Set(t).add(e)),be(t=>{let n=new Set(t);return n.delete(e),n});return}L(t=>{let n=new Set(t);return n.delete(e),n}),be(t=>new Set(t).add(e))},t[12]=V,t[13]=H);let U=H;if(n.length===0)return null;let W;t[14]===O.credentialsIntro?W=t[15]:(W=(0,A.jsx)(`p`,{children:O.credentialsIntro}),t[14]=O.credentialsIntro,t[15]=W);let G;t[16]!==ae||t[17]!==O.regionHint?(G=ae?(0,A.jsx)(`p`,{className:`text-fg-subtle`,children:O.regionHint}):null,t[16]=ae,t[17]=O.regionHint,t[18]=G):G=t[18];let K;t[19]!==P||t[20]!==O.endpointPresetsHint?(K=P?(0,A.jsx)(`p`,{className:`text-fg-subtle`,children:O.endpointPresetsHint}):null,t[19]=P,t[20]=O.endpointPresetsHint,t[21]=K):K=t[21];let q;t[22]!==te||t[23]!==O.imageModelsLinkTitle||t[24]!==O.openImageModelsPage?(q=te?(0,A.jsx)(`p`,{children:(0,A.jsx)(i,{to:`/settings/credentials?tab=image-models`,className:`font-medium text-accent hover:underline`,title:O.imageModelsLinkTitle,children:O.openImageModelsPage})}):null,t[22]=te,t[23]=O.imageModelsLinkTitle,t[24]=O.openImageModelsPage,t[25]=q):q=t[25];let J;t[26]!==W||t[27]!==G||t[28]!==K||t[29]!==q?(J=(0,A.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs leading-relaxed text-fg-muted`,children:[W,G,K,q]}),t[26]=W,t[27]=G,t[28]=K,t[29]=q,t[30]=J):J=t[30];let Y;t[31]===l?Y=t[32]:(Y=l?(0,A.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:l}):null,t[31]=l,t[32]=Y);let X;t[33]!==s||t[34]!==p||t[35]!==u||t[36]!==c||t[37]!==ie||t[38]!==g||t[39]!==x||t[40]!==O.credentialsNothingToSave||t[41]!==O.credentialsSaved||t[42]!==O.discardCredentials||t[43]!==O.saveCredentials||t[44]!==O.savingCredentials?(X=ie?null:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[u?(0,A.jsx)(`span`,{className:`text-sm text-fg-muted`,children:O.credentialsSaved}):null,p?(0,A.jsx)(`span`,{className:`text-sm text-fg-muted`,children:O.credentialsNothingToSave}):null,(0,A.jsx)(v,{type:`button`,variant:`secondary`,onClick:g,disabled:!s||c,children:O.discardCredentials}),(0,A.jsx)(v,{type:`button`,variant:`primary`,onClick:x,disabled:!s||c,children:c?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(y,{className:`size-3.5 animate-spin`}),(0,A.jsx)(`span`,{className:`ml-1.5`,children:O.savingCredentials})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(h,{className:`size-3.5`}),(0,A.jsx)(`span`,{className:`ml-1.5`,children:O.saveCredentials})]})})]}),t[33]=s,t[34]=p,t[35]=u,t[36]=c,t[37]=ie,t[38]=g,t[39]=x,t[40]=O.credentialsNothingToSave,t[41]=O.credentialsSaved,t[42]=O.discardCredentials,t[43]=O.saveCredentials,t[44]=O.savingCredentials,t[45]=X):X=t[45];let Z;if(t[46]!==D||t[47]!==o||t[48]!==r||t[49]!==S||t[50]!==V||t[51]!==E||t[52]!==C||t[53]!==n||t[54]!==O||t[55]!==U||t[56]!==m){let e;t[58]!==D||t[59]!==o||t[60]!==r||t[61]!==S||t[62]!==V||t[63]!==E||t[64]!==C||t[65]!==O||t[66]!==U||t[67]!==m?(e=e=>{let t=r[e.id]??T(),n=e.ui,s=C&&S.has(e.id)?`/settings/ext/${encodeURIComponent(e.id)}`:null,c=pe(t,o[e.id]??T()),l=V(e.id),u=e.label??e.id,p=me(O,e.models.length);return(0,A.jsxs)(`section`,{className:a(`overflow-hidden rounded-xl bg-surface-panel/80 shadow-surface transition-colors`,c&&`ring-1 ring-accent/50`),children:[(0,A.jsxs)(`button`,{type:`button`,className:`flex w-full items-start justify-between gap-3 px-4 py-3 text-left hover:bg-surface-hover/70`,"aria-expanded":l,"aria-controls":`img-provider-credentials-${e.id}`,onClick:()=>U(e.id),children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`truncate text-sm font-semibold text-fg`,children:u}),(0,A.jsx)(`span`,{className:`rounded-full bg-surface-subtle px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.id}),c?(0,A.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:O.unsavedChanges}):null,e.configured?(0,A.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:O.configured}):(0,A.jsx)(`span`,{className:`rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-[11px] font-medium text-amber-700 dark:text-amber-300`,children:O.missingKey})]}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[(0,A.jsx)(`span`,{children:p}),e.defaultModel?(0,A.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,A.jsxs)(`span`,{className:`text-fg-muted`,children:[O.defaultModel,`:`]}),` `,e.id,`/`,e.defaultModel]}):null]})]}),(0,A.jsx)(b,{className:a(`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform`,l?`rotate-180`:`rotate-0`),"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`sr-only`,children:l?O.collapseProvider:O.expandProvider})]}),l?(0,A.jsxs)(`div`,{id:`img-provider-credentials-${e.id}`,className:`bg-surface-base/45 px-4 py-4`,children:[s?(0,A.jsxs)(i,{to:s,className:`mb-3 inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,title:O.extensionSettingsLinkTitle,children:[(0,A.jsx)(ee,{className:`size-3`}),O.openExtensionSettings]}):null,e.models.length>0?(0,A.jsxs)(`p`,{className:`mb-3 text-xs leading-relaxed text-fg-subtle`,children:[(0,A.jsxs)(`span`,{className:`text-fg-muted`,children:[O.modelsLabel,`:`]}),` `,e.models.map(t=>`${e.id}/${t}`).join(`, `)]}):null,(0,A.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,A.jsx)(oe,{providerId:e.id,value:t.apiKey,onChange:t=>m(e.id,{apiKey:t}),apiKeyLinks:f(e.id,E),apiKeyLinkLabels:D,labels:{apiKeyLabel:O.apiKeyLabel,optionalPlaceholder:O.optionalPlaceholder,maskedHelp:O.apiKeyMaskedHelp,copy:O.apiKeyCopy,copied:O.apiKeyCopied,show:O.apiKeyShow,hide:O.apiKeyHide,notInConfigFile:O.apiKeyNotInConfigFile,loadFailed:O.apiKeyRevealFailed}}),n?.regions?.length?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`img-cred-region-preset-${e.id}`,children:O.regionLabel}),(0,A.jsxs)(_,{id:`img-cred-region-preset-${e.id}`,className:se(),value:ce(t,n.regions),onChange:t=>{let r=t.target.value;if(r===``){m(e.id,{region:``,imageBaseUrl:``});return}if(r===N){m(e.id,{region:``,imageBaseUrl:``});return}let i=n.regions.find(e=>e.value===r);i&&m(e.id,{region:i.value,imageBaseUrl:i.imageBaseUrl})},children:[(0,A.jsx)(d,{value:``,children:O.regionPresetDefault}),n.regions.map(e=>(0,A.jsx)(d,{value:e.value,children:ue(O,e.value,e.label)},e.value)),(0,A.jsx)(d,{value:N,children:O.regionPresetCustom})]}),ce(t,n.regions)===N?(0,A.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[(0,A.jsx)(`input`,{type:`text`,className:M(),value:t.region,placeholder:`region`,onChange:t=>m(e.id,{region:t.target.value})}),(0,A.jsx)(`input`,{type:`url`,className:M(),value:t.imageBaseUrl,placeholder:O.imageBaseUrlLabel,onChange:t=>m(e.id,{imageBaseUrl:t.target.value})})]}):null]}):null,n?.baseUrlPresets?.length?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`img-cred-base-preset-${e.id}`,children:de(O,n.baseUrlPresetKind)}),fe(O,n.baseUrlPresetKind)?(0,A.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:fe(O,n.baseUrlPresetKind)}):null,(0,A.jsxs)(_,{id:`img-cred-base-preset-${e.id}`,className:se(),value:le(t,n.baseUrlPresets),onChange:t=>{let n=t.target.value;if(n===``){m(e.id,{baseUrl:``});return}if(n===N){m(e.id,{baseUrl:``});return}m(e.id,{baseUrl:n.replace(/\/+$/,``)})},children:[(0,A.jsx)(d,{value:``,children:O.baseUrlPresetDefault}),n.baseUrlPresets.map(he),(0,A.jsx)(d,{value:N,children:O.baseUrlPresetCustom})]}),le(t,n.baseUrlPresets)===N?(0,A.jsx)(`input`,{type:`url`,className:a(M(),`mt-2`),value:t.baseUrl,placeholder:`https://…`,onChange:t=>m(e.id,{baseUrl:t.target.value})}):null]}):null,n?.regions?.length&&ce(t,n.regions)!==N?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`img-cred-imgbase-ro-${e.id}`,children:O.imageBaseUrlLabel}),(0,A.jsx)(`input`,{id:`img-cred-imgbase-ro-${e.id}`,type:`url`,readOnly:!0,className:a(M(),`cursor-not-allowed opacity-90`),value:t.imageBaseUrl,title:O.imageBaseUrlPresetHint}),(0,A.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:O.imageBaseUrlPresetHint})]}):null]})]}):null]},e.id)},t[58]=D,t[59]=o,t[60]=r,t[61]=S,t[62]=V,t[63]=E,t[64]=C,t[65]=O,t[66]=U,t[67]=m,t[68]=e):e=t[68],Z=n.map(e),t[46]=D,t[47]=o,t[48]=r,t[49]=S,t[50]=V,t[51]=E,t[52]=C,t[53]=n,t[54]=O,t[55]=U,t[56]=m,t[57]=Z}else Z=t[57];let Q;t[69]===Z?Q=t[70]:(Q=(0,A.jsx)(`div`,{className:`flex flex-col gap-4`,children:Z}),t[69]=Z,t[70]=Q);let $;return t[71]!==J||t[72]!==Y||t[73]!==X||t[74]!==Q?($=(0,A.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[J,Y,X,Q]}),t[71]=J,t[72]=Y,t[73]=X,t[74]=Q,t[75]=$):$=t[75],$}function he(e){return(0,A.jsx)(d,{value:e.value,children:e.label},e.value)}function ge(){return new Set}function _e(){return new Set}function ve(e){return(e.ui?.baseUrlPresets?.length??0)>0}function ye(e){return(e.ui?.regions?.length??0)>0}function F(e){let t=S(c(e=>!!e.token)),n=t.data,r=(0,w.useMemo)(()=>e.map(e=>e.id),[e]),i=(0,w.useRef)(!1),[a,s]=(0,w.useState)(null),[u,d]=(0,w.useState)(!1),[f,p]=(0,w.useState)(null),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),v=(0,w.useMemo)(()=>E(n?.payload?.config,r),[n?.payload?.config,r]),y=a??v,b=v;return{gwSwr:t,credDraft:y,credBaseline:b,credDirty:(0,w.useMemo)(()=>JSON.stringify(y)!==JSON.stringify(b),[y,b]),credSaving:u,credError:f,credSavedFlash:m,credNoopFlash:g,updateCredRow:(0,w.useCallback)((e,t)=>{i.current=!0,s(n=>{let r=n??v,i=r[e]??T();return{...r,[e]:{...i,...t}}})},[v]),onDiscardCredentials:(0,w.useCallback)(()=>{i.current=!1,s(null),p(null),h(!1),_(!1)},[]),saveCredentials:(0,w.useCallback)(async e=>{let n=ie(r,y,b);if(Object.keys(n).length===0){_(!0),window.setTimeout(()=>_(!1),2200);return}d(!0),p(null),h(!1);try{await ae(n),await t.mutate?.(),l(o(C)),i.current=!1,s(null),h(!0),window.setTimeout(()=>h(!1),2e3)}catch(t){p(t instanceof Error?t.message:e)}finally{d(!1)}},[r,y,b,t])}}function be(){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 I(){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 L(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function R(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function z(e,t,n){let r=L(e.providers)?e.providers:void 0,i=r&&L(r[t])?r[t]:void 0;return{...n,...i??{}}}function B(e){let t=be();if(!L(e))return t;let n=R(e.provider),r=z(e,`alibaba`,t.alibaba??{}),i=z(e,`openai`,t.openai??{}),a=t.fallback??{enabled:!1,order:[`xopc-local`]};if(L(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=L(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,L(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,alibaba:r,openai:i,...o?{providers:o}:{},fallback:a}}function V(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function H(e){let t=I();if(!L(e))return t;let n=V(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i=t[`tts-local-cli`]??{},a=L(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,L(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:z(e,`alibaba`,t.alibaba??{}),openai:z(e,`openai`,t.openai??{}),edge:z(e,`edge`,t.edge??{}),minimax:z(e,`minimax`,t.minimax??{}),"tts-local-cli":z(e,`tts-local-cli`,i)}}function U(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 W(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 G(e){let t=L(e)?e:{},n=L(t.voice)?t.voice:{},r=L(n.input)?n.input:{},i=L(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:B(t.stt),tts:H(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 K(){return G((await s(o(`/api/config`))).payload?.config??{})}async function q(e){await s(o(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:U(e.stt),tts:W(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await s(o(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),g()}async function J(){let e=await s(o(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function Y(){let e=await s(o(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function X(){let e=await s(o(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function Z(){let e=await s(o(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function Q(e){await s(o(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function $(e){await s(o(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function xe(e){let t=await s(o(`/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 Se(e){let t=await s(o(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}function Ce(e){let t=(0,ne.c)(15),{kind:n,providerId:r,fieldId:i,value:o,onChange:s,labels:c,placeholder:l,className:d}=e,f=l===void 0?`sk-...`:l,p;t[0]!==n||t[1]!==r?(p=()=>Se({kind:n,provider:r}).then(we),t[0]=n,t[1]=r,t[2]=p):p=t[2];let m=p,h;t[3]===d?h=t[4]:(h=a(`flex min-w-0 flex-col gap-1.5`,d),t[3]=d,t[4]=h);let g;t[5]!==i||t[6]!==c||t[7]!==s||t[8]!==f||t[9]!==m||t[10]!==o?(g=(0,A.jsx)(u,{id:i,value:o,onChange:s,placeholder:f,labels:c,reveal:m,loadFailedLabel:c.loadFailed,maskedHelp:c.maskedHelp,notInConfigFile:c.notInConfigFile,inputClassName:`text-xs`}),t[5]=i,t[6]=c,t[7]=s,t[8]=f,t[9]=m,t[10]=o,t[11]=g):g=t[11];let _;return t[12]!==h||t[13]!==g?(_=(0,A.jsx)(`div`,{className:h,children:g}),t[12]=h,t[13]=g,t[14]=_):_=t[14],_}function we(e){return e.apiKey??null}export{K as a,G as c,xe as d,F as f,C as h,Y as i,q as l,te as m,Z as n,X as o,P as p,J as r,Q as s,Ce as t,$ as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as s}from"./cn-BQ_8x0bT.js";import{t as c}from"./messages-Cb1VMeqP.js";import{n as l}from"./locale-store-CiM-D9jA.js";import{Bs as u,Do as d,Ml as f,Tl as ee,To as te,Ul as p,Vs as ne,Wc as m,Yo as h,Zc as g,a as re,f as ie,fc as _,il as ae,l as oe,lo as v,m as se,ms as y,mt as ce,nc as le,o as ue,p as de,qs as b,s as fe,tl as pe,u as x,us as me,va as S}from"./index-I-ZCenVw.js";var C=n(),w=e(t(),1),T=r();function he(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?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):``}function ge(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 _e(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 ve(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 ye(e,t,n){return[...n].sort((n,r)=>k(e,t,r)-k(e,t,n)||n.title.localeCompare(r.title))}function A(){let{workItemId:e=``}=o(),t=i(),n=c(l(e=>e.language)).projectDetailPage.workItems,[r,C]=(0,w.useState)(null),[O,A]=(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=v(e=>e.setPageHeader),K=v(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([oe(e),x(e).catch(()=>({events:[]}))]);C(t.item),L(t.item.nextAction||t.item.title),M(n.events);let[r,i]=await Promise.all([S(t.item.projectId).catch(()=>null),ce().catch(()=>[])]),a=ye(t.item,r,i);A(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 ie(r.id);C(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 re(r.id);C(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 x(e).catch(()=>({events:[]}))).events)},[]),xe=(0,w.useCallback)(async()=>{if(!(!r||!P)){V(!0),U(null);try{let e=await de(r.id,{definitionId:P,goal:I.trim()||r.nextAction||r.title});C(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 se(r.id,e);C(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 ue(r.id,e.id);C(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 fe(r.id,e)}catch(e){U(e instanceof Error?e.message:String(e))}}},[r]),Q=(0,w.useMemo)(()=>r?N.filter(e=>k(r,O,e)>0).slice(0,3):[],[r,O,N]),$=(0,w.useMemo)(()=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void J(),children:[(0,T.jsx)(ne,{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)(h,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.startChat})]}),(0,T.jsxs)(h,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(y,{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)(a,{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":O?.name?n.detail.backToProject.replace(`{{name}}`,O.name):n.detail.backToProjects,children:(0,T.jsx)(p,{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)(f,{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],` · `,O?.name||r.projectId,` · `,n.updated,`: `,E(r.updatedAt)]}):null]}),end:$}),()=>K()),[K,$,r,R,O?.name,q,G,n,O]),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)(a,{to:`/projects`,className:`inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,T.jsx)(p,{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 px-4 py-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)(f,{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`,he(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)(h,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startChat]}),(0,T.jsxs)(h,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(y,{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)(g,{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)(ve,{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)(m,{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)(te,{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)(d,{value:``,children:n.detail.noWorkflowTemplates}):null,N.map(e=>(0,T.jsx)(d,{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 px-2 py-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)(h,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3 text-xs`,disabled:B||!P,onClick:xe,children:[(0,T.jsx)(u,{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)(le,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`truncate`,children:n.attachments.title})]}),(0,T.jsxs)(h,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:()=>W.current?.click(),children:[(0,T.jsx)(b,{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 px-2 py-2 text-sm`,children:[(0,T.jsx)(g,{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,` · `,ge(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)(ae,{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)(me,{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)(a,{to:_e(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)(pe,{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)(a,{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)(ee,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:O?.name||r.projectId})]})]})]})]})]})}export{A as WorkItemDetailPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as s}from"./cn-BQ_8x0bT.js";import{t as c}from"./messages-Cb1VMeqP.js";import{n as l}from"./locale-store-CiM-D9jA.js";import{Bs as u,Do as d,Ml as f,Tl as ee,To as te,Ul as p,Vs as ne,Wc as m,Yo as h,Zc as g,a as re,f as ie,fc as _,il as ae,l as oe,lo as v,m as se,ms as y,mt as ce,nc as le,o as ue,p as de,qs as b,s as fe,tl as pe,u as x,us as me,va as S}from"./index-BJGusbyV.js";var C=n(),w=e(t(),1),T=r();function he(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?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):``}function ge(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 _e(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 ve(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 ye(e,t,n){return[...n].sort((n,r)=>k(e,t,r)-k(e,t,n)||n.title.localeCompare(r.title))}function A(){let{workItemId:e=``}=o(),t=i(),n=c(l(e=>e.language)).projectDetailPage.workItems,[r,C]=(0,w.useState)(null),[O,A]=(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=v(e=>e.setPageHeader),K=v(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([oe(e),x(e).catch(()=>({events:[]}))]);C(t.item),L(t.item.nextAction||t.item.title),M(n.events);let[r,i]=await Promise.all([S(t.item.projectId).catch(()=>null),ce().catch(()=>[])]),a=ye(t.item,r,i);A(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 ie(r.id);C(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 re(r.id);C(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 x(e).catch(()=>({events:[]}))).events)},[]),xe=(0,w.useCallback)(async()=>{if(!(!r||!P)){V(!0),U(null);try{let e=await de(r.id,{definitionId:P,goal:I.trim()||r.nextAction||r.title});C(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 se(r.id,e);C(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 ue(r.id,e.id);C(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 fe(r.id,e)}catch(e){U(e instanceof Error?e.message:String(e))}}},[r]),Q=(0,w.useMemo)(()=>r?N.filter(e=>k(r,O,e)>0).slice(0,3):[],[r,O,N]),$=(0,w.useMemo)(()=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void J(),children:[(0,T.jsx)(ne,{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)(h,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.startChat})]}),(0,T.jsxs)(h,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(y,{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)(a,{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":O?.name?n.detail.backToProject.replace(`{{name}}`,O.name):n.detail.backToProjects,children:(0,T.jsx)(p,{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)(f,{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],` · `,O?.name||r.projectId,` · `,n.updated,`: `,E(r.updatedAt)]}):null]}),end:$}),()=>K()),[K,$,r,R,O?.name,q,G,n,O]),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)(a,{to:`/projects`,className:`inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,T.jsx)(p,{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 px-4 py-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)(f,{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`,he(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)(h,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startChat]}),(0,T.jsxs)(h,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(y,{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)(g,{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)(ve,{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)(m,{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)(te,{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)(d,{value:``,children:n.detail.noWorkflowTemplates}):null,N.map(e=>(0,T.jsx)(d,{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 px-2 py-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)(h,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3 text-xs`,disabled:B||!P,onClick:xe,children:[(0,T.jsx)(u,{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)(le,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`truncate`,children:n.attachments.title})]}),(0,T.jsxs)(h,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:()=>W.current?.click(),children:[(0,T.jsx)(b,{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 px-2 py-2 text-sm`,children:[(0,T.jsx)(g,{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,` · `,ge(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)(ae,{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)(me,{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)(a,{to:_e(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)(pe,{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)(a,{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)(ee,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:O?.name||r.projectId})]})]})]})]})]})}export{A as WorkItemDetailPage};
|