@xopcai/xopc 0.0.220 → 0.0.221
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-DeKZ36Jy.js → activity-store-NItGQmvR.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D0hZfdkn.js → agent-avatar-dicebear-B8SBTGg3.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-Bu0NfWuh.js → agents-Brs2-m6t.js} +1 -1
- package/dist/gateway/static/root/assets/{api-yLnYUedB.js → api-53ZXsuyr.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-C2kZNEHz.js → app-management-settings-panel-BtmPXaqu.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DQ7H35sN.js → appearance-settings-t7HoJyNN.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Tty2xaUG.js → apps-page-DJ_Dsb1j.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CBArbTPH.js → archive-plugin-D8o8CP9Y.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-oc6DRj4G.js → attachment-load-CsLXzas8.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CHPEUpz8.js → automations-page-D-zgoAKz.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-9uYkHmdI.js → automations-workspace-DehLRXfd.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-BRBd0X7_.js → binary-plugins-B-MjP_22.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-ZgM-Z4Qv.js → block-editor-i4CfDqLG.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-BT3mEm00.js → browser-settings-page-C3QIO4Ti.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-DxD74a4c.js → browser-workflow-inputs-Bi6RSSpD.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-Dpc7NqZf.js → browser-workflows-page-EEFHUm1i.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-DHlfRj4M.js → capabilities-settings-panel-BHhUp7FW.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-B9ID97j6.js → capability-presets-api-pC2fno7r.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-D2FkREUX.js → capability-presets-settings-panel-DoClNVLz.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-DCNn6MWL.js → channel-recipient-api-B5Szgu_z.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-D4YcKMtf.js → channels-settings-Je-9a5ZC.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-ByRbxC6z.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-MvNpjcUs.js → chat-terminal-dock-DT-OFl4r.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-Bd6K9bDk.js → connectors-page-D8z9Trw4.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-BSXX9uY0.js → cron-expression-MZ_AJqrm.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-CiHNkkIS.js → date-picker-Bv9hZLuD.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DQyh2ZXE.js → dependency-picker-D-6oO_Vk.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DnAHU-zA.js → desktop-pet-CiI5caKj.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DUdhIBBB.js → desktop-pet-settings-DhkSOy4K.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-B3gFQt8x.js → directory-picker-path-field-C4s4Pz8I.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-Lq-gRApw.js → extension-debug-page-DE7J1-6W.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D0ROxJmY.js → extension-page-DSnACD7E.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-B2tS6mFy.js → extension-settings-page-Dk7k2Pok.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DJqWfVi6.js → gateway-config-api-IOA1OlHx.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-CnwF9Vso.js → gateway-config-swr-BzTbnu4O.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-B3thenPX.js → gateway-settings-FX7QsgSQ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DdJJZR8M.js → gateway-startup-retry-B2zpkNvi.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-C_g-ZGSE.js → heartbeat-settings-D5CGVyci.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-Cgwx66kc.js → home-page-DzfZFZx5.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-Dtt9M5qz.js → image-generation-api-BXRjz-iY.js} +1 -1
- package/dist/gateway/static/root/assets/{index-Cf0qTkBK.css → index-Dcj5KJRg.css} +1 -1
- package/dist/gateway/static/root/assets/{index-V9g9-SWT.js → index-EvA8c7fo.js} +11 -45
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-cJqkmQdP.js → keyboard-shortcuts-settings-BjYiM4xq.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CmjLMdly.js → local-app-workbench-page-hPyTaVYU.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BiuP2pkl.js → local-apps-page-7DHvwSgA.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-D3Q2yEAb.js → locale-store-iKjqemWG.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BTlxGPho.js → logs-page-DW0xMKWP.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-Z1gJUwP_.js → management-settings-BSxppo9Z.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-DuOmpGgE.js → markdown-split-D4oDjZtl.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-WYArkdrc.js → markdown-view-DYkxMtJA.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DKPh3Mud.js → media-plugins-BPNTGROA.js} +1 -1
- package/dist/gateway/static/root/assets/messages-kx5W39dO.js +3 -0
- package/dist/gateway/static/root/assets/{notes-api-DMEon7Zv.js → notes-api-DJizatxh.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BG4gV8WG.js → notes-page-DU5tKPTq.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-D3LMBO2X.js → notes-workbench-D669d98r.js} +2 -2
- package/dist/gateway/static/root/assets/pcm-capture-worklet-uW_SEACy.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-BjJf4QOB.js → product-open-page-CPoQvD6P.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-C59tYJG-.js → project-detail-page-CpsQ9PTA.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-Di7W-Fg8.js → projects-page-CitO1LMc.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-DRyvynb5.js → registry-api-Cx3JxXSL.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BYOKveWT.js → remote-access-hub-C9-bL4V6.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DC6t_-db.js → runtime-tools-settings-panel-xqnWcvIv.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DSTWtpjp.js → schema-form-CuIDPYu6.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-CJMNQsxK.js → sessions-page-CPSARi4y.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BxT80Fmr.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-ZzEMNLYS.js → settings-form-section-DkAv9ncE.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-D7-bkbcW.js → settings-loading-skeleton-BJUQiEKb.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-PaTpLbmi.js → settings-page-KHRbLwmw.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-Bnpim6NY.js → setup-status-panel-C8jd20Db.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Cxcw0ksa.js → share-preview-page-WCVtJ3sX.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DBqmV7ZY.js → shares-settings-DrQ_cOXh.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-C_4cG30x.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-Dby4iAYe.js → skills-page-CKhR9J81.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-nlzJ5Y1V.js → skills-page.utils-AYX-e5sD.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-vOsgnzDl.js → system-settings-panel-IIF-K9ML.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-CRy8Wl5g.js → task-detail-page-CYjsecEr.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-CvnEHGyP.js → theme-store-BOD2D0dJ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BTNZHulv.js → use-autosave-DcktF1j1.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-BT8F4mh5.js → user-context-page-Cy1D2hkt.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-DDJ2-3Tx.js → voice-api-key-field-BMkNTHHE.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DV_qiKSD.js → work-discovery-overlay-DVoiXekA.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel--AcvRw1w.js → workflow-run-setup-panel-Cw4LQjuM.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-CwvskVvU.js → workflows-page-DKKH1_Yt.js} +1 -1
- package/dist/gateway/static/root/index.html +11 -11
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +3 -3
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service.js +3 -3
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/channels-status-swr-B8XWrzKM.js +0 -1
- package/dist/gateway/static/root/assets/messages-BQHpB4VI.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-FJxZw08y.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-UgLQaWoz.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i,t as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as o}from"./check-DUBLcKHA.js";import{n as s,r as c}from"./popover-select-BzdnTy3h.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./external-link-DjqjBmc3.js";import{t as d}from"./eye-off-DEAzt3g1.js";import{t as f}from"./eye-CABVeTq0.js";import{t as p}from"./loader-circle-CifKLtgG.js";import{t as m}from"./plus-Q2yW6OE7.js";import{t as h}from"./x-B_N4OPjy.js";import{t as g}from"./button-CSEbl4zT.js";import{n as _}from"./locale-store-D3Q2yEAb.js";import{a as v,i as y,n as b,o as x,r as S,s as C,t as w}from"./dist-BPoKqzeH.js";import{i as T}from"./vendor-swr-BIWyz7Rc.js";import{As as E,Co as D,Dl as O,Do as k,Dt as A,Eo as j,Fs as M,Gl as N,Ml as P,Nl as F,Ol as I,Oo as L,Ot as R,Rs as z,So as B,To as V,Wc as H,Ya as U,_o as W,bo as G,bs as K,cc as ee,fo as q,gc as te,go as ne,gs as re,ho as ie,ko as ae,lc as J,ls as oe,mo as se,ol as ce,po as le,tc as Y,uo as X,us as ue,vo as de,wo as fe,wt as pe,xo as me,yl as he,yo as ge,zc as _e}from"./index-V9g9-SWT.js";import{n as ve,t as ye}from"./use-autosave-BTNZHulv.js";import{t as be}from"./tab-completion-input-D64VNmiA.js";import{t as xe}from"./page-tabs-BaEQMYm_.js";var Z=e(t(),1),Q=n(),Se=new Set([`candidate`,`needs_review`,`stale`]),Ce=new Set([`archived`,`rejected`]),we=new Set([`preference`,`boundary`,`relationship`,`routine`,`current_state`,`long_term_goal`]),Te=new Set([`and`,`are`,`for`,`from`,`into`,`that`,`the`,`this`,`with`,`you`,`your`]);function Ee(e,t){return t.updatedAt-e.updatedAt}function De(e,t){return{currentFocuses:e.filter(e=>e.status===`active`).sort(Ee),activeUnderstandings:t.filter(e=>e.status===`active`).sort(Ee),reviewQueue:[...e.filter(e=>e.status===`candidate`).map(e=>({type:`focus`,id:e.id,updatedAt:e.updatedAt,focus:e})),...t.filter(e=>Se.has(e.status)).map(e=>({type:`understanding`,id:e.id,updatedAt:e.updatedAt,understanding:e}))].sort(Ee),history:[...e.filter(e=>e.status===`paused`||e.status===`completed`||e.status===`rejected`).map(e=>({type:`focus`,id:e.id,updatedAt:e.updatedAt,focus:e})),...t.filter(e=>Ce.has(e.status)).map(e=>({type:`understanding`,id:e.id,updatedAt:e.updatedAt,understanding:e}))].sort(Ee),timeline:[...e.map(e=>({type:`focus`,id:e.id,updatedAt:e.updatedAt,focus:e})),...t.map(e=>({type:`understanding`,id:e.id,updatedAt:e.updatedAt,understanding:e}))].sort(Ee)}}function Oe(e){let t=new Set,n=e.toLocaleLowerCase().match(/[\p{Script=Han}]+|[\p{L}\p{N}]+/gu)??[];for(let e of n){if(/^\p{Script=Han}+$/u.test(e)){e.length===1&&t.add(e);for(let n=0;n<e.length-1;n+=1)t.add(e.slice(n,n+2));continue}e.length>=3&&!Te.has(e)&&t.add(e)}return t}function ke(e,t){let n=Oe(e),r=Oe(t);if(!n.size||!r.size)return 0;let i=0;for(let e of n)r.has(e)&&(i+=1);return i/Math.min(n.size,r.size)}function Ae(e,t,n=6){let r=`${e.title} ${e.summary}`;return t.filter(e=>[`active`,`candidate`,`needs_review`,`stale`].includes(e.status)).map(t=>{let n=[],i=0;e.scope.type===`project`&&t.scope.type===`project`&&t.scope.id===e.scope.id&&(n.push(`project_scope`),i+=.75);let a=ke(r,t.statement);return a>=.12&&(n.push(`topic_overlap`),i+=Math.min(.65,.18+a*.55)),t.status===`active`&&t.scope.type===`global`&&we.has(t.kind)&&(n.push(`global_context`),i+=.16),n.length?{understanding:t,reasons:n,score:Math.min(1,i)}:null}).filter(e=>e!==null).sort((e,t)=>t.score-e.score||t.understanding.updatedAt-e.understanding.updatedAt).slice(0,Math.max(0,n))}var je={preference:{en:`Preference`,zh:`偏好`},boundary:{en:`Boundary`,zh:`边界`},relationship:{en:`Relationship`,zh:`关系`},routine:{en:`Routine`,zh:`习惯`},current_state:{en:`Current state`,zh:`当前状态`},long_term_goal:{en:`Long-term goal`,zh:`长期目标`},project_context:{en:`Project context`,zh:`项目背景`},task_lesson:{en:`Task lesson`,zh:`任务经验`},derived_insight:{en:`Insight`,zh:`洞察`}},$=r(),Me=[{x:15,y:17},{x:14,y:51},{x:19,y:83},{x:85,y:17},{x:86,y:51},{x:81,y:83}],Ne={en:{focus:`Focus`,selectFocus:`Focus in view`,you:`You`,active:`Active`,pending:`Needs review`,hint:`A local map around one focus — enough context to explain xopc’s help, without turning your portrait into a database.`,confirmed:`Confirmed`,possible:`Possible`,weak:`Show weak signals`,hideWeak:`Hide weak signals`,noFocus:`Confirm a focus first, then xopc can show the context that affects it.`,noRelations:`No relationship is strong enough to show yet.`,why:`Why this relationship is shown`,project_scope:`Both belong to the same project.`,topic_overlap:`They share a meaningful topic signal.`,global_context:`This confirmed context may shape work across projects.`,projectEdge:`same project`,topicEdge:`shared topic`,contextEdge:`shapes work`,edit:`Edit`,pause:`Pause`,complete:`Complete`,incorrect:`Not true`,archive:`Move to history`,save:`Save`,cancel:`Cancel`,review:`Review this suggestion`,explicit:`You said this directly`,observed:`Observed across work`,inferred:`Inferred — may be wrong`,relatedCount:`relationships`},zh:{focus:`当前关注`,selectFocus:`图中关注`,you:`你`,active:`进行中`,pending:`待确认`,hint:`只围绕一个当前重点展开局部关系:足以解释 xopc 为什么这样帮助你,又不会把画像变成数据库。`,confirmed:`已确认`,possible:`可能关联`,weak:`显示弱信号`,hideWeak:`隐藏弱信号`,noFocus:`先确认一项关注,xopc 才能展示会影响它的上下文。`,noRelations:`目前还没有足够明确的关系。`,why:`为什么展示这条关系`,project_scope:`它们属于同一个项目。`,topic_overlap:`它们共享了有意义的主题信号。`,global_context:`这条已确认的上下文可能影响不同项目中的工作。`,projectEdge:`同一项目`,topicEdge:`主题相关`,contextEdge:`影响工作方式`,edit:`编辑`,pause:`暂停`,complete:`完成`,incorrect:`不正确`,archive:`移入历史`,save:`保存`,cancel:`取消`,review:`去确认这条建议`,explicit:`由你直接告知`,observed:`从过往工作中观察到`,inferred:`推断内容,可能有误`,relatedCount:`条关系`}},Pe=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent/60 focus:ring-2 focus:ring-accent/20`;function Fe(e){let t=(0,Q.c)(128),{focuses:n,understandings:r,language:i,onRefresh:a,onOpenReview:o}=e,c=Ne[i],[l,u]=(0,Z.useState)(n[0]?.id??``),p;t[0]!==l||t[1]!==n?(p=n.find(e=>e.id===l)??n[0],t[0]=l,t[1]=n,t[2]=p):p=t[2];let m=p,h;t[3]!==m||t[4]!==r?(h=m?Ae(m,r):[],t[3]=m,t[4]=r,t[5]=h):h=t[5];let g=h,[_,v]=(0,Z.useState)(!1),y;t[6]!==g||t[7]!==_?(y=_?g:g.filter(ze),t[6]=g,t[7]=_,t[8]=y):y=t[8];let b=y,[x,S]=(0,Z.useState)(null),C;t[9]!==b||t[10]!==x?(C=b.find(e=>e.understanding.id===x)??null,t[9]=b,t[10]=x,t[11]=C):C=t[11];let w=C,T,E;t[12]!==m||t[13]!==l?(T=()=>{!m||m.id===l||u(m.id)},E=[m,l],t[12]=m,t[13]=l,t[14]=T,t[15]=E):(T=t[14],E=t[15]),(0,Z.useEffect)(T,E);let D,O;if(t[16]!==b||t[17]!==x?(D=()=>{x&&!b.some(e=>e.understanding.id===x)&&S(null)},O=[b,x],t[16]=b,t[17]=x,t[18]=D,t[19]=O):(D=t[18],O=t[19]),(0,Z.useEffect)(D,O),!m){let e;return t[20]===c.noFocus?e=t[21]:(e=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-16 text-center text-sm text-fg-muted`,children:c.noFocus}),t[20]=c.noFocus,t[21]=e),e}let k;t[22]===c.hint?k=t[23]:(k=(0,$.jsx)(`p`,{className:`max-w-2xl text-xs leading-5 text-fg-muted`,children:c.hint}),t[22]=c.hint,t[23]=k);let A;t[24]!==m.id||t[25]!==n||t[26]!==c.selectFocus?(A=n.length>1?(0,$.jsxs)(`label`,{className:`flex shrink-0 items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:c.selectFocus}),(0,$.jsx)(s,{value:m.id,onChange:e=>{u(e.target.value),S(null)},triggerClassName:`min-w-44 bg-surface-base`,children:n.map(Re)})]}):null,t[24]=m.id,t[25]=n,t[26]=c.selectFocus,t[27]=A):A=t[27];let j;t[28]!==A||t[29]!==k?(j=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[k,A]}),t[28]=A,t[29]=k,t[30]=j):j=t[30];let M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(`span`,{className:`h-px w-5 bg-edge-strong`}),t[31]=M):M=t[31];let N;t[32]===c.confirmed?N=t[33]:(N=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[M,c.confirmed]}),t[32]=c.confirmed,t[33]=N);let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(`span`,{className:`w-5 border-t border-dashed border-warning`}),t[34]=P):P=t[34];let F;t[35]===c.possible?F=t[36]:(F=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[P,c.possible]}),t[35]=c.possible,t[36]=F);let I;t[37]!==g||t[38]!==_||t[39]!==c.hideWeak||t[40]!==c.weak?(I=g.some(Le)?(0,$.jsxs)(`button`,{type:`button`,className:`ml-auto inline-flex items-center gap-1.5 rounded-md text-fg-muted hover:text-accent`,onClick:()=>v(Ie),children:[_?(0,$.jsx)(d,{className:`size-3.5`}):(0,$.jsx)(f,{className:`size-3.5`}),_?c.hideWeak:c.weak]}):null,t[37]=g,t[38]=_,t[39]=c.hideWeak,t[40]=c.weak,t[41]=I):I=t[41];let L;t[42]!==N||t[43]!==F||t[44]!==I?(L=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 text-[11px] text-fg-subtle`,children:[N,F,I]}),t[42]=N,t[43]=F,t[44]=I,t[45]=L):L=t[45];let R;t[46]!==j||t[47]!==L?(R=(0,$.jsxs)(`header`,{className:`flex flex-col gap-3 border-b border-edge px-4 py-3`,children:[j,L]}),t[46]=j,t[47]=L,t[48]=R):R=t[48];let z;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(`div`,{className:`absolute inset-0 opacity-50 [background-image:radial-gradient(var(--color-edge)_0.7px,transparent_0.7px)] [background-size:20px_20px]`,"aria-hidden":`true`}),t[49]=z):z=t[49];let B;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(`line`,{x1:`50`,y1:`13`,x2:`50`,y2:`50`,className:`stroke-edge-strong`,strokeWidth:`0.35`,vectorEffect:`non-scaling-stroke`}),t[50]=B):B=t[50];let V;if(t[51]!==b||t[52]!==x){let e;t[54]===x?e=t[55]:(e=(e,t)=>(0,$.jsx)(`line`,{x1:`50`,y1:`50`,x2:Me[t]?.x??50,y2:Me[t]?.y??50,className:e.understanding.status===`active`?`stroke-edge-strong`:`stroke-warning`,strokeWidth:x===e.understanding.id?`0.55`:`0.3`,strokeDasharray:e.understanding.status===`active`?void 0:`1.4 1.4`,vectorEffect:`non-scaling-stroke`},e.understanding.id),t[54]=x,t[55]=e),V=b.map(e),t[51]=b,t[52]=x,t[53]=V}else V=t[53];let H;t[56]===V?H=t[57]:(H=(0,$.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0 size-full`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[B,V]}),t[56]=V,t[57]=H);let U;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(oe,{className:`size-5`}),t[58]=U):U=t[58];let W;t[59]===c.you?W=t[60]:(W=(0,$.jsxs)(`div`,{className:`absolute left-1/2 top-[13%] z-10 flex size-12 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-accent text-white shadow-surface`,children:[U,(0,$.jsx)(`span`,{className:`sr-only`,children:c.you})]}),t[59]=c.you,t[60]=W);let G;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>S(null),t[61]=G):G=t[61];let ee=`absolute left-1/2 top-1/2 z-10 flex w-44 -translate-x-1/2 -translate-y-1/2 items-center gap-2 rounded-xl border px-3 py-3 text-left text-sm font-medium shadow-surface transition-colors ${w?`border-edge bg-surface-panel hover:bg-surface-hover`:`border-accent bg-accent-soft text-accent-fg ring-2 ring-accent/15`}`,q;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(K,{className:`size-4 shrink-0`}),t[62]=q):q=t[62];let te;t[63]===m.title?te=t[64]:(te=(0,$.jsx)(`span`,{className:`line-clamp-2`,children:m.title}),t[63]=m.title,t[64]=te);let ne;t[65]!==ee||t[66]!==te?(ne=(0,$.jsxs)(`button`,{type:`button`,onClick:G,className:ee,children:[q,te]}),t[65]=ee,t[66]=te,t[67]=ne):ne=t[67];let re;if(t[68]!==b||t[69]!==c){let e;t[71]===c?e=t[72]:(e=(e,t)=>{let n=Me[t]??Me[0];return(0,$.jsx)(`span`,{style:{left:`${(50+n.x)/2}%`,top:`${(50+n.y)/2}%`},className:`pointer-events-none absolute z-[5] -translate-x-1/2 -translate-y-1/2 rounded bg-surface-base/90 px-1.5 py-0.5 text-[9px] text-fg-subtle`,children:Be(e,c)},`edge:${e.understanding.id}`)},t[71]=c,t[72]=e),re=b.map(e),t[68]=b,t[69]=c,t[70]=re}else re=t[70];let ie;if(t[73]!==i||t[74]!==b||t[75]!==x){let e;t[77]!==i||t[78]!==x?(e=(e,t)=>(0,$.jsx)(Ve,{relation:e,position:Me[t]??Me[0],language:i,selected:x===e.understanding.id,onSelect:()=>S(e.understanding.id)},e.understanding.id),t[77]=i,t[78]=x,t[79]=e):e=t[79],ie=b.map(e),t[73]=i,t[74]=b,t[75]=x,t[76]=ie}else ie=t[76];let ae;t[80]!==b.length||t[81]!==c.noRelations?(ae=b.length?null:(0,$.jsx)(`p`,{className:`absolute inset-x-0 bottom-8 text-center text-xs text-fg-muted`,children:c.noRelations}),t[80]=b.length,t[81]=c.noRelations,t[82]=ae):ae=t[82];let J;t[83]!==H||t[84]!==W||t[85]!==ne||t[86]!==re||t[87]!==ie||t[88]!==ae?(J=(0,$.jsxs)(`div`,{className:`relative hidden h-[30rem] overflow-hidden rounded-xl border border-edge bg-surface-base sm:block`,children:[z,H,W,ne,re,ie,ae]}),t[83]=H,t[84]=W,t[85]=ne,t[86]=re,t[87]=ie,t[88]=ae,t[89]=J):J=t[89];let se;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>S(null),t[90]=se):se=t[90];let ce=`rounded-xl border p-3 text-left ${w?`border-edge bg-surface-panel`:`border-accent bg-accent-soft`}`,le;t[91]===c.focus?le=t[92]:(le=(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:c.focus}),t[91]=c.focus,t[92]=le);let Y;t[93]===m.title?Y=t[94]:(Y=(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium text-fg`,children:m.title}),t[93]=m.title,t[94]=Y);let X;t[95]!==ce||t[96]!==le||t[97]!==Y?(X=(0,$.jsxs)(`button`,{type:`button`,onClick:se,className:ce,children:[le,Y]}),t[95]=ce,t[96]=le,t[97]=Y,t[98]=X):X=t[98];let ue;if(t[99]!==i||t[100]!==b||t[101]!==x||t[102]!==c){let e;t[104]!==i||t[105]!==x||t[106]!==c?(e=e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>S(e.understanding.id),className:`rounded-xl border p-3 text-left ${x===e.understanding.id?`border-accent bg-accent-soft`:e.understanding.status===`active`?`border-edge bg-surface-panel`:`border-dashed border-warning/40 bg-warning-soft`}`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:je[e.understanding.kind][i]}),(0,$.jsx)(`span`,{children:Be(e,c)})]}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg`,children:e.understanding.statement})]},e.understanding.id),t[104]=i,t[105]=x,t[106]=c,t[107]=e):e=t[107],ue=b.map(e),t[99]=i,t[100]=b,t[101]=x,t[102]=c,t[103]=ue}else ue=t[103];let de;t[108]!==X||t[109]!==ue?(de=(0,$.jsxs)(`div`,{className:`grid gap-2 sm:hidden`,children:[X,ue]}),t[108]=X,t[109]=ue,t[110]=de):de=t[110];let fe;t[111]!==J||t[112]!==de?(fe=(0,$.jsxs)(`div`,{className:`min-w-0 bg-surface-base/45 p-3 sm:p-4`,children:[J,de]}),t[111]=J,t[112]=de,t[113]=fe):fe=t[113];let pe;t[114]!==m||t[115]!==i||t[116]!==o||t[117]!==a||t[118]!==b.length||t[119]!==w||t[120]!==c?(pe=(0,$.jsx)(He,{focus:m,relation:w,relationCount:b.length,language:i,t:c,onRefresh:a,onOpenReview:o}),t[114]=m,t[115]=i,t[116]=o,t[117]=a,t[118]=b.length,t[119]=w,t[120]=c,t[121]=pe):pe=t[121];let me;t[122]!==fe||t[123]!==pe?(me=(0,$.jsxs)(`div`,{className:`grid lg:grid-cols-[minmax(0,1fr)_19rem]`,children:[fe,pe]}),t[122]=fe,t[123]=pe,t[124]=me):me=t[124];let he;return t[125]!==R||t[126]!==me?(he=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[R,me]}),t[125]=R,t[126]=me,t[127]=he):he=t[127],he}function Ie(e){return!e}function Le(e){return e.score<.25}function Re(e){return(0,$.jsx)(c,{value:e.id,children:e.title},e.id)}function ze(e){return e.score>=.25}function Be(e,t){return e.reasons.includes(`project_scope`)?t.projectEdge:e.reasons.includes(`topic_overlap`)?t.topicEdge:t.contextEdge}function Ve(e){let t=(0,Q.c)(18),{relation:n,position:r,language:i,selected:a,onSelect:o}=e,s=n.understanding.status!==`active`,c=`${r.x}%`,l=`${r.y}%`,u;t[0]!==c||t[1]!==l?(u={left:c,top:l},t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=`absolute z-10 flex max-w-40 -translate-x-1/2 -translate-y-1/2 items-start gap-2 rounded-xl border px-3 py-2.5 text-left text-xs leading-5 shadow-surface transition-colors ${a?`border-accent bg-accent-soft ring-2 ring-accent/15`:s?`border-dashed border-warning/60 bg-warning-soft hover:border-warning`:`border-edge bg-surface-panel hover:bg-surface-hover`}`,f=`mt-1.5 size-1.5 shrink-0 rounded-full ${s?`bg-warning`:`bg-success`}`,p;t[3]===f?p=t[4]:(p=(0,$.jsx)(`span`,{className:f}),t[3]=f,t[4]=p);let m=je[n.understanding.kind][i],h;t[5]===m?h=t[6]:(h=(0,$.jsx)(`span`,{className:`block text-[10px] text-fg-subtle`,children:m}),t[5]=m,t[6]=h);let g;t[7]===n.understanding.statement?g=t[8]:(g=(0,$.jsx)(`span`,{className:`line-clamp-2 text-fg`,children:n.understanding.statement}),t[7]=n.understanding.statement,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,$.jsxs)(`span`,{className:`min-w-0`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;return t[12]!==o||t[13]!==_||t[14]!==u||t[15]!==d||t[16]!==p?(v=(0,$.jsxs)(`button`,{type:`button`,onClick:o,style:u,className:d,children:[p,_]}),t[12]=o,t[13]=_,t[14]=u,t[15]=d,t[16]=p,t[17]=v):v=t[17],v}function He({focus:e,relation:t,relationCount:n,language:r,t:i,onRefresh:a,onOpenReview:o}){let[s,c]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(e.title),[f,p]=(0,Z.useState)(t?.understanding.statement??e.summary),[m,h]=(0,Z.useState)(!1),_=t?.understanding;(0,Z.useEffect)(()=>{c(!1),d(e.title),p(_?.statement??e.summary)},[e.id,e.summary,e.title,_?.id,_?.statement]);let v=async e=>{h(!0);try{await e(),await a()}finally{h(!1)}},y=async t=>{t.preventDefault(),!(!f.trim()||!_&&!u.trim())&&(await v(()=>_?j(_.id,{statement:f}):L(e.id,{title:u,summary:f})),c(!1))},b=_?_.explicitness===`explicit`?i.explicit:_.explicitness===`observed`?i.observed:i.inferred:`${n} ${i.relatedCount}`,x=_?.status===`active`||!_?i.active:i.pending;return(0,$.jsxs)(`aside`,{className:`border-t border-edge bg-surface-panel p-5 lg:border-l lg:border-t-0`,children:[(0,$.jsx)(`p`,{className:`text-[11px] font-medium text-accent`,children:_?je[_.kind][r]:i.focus}),s?(0,$.jsxs)(`form`,{className:`mt-3 space-y-3`,onSubmit:y,children:[_?null:(0,$.jsx)(`input`,{className:Pe,value:u,onChange:e=>d(e.target.value)}),(0,$.jsx)(`textarea`,{autoFocus:!0,className:Pe,rows:5,value:f,onChange:e=>p(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(g,{type:`button`,disabled:m,onClick:()=>c(!1),children:i.cancel}),(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:m||!f.trim()||!_&&!u.trim(),children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h2`,{className:`mt-2 text-base font-semibold leading-6 text-fg`,children:_?.statement??e.title}),_?null:(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.summary}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full ${_?.status===`active`||!_?`bg-success`:`bg-warning`}`}),x,(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:b})]}),t?(0,$.jsxs)(`div`,{className:`mt-6`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.why}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:t.reasons.map(e=>(0,$.jsx)(`p`,{className:`rounded-xl bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-muted`,children:i[e]},e))})]}):null,(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2`,children:[_?_.status===`active`?(0,$.jsxs)(g,{disabled:m,onClick:()=>c(!0),children:[(0,$.jsx)(Y,{className:`size-3.5`}),i.edit]}):(0,$.jsx)(g,{variant:`primary`,onClick:o,children:i.review}):(0,$.jsxs)(g,{disabled:m,onClick:()=>c(!0),children:[(0,$.jsx)(Y,{className:`size-3.5`}),i.edit]}),_?_.status===`active`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{variant:`ghost`,disabled:m,onClick:()=>void v(()=>j(_.id,{status:`archived`})),children:i.archive}),(0,$.jsx)(g,{variant:`ghost`,className:`text-danger`,disabled:m,onClick:()=>void v(()=>j(_.id,{status:`rejected`})),children:i.incorrect})]}):null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{disabled:m,onClick:()=>void v(()=>L(e.id,{status:`paused`})),children:i.pause}),(0,$.jsxs)(g,{variant:`ghost`,disabled:m,onClick:()=>void v(()=>L(e.id,{status:`completed`})),children:[(0,$.jsx)(l,{className:`size-3.5`}),i.complete]})]})]})]})]})}var Ue={en:{eyebrow:`YOU, NOW`,intro:`A living, correctable portrait of what matters now and what remains true over time.`,add:`Add understanding`,portrait:`Now`,map:`Relationships`,changes:`Recent changes`,review:`Review`,portraitHint:`This is the context xopc will use when helping you now.`,importantNow:`Important now`,lastingPortrait:`What continues to shape the portrait`,lastingHint:`Confirmed context that can travel across conversations.`,noFocus:`No active focus yet. Tell xopc what matters now, or confirm a suggested focus.`,noUnderstanding:`No confirmed understanding yet. Add one directly or review a suggestion.`,selectedDetail:`Selected understanding`,focusDetail:`Selected focus`,scope:`Scope`,source:`Origin`,global:`Across xopc`,workspace:`Workspace`,project:`Project`,session:`Conversation`,active:`Active`,horizonCurrent:`Right now`,horizonOngoing:`Ongoing`,horizonLongTerm:`Long term`,moreFocuses:`more active focuses`,explicit:`Told by you`,observed:`Observed over time`,inferred:`Inferred — may be wrong`,validSince:`Valid since`,validUntil:`Valid until`,updated:`Updated`,reviewDue:`Review due`,edit:`Edit`,save:`Save`,cancel:`Cancel`,pause:`Pause`,complete:`Complete`,archive:`Archive`,incorrect:`Not true`,evidence:`View evidence`,evidenceTitle:`Why xopc holds this`,evidenceLoading:`Loading evidence…`,evidenceEmpty:`No displayable evidence is linked.`,evidenceError:`Evidence could not be loaded.`,changesIntro:`A timeline of when the portrait formed, changed, or stopped applying. It shows state changes without inventing a diff.`,timelineEmpty:`There are no changes yet.`,formed:`Formed`,changed:`Updated`,proposed:`Proposed`,needsReview:`Needs review`,paused:`Paused`,completed:`Completed`,rejected:`Marked incorrect`,archived:`Archived`,reviewTitle:`One decision at a time`,reviewHint:`Suggestions do not affect xopc until you confirm them.`,later:`Later`,yes:`Yes`,change:`Needs changes`,wrong:`Not true`,saveConfirm:`Save and confirm`,confidence:`confidence`,focusCandidate:`Suggested focus`,understandingCandidate:`Suggested understanding`,high:`high`,medium:`medium`,low:`low`,noReview:`Nothing needs your review.`,statement:`What should xopc understand?`,type:`Type`,create:`Add`},zh:{eyebrow:`此刻的你`,intro:`一份会随时间生长、可以随时纠正的画像:既看此刻重要的事,也保留长期成立的理解。`,add:`添加理解`,portrait:`此刻`,map:`关系`,changes:`最近变化`,review:`待确认`,portraitHint:`这是 xopc 此刻帮助你时会使用的上下文。`,importantNow:`此刻重要`,lastingPortrait:`持续构成画像的理解`,lastingHint:`已经确认、可以跨对话使用的上下文。`,noFocus:`还没有进行中的关注。你可以告诉 xopc 此刻什么最重要,或确认一条候选关注。`,noUnderstanding:`还没有已确认的理解。你可以直接添加,或确认一条建议。`,selectedDetail:`选中的理解`,focusDetail:`选中的关注`,scope:`适用范围`,source:`形成方式`,global:`全局适用`,workspace:`工作区`,project:`项目`,session:`当前对话`,active:`生效中`,horizonCurrent:`当下`,horizonOngoing:`持续推进`,horizonLongTerm:`长期方向`,moreFocuses:`项进行中的关注`,explicit:`由你直接告知`,observed:`从长期共事中观察到`,inferred:`推断内容,可能有误`,validSince:`开始成立`,validUntil:`有效至`,updated:`最近更新`,reviewDue:`建议复核`,edit:`编辑`,save:`保存`,cancel:`取消`,pause:`暂停`,complete:`完成`,archive:`归档`,incorrect:`不正确`,evidence:`查看依据`,evidenceTitle:`xopc 为什么这样理解`,evidenceLoading:`正在读取依据…`,evidenceEmpty:`暂时没有可展示的依据。`,evidenceError:`暂时无法读取依据。`,changesIntro:`按时间呈现画像何时形成、更新或不再适用;只表达状态变化,不虚构具体差异。`,timelineEmpty:`还没有画像变化。`,formed:`形成`,changed:`更新`,proposed:`提出建议`,needsReview:`需要复核`,paused:`已暂停`,completed:`已完成`,rejected:`标记为不正确`,archived:`已归档`,reviewTitle:`一次只确认一条`,reviewHint:`建议内容在你确认前不会影响 xopc 的行动。`,later:`稍后`,yes:`是的`,change:`需要修改`,wrong:`不是这样`,saveConfirm:`保存并确认`,confidence:`把握`,focusCandidate:`候选关注`,understandingCandidate:`候选理解`,high:`高`,medium:`中`,low:`低`,noReview:`目前没有需要你确认的内容。`,statement:`希望 xopc 了解什么?`,type:`类型`,create:`添加`}},We=`w-full rounded-xl border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/60 focus:ring-2 focus:ring-accent/20`;function Ge(e){let t=(0,Q.c)(83),{focuses:n,understandings:r,language:i,onRefresh:a}=e,o=Ue[i],s;t[0]!==n||t[1]!==r?(s=De(n,r),t[0]=n,t[1]=r,t[2]=s):s=t[2];let c=s,[l,u]=(0,Z.useState)(`portrait`),[d,f]=(0,Z.useState)(!1),p;t[3]===o.eyebrow?p=t[4]:(p=(0,$.jsx)(`p`,{className:`text-[11px] font-semibold uppercase tracking-[0.18em] text-accent`,children:o.eyebrow}),t[3]=o.eyebrow,t[4]=p);let h;t[5]===o.intro?h=t[6]:(h=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:o.intro}),t[5]=o.intro,t[6]=h);let _;t[7]!==p||t[8]!==h?(_=(0,$.jsxs)(`div`,{className:`max-w-2xl`,children:[p,h]}),t[7]=p,t[8]=h,t[9]=_):_=t[9];let v,y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>f(!0),y=(0,$.jsx)(m,{className:`size-4`}),t[10]=v,t[11]=y):(v=t[10],y=t[11]);let b;t[12]===o.add?b=t[13]:(b=(0,$.jsxs)(g,{variant:`primary`,className:`shrink-0`,onClick:v,children:[y,o.add]}),t[12]=o.add,t[13]=b);let x;t[14]!==_||t[15]!==b?(x=(0,$.jsxs)(`header`,{className:`flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between`,children:[_,b]}),t[14]=_,t[15]=b,t[16]=x):x=t[16];let S=i===`zh`?`共同理解视图`:`Shared understanding views`,C=l===`portrait`,w,T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>u(`portrait`),T=(0,$.jsx)(K,{className:`size-3.5`}),t[17]=w,t[18]=T):(w=t[17],T=t[18]);let D;t[19]!==c.currentFocuses.length||t[20]!==o.portrait||t[21]!==C?(D=(0,$.jsx)(Ke,{selected:C,onClick:w,icon:T,label:o.portrait,count:c.currentFocuses.length}),t[19]=c.currentFocuses.length,t[20]=o.portrait,t[21]=C,t[22]=D):D=t[22];let O=l===`map`,k,A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>u(`map`),A=(0,$.jsx)(ee,{className:`size-3.5`}),t[23]=k,t[24]=A):(k=t[23],A=t[24]);let j;t[25]!==o.map||t[26]!==O?(j=(0,$.jsx)(Ke,{selected:O,onClick:k,icon:A,label:o.map}),t[25]=o.map,t[26]=O,t[27]=j):j=t[27];let M=l===`changes`,N,P;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>u(`changes`),P=(0,$.jsx)(_e,{className:`size-3.5`}),t[28]=N,t[29]=P):(N=t[28],P=t[29]);let F;t[30]!==o.changes||t[31]!==M?(F=(0,$.jsx)(Ke,{selected:M,onClick:N,icon:P,label:o.changes}),t[30]=o.changes,t[31]=M,t[32]=F):F=t[32];let I=l===`review`,L,R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>u(`review`),R=(0,$.jsx)(E,{className:`size-3.5`}),t[33]=L,t[34]=R):(L=t[33],R=t[34]);let z=c.reviewQueue.length>0,B;t[35]!==c.reviewQueue.length||t[36]!==o.review||t[37]!==I||t[38]!==z?(B=(0,$.jsx)(Ke,{selected:I,onClick:L,icon:R,label:o.review,count:c.reviewQueue.length,emphasize:z}),t[35]=c.reviewQueue.length,t[36]=o.review,t[37]=I,t[38]=z,t[39]=B):B=t[39];let V;t[40]!==D||t[41]!==j||t[42]!==F||t[43]!==B||t[44]!==S?(V=(0,$.jsxs)(`div`,{className:`flex gap-1 overflow-x-auto border-b border-edge`,role:`tablist`,"aria-label":S,children:[D,j,F,B]}),t[40]=D,t[41]=j,t[42]=F,t[43]=B,t[44]=S,t[45]=V):V=t[45];let H;t[46]!==i||t[47]!==c.activeUnderstandings||t[48]!==c.currentFocuses||t[49]!==a||t[50]!==o||t[51]!==l?(H=l===`portrait`?(0,$.jsx)(qe,{focuses:c.currentFocuses,understandings:c.activeUnderstandings,language:i,t:o,onRefresh:a}):null,t[46]=i,t[47]=c.activeUnderstandings,t[48]=c.currentFocuses,t[49]=a,t[50]=o,t[51]=l,t[52]=H):H=t[52];let U;t[53]!==i||t[54]!==c.currentFocuses||t[55]!==a||t[56]!==r||t[57]!==l?(U=l===`map`?(0,$.jsx)(Fe,{focuses:c.currentFocuses,understandings:r,language:i,onRefresh:a,onOpenReview:()=>u(`review`)}):null,t[53]=i,t[54]=c.currentFocuses,t[55]=a,t[56]=r,t[57]=l,t[58]=U):U=t[58];let W;t[59]!==i||t[60]!==c.timeline||t[61]!==o||t[62]!==l?(W=l===`changes`?(0,$.jsx)($e,{items:c.timeline,language:i,t:o}):null,t[59]=i,t[60]=c.timeline,t[61]=o,t[62]=l,t[63]=W):W=t[63];let G;t[64]!==i||t[65]!==c.reviewQueue||t[66]!==a||t[67]!==o||t[68]!==l?(G=l===`review`?(0,$.jsx)(it,{items:c.reviewQueue,language:i,t:o,onRefresh:a}):null,t[64]=i,t[65]=c.reviewQueue,t[66]=a,t[67]=o,t[68]=l,t[69]=G):G=t[69];let q;t[70]!==d||t[71]!==i||t[72]!==a||t[73]!==o?(q=(0,$.jsx)(ot,{open:d,onOpenChange:f,language:i,t:o,onCreated:a}),t[70]=d,t[71]=i,t[72]=a,t[73]=o,t[74]=q):q=t[74];let te;return t[75]!==V||t[76]!==H||t[77]!==U||t[78]!==W||t[79]!==G||t[80]!==q||t[81]!==x?(te=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[x,V,H,U,W,G,q]}),t[75]=V,t[76]=H,t[77]=U,t[78]=W,t[79]=G,t[80]=q,t[81]=x,t[82]=te):te=t[82],te}function Ke(e){let t=(0,Q.c)(12),{selected:n,onClick:r,icon:i,label:a,count:o,emphasize:s}=e,c=s===void 0?!1:s,l=`inline-flex min-h-10 shrink-0 items-center gap-1.5 border-b-2 px-3 text-sm transition-colors ${n?`border-accent text-fg`:`border-transparent text-fg-muted hover:text-fg`}`,u;t[0]===a?u=t[1]:(u=(0,$.jsx)(`span`,{children:a}),t[0]=a,t[1]=u);let d;t[2]!==o||t[3]!==c?(d=o===void 0?null:(0,$.jsx)(`span`,{className:`rounded-full px-1.5 py-0.5 text-[10px] ${c?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:o}),t[2]=o,t[3]=c,t[4]=d):d=t[4];let f;return t[5]!==i||t[6]!==r||t[7]!==n||t[8]!==l||t[9]!==u||t[10]!==d?(f=(0,$.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n,onClick:r,className:l,children:[i,u,d]}),t[5]=i,t[6]=r,t[7]=n,t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}function qe(e){let t=(0,Q.c)(62),{focuses:n,understandings:r,language:i,t:a,onRefresh:o}=e,s;t[0]!==n[0]||t[1]!==r?(s=n[0]?{type:`focus`,item:n[0]}:r[0]?{type:`understanding`,item:r[0]}:null,t[0]=n[0],t[1]=r,t[2]=s):s=t[2];let c=s,[l,u]=(0,Z.useState)(c?`${c.type}:${c.item.id}`:``),d;t[3]!==n||t[4]!==c||t[5]!==l||t[6]!==r?(d=Je(l,n,r)??c,t[3]=n,t[4]=c,t[5]=l,t[6]=r,t[7]=d):d=t[7];let f=d,p=n[0],m=Ye(n),h=m.slice(0,5),g=Math.max(0,m.length-h.length),_,v;if(t[8]!==c||t[9]!==f?(_=()=>{f||!c||u(`${c.type}:${c.item.id}`)},v=[c,f],t[8]=c,t[9]=f,t[10]=_,t[11]=v):(_=t[10],v=t[11]),(0,Z.useEffect)(_,v),!p&&!r.length){let e;return t[12]===a.noFocus?e=t[13]:(e=(0,$.jsx)(st,{children:a.noFocus}),t[12]=a.noFocus,t[13]=e),e}let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-accent/45 to-transparent`,"aria-hidden":`true`}),t[14]=y):y=t[14];let b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(E,{className:`size-3.5`}),t[15]=b):b=t[15];let x;t[16]===a.portraitHint?x=t[17]:(x=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.16em] text-accent`,children:[b,a.portraitHint]}),t[16]=a.portraitHint,t[17]=x);let S;t[18]!==i||t[19]!==p||t[20]!==a?(S=p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,className:`mt-7 block max-w-3xl text-left`,onClick:()=>u(`focus:${p.id}`),children:[(0,$.jsx)(`h2`,{className:`text-2xl font-semibold leading-tight tracking-tight text-fg sm:text-3xl`,children:p.title}),(0,$.jsx)(`p`,{className:`mt-3 max-w-2xl text-sm leading-7 text-fg-muted sm:text-base`,children:p.summary})]}),(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-4 gap-y-2 pt-8 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`}),a.active]}),(0,$.jsx)(`span`,{children:nt(p.horizon,a)}),(0,$.jsx)(`span`,{children:tt(p.scope,a)}),(0,$.jsxs)(`span`,{children:[a.updated,` · `,rt(p.updatedAt,i)]})]})]}):(0,$.jsx)(`p`,{className:`mt-7 max-w-2xl text-base leading-7 text-fg-muted`,children:a.noFocus}),t[18]=i,t[19]=p,t[20]=a,t[21]=S):S=t[21];let C;t[22]!==x||t[23]!==S?(C=(0,$.jsxs)(`div`,{className:`flex min-h-[18rem] min-w-0 flex-col`,children:[x,S]}),t[22]=x,t[23]=S,t[24]=C):C=t[24];let w;t[25]===a.importantNow?w=t[26]:(w=(0,$.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.12em] text-fg-subtle`,children:a.importantNow}),t[25]=a.importantNow,t[26]=w);let T=n.length?(0,$.jsxs)(`div`,{className:`mt-4 space-y-1`,children:[h.map((e,t)=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>u(`focus:${e.id}`),className:`group flex w-full items-start gap-3 rounded-xl px-2.5 py-2.5 text-left transition-colors ${f?.type===`focus`&&f.item.id===e.id?`bg-accent-soft`:`hover:bg-surface-hover`}`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full ${t===0?`bg-accent`:`bg-success`}`}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`line-clamp-2 text-sm leading-6 text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-fg-subtle`,children:rt(e.updatedAt,i)})]}),(0,$.jsx)(O,{className:`mt-1 size-3.5 shrink-0 text-fg-subtle opacity-0 transition-opacity group-hover:opacity-100`})]},e.id)),g?(0,$.jsxs)(`p`,{className:`border-t border-edge px-2.5 pt-3 text-[11px] text-fg-subtle`,children:[`+`,g,` `,a.moreFocuses]}):null]}):(0,$.jsx)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:a.noFocus}),D;t[27]!==w||t[28]!==T?(D=(0,$.jsxs)(`div`,{className:`self-start rounded-2xl border border-edge bg-surface-base/70 p-5`,children:[w,T]}),t[27]=w,t[28]=T,t[29]=D):D=t[29];let k;t[30]!==C||t[31]!==D?(k=(0,$.jsxs)(`div`,{className:`grid gap-8 px-5 py-7 sm:px-8 sm:py-9 lg:grid-cols-[minmax(0,1fr)_18rem] lg:gap-12 lg:px-10 lg:py-11`,children:[C,D]}),t[30]=C,t[31]=D,t[32]=k):k=t[32];let A;t[33]!==k||t[34]!==y?(A=(0,$.jsxs)(`section`,{className:`relative overflow-hidden rounded-3xl border border-edge bg-surface-panel`,children:[y,k]}),t[33]=k,t[34]=y,t[35]=A):A=t[35];let j;t[36]===a.lastingPortrait?j=t[37]:(j=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.lastingPortrait}),t[36]=a.lastingPortrait,t[37]=j);let M;t[38]===a.lastingHint?M=t[39]:(M=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a.lastingHint}),t[38]=a.lastingHint,t[39]=M);let N;t[40]!==j||t[41]!==M?(N=(0,$.jsxs)(`div`,{children:[j,M]}),t[40]=j,t[41]=M,t[42]=N):N=t[42];let P;t[43]!==i||t[44]!==f||t[45]!==a.noUnderstanding||t[46]!==r?(P=r.length?(0,$.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:r.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>u(`understanding:${e.id}`),className:`group min-h-28 rounded-xl border p-3.5 text-left transition-colors ${f?.type===`understanding`&&f.item.id===e.id?`border-accent bg-accent-soft ring-2 ring-accent/10`:`border-edge bg-surface-base/50 hover:bg-surface-hover`}`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:je[e.kind][i]}),(0,$.jsx)(`span`,{children:rt(e.updatedAt,i)})]}),(0,$.jsx)(`span`,{className:`mt-2 line-clamp-3 block text-sm leading-6 text-fg`,children:e.statement})]},e.id))}):(0,$.jsx)(`p`,{className:`mt-5 rounded-xl border border-dashed border-edge px-4 py-8 text-center text-sm leading-6 text-fg-muted`,children:a.noUnderstanding}),t[43]=i,t[44]=f,t[45]=a.noUnderstanding,t[46]=r,t[47]=P):P=t[47];let F;t[48]!==N||t[49]!==P?(F=(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:[N,P]}),t[48]=N,t[49]=P,t[50]=F):F=t[50];let I;t[51]!==i||t[52]!==o||t[53]!==f||t[54]!==a?(I=f?(0,$.jsx)(Xe,{selection:f,language:i,t:a,onRefresh:o}):null,t[51]=i,t[52]=o,t[53]=f,t[54]=a,t[55]=I):I=t[55];let L;t[56]!==F||t[57]!==I?(L=(0,$.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-[minmax(0,1fr)_20rem]`,children:[F,I]}),t[56]=F,t[57]=I,t[58]=L):L=t[58];let R;return t[59]!==A||t[60]!==L?(R=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[A,L]}),t[59]=A,t[60]=L,t[61]=R):R=t[61],R}function Je(e,t,n){let[r,i]=e.split(`:`,2);if(r===`focus`){let e=t.find(e=>e.id===i);return e?{type:`focus`,item:e}:null}if(r===`understanding`){let e=n.find(e=>e.id===i);return e?{type:`understanding`,item:e}:null}return null}function Ye(e){let t=new Set;return e.filter(e=>{let n=e.title.trim().toLocaleLowerCase();return t.has(n)?!1:(t.add(n),!0)})}function Xe({selection:e,language:t,t:n,onRefresh:r}){let i=e.item,a=e.type===`understanding`?e.item:null,[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(e.type===`focus`?e.item.title:``),[d,p]=(0,Z.useState)(e.type===`focus`?e.item.summary:e.item.statement),[m,h]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(`idle`),[y,b]=(0,Z.useState)([]);(0,Z.useEffect)(()=>{c(!1),u(e.type===`focus`?e.item.title:``),p(e.type===`focus`?e.item.summary:e.item.statement),v(`idle`),b([])},[e.type,e.item.id]);let x=async e=>{h(!0);try{await e(),await r()}finally{h(!1)}},S=async t=>{t.preventDefault(),!(!d.trim()||e.type===`focus`&&!l.trim())&&(await x(()=>e.type===`focus`?L(e.item.id,{title:l.trim(),summary:d.trim()}):j(e.item.id,{statement:d.trim()})),c(!1))},C=async()=>{if(!(!a||_===`loading`)){v(`loading`);try{b((await W(a.id)).evidence),v(`loaded`)}catch{v(`error`)}}},w=i.explicitness===`explicit`?n.explicit:i.explicitness===`observed`?n.observed:n.inferred;return(0,$.jsxs)(`aside`,{className:`self-start overflow-hidden rounded-2xl border border-edge bg-surface-panel lg:sticky lg:top-5`,children:[(0,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(`p`,{className:`text-[11px] font-semibold uppercase tracking-[0.12em] text-accent`,children:e.type===`focus`?n.focusDetail:n.selectedDetail}),s?(0,$.jsxs)(`form`,{className:`mt-3 space-y-3`,onSubmit:S,children:[e.type===`focus`?(0,$.jsx)(`input`,{className:We,value:l,onChange:e=>u(e.target.value)}):null,(0,$.jsx)(`textarea`,{autoFocus:!0,className:We,rows:5,value:d,onChange:e=>p(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(g,{type:`button`,disabled:m,onClick:()=>c(!1),children:n.cancel}),(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:m||!d.trim()||e.type===`focus`&&!l.trim(),children:n.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`mt-3 text-base font-semibold leading-6 text-fg`,children:e.type===`focus`?e.item.title:e.item.statement}),e.type===`focus`?(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.item.summary}):null]})]}),s?null:(0,$.jsxs)(`div`,{className:`space-y-5 px-5 py-4`,children:[(0,$.jsxs)(`dl`,{className:`space-y-3 text-xs`,children:[(0,$.jsx)(Ze,{label:n.source,value:w}),(0,$.jsx)(Ze,{label:n.scope,value:tt(i.scope,n)}),(0,$.jsx)(Ze,{label:n.updated,value:rt(i.updatedAt,t,!0)}),i.validFrom?(0,$.jsx)(Ze,{label:n.validSince,value:rt(i.validFrom,t,!0)}):null,i.validTo?(0,$.jsx)(Ze,{label:n.validUntil,value:rt(i.validTo,t,!0)}):null,i.reviewAt?(0,$.jsx)(Ze,{label:n.reviewDue,value:rt(i.reviewAt,t,!0)}):null]}),a?(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void C(),className:`inline-flex items-center gap-1.5 text-xs font-medium text-accent hover:underline`,children:[(0,$.jsx)(f,{className:`size-3.5`}),n.evidence]}),_===`idle`?null:(0,$.jsxs)(`div`,{className:`mt-2 rounded-xl bg-surface-muted p-3`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n.evidenceTitle}),_===`loading`?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.evidenceLoading}):null,_===`error`?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:n.evidenceError}):null,_===`loaded`&&!y.length?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.evidenceEmpty}):null,y.length?(0,$.jsx)(`div`,{className:`mt-2 space-y-2`,children:y.slice(0,4).map(e=>(0,$.jsx)(Qe,{evidence:e,language:t},e.id))}):null]})]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2 border-t border-edge pt-4`,children:[(0,$.jsxs)(g,{disabled:m,onClick:()=>c(!0),children:[(0,$.jsx)(Y,{className:`size-3.5`}),n.edit]}),e.type===`focus`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{variant:`ghost`,disabled:m,onClick:()=>void x(()=>L(e.item.id,{status:`paused`})),children:n.pause}),(0,$.jsxs)(g,{variant:`ghost`,disabled:m,onClick:()=>void x(()=>L(e.item.id,{status:`completed`})),children:[(0,$.jsx)(o,{className:`size-3.5`}),n.complete]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{variant:`ghost`,disabled:m,onClick:()=>void x(()=>j(e.item.id,{status:`archived`})),children:n.archive}),(0,$.jsx)(g,{variant:`ghost`,className:`text-danger`,disabled:m,onClick:()=>void x(()=>j(e.item.id,{status:`rejected`})),children:n.incorrect})]})]})]})]})}function Ze(e){let t=(0,Q.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`dt`,{className:`shrink-0 text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,$.jsx)(`dd`,{className:`text-right leading-5 text-fg-muted`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Qe(e){let t=(0,Q.c)(12),{evidence:n,language:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={conversation:{en:`Conversation`,zh:`对话`},connector:{en:`Connected source`,zh:`连接的数据源`},user:{en:`Direct input`,zh:`直接输入`},runtime:{en:`Work context`,zh:`工作过程`}},t[0]=i):i=t[0];let a=i[n.sourceType][r],o;t[1]!==n.observedAt||t[2]!==r?(o=rt(n.observedAt,r),t[1]=n.observedAt,t[2]=r,t[3]=o):o=t[3];let s;t[4]!==a||t[5]!==o?(s=(0,$.jsxs)(`p`,{className:`text-[11px] text-fg-subtle`,children:[a,` · `,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===n.redactedExcerpt?c=t[8]:(c=n.redactedExcerpt?(0,$.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.redactedExcerpt}):null,t[7]=n.redactedExcerpt,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,$.jsxs)(`div`,{className:`border-l-2 border-edge-strong pl-2.5`,children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function $e(e){let t=(0,Q.c)(17),{items:n,language:r,t:i}=e;if(!n.length){let e;return t[0]===i.timelineEmpty?e=t[1]:(e=(0,$.jsx)(st,{children:i.timelineEmpty}),t[0]=i.timelineEmpty,t[1]=e),e}let a;t[2]===i.changesIntro?a=t[3]:(a=(0,$.jsx)(`header`,{className:`border-b border-edge px-5 py-4`,children:(0,$.jsx)(`p`,{className:`max-w-2xl text-xs leading-5 text-fg-muted`,children:i.changesIntro})}),t[2]=i.changesIntro,t[3]=a);let o;if(t[4]!==n||t[5]!==r||t[6]!==i){let e;t[8]!==n.length||t[9]!==r||t[10]!==i?(e=(e,t)=>{let a=e.type===`focus`?e.focus.status:e.understanding.status,o=e.type===`focus`?e.focus:e.understanding,s=e.type===`focus`?e.focus.title:e.understanding.statement,c=et(a,o.createdAt===o.updatedAt,i),l=e.type===`focus`?i.importantNow:je[e.understanding.kind][r],u=[`paused`,`completed`,`rejected`,`archived`].includes(a);return(0,$.jsxs)(`article`,{className:`relative grid grid-cols-[1.25rem_minmax(0,1fr)] gap-3 py-4 sm:grid-cols-[6.5rem_1.25rem_minmax(0,1fr)] sm:gap-4`,children:[(0,$.jsx)(`time`,{className:`hidden pt-0.5 text-right text-[11px] tabular-nums text-fg-subtle sm:block`,children:rt(e.updatedAt,r)}),t<n.length-1?(0,$.jsx)(`span`,{className:`absolute bottom-0 left-[0.6rem] top-7 w-px bg-edge sm:left-[7.9rem]`,"aria-hidden":`true`}):null,(0,$.jsx)(`span`,{className:`relative z-10 mt-1 size-2.5 rounded-full border-2 border-surface-panel ${u?`bg-fg-subtle`:a===`active`?`bg-success`:`bg-warning`}`,"aria-hidden":`true`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-accent`,children:c}),(0,$.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:l}),(0,$.jsx)(`time`,{className:`text-[11px] text-fg-subtle sm:hidden`,children:rt(e.updatedAt,r)})]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 ${u?`text-fg-muted`:`text-fg`}`,children:s})]})]},`${e.type}:${e.id}`)},t[8]=n.length,t[9]=r,t[10]=i,t[11]=e):e=t[11],o=n.map(e),t[4]=n,t[5]=r,t[6]=i,t[7]=o}else o=t[7];let s;t[12]===o?s=t[13]:(s=(0,$.jsx)(`div`,{className:`px-4 py-2 sm:px-6`,children:o}),t[12]=o,t[13]=s);let c;return t[14]!==a||t[15]!==s?(c=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[a,s]}),t[14]=a,t[15]=s,t[16]=c):c=t[16],c}function et(e,t,n){return e===`candidate`?n.proposed:e===`needs_review`||e===`stale`?n.needsReview:e===`paused`?n.paused:e===`completed`?n.completed:e===`rejected`?n.rejected:e===`archived`?n.archived:t?n.formed:n.changed}function tt(e,t){let n=e.type===`global`?t.global:e.type===`workspace`?t.workspace:e.type===`project`?t.project:t.session;return e.id?`${n} · ${e.id}`:n}function nt(e,t){return e===`long_term`?t.horizonLongTerm:e===`ongoing`?t.horizonOngoing:t.horizonCurrent}function rt(e,t,n=!1){return new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{...n?{year:`numeric`}:{},month:`short`,day:`numeric`}).format(new Date(e))}function it({items:e,language:t,t:n,onRefresh:r}){let[i,a]=(0,Z.useState)(0),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d=e.length?i%e.length:0,f=e[d];if((0,Z.useEffect)(()=>{a(0),c(!1)},[e.length]),!f)return(0,$.jsx)(st,{children:n.noReview});let p=async e=>{u(!0);try{f.type===`focus`?await L(f.id,{status:e?`active`:`rejected`}):await j(f.id,{status:e?`active`:`rejected`}),await r()}finally{u(!1)}};return(0,$.jsxs)(`section`,{className:`mx-auto max-w-2xl`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:n.reviewTitle}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[d+1,` / `,e.length]})]}),(0,$.jsxs)(`article`,{className:`mt-3 rounded-2xl border border-edge bg-surface-panel p-5 sm:p-6`,children:[(0,$.jsx)(at,{item:f,language:t,t:n,editing:s,pending:l,onCancelEdit:()=>c(!1),onSaved:r}),s?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`mt-5 rounded-xl bg-surface-muted px-3 py-2.5 text-xs leading-5 text-fg-muted`,children:n.reviewHint}),(0,$.jsxs)(`div`,{className:`mt-5 grid gap-2 sm:grid-cols-3`,children:[(0,$.jsxs)(g,{variant:`primary`,disabled:l,onClick:()=>void p(!0),children:[(0,$.jsx)(o,{className:`size-4`}),n.yes]}),(0,$.jsx)(g,{disabled:l,onClick:()=>c(!0),children:n.change}),(0,$.jsx)(g,{variant:`ghost`,className:`text-danger`,disabled:l,onClick:()=>void p(!1),children:n.wrong})]}),e.length>1?(0,$.jsx)(`button`,{type:`button`,className:`mx-auto mt-3 block rounded-md px-2 py-1 text-xs text-fg-muted hover:text-fg`,onClick:()=>a(t=>(t+1)%e.length),children:n.later}):null]})]})]})}function at({item:e,language:t,t:n,editing:r,pending:i,onCancelEdit:a,onSaved:o}){let[s,c]=(0,Z.useState)(e.type===`focus`?e.focus.title:``),[l,u]=(0,Z.useState)(e.type===`focus`?e.focus.summary:e.understanding.statement),[d,f]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{c(e.type===`focus`?e.focus.title:``),u(e.type===`focus`?e.focus.summary:e.understanding.statement)},[e]);let p=e.type===`focus`?e.focus.confidence:e.understanding.confidence,m=p>=.85?n.high:p>=.65?n.medium:n.low,h=async t=>{if(t.preventDefault(),!(!l.trim()||e.type===`focus`&&!s.trim())){f(!0);try{e.type===`focus`?await L(e.id,{title:s,summary:l,status:`active`}):await j(e.id,{statement:l,status:`active`}),await o()}finally{f(!1)}}};if(r)return(0,$.jsxs)(`form`,{onSubmit:h,className:`space-y-3`,children:[e.type===`focus`?(0,$.jsx)(`input`,{autoFocus:!0,className:We,value:s,onChange:e=>c(e.target.value)}):null,(0,$.jsx)(`textarea`,{autoFocus:e.type===`understanding`,className:We,rows:4,value:l,onChange:e=>u(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(g,{type:`button`,disabled:d,onClick:a,children:n.cancel}),(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:i||d||!l.trim()||e.type===`focus`&&!s.trim(),children:n.saveConfirm})]})]});let _=e.type===`understanding`?e.understanding:null,v=_?_.explicitness===`explicit`?n.explicit:_.explicitness===`observed`?n.observed:n.inferred:n.inferred;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`font-medium text-accent`,children:e.type===`focus`?n.focusCandidate:n.understandingCandidate}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[n.confidence,` `,m]}),_?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:je[_.kind][t]})]}):null]}),e.type===`focus`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h2`,{className:`mt-4 text-lg font-semibold leading-7 text-fg`,children:e.focus.title}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.focus.summary})]}):(0,$.jsx)(`p`,{className:`mt-4 text-lg font-semibold leading-8 text-fg`,children:e.understanding.statement}),(0,$.jsx)(`p`,{className:`mt-4 text-xs text-fg-subtle`,children:v})]})}function ot(e){let t=(0,Q.c)(56),{open:n,onOpenChange:r,language:i,t:a,onCreated:o}=e,[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(`preference`),p;t[0]!==d||t[1]!==o||t[2]!==r||t[3]!==l?(p=async e=>{e.preventDefault(),l.trim()&&(await le({statement:l,kind:d}),u(``),r(!1),await o())},t[0]=d,t[1]=o,t[2]=r,t[3]=l,t[4]=p):p=t[4];let m=p,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(v,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[5]=_):_=t[5];let y;t[6]===a.add?y=t[7]:(y=(0,$.jsx)(C,{className:`text-base font-semibold text-fg`,children:a.add}),t[6]=a.add,t[7]=y);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(h,{className:`size-4`}),t[8]=T):T=t[8];let E;t[9]===a.cancel?E=t[10]:(E=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":a.cancel,children:T})}),t[9]=a.cancel,t[10]=E);let D;t[11]!==y||t[12]!==E?(D=(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[y,E]}),t[11]=y,t[12]=E,t[13]=D):D=t[13];let O;t[14]===a.statement?O=t[15]:(O=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.statement}),t[14]=a.statement,t[15]=O);let k;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>u(e.target.value),t[16]=k):k=t[16];let A;t[17]===l?A=t[18]:(A=(0,$.jsx)(`textarea`,{autoFocus:!0,className:We,rows:4,value:l,onChange:k}),t[17]=l,t[18]=A);let j;t[19]!==O||t[20]!==A?(j=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[O,A]}),t[19]=O,t[20]=A,t[21]=j):j=t[21];let M;t[22]===a.type?M=t[23]:(M=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.type}),t[22]=a.type,t[23]=M);let N,P;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>f(e.target.value),P=Object.entries(je),t[24]=N,t[25]=P):(N=t[24],P=t[25]);let F;t[26]===i?F=t[27]:(F=P.map(e=>{let[t,n]=e;return(0,$.jsx)(c,{value:t,children:n[i]},t)}),t[26]=i,t[27]=F);let I;t[28]!==d||t[29]!==F?(I=(0,$.jsx)(s,{value:d,onChange:N,children:F}),t[28]=d,t[29]=F,t[30]=I):I=t[30];let L;t[31]!==M||t[32]!==I?(L=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[M,I]}),t[31]=M,t[32]=I,t[33]=L):L=t[33];let R;t[34]!==j||t[35]!==L?(R=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[j,L]}),t[34]=j,t[35]=L,t[36]=R):R=t[36];let z;t[37]===a.cancel?z=t[38]:(z=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{type:`button`,children:a.cancel})}),t[37]=a.cancel,t[38]=z);let B;t[39]===l?B=t[40]:(B=l.trim(),t[39]=l,t[40]=B);let V=!B,H;t[41]!==a.create||t[42]!==V?(H=(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:V,children:a.create}),t[41]=a.create,t[42]=V,t[43]=H):H=t[43];let U;t[44]!==z||t[45]!==H?(U=(0,$.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-3`,children:[z,H]}),t[44]=z,t[45]=H,t[46]=U):U=t[46];let W;t[47]!==m||t[48]!==R||t[49]!==U||t[50]!==D?(W=(0,$.jsxs)(x,{children:[_,(0,$.jsx)(S,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(30rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:m,children:[D,R,U]})})]}),t[47]=m,t[48]=R,t[49]=U,t[50]=D,t[51]=W):W=t[51];let G;return t[52]!==r||t[53]!==n||t[54]!==W?(G=(0,$.jsx)(w,{open:n,onOpenChange:r,children:W}),t[52]=r,t[53]=n,t[54]=W,t[55]=G):G=t[55],G}function st(e){let t=(0,Q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-12 text-center text-sm leading-6 text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}var ct=new Set([`profile`,`understanding`,`collaboration`,`sources`,`dreaming`,`privacy`]),lt=`w-full rounded-xl border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/60 focus:ring-2 focus:ring-accent/20`,ut={en:{title:`You`,subtitle:`A living portrait, shaped together by you and xopc.`,profile:`Your portrait`,understanding:`Shared understanding`,collaboration:`Working together`,sources:`Sources`,dreaming:`Background review`,privacy:`Privacy`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`This is how xopc currently understands you. It grows through your conversations and work — and you always have the final say.`,maintainedTogether:`Shaped together`,youDecide:`You decide what stays`,editProfile:`Edit basics`,talkAboutMe:`Add through conversation`,roleMissing:`Add what you do`,direction:`What matters now`,directionEmpty:`Add a direction so xopc can help keep important work moving.`,portraitUnderstanding:`What xopc understands`,portraitUnderstandingHint:`Confirmed context xopc can use across conversations.`,portraitRules:`How we work together`,portraitRulesHint:`The agreements xopc should follow when helping you.`,reviewWaiting:`waiting for your review`,seeAll:`See all`,addFirstUnderstanding:`Nothing confirmed yet. Tell xopc what matters to you, or review a suggestion when one appears.`,addFirstRule:`No working agreements yet. Add one to make collaboration feel more like yours.`,portraitControl:`How this portrait evolves`,portraitControlHint:`Manage where understanding comes from, how it is reviewed, and what is never retained.`,portraitLearn:`Learn how this portrait is formed`,advanced:`Portrait controls`,backToPortrait:`Back to your portrait`,controlSourcesHint:`See which conversations, connections, and explicit details shape xopc’s understanding.`,controlReviewHint:`Choose how xopc proposes updates and which changes require your confirmation.`,controlPrivacyHint:`Set the boundaries for sensitive content and long-term retention.`,controlTrust:`Inferred understanding is never activated automatically. You can review, correct, or remove it at any time.`,profileHint:`Facts you provide directly. These are available across conversations.`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: product designer, founder, or engineer`,primaryGoal:`What are you mainly trying to achieve?`,primaryGoalPlaceholder:`The outcome you want xopc to optimize for`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,detect:`Use this device`,add:`Add`,cancel:`Cancel`,delete:`Delete`,confirmDelete:`Delete now`,rulesHint:`Explicit instructions for how xopc should collaborate with you. Rules outrank inferred understanding.`,addRule:`Add rule`,ruleStatement:`How should xopc work with you?`,category:`Category`,disable:`Disable`,enable:`Enable`,emptyRules:`No working agreements yet.`,sourcesHint:`Review every granted source, its latest learning result, access mode, and retention. Revoking stops future learning.`,manageSources:`Connect another source`,authorizedSources:`Authorized sources`,connectorsTitle:`Connectors`,openConnector:`Open connector`,noSources:`No sources are authorized.`,noConnectors:`No connectors are installed.`,connected:`Connected`,unavailable:`Needs attention`,revoke:`Revoke source`,revokeHint:`Review the impact before revoking this source`,revoking:`Revoking…`,revokeDone:`Source revoked.`,revokeImpact:`This source exclusively supports {{count}} context objects. Keeping them removes them from planning until reviewed.`,deleteDerived:`Revoke and delete`,retainDerived:`Revoke and keep for review`,refresh:`Update`,refreshing:`Updating…`,refreshStarted:`Update started.`,actionFailed:`Action failed`,once:`One-time`,continuous:`Continuous`,localOnly:`Local only`,derivedOnly:`Derived understanding only`,sourceQueued:`Queued`,sourceRunning:`Learning`,sourceCompleted:`Learned`,sourcePartial:`Partially learned`,sourceFailed:`Learning failed`,sourceNotRun:`Not collected yet`,sourceItems:`items reviewed`,sourceCandidates:`candidates formed`,sourceAccountUnavailable:`The connected account is unavailable. Reconnect it and try again.`,sourceSyncFailed:`This source could not be synchronized. Try updating it again.`,sourceAnalysisFailed:`Content was collected, but deeper understanding could not be completed. Try again later.`,contentReadTitle:`Additional deeper reading`,contentReadHint:`These items still need content to add useful context. Select up to 5 for one bounded read.`,readSelected:`Read selected`,reading:`Reading…`,contentReadDone:`Selected content was read and indexed.`,dreamingHint:`A deterministic daily review checks expiry, contradictory evidence, and corroborated candidates. It never auto-activates an inference.`,mode:`Background review`,on:`On — propose for review`,off:`Off`,reviewTime:`Daily review time`,evidenceThreshold:`Supporting evidence required`,scanLimit:`Maximum items per run`,lastRun:`Last review`,neverRun:`Not run yet`,runCompleted:`Completed`,runFailed:`Failed`,runRunning:`Running`,runItems:`items`,privacyHint:`Choose how generic memory providers handle sensitive content. Structured user understanding applies stricter rules of its own.`,sensitivePolicy:`Sensitive memory writes`,policyDeny:`Do not store`,policyConfirm:`Ask before storing`,policyAllow:`Store when relevant`,privacyWarning:`Secret and regulated content is never stored as structured user understanding, regardless of this setting.`,error:`Could not load your context.`,retry:`Try again`},zh:{title:`你`,subtitle:`一份由你和 xopc 共同塑造、持续生长的画像。`,profile:`你的画像`,understanding:`共同理解`,collaboration:`协作方式`,sources:`数据来源`,dreaming:`后台复核`,privacy:`隐私`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`这是 xopc 此刻对你的理解。它会在对话与共事中逐渐丰富,而你始终拥有最终决定权。`,maintainedTogether:`由你与 xopc 共同维护`,youDecide:`你决定什么被保留`,editProfile:`编辑基本信息`,talkAboutMe:`在对话中补充`,roleMissing:`补充你的角色`,direction:`此刻重要的事`,directionEmpty:`写下你此刻的方向,让 xopc 帮你持续推动真正重要的事。`,portraitUnderstanding:`xopc 对你的理解`,portraitUnderstandingHint:`已经确认、可以在不同对话中帮助你的上下文。`,portraitRules:`我们如何一起工作`,portraitRulesHint:`xopc 在帮助你时应该遵循的约定。`,reviewWaiting:`条等待你确认`,seeAll:`查看全部`,addFirstUnderstanding:`还没有已确认的理解。你可以直接告诉 xopc 什么对你重要,或在它形成建议后确认。`,addFirstRule:`还没有协作约定。添加后,xopc 会更像你熟悉的搭档。`,portraitControl:`这份画像如何更新`,portraitControlHint:`管理理解从哪里来、如何复核,以及哪些内容永远不会被保留。`,portraitLearn:`了解这份画像如何形成`,advanced:`画像管理`,backToPortrait:`返回你的画像`,controlSourcesHint:`查看哪些对话、连接与明确告知的内容塑造了 xopc 的理解。`,controlReviewHint:`决定 xopc 如何提出更新,以及哪些变化需要你确认。`,controlPrivacyHint:`设定敏感内容与长期保留的边界。`,controlTrust:`推断出的理解不会自动生效。你可以随时复核、修正或删除。`,profileHint:`由你直接提供的事实,会在不同对话中使用。`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:产品设计师、创业者、工程师`,primaryGoal:`你目前最想达成什么?`,primaryGoalPlaceholder:`希望 xopc 优先帮助你实现的结果`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,detect:`使用本机时区`,add:`添加`,cancel:`取消`,delete:`删除`,confirmDelete:`确认删除`,rulesHint:`你明确设定的协作方式。协作约定的优先级高于推断出的理解。`,addRule:`添加约定`,ruleStatement:`希望 xopc 如何与你协作?`,category:`类别`,disable:`停用`,enable:`启用`,emptyRules:`还没有协作约定。`,sourcesHint:`查看每项授权最近一次学习结果、访问方式与保留策略;撤销后将停止后续学习。`,manageSources:`连接其他来源`,authorizedSources:`已授权数据来源`,connectorsTitle:`连接器`,openConnector:`打开连接器`,noSources:`尚未授权任何来源。`,noConnectors:`尚未安装连接器。`,connected:`已连接`,unavailable:`需要处理`,revoke:`撤销来源`,revokeHint:`撤销前先查看影响范围`,revoking:`正在撤销…`,revokeDone:`已撤销来源。`,revokeImpact:`此来源是 {{count}} 个上下文对象的唯一依据。若保留,它们会先退出规划,等待复核。`,deleteDerived:`撤销并删除`,retainDerived:`撤销并保留待复核`,refresh:`更新`,refreshing:`正在更新…`,refreshStarted:`更新任务已开始。`,actionFailed:`操作失败`,once:`仅一次`,continuous:`持续更新`,localOnly:`仅本地处理`,derivedOnly:`仅保留派生理解`,sourceQueued:`等待中`,sourceRunning:`正在理解`,sourceCompleted:`理解完成`,sourcePartial:`部分完成`,sourceFailed:`理解失败`,sourceNotRun:`尚未采集`,sourceItems:`项已检查`,sourceCandidates:`项候选理解`,sourceAccountUnavailable:`连接的账号不可用,请重新连接后重试。`,sourceSyncFailed:`该来源同步失败,请再次更新。`,sourceAnalysisFailed:`内容已采集,但深入理解未完成,请稍后重试。`,contentReadTitle:`补充深入读取`,contentReadHint:`这些条目还需要正文才能形成有用上下文。你可以选择最多 5 项进行一次有界读取。`,readSelected:`读取所选内容`,reading:`正在读取…`,contentReadDone:`已读取并索引所选内容。`,dreamingHint:`每天进行一次确定性复核,检查过期、矛盾证据和得到佐证的候选理解;推断内容不会自动生效。`,mode:`后台复核`,on:`开启并生成待审核项`,off:`关闭`,reviewTime:`每日复核时间`,evidenceThreshold:`所需支持证据数`,scanLimit:`每次最多检查`,lastRun:`最近一次复核`,neverRun:`尚未运行`,runCompleted:`已完成`,runFailed:`失败`,runRunning:`运行中`,runItems:`项`,privacyHint:`选择通用记忆服务如何处理敏感内容;结构化用户理解有独立且更严格的规则。`,sensitivePolicy:`敏感记忆写入`,policyDeny:`不保存`,policyConfirm:`保存前询问`,policyAllow:`相关时允许保存`,privacyWarning:`无论这里如何设置,秘密和受监管内容都不会保存为结构化用户理解。`,error:`无法加载用户上下文。`,retry:`重试`}},dt={communication:{en:`Communication`,zh:`沟通`},execution:{en:`Execution`,zh:`执行`},boundary:{en:`Boundary`,zh:`边界`},routine:{en:`Routine`,zh:`习惯`},proactive:{en:`Proactive help`,zh:`主动协助`}};function ft(e){let t=(0,Q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:n}),t[0]=n,t[1]=r),r}function pt(e){let t=(0,Q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-10 text-center text-sm text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function mt(e){let t=(0,Q.c)(33),{open:n,onOpenChange:r,title:i,description:a,submitLabel:o,cancelLabel:s,submitDisabled:c,onSubmit:l,children:u}=e,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(v,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=d):d=t[0];let f;t[1]===i?f=t[2]:(f=(0,$.jsx)(C,{className:`text-base font-semibold text-fg`,children:i}),t[1]=i,t[2]=f);let p;t[3]===a?p=t[4]:(p=(0,$.jsx)(y,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a}),t[3]=a,t[4]=p);let m;t[5]!==f||t[6]!==p?(m=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[f,p]}),t[5]=f,t[6]=p,t[7]=m):m=t[7];let _;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(h,{className:`size-4`}),t[8]=_):_=t[8];let T;t[9]===s?T=t[10]:(T=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":s,children:_})}),t[9]=s,t[10]=T);let E;t[11]!==m||t[12]!==T?(E=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[m,T]}),t[11]=m,t[12]=T,t[13]=E):E=t[13];let D;t[14]===u?D=t[15]:(D=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:u}),t[14]=u,t[15]=D);let O;t[16]===s?O=t[17]:(O=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{type:`button`,children:s})}),t[16]=s,t[17]=O);let k;t[18]!==c||t[19]!==o?(k=(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:c,children:o}),t[18]=c,t[19]=o,t[20]=k):k=t[20];let A;t[21]!==k||t[22]!==O?(A=(0,$.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[O,k]}),t[21]=k,t[22]=O,t[23]=A):A=t[23];let j;t[24]!==l||t[25]!==A||t[26]!==E||t[27]!==D?(j=(0,$.jsxs)(x,{children:[d,(0,$.jsx)(S,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(30rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:l,children:[E,D,A]})})]}),t[24]=l,t[25]=A,t[26]=E,t[27]=D,t[28]=j):j=t[28];let M;return t[29]!==r||t[30]!==n||t[31]!==j?(M=(0,$.jsx)(w,{open:n,onOpenChange:r,children:j}),t[29]=r,t[30]=n,t[31]=j,t[32]=M):M=t[32],M}function ht(e){return JSON.stringify(e)}function gt(e){let t=(0,Q.c)(10),[n,r]=(0,Z.useState)(e),i;t[0]===e?i=t[1]:(i=ht(e),t[0]=e,t[1]=i);let a=(0,Z.useRef)(i),o;t[2]===e?o=t[3]:(o=ht(e),t[2]=e,t[3]=o);let s=o,c,l;t[4]!==e||t[5]!==s?(c=()=>{if(s===a.current)return;let t=a.current;a.current=s,r(n=>ht(n)===t?e:n)},l=[e,s],t[4]=e,t[5]=s,t[6]=c,t[7]=l):(c=t[6],l=t[7]),(0,Z.useEffect)(c,l);let u;return t[8]===n?u=t[9]:(u=[n,r],t[8]=n,t[9]=u),u}function _t(e){return{callName:e.callName,role:e.role,primaryGoal:e.primaryGoal,pronouns:e.pronouns,timezone:e.timezone,locale:e.locale}}function vt(){let e=(0,Q.c)(67),t=_(Ct),n=ut[t],[r,a]=i(),o;if(e[0]!==r){let t=r.get(`tab`);o=t&&ct.has(t)?t:`profile`,e[0]=r,e[1]=o}else o=e[1];let s=o,c=X(St),l=X(xt),{data:u,error:d,isLoading:f,mutate:p}=T(`/api/you`,G),m;e[2]!==l||e[3]!==c||e[4]!==n.subtitle||e[5]!==n.title?(m=()=>(c({startExtra:null,main:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:n.subtitle})]}),end:null}),l),e[2]=l,e[3]=c,e[4]=n.subtitle,e[5]=n.title,e[6]=m):m=e[6];let h;if(e[7]!==l||e[8]!==c||e[9]!==n?(h=[l,c,n],e[7]=l,e[8]=c,e[9]=n,e[10]=h):h=e[10],(0,Z.useEffect)(m,h),f){let t;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-6`,children:[(0,$.jsx)(U,{className:`h-10 w-96 max-w-full`}),(0,$.jsx)(U,{className:`h-72 rounded-2xl`})]}),e[11]=t):t=e[11],t}if(d||!u){let t;e[12]===p?t=e[13]:(t=()=>void p(),e[12]=p,e[13]=t);let r;e[14]!==n.retry||e[15]!==t?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:t,children:n.retry}),e[14]=n.retry,e[15]=t,e[16]=r):r=e[16];let i;return e[17]!==n.error||e[18]!==r?(i=(0,$.jsx)(`div`,{className:`p-6`,children:(0,$.jsxs)(pt,{children:[n.error,` `,r]})}),e[17]=n.error,e[18]=r,e[19]=i):i=e[19],i}let v=s===`sources`||s===`dreaming`||s===`privacy`,y;e[20]!==v||e[21]!==u||e[22]!==a||e[23]!==n.advanced||e[24]!==n.backToPortrait||e[25]!==n.collaboration||e[26]!==n.profile||e[27]!==n.title||e[28]!==n.understanding||e[29]!==s?(y=v?(0,$.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge pb-4`,children:[(0,$.jsxs)(g,{variant:`ghost`,className:`-ml-2`,onClick:()=>a({tab:`profile`}),children:[(0,$.jsx)(I,{className:`size-4`}),n.backToPortrait]}),(0,$.jsx)(`span`,{className:`h-4 w-px bg-edge`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n.advanced})]}):(0,$.jsx)(xe,{ariaLabel:n.title,activeTab:s,onChange:e=>a({tab:e}),items:[{id:`profile`,label:n.profile,icon:he},{id:`understanding`,label:n.understanding,icon:F,count:u.understandings.filter(bt).length+u.focuses.filter(yt).length||void 0},{id:`collaboration`,label:n.collaboration,icon:H}]}),e[20]=v,e[21]=u,e[22]=a,e[23]=n.advanced,e[24]=n.backToPortrait,e[25]=n.collaboration,e[26]=n.profile,e[27]=n.title,e[28]=n.understanding,e[29]=s,e[30]=y):y=e[30];let b;e[31]!==u||e[32]!==t||e[33]!==p||e[34]!==a||e[35]!==n||e[36]!==s?(b=s===`profile`?(0,$.jsx)(wt,{data:u,language:t,t:n,onNavigate:e=>a({tab:e}),onProfileChanged:e=>p(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[31]=u,e[32]=t,e[33]=p,e[34]=a,e[35]=n,e[36]=s,e[37]=b):b=e[37];let x;e[38]!==u||e[39]!==t||e[40]!==p||e[41]!==s?(x=s===`understanding`?(0,$.jsx)(Ge,{focuses:u.focuses,understandings:u.understandings,language:t,onRefresh:()=>p()}):null,e[38]=u,e[39]=t,e[40]=p,e[41]=s,e[42]=x):x=e[42];let S;e[43]!==u||e[44]!==t||e[45]!==p||e[46]!==n||e[47]!==s?(S=s===`collaboration`?(0,$.jsx)(Pt,{rules:u.rules,language:t,t:n,onChanged:()=>p()}):null,e[43]=u,e[44]=t,e[45]=p,e[46]=n,e[47]=s,e[48]=S):S=e[48];let C;e[49]!==n||e[50]!==s?(C=s===`sources`?(0,$.jsx)(Lt,{t:n}):null,e[49]=n,e[50]=s,e[51]=C):C=e[51];let w;e[52]!==u||e[53]!==n||e[54]!==s?(w=s===`dreaming`?(0,$.jsx)(Rt,{lastRun:u.consolidation?.lastRun??null,t:n}):null,e[52]=u,e[53]=n,e[54]=s,e[55]=w):w=e[55];let E;e[56]!==n||e[57]!==s?(E=s===`privacy`?(0,$.jsx)(Bt,{t:n}):null,e[56]=n,e[57]=s,e[58]=E):E=e[58];let D;return e[59]!==y||e[60]!==b||e[61]!==x||e[62]!==S||e[63]!==C||e[64]!==w||e[65]!==E?(D=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[y,b,x,S,C,w,E]}),e[59]=y,e[60]=b,e[61]=x,e[62]=S,e[63]=C,e[64]=w,e[65]=E,e[66]=D):D=e[66],D}function yt(e){return e.status===`candidate`}function bt(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function xt(e){return e.clearPageHeader}function St(e){return e.setPageHeader}function Ct(e){return e.language}function wt(e){let t=(0,Q.c)(179),{data:n,language:r,t:i,onNavigate:o,onProfileChanged:s}=e,[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),f,p,m,h,_,v,y,b,x,S;if(t[0]!==n.focuses||t[1]!==n.profile.callName||t[2]!==n.profile.primaryGoal||t[3]!==n.profile.role||t[4]!==n.rules||t[5]!==n.understandings||t[6]!==r||t[7]!==o||t[8]!==i.addFirstRule||t[9]!==i.addFirstUnderstanding||t[10]!==i.advanced||t[11]!==i.direction||t[12]!==i.directionEmpty||t[13]!==i.editProfile||t[14]!==i.maintainedTogether||t[15]!==i.portraitEyebrow||t[16]!==i.portraitIntro||t[17]!==i.portraitRules||t[18]!==i.portraitRulesHint||t[19]!==i.portraitUnderstanding||t[20]!==i.portraitUnderstandingHint||t[21]!==i.reviewWaiting||t[22]!==i.roleMissing||t[23]!==i.seeAll||t[24]!==i.talkAboutMe||t[25]!==i.youDecide){let e=n.understandings.filter(Ot),s;t[36]===n.understandings?s=t[37]:(s=n.understandings.filter(Dt),t[36]=n.understandings,t[37]=s);let c=s.length,u;t[38]===n.focuses?u=t[39]:(u=n.focuses.filter(Et),t[38]=n.focuses,t[39]=u);let C=c+u.length,w=n.rules.filter(Tt),T,D;t[40]!==n.profile.callName||t[41]!==r?(T=n.profile.callName.trim()||(r===`zh`?`你`:`You`),D=[...T][0]?.toLocaleUpperCase()??`Y`,t[40]=n.profile.callName,t[41]=r,t[42]=T,t[43]=D):(T=t[42],D=t[43]);let k=D;x=`space-y-5`;let A;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-accent/40 to-transparent`,"aria-hidden":`true`}),t[44]=A):A=t[44];let j;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(E,{className:`size-3.5`}),t[45]=j):j=t[45];let P;t[46]===i.portraitEyebrow?P=t[47]:(P=(0,$.jsxs)(`div`,{className:`mb-7 flex items-center gap-2 text-[11px] font-semibold tracking-[0.18em] text-accent`,children:[j,i.portraitEyebrow]}),t[46]=i.portraitEyebrow,t[47]=P);let I;t[48]===k?I=t[49]:(I=(0,$.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl border border-edge bg-surface-muted text-2xl font-semibold text-fg sm:size-20 sm:text-3xl`,children:k}),t[48]=k,t[49]=I);let L;t[50]===T?L=t[51]:(L=(0,$.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:T}),t[50]=T,t[51]=L);let R;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>l(!0),t[52]=R):R=t[52];let z;t[53]!==n.profile.role||t[54]!==i.roleMissing?(z=n.profile.role.trim()||i.roleMissing,t[53]=n.profile.role,t[54]=i.roleMissing,t[55]=z):z=t[55];let B;t[56]===z?B=t[57]:(B=(0,$.jsx)(`button`,{className:`mt-1 text-left text-sm text-fg-muted transition-colors hover:text-accent`,onClick:R,children:z}),t[56]=z,t[57]=B);let V;t[58]!==L||t[59]!==B?(V=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[L,B]}),t[58]=L,t[59]=B,t[60]=V):V=t[60];let U;t[61]!==I||t[62]!==V?(U=(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[I,V]}),t[61]=I,t[62]=V,t[63]=U):U=t[63];let W;t[64]===i.portraitIntro?W=t[65]:(W=(0,$.jsx)(`p`,{className:`mt-7 max-w-2xl text-base leading-7 text-fg-muted`,children:i.portraitIntro}),t[64]=i.portraitIntro,t[65]=W);let G;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`}),t[66]=G):G=t[66];let K;t[67]===i.maintainedTogether?K=t[68]:(K=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[G,i.maintainedTogether]}),t[67]=i.maintainedTogether,t[68]=K);let ee,q;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>d(!0),q=(0,$.jsx)(M,{className:`size-3.5`}),t[69]=ee,t[70]=q):(ee=t[69],q=t[70]);let ne;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t[71]=ne):ne=t[71];let re;t[72]===i.advanced?re=t[73]:(re=(0,$.jsx)(`span`,{className:`font-medium text-accent`,children:i.advanced}),t[72]=i.advanced,t[73]=re);let ie;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(O,{className:`size-3`}),t[74]=ie):ie=t[74];let ae;t[75]!==i.youDecide||t[76]!==re?(ae=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1.5 rounded-md transition-colors hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,onClick:ee,children:[q,i.youDecide,ne,re,ie]}),t[75]=i.youDecide,t[76]=re,t[77]=ae):ae=t[77];let J;t[78]!==K||t[79]!==ae?(J=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-x-5 gap-y-2 text-xs text-fg-subtle`,children:[K,ae]}),t[78]=K,t[79]=ae,t[80]=J):J=t[80];let oe;t[81]!==P||t[82]!==U||t[83]!==W||t[84]!==J?(oe=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[P,U,W,J]}),t[81]=P,t[82]=U,t[83]=W,t[84]=J,t[85]=oe):oe=t[85];let se;t[86]===i.direction?se=t[87]:(se=(0,$.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.12em] text-fg-subtle`,children:i.direction}),t[86]=i.direction,t[87]=se);let ce=`mt-4 text-base leading-7 ${n.profile.primaryGoal.trim()?`text-fg`:`text-fg-muted`}`,le;t[88]!==n.profile.primaryGoal||t[89]!==i.directionEmpty?(le=n.profile.primaryGoal.trim()||i.directionEmpty,t[88]=n.profile.primaryGoal,t[89]=i.directionEmpty,t[90]=le):le=t[90];let Y;t[91]!==ce||t[92]!==le?(Y=(0,$.jsx)(`p`,{className:ce,children:le}),t[91]=ce,t[92]=le,t[93]=Y):Y=t[93];let X;t[94]!==se||t[95]!==Y?(X=(0,$.jsxs)(`div`,{children:[se,Y]}),t[94]=se,t[95]=Y,t[96]=X):X=t[96];let de;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(te,{className:`size-4`}),t[97]=de):de=t[97];let fe;t[98]===i.talkAboutMe?fe=t[99]:(fe=(0,$.jsx)(g,{variant:`primary`,asChild:!0,children:(0,$.jsxs)(a,{to:`/chat/new`,children:[de,i.talkAboutMe]})}),t[98]=i.talkAboutMe,t[99]=fe);let pe,me;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>l(!0),me=(0,$.jsx)(ue,{className:`size-4`}),t[100]=pe,t[101]=me):(pe=t[100],me=t[101]);let he;t[102]===i.editProfile?he=t[103]:(he=(0,$.jsxs)(g,{onClick:pe,children:[me,i.editProfile]}),t[102]=i.editProfile,t[103]=he);let ge;t[104]!==fe||t[105]!==he?(ge=(0,$.jsxs)(`div`,{className:`mt-8 flex flex-wrap gap-2`,children:[fe,he]}),t[104]=fe,t[105]=he,t[106]=ge):ge=t[106];let _e;t[107]!==X||t[108]!==ge?(_e=(0,$.jsxs)(`div`,{className:`flex flex-col justify-between rounded-2xl border border-edge bg-surface-base/70 p-5 sm:p-6`,children:[X,ge]}),t[107]=X,t[108]=ge,t[109]=_e):_e=t[109],t[110]!==oe||t[111]!==_e?(S=(0,$.jsxs)(`section`,{className:`relative overflow-hidden rounded-3xl border border-edge bg-surface-panel`,children:[A,(0,$.jsxs)(`div`,{className:`grid gap-8 px-5 py-7 sm:px-8 sm:py-9 lg:grid-cols-[minmax(0,1fr)_20rem] lg:gap-12 lg:px-10 lg:py-11`,children:[oe,_e]})]}),t[110]=oe,t[111]=_e,t[112]=S):S=t[112],y=`grid gap-5 lg:grid-cols-2`;let ve;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,$.jsx)(F,{className:`size-4`}),t[113]=ve):ve=t[113];let ye;t[114]===o?ye=t[115]:(ye=()=>o(`understanding`),t[114]=o,t[115]=ye);let be;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,$.jsx)(O,{className:`size-3.5`}),t[116]=be):be=t[116];let xe;t[117]!==i.seeAll||t[118]!==ye?(xe=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,onClick:ye,children:[i.seeAll,be]}),t[117]=i.seeAll,t[118]=ye,t[119]=xe):xe=t[119];let Z;t[120]!==o||t[121]!==C||t[122]!==i.reviewWaiting?(Z=C?(0,$.jsxs)(`button`,{className:`mb-4 flex w-full items-center justify-between rounded-xl border border-accent/20 bg-accent-soft px-3 py-2.5 text-left text-xs text-accent transition-colors hover:border-accent/40`,onClick:()=>o(`understanding`),children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(E,{className:`mr-1.5 inline size-3.5`}),C,` `,i.reviewWaiting]}),(0,$.jsx)(N,{className:`size-3.5`})]}):null,t[120]=o,t[121]=C,t[122]=i.reviewWaiting,t[123]=Z):Z=t[123];let Q=e.length?(0,$.jsx)(`div`,{className:`space-y-1`,children:e.slice(0,4).map(e=>(0,$.jsxs)(`div`,{className:`group flex gap-3 rounded-xl px-2 py-2.5 transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full bg-accent/70`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:je[e.kind][r]})]})]},e.id))}):(0,$.jsx)(`p`,{className:`py-5 text-sm leading-6 text-fg-muted`,children:i.addFirstUnderstanding});t[124]!==i.portraitUnderstanding||t[125]!==i.portraitUnderstandingHint||t[126]!==xe||t[127]!==Z||t[128]!==Q?(b=(0,$.jsxs)(kt,{icon:ve,title:i.portraitUnderstanding,description:i.portraitUnderstandingHint,action:xe,children:[Z,Q]}),t[124]=i.portraitUnderstanding,t[125]=i.portraitUnderstandingHint,t[126]=xe,t[127]=Z,t[128]=Q,t[129]=b):b=t[129],f=kt,t[130]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(H,{className:`size-4`}),t[130]=p):p=t[130],m=i.portraitRules,h=i.portraitRulesHint;let Se;t[131]===o?Se=t[132]:(Se=()=>o(`collaboration`),t[131]=o,t[132]=Se);let Ce;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,$.jsx)(O,{className:`size-3.5`}),t[133]=Ce):Ce=t[133],t[134]!==i.seeAll||t[135]!==Se?(_=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,onClick:Se,children:[i.seeAll,Ce]}),t[134]=i.seeAll,t[135]=Se,t[136]=_):_=t[136],v=w.length?(0,$.jsx)(`div`,{className:`space-y-1`,children:w.slice(0,4).map(e=>(0,$.jsxs)(`div`,{className:`flex gap-3 rounded-xl px-2 py-2.5 transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full bg-fg-subtle`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:dt[e.category][r]})]})]},e.id))}):(0,$.jsx)(`p`,{className:`py-5 text-sm leading-6 text-fg-muted`,children:i.addFirstRule}),t[0]=n.focuses,t[1]=n.profile.callName,t[2]=n.profile.primaryGoal,t[3]=n.profile.role,t[4]=n.rules,t[5]=n.understandings,t[6]=r,t[7]=o,t[8]=i.addFirstRule,t[9]=i.addFirstUnderstanding,t[10]=i.advanced,t[11]=i.direction,t[12]=i.directionEmpty,t[13]=i.editProfile,t[14]=i.maintainedTogether,t[15]=i.portraitEyebrow,t[16]=i.portraitIntro,t[17]=i.portraitRules,t[18]=i.portraitRulesHint,t[19]=i.portraitUnderstanding,t[20]=i.portraitUnderstandingHint,t[21]=i.reviewWaiting,t[22]=i.roleMissing,t[23]=i.seeAll,t[24]=i.talkAboutMe,t[25]=i.youDecide,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=_,t[31]=v,t[32]=y,t[33]=b,t[34]=x,t[35]=S}else f=t[26],p=t[27],m=t[28],h=t[29],_=t[30],v=t[31],y=t[32],b=t[33],x=t[34],S=t[35];let C;t[137]!==f||t[138]!==p||t[139]!==m||t[140]!==h||t[141]!==_||t[142]!==v?(C=(0,$.jsx)(f,{icon:p,title:m,description:h,action:_,children:v}),t[137]=f,t[138]=p,t[139]=m,t[140]=h,t[141]=_,t[142]=v,t[143]=C):C=t[143];let w;t[144]!==C||t[145]!==y||t[146]!==b?(w=(0,$.jsxs)(`div`,{className:y,children:[b,C]}),t[144]=C,t[145]=y,t[146]=b,t[147]=w):w=t[147];let T;t[148]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>d(!0),t[148]=T):T=t[148];let D;t[149]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:(0,$.jsx)(z,{className:`size-4`})}),t[149]=D):D=t[149];let k;t[150]===i.portraitLearn?k=t[151]:(k=(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:i.portraitLearn}),t[150]=i.portraitLearn,t[151]=k);let A;t[152]===i.portraitControlHint?A=t[153]:(A=(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i.portraitControlHint}),t[152]=i.portraitControlHint,t[153]=A);let j;t[154]!==k||t[155]!==A?(j=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[k,A]}),t[154]=k,t[155]=A,t[156]=j):j=t[156];let P;t[157]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(O,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`}),t[157]=P):P=t[157];let I;t[158]===j?I=t[159]:(I=(0,$.jsxs)(`button`,{className:`group flex w-full items-center gap-4 rounded-2xl border border-edge bg-surface-panel px-5 py-4 text-left transition-colors hover:bg-surface-hover sm:px-6`,onClick:T,children:[D,j,P]}),t[158]=j,t[159]=I);let L;t[160]!==n.profile||t[161]!==c||t[162]!==r||t[163]!==s||t[164]!==i?(L=(0,$.jsx)(jt,{open:c,onOpenChange:l,profile:n.profile,language:r,t:i,onChanged:s}),t[160]=n.profile,t[161]=c,t[162]=r,t[163]=s,t[164]=i,t[165]=L):L=t[165];let R;t[166]===o?R=t[167]:(R=e=>{d(!1),o(e)},t[166]=o,t[167]=R);let B;t[168]!==u||t[169]!==i||t[170]!==R?(B=(0,$.jsx)(At,{open:u,onOpenChange:d,t:i,onNavigate:R}),t[168]=u,t[169]=i,t[170]=R,t[171]=B):B=t[171];let V;return t[172]!==w||t[173]!==I||t[174]!==L||t[175]!==B||t[176]!==x||t[177]!==S?(V=(0,$.jsxs)(`div`,{className:x,children:[S,w,I,L,B]}),t[172]=w,t[173]=I,t[174]=L,t[175]=B,t[176]=x,t[177]=S,t[178]=V):V=t[178],V}function Tt(e){return e.status===`active`}function Et(e){return e.status===`candidate`}function Dt(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function Ot(e){return e.status===`active`}function kt(e){let t=(0,Q.c)(20),{icon:n,title:r,description:i,action:a,children:o}=e,s;t[0]===n?s=t[1]:(s=(0,$.jsx)(`span`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==a||t[5]!==c?(l=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,a]}),t[4]=a,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i}),t[7]=i,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]!==s||t[13]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[s,d]}),t[12]=s,t[13]=d,t[14]=f):f=t[14];let p;t[15]===o?p=t[16]:(p=(0,$.jsx)(`div`,{className:`mt-4 border-t border-edge pt-3`,children:o}),t[15]=o,t[16]=p);let m;return t[17]!==f||t[18]!==p?(m=(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5 sm:p-6`,children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function At(e){let t=(0,Q.c)(47),{open:n,onOpenChange:r,t:i,onNavigate:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(P,{className:`size-4`}),t[0]=o):o=t[0];let s;t[1]!==i.controlSourcesHint||t[2]!==i.sources?(s={tab:`sources`,icon:o,label:i.sources,description:i.controlSourcesHint},t[1]=i.controlSourcesHint,t[2]=i.sources,t[3]=s):s=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(J,{className:`size-4`}),t[4]=c):c=t[4];let l;t[5]!==i.controlReviewHint||t[6]!==i.dreaming?(l={tab:`dreaming`,icon:c,label:i.dreaming,description:i.controlReviewHint},t[5]=i.controlReviewHint,t[6]=i.dreaming,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(M,{className:`size-4`}),t[8]=u):u=t[8];let d;t[9]!==i.controlPrivacyHint||t[10]!==i.privacy?(d={tab:`privacy`,icon:u,label:i.privacy,description:i.controlPrivacyHint},t[9]=i.controlPrivacyHint,t[10]=i.privacy,t[11]=d):d=t[11];let f;t[12]!==s||t[13]!==l||t[14]!==d?(f=[s,l,d],t[12]=s,t[13]=l,t[14]=d,t[15]=f):f=t[15];let p=f,m;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(v,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[16]=m):m=t[16];let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`div`,{className:`mb-3 flex size-9 items-center justify-center rounded-xl bg-accent-soft text-accent`,children:(0,$.jsx)(z,{className:`size-4`})}),t[17]=_):_=t[17];let T;t[18]===i.portraitControl?T=t[19]:(T=(0,$.jsx)(C,{className:`text-lg font-semibold tracking-tight text-fg`,children:i.portraitControl}),t[18]=i.portraitControl,t[19]=T);let E;t[20]===i.portraitControlHint?E=t[21]:(E=(0,$.jsx)(y,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:i.portraitControlHint}),t[20]=i.portraitControlHint,t[21]=E);let D;t[22]!==T||t[23]!==E?(D=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[_,T,E]}),t[22]=T,t[23]=E,t[24]=D):D=t[24];let k;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(h,{className:`size-4`}),t[25]=k):k=t[25];let A;t[26]===i.cancel?A=t[27]:(A=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":i.cancel,children:k})}),t[26]=i.cancel,t[27]=A);let j;t[28]!==D||t[29]!==A?(j=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-5 sm:px-6 sm:py-6`,children:[D,A]}),t[28]=D,t[29]=A,t[30]=j):j=t[30];let N;t[31]!==p||t[32]!==a?(N=(0,$.jsx)(`div`,{className:`space-y-3`,children:p.map(e=>(0,$.jsxs)(`button`,{className:`group flex w-full items-start gap-4 rounded-2xl border border-edge bg-surface-base p-4 text-left transition-colors hover:border-edge-strong hover:bg-surface-hover`,onClick:()=>a(e.tab),children:[(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted transition-colors group-hover:text-accent`,children:e.icon}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.label}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.description})]}),(0,$.jsx)(O,{className:`mt-2.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},e.tab))}),t[31]=p,t[32]=a,t[33]=N):N=t[33];let F;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-success`}),t[34]=F):F=t[34];let I;t[35]===i.controlTrust?I=t[36]:(I=(0,$.jsxs)(`div`,{className:`mt-6 flex gap-3 rounded-2xl bg-surface-muted p-4`,children:[F,(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i.controlTrust})]}),t[35]=i.controlTrust,t[36]=I);let L;t[37]!==N||t[38]!==I?(L=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:[N,I]}),t[37]=N,t[38]=I,t[39]=L):L=t[39];let R;t[40]!==j||t[41]!==L?(R=(0,$.jsxs)(x,{children:[m,(0,$.jsx)(S,{className:`fixed inset-y-0 right-0 z-[90] h-full w-[min(30rem,100vw)] overflow-hidden border-l border-edge bg-surface-panel shadow-popover outline-none sm:rounded-l-2xl`,children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[j,L]})})]}),t[40]=j,t[41]=L,t[42]=R):R=t[42];let B;return t[43]!==r||t[44]!==n||t[45]!==R?(B=(0,$.jsx)(w,{open:n,onOpenChange:r,children:R}),t[43]=r,t[44]=n,t[45]=R,t[46]=B):B=t[46],B}function jt(e){let t=(0,Q.c)(26),{open:n,onOpenChange:r,profile:i,language:a,t:o,onChanged:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(v,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=c):c=t[0];let l;t[1]===o.editProfile?l=t[2]:(l=(0,$.jsx)(C,{className:`text-base font-semibold text-fg`,children:o.editProfile}),t[1]=o.editProfile,t[2]=l);let u;t[3]===o.profileHint?u=t[4]:(u=(0,$.jsx)(y,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.profileHint}),t[3]=o.profileHint,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,$.jsxs)(`div`,{children:[l,u]}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(h,{className:`size-4`}),t[8]=f):f=t[8];let p;t[9]===o.cancel?p=t[10]:(p=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":o.cancel,children:f})}),t[9]=o.cancel,t[10]=p);let m;t[11]!==d||t[12]!==p?(m=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4 sm:px-6`,children:[d,p]}),t[11]=d,t[12]=p,t[13]=m):m=t[13];let _;t[14]!==a||t[15]!==s||t[16]!==i||t[17]!==o?(_=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:(0,$.jsx)(Mt,{profile:i,language:a,t:o,onChanged:s,bare:!0})}),t[14]=a,t[15]=s,t[16]=i,t[17]=o,t[18]=_):_=t[18];let T;t[19]!==m||t[20]!==_?(T=(0,$.jsxs)(x,{children:[c,(0,$.jsx)(S,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(42rem,calc(100vh-2rem))] w-[min(44rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[m,_]})})]}),t[19]=m,t[20]=_,t[21]=T):T=t[21];let E;return t[22]!==r||t[23]!==n||t[24]!==T?(E=(0,$.jsx)(w,{open:n,onOpenChange:r,children:T}),t[22]=r,t[23]=n,t[24]=T,t[25]=E):E=t[25],E}function Mt(e){let t=(0,Q.c)(80),{profile:n,language:r,t:i,onChanged:a,bare:o}=e,s=o===void 0?!1:o,c;t[0]===n?c=t[1]:(c=_t(n),t[0]=n,t[1]=c);let l=c,[u,d]=gt(l),f;t[2]===u?f=t[3]:(f=ht(u),t[2]=u,t[3]=f);let p;t[4]===l?p=t[5]:(p=ht(l),t[4]=l,t[5]=p);let m=f!==p,h;t[6]!==a||t[7]!==n?(h=async e=>{await a((await ae({...e,accessibility:n.accessibility})).profile)},t[6]=a,t[7]=n,t[8]=h):h=t[8];let _;t[9]!==u||t[10]!==m||t[11]!==h?(_={value:u,dirty:m,delayMs:500,onSave:h},t[9]=u,t[10]=m,t[11]=h,t[12]=_):_=t[12];let v=ye(_),y;t[13]!==u||t[14]!==d?(y=(e,t,n)=>(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,$.jsx)(`input`,{className:lt,placeholder:n,value:u[e],onChange:t=>d(n=>({...n,[e]:t.target.value}))})]}),t[13]=u,t[14]=d,t[15]=y):y=t[15];let b=y,x=v.onBlurCapture,S;t[16]!==b||t[17]!==i.callName||t[18]!==i.callNamePlaceholder?(S=b(`callName`,i.callName,i.callNamePlaceholder),t[16]=b,t[17]=i.callName,t[18]=i.callNamePlaceholder,t[19]=S):S=t[19];let C;t[20]!==b||t[21]!==i.role||t[22]!==i.rolePlaceholder?(C=b(`role`,i.role,i.rolePlaceholder),t[20]=b,t[21]=i.role,t[22]=i.rolePlaceholder,t[23]=C):C=t[23];let w;t[24]===i.primaryGoal?w=t[25]:(w=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.primaryGoal}),t[24]=i.primaryGoal,t[25]=w);let T;t[26]===d?T=t[27]:(T=e=>d(t=>({...t,primaryGoal:e.target.value})),t[26]=d,t[27]=T);let E;t[28]!==u.primaryGoal||t[29]!==i.primaryGoalPlaceholder||t[30]!==T?(E=(0,$.jsx)(`textarea`,{className:lt,rows:3,placeholder:i.primaryGoalPlaceholder,value:u.primaryGoal,onChange:T}),t[28]=u.primaryGoal,t[29]=i.primaryGoalPlaceholder,t[30]=T,t[31]=E):E=t[31];let D;t[32]!==w||t[33]!==E?(D=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[w,E]}),t[32]=w,t[33]=E,t[34]=D):D=t[34];let O;t[35]!==b||t[36]!==r||t[37]!==i.pronouns||t[38]!==i.pronounsPlaceholder?(O=r===`en`?b(`pronouns`,i.pronouns,i.pronounsPlaceholder):null,t[35]=b,t[36]=r,t[37]=i.pronouns,t[38]=i.pronounsPlaceholder,t[39]=O):O=t[39];let k;t[40]===i.timezone?k=t[41]:(k=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[40]=i.timezone,t[41]=k);let A;t[42]===d?A=t[43]:(A=e=>d(t=>({...t,timezone:e.target.value})),t[42]=d,t[43]=A);let j;t[44]!==u.timezone||t[45]!==A?(j=(0,$.jsx)(`input`,{className:`${lt} min-w-0 flex-1`,value:u.timezone,onChange:A}),t[44]=u.timezone,t[45]=A,t[46]=j):j=t[46];let M;t[47]===d?M=t[48]:(M=()=>d(Nt),t[47]=d,t[48]=M);let N;t[49]!==i.detect||t[50]!==M?(N=(0,$.jsx)(g,{className:`shrink-0 whitespace-nowrap`,onClick:M,children:i.detect}),t[49]=i.detect,t[50]=M,t[51]=N):N=t[51];let P;t[52]!==j||t[53]!==N?(P=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[j,N]}),t[52]=j,t[53]=N,t[54]=P):P=t[54];let F;t[55]!==k||t[56]!==P?(F=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[k,P]}),t[55]=k,t[56]=P,t[57]=F):F=t[57];let I;t[58]!==b||t[59]!==i.locale?(I=b(`locale`,i.locale),t[58]=b,t[59]=i.locale,t[60]=I):I=t[60];let L;t[61]!==S||t[62]!==C||t[63]!==D||t[64]!==O||t[65]!==F||t[66]!==I?(L=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[S,C,D,O,F,I]}),t[61]=S,t[62]=C,t[63]=D,t[64]=O,t[65]=F,t[66]=I,t[67]=L):L=t[67];let R;t[68]!==v.error||t[69]!==v.status?(R=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ve,{status:v.status,error:v.error})}),t[68]=v.error,t[69]=v.status,t[70]=R):R=t[70];let z;t[71]!==v.onBlurCapture||t[72]!==L||t[73]!==R?(z=(0,$.jsxs)(`div`,{onBlurCapture:x,children:[L,R]}),t[71]=v.onBlurCapture,t[72]=L,t[73]=R,t[74]=z):z=t[74];let B=z;if(s)return B;let V;t[75]===i.profileHint?V=t[76]:(V=(0,$.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-fg-muted`,children:i.profileHint}),t[75]=i.profileHint,t[76]=V);let H;return t[77]!==B||t[78]!==V?(H=(0,$.jsxs)(ft,{children:[V,B]}),t[77]=B,t[78]=V,t[79]=H):H=t[79],H}function Nt(e){return{...e,timezone:ie()}}function Pt(e){let t=(0,Q.c)(80),{rules:n,language:r,t:i,onChanged:a}=e,[o,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(`communication`),[h,_]=(0,Z.useState)(null),v,y,b,x,S,C;if(t[0]!==o||t[1]!==f||t[2]!==h||t[3]!==r||t[4]!==a||t[5]!==n||t[6]!==u||t[7]!==i.add||t[8]!==i.addRule||t[9]!==i.cancel||t[10]!==i.category||t[11]!==i.collaboration||t[12]!==i.confirmDelete||t[13]!==i.delete||t[14]!==i.disable||t[15]!==i.emptyRules||t[16]!==i.enable||t[17]!==i.ruleStatement||t[18]!==i.rulesHint){let e=n.filter(Ft),w;t[25]!==f||t[26]!==a||t[27]!==u?(w=async e=>{e.preventDefault(),u.trim()&&(await q({statement:u,category:f}),d(``),l(!1),await a())},t[25]=f,t[26]=a,t[27]=u,t[28]=w):w=t[28];let T=w;x=`space-y-5`;let E;t[29]===i.rulesHint?E=t[30]:(E=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[29]=i.rulesHint,t[30]=E);let D,O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>l(!0),D=(0,$.jsx)(m,{className:`size-4`}),t[31]=D,t[32]=O):(D=t[31],O=t[32]);let k;t[33]===i.addRule?k=t[34]:(k=(0,$.jsxs)(g,{variant:`primary`,onClick:O,children:[D,i.addRule]}),t[33]=i.addRule,t[34]=k),t[35]!==k||t[36]!==E?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[35]=k,t[36]=E,t[37]=S):S=t[37];let A=i.addRule,j=i.rulesHint,M=i.add,N=i.cancel,P;t[38]===u?P=t[39]:(P=u.trim(),t[38]=u,t[39]=P);let F=!P,I;t[40]===i.ruleStatement?I=t[41]:(I=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.ruleStatement}),t[40]=i.ruleStatement,t[41]=I);let L;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>d(e.target.value),t[42]=L):L=t[42];let R;t[43]!==u||t[44]!==i.ruleStatement?(R=(0,$.jsx)(`textarea`,{autoFocus:!0,className:lt,rows:4,placeholder:i.ruleStatement,value:u,onChange:L}),t[43]=u,t[44]=i.ruleStatement,t[45]=R):R=t[45];let z;t[46]!==I||t[47]!==R?(z=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[I,R]}),t[46]=I,t[47]=R,t[48]=z):z=t[48];let B;t[49]===i.category?B=t[50]:(B=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.category}),t[49]=i.category,t[50]=B);let H,U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>p(e.target.value),U=Object.entries(dt),t[51]=H,t[52]=U):(H=t[51],U=t[52]);let W;t[53]===r?W=t[54]:(W=U.map(e=>{let[t,n]=e;return(0,$.jsx)(c,{value:t,children:n[r]},t)}),t[53]=r,t[54]=W);let G;t[55]!==f||t[56]!==W?(G=(0,$.jsx)(s,{value:f,onChange:H,children:W}),t[55]=f,t[56]=W,t[57]=G):G=t[57];let K;t[58]!==B||t[59]!==G?(K=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[B,G]}),t[58]=B,t[59]=G,t[60]=K):K=t[60],t[61]!==o||t[62]!==T||t[63]!==i.add||t[64]!==i.addRule||t[65]!==i.cancel||t[66]!==i.rulesHint||t[67]!==F||t[68]!==z||t[69]!==K?(C=(0,$.jsxs)(mt,{open:o,onOpenChange:l,title:A,description:j,submitLabel:M,cancelLabel:N,submitDisabled:F,onSubmit:T,children:[z,K]}),t[61]=o,t[62]=T,t[63]=i.add,t[64]=i.addRule,t[65]=i.cancel,t[66]=i.rulesHint,t[67]=F,t[68]=z,t[69]=K,t[70]=C):C=t[70],v=`space-y-2`,y=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.collaboration,` · `,e.length]}),b=e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-2 px-4 py-3 sm:flex-row sm:items-start sm:gap-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 ${e.status===`disabled`?`text-fg-subtle line-through`:`text-fg`}`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:dt[e.category][r]}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[`P`,e.priority]}),e.status===`disabled`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:i.disable})]}):null]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[(0,$.jsx)(g,{variant:`ghost`,onClick:async()=>{await V(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,$.jsxs)(g,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(h!==e.id){_(e.id);return}await se(e.id),_(null),await a()},children:[(0,$.jsx)(re,{className:`size-3.5`}),h===e.id?i.confirmDelete:i.delete]})]})]},e.id))}):(0,$.jsx)(pt,{children:i.emptyRules}),t[0]=o,t[1]=f,t[2]=h,t[3]=r,t[4]=a,t[5]=n,t[6]=u,t[7]=i.add,t[8]=i.addRule,t[9]=i.cancel,t[10]=i.category,t[11]=i.collaboration,t[12]=i.confirmDelete,t[13]=i.delete,t[14]=i.disable,t[15]=i.emptyRules,t[16]=i.enable,t[17]=i.ruleStatement,t[18]=i.rulesHint,t[19]=v,t[20]=y,t[21]=b,t[22]=x,t[23]=S,t[24]=C}else v=t[19],y=t[20],b=t[21],x=t[22],S=t[23],C=t[24];let w;t[71]!==v||t[72]!==y||t[73]!==b?(w=(0,$.jsxs)(`section`,{className:v,children:[y,b]}),t[71]=v,t[72]=y,t[73]=b,t[74]=w):w=t[74];let T;return t[75]!==x||t[76]!==S||t[77]!==C||t[78]!==w?(T=(0,$.jsxs)(`div`,{className:x,children:[S,C,w]}),t[75]=x,t[76]=S,t[77]=C,t[78]=w,t[79]=T):T=t[79],T}function Ft(e){return e.status!==`archived`}async function It(){let[e,t,n]=await Promise.all([de(),R(),A()]);return{...e,connectors:t,catalog:n}}function Lt({t:e}){let{data:t,error:n,isLoading:r,mutate:i}=T(`you-understanding-sources`,It,{refreshInterval:5e3}),{data:o=[],mutate:s}=T(`you-connected-content-candidates`,ne),[c,l]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),[m,h]=(0,Z.useState)(null),[_,v]=(0,Z.useState)([]),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(null);if(r)return(0,$.jsx)(U,{className:`h-64 rounded-2xl`});if(n)return(0,$.jsxs)(pt,{children:[e.error,` `,(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:()=>void i(),children:e.retry})]});let C=t?.grants??[],w=t?.connectors??[],E=new Map((t?.catalog??[]).map(e=>[e.id,e])),k=t?.latestRuns??{},A=t=>t?t.status===`completed`?e.sourceCompleted:t.status===`partial`?e.sourcePartial:t.status===`failed`||t.status===`canceled`?e.sourceFailed:t.status===`running`?e.sourceRunning:e.sourceQueued:e.sourceNotRun,j=e=>e?e.status===`completed`?`bg-success-soft text-success`:e.status===`partial`?`bg-warning-soft text-warning`:e.status===`failed`||e.status===`canceled`?`bg-danger/10 text-danger`:`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-muted`,M=t=>t===`connected_account_unavailable`?e.sourceAccountUnavailable:t===`connected_source_sync_failed`?e.sourceSyncFailed:t===`connected_source_analysis_failed`?e.sourceAnalysisFailed:t,N=e=>{let t=e.displayName.trim().toLocaleLowerCase(),n=w.find(e=>e.displayName.trim().toLocaleLowerCase()===t);return n?E.get(n.connectorId):[...E.values()].find(n=>n.displayName.trim().toLocaleLowerCase()===t||e.sourceKey.toLocaleLowerCase().includes(n.id.toLocaleLowerCase()))},P=t=>`${e.actionFailed}: ${t instanceof Error?t.message:String(t)}`,F=async t=>{S(null),f(null),l({grantId:t.id,kind:`refresh`});try{await D(t.id),await i().catch(()=>void 0),S({tone:`success`,message:`${t.displayName}: ${e.refreshStarted}`})}catch(e){S({tone:`error`,message:P(e)})}finally{l(null)}},I=async(t,n)=>{if(d!==t.id){try{let e=await ge(t.id);f(t.id),h({grantId:t.id,impact:e.impact}),S(null)}catch(e){S({tone:`error`,message:P(e)})}return}if(n){l({grantId:t.id,kind:`revoke`});try{await fe(t.id,{derived:n,raw:`delete`}),await i().catch(()=>void 0),f(null),h(null),S({tone:`success`,message:`${t.displayName}: ${e.revokeDone}`})}catch(e){S({tone:`error`,message:P(e)})}finally{l(null)}}},L=async()=>{if(_.length){b(!0),S(null);try{let t=await B(_);t.result.failed.length?S({tone:`error`,message:t.result.failed.map(e=>e.error).join(`; `)}):S({tone:`success`,message:e.contentReadDone}),v([]),await s()}catch(e){S({tone:`error`,message:P(e)})}finally{b(!1)}}};return(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:e.sourcesHint}),(0,$.jsx)(g,{asChild:!0,variant:`primary`,children:(0,$.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[e.manageSources,(0,$.jsx)(u,{className:`size-4`})]})})]}),x?(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`rounded-xl px-3 py-2 text-sm ${x.tone===`success`?`bg-success-soft text-success`:`bg-danger/10 text-danger`}`,children:x.message}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.authorizedSources,` · `,C.length]}),C.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:C.map(t=>{let n=N(t),r=k[t.id],i=typeof r?.metadata.candidatesCreated==`number`?r.metadata.candidatesCreated:0,a=M(r?.errorMessage??(typeof r?.metadata.semanticError==`string`?r.metadata.semanticError:void 0));return(0,$.jsxs)(`article`,{className:`flex min-h-28 flex-wrap items-start gap-3 rounded-2xl border border-edge bg-surface-panel p-4`,children:[n?(0,$.jsx)(pe,{connector:n,size:`sm`}):(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base`,children:(0,$.jsx)(ce,{className:`size-4 text-fg-muted`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] ${j(r)}`,children:A(r)})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:[t.accessMode===`continuous`?e.continuous:e.once,` · `,t.processingPolicy===`local_only`?e.localOnly:t.retentionPolicy===`derived_only`?e.derivedOnly:t.retentionPolicy]}),r?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[r.itemsSeen,` `,e.sourceItems,i?` · ${i} ${e.sourceCandidates}`:``,` · `,new Date(r.completedAt??r.startedAt).toLocaleString()]}):t.lastCollectedAt?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:new Date(t.lastCollectedAt).toLocaleString()}):null,a?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-danger`,title:a,children:a}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:[t.accessMode===`continuous`?(0,$.jsx)(g,{variant:`ghost`,disabled:c!==null,"aria-busy":c?.grantId===t.id&&c.kind===`refresh`,onClick:()=>void F(t),children:c?.grantId===t.id&&c.kind===`refresh`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`size-4 animate-spin`}),e.refreshing]}):e.refresh}):null,(0,$.jsx)(g,{variant:`ghost`,className:`text-danger`,title:e.revokeHint,"aria-label":`${e.revoke}: ${t.displayName}`,disabled:c!==null,"aria-busy":c?.grantId===t.id&&c.kind===`revoke`,onClick:()=>{d===t.id?(f(null),h(null)):I(t)},children:c?.grantId===t.id&&c.kind===`revoke`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`size-4 animate-spin`}),e.revoking]}):d===t.id?e.cancel:e.revoke})]}),m?.grantId===t.id?(0,$.jsxs)(`div`,{className:`basis-full rounded-xl border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:e.revokeImpact.replace(`{{count}}`,String(m.impact.derivedCount))}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-2`,children:[(0,$.jsx)(g,{variant:`ghost`,onClick:()=>{f(null),h(null)},children:e.cancel}),(0,$.jsx)(g,{variant:`ghost`,onClick:()=>void I(t,`retain`),children:e.retainDerived}),(0,$.jsx)(g,{variant:`primary`,onClick:()=>void I(t,`delete`),children:e.deleteDerived})]})]}):null]},t.id)})}):(0,$.jsx)(pt,{children:e.noSources})]}),o.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.contentReadTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-xs leading-5 text-fg-muted`,children:e.contentReadHint})]}),(0,$.jsx)(g,{variant:`primary`,disabled:!_.length||y,onClick:()=>void L(),children:y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`size-4 animate-spin`}),e.reading]}):`${e.readSelected} · ${_.length}`})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:o.map(e=>{let t=_.includes(e.sourceItemId),n=_.length>=5&&!t;return(0,$.jsxs)(`label`,{className:`flex items-center gap-3 px-4 py-3 ${n?`opacity-50`:`cursor-pointer hover:bg-surface-hover`}`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-[var(--color-accent)]`,checked:t,disabled:n||y,onChange:t=>v(n=>t.target.checked?[...n,e.sourceItemId]:n.filter(t=>t!==e.sourceItemId))}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm text-fg`,children:e.title}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[e.toolkit===`gmail`?`Gmail`:`Google Drive`,e.occurredAt?` · ${new Date(e.occurredAt).toLocaleDateString()}`:``]})]})]},e.sourceItemId)})})]}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.connectorsTitle,` · `,w.length]}),w.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:w.map(t=>{let n=t.enabled&&(t.status===`connected`||t.connectionStatus===`connected`||t.authStatus===`connected`),r=E.get(t.connectorId);return(0,$.jsxs)(a,{to:`/connectors?tab=connected&instance=${encodeURIComponent(t.instanceId)}`,"aria-label":`${e.openConnector}: ${t.displayName}`,className:`group flex min-h-24 items-center gap-3 rounded-2xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,$.jsx)(pe,{connector:r??{displayName:t.displayName}}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:t.connectorId})]}),(0,$.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-1 text-xs ${n?`bg-success-soft text-success`:`bg-warning-soft text-warning`}`,children:n?e.connected:e.unavailable}),(0,$.jsx)(O,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},t.instanceId)})}):(0,$.jsx)(pt,{children:e.noConnectors})]})]})}function Rt(e){let t=(0,Q.c)(115),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:o,mutate:l}=T(`you-context-settings`,me),u=i?.dreaming??null,[d,f]=gt(u),p;t[0]!==d||t[1]!==u?(p=d&&u&&ht(d)!==ht(u),t[0]=d,t[1]=u,t[2]=p):p=t[2];let m=!!p,h;t[3]===l?h=t[4]:(h=async e=>{await k({dreaming:e}),await l()},t[3]=l,t[4]=h);let _;t[5]!==d||t[6]!==m||t[7]!==h?(_={value:d,dirty:m,delayMs:500,onSave:h},t[5]=d,t[6]=m,t[7]=h,t[8]=_):_=t[8];let v=ye(_);if(a){let e;t[9]===l?e=t[10]:(e=()=>void l(),t[9]=l,t[10]=e);let n;t[11]!==r.retry||t[12]!==e?(n=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:r.retry}),t[11]=r.retry,t[12]=e,t[13]=n):n=t[13];let i;return t[14]!==r.error||t[15]!==n?(i=(0,$.jsxs)(pt,{children:[r.error,` `,n]}),t[14]=r.error,t[15]=n,t[16]=i):i=t[16],i}if(o||!d){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(U,{className:`h-72 rounded-2xl`}),t[17]=e):e=t[17],e}let y=n?.status===`completed`?r.runCompleted:n?.status===`failed`?r.runFailed:r.runRunning,b;t[18]===r.dreamingHint?b=t[19]:(b=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:r.dreamingHint}),t[18]=r.dreamingHint,t[19]=b);let x=v.onBlurCapture,S;t[20]===r.mode?S=t[21]:(S=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.mode}),t[20]=r.mode,t[21]=S);let C;t[22]===f?C=t[23]:(C=e=>f(t=>t&&{...t,mode:e.target.value}),t[22]=f,t[23]=C);let w;t[24]===r.on?w=t[25]:(w=(0,$.jsx)(c,{value:`review`,children:r.on}),t[24]=r.on,t[25]=w);let E;t[26]===r.off?E=t[27]:(E=(0,$.jsx)(c,{value:`off`,children:r.off}),t[26]=r.off,t[27]=E);let D;t[28]!==d.mode||t[29]!==E||t[30]!==C||t[31]!==w?(D=(0,$.jsxs)(s,{value:d.mode,onChange:C,children:[w,E]}),t[28]=d.mode,t[29]=E,t[30]=C,t[31]=w,t[32]=D):D=t[32];let O;t[33]!==D||t[34]!==S?(O=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[S,D]}),t[33]=D,t[34]=S,t[35]=O):O=t[35];let A;t[36]===r.reviewTime?A=t[37]:(A=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=A);let j;t[38]===f?j=t[39]:(j=e=>f(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=f,t[39]=j);let M;t[40]!==d.schedule.time||t[41]!==j?(M=(0,$.jsx)(`input`,{type:`time`,className:lt,value:d.schedule.time,onChange:j}),t[40]=d.schedule.time,t[41]=j,t[42]=M):M=t[42];let N;t[43]!==A||t[44]!==M?(N=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[A,M]}),t[43]=A,t[44]=M,t[45]=N):N=t[45];let P;t[46]===r.timezone?P=t[47]:(P=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=P);let F=d.timezone??``,I,L;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(I=ie(),L=ie(),t[48]=I,t[49]=L):(I=t[48],L=t[49]);let R,z;t[50]===f?(R=t[51],z=t[52]):(R=e=>f(t=>t&&{...t,timezone:e}),z=e=>f(t=>t&&{...t,timezone:e.target.value||void 0}),t[50]=f,t[51]=R,t[52]=z);let B;t[53]!==F||t[54]!==R||t[55]!==z?(B=(0,$.jsx)(be,{className:`${lt} min-w-0 flex-1`,value:F,placeholder:I,suggestion:L,onAcceptSuggestion:R,onChange:z}),t[53]=F,t[54]=R,t[55]=z,t[56]=B):B=t[56];let V;t[57]===f?V=t[58]:(V=()=>f(zt),t[57]=f,t[58]=V);let H;t[59]!==r.detect||t[60]!==V?(H=(0,$.jsx)(g,{className:`shrink-0 whitespace-nowrap`,onClick:V,children:r.detect}),t[59]=r.detect,t[60]=V,t[61]=H):H=t[61];let W;t[62]!==B||t[63]!==H?(W=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[B,H]}),t[62]=B,t[63]=H,t[64]=W):W=t[64];let G;t[65]!==P||t[66]!==W?(G=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[P,W]}),t[65]=P,t[66]=W,t[67]=G):G=t[67];let K;t[68]===r.evidenceThreshold?K=t[69]:(K=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.evidenceThreshold}),t[68]=r.evidenceThreshold,t[69]=K);let ee;t[70]===f?ee=t[71]:(ee=e=>f(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[70]=f,t[71]=ee);let q;t[72]!==d.minEvidenceSources||t[73]!==ee?(q=(0,$.jsx)(`input`,{type:`number`,min:2,max:10,className:lt,value:d.minEvidenceSources,onChange:ee}),t[72]=d.minEvidenceSources,t[73]=ee,t[74]=q):q=t[74];let te;t[75]!==K||t[76]!==q?(te=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[K,q]}),t[75]=K,t[76]=q,t[77]=te):te=t[77];let ne;t[78]===r.scanLimit?ne=t[79]:(ne=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.scanLimit}),t[78]=r.scanLimit,t[79]=ne);let re;t[80]===f?re=t[81]:(re=e=>f(t=>t&&{...t,limit:Number(e.target.value)}),t[80]=f,t[81]=re);let ae;t[82]!==d.limit||t[83]!==re?(ae=(0,$.jsx)(`input`,{type:`number`,min:1,max:2e3,className:lt,value:d.limit,onChange:re}),t[82]=d.limit,t[83]=re,t[84]=ae):ae=t[84];let J;t[85]!==ne||t[86]!==ae?(J=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[ne,ae]}),t[85]=ne,t[86]=ae,t[87]=J):J=t[87];let oe;t[88]!==O||t[89]!==N||t[90]!==G||t[91]!==te||t[92]!==J?(oe=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[O,N,G,te,J]}),t[88]=O,t[89]=N,t[90]=G,t[91]=te,t[92]=J,t[93]=oe):oe=t[93];let se;t[94]!==v.error||t[95]!==v.status?(se=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ve,{status:v.status,error:v.error})}),t[94]=v.error,t[95]=v.status,t[96]=se):se=t[96];let ce;t[97]!==v.onBlurCapture||t[98]!==oe||t[99]!==se?(ce=(0,$.jsx)(ft,{children:(0,$.jsxs)(`div`,{onBlurCapture:x,children:[oe,se]})}),t[97]=v.onBlurCapture,t[98]=oe,t[99]=se,t[100]=ce):ce=t[100];let le;t[101]===r.lastRun?le=t[102]:(le=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[101]=r.lastRun,t[102]=le);let Y;t[103]!==n||t[104]!==y||t[105]!==r.neverRun||t[106]!==r.runItems?(Y=n?(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{children:y}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`time`,{children:new Date(n.startedAt).toLocaleString()}),typeof n.metrics.scanned==`number`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[String(n.metrics.scanned),` `,r.runItems]})]}):null]}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.neverRun}),t[103]=n,t[104]=y,t[105]=r.neverRun,t[106]=r.runItems,t[107]=Y):Y=t[107];let X;t[108]!==le||t[109]!==Y?(X=(0,$.jsxs)(ft,{children:[le,Y]}),t[108]=le,t[109]=Y,t[110]=X):X=t[110];let ue;return t[111]!==ce||t[112]!==X||t[113]!==b?(ue=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[b,ce,X]}),t[111]=ce,t[112]=X,t[113]=b,t[114]=ue):ue=t[114],ue}function zt(e){return e&&{...e,timezone:ie()}}function Bt(e){let t=(0,Q.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=T(`you-context-settings`,me),l=r?.privacy.sensitiveWritePolicy??null,[u,d]=gt(l),f=!!(u&&l&&u!==l),p;t[0]===o?p=t[1]:(p=async e=>{await k({privacy:{sensitiveWritePolicy:e}}),await o()},t[0]=o,t[1]=p);let m;t[2]!==u||t[3]!==f||t[4]!==p?(m={value:u,dirty:f,delayMs:350,onSave:p},t[2]=u,t[3]=f,t[4]=p,t[5]=m):m=t[5];let h=ye(m);if(i){let e;t[6]===o?e=t[7]:(e=()=>void o(),t[6]=o,t[7]=e);let r;t[8]!==n.retry||t[9]!==e?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[8]=n.retry,t[9]=e,t[10]=r):r=t[10];let i;return t[11]!==n.error||t[12]!==r?(i=(0,$.jsxs)(pt,{children:[n.error,` `,r]}),t[11]=n.error,t[12]=r,t[13]=i):i=t[13],i}if(a||!u){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(U,{className:`h-56 rounded-2xl`}),t[14]=e):e=t[14],e}let g;t[15]===n.privacyHint?g=t[16]:(g=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=g);let _;t[17]===n.sensitivePolicy?_=t[18]:(_=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=_);let v;t[19]===d?v=t[20]:(v=e=>d(e.target.value),t[19]=d,t[20]=v);let y;t[21]===n.policyDeny?y=t[22]:(y=(0,$.jsx)(c,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=y);let b;t[23]===n.policyConfirm?b=t[24]:(b=(0,$.jsx)(c,{value:`confirm`,children:n.policyConfirm}),t[23]=n.policyConfirm,t[24]=b);let x;t[25]===n.policyAllow?x=t[26]:(x=(0,$.jsx)(c,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=x);let S;t[27]!==u||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==x?(S=(0,$.jsxs)(s,{value:u,onChange:v,children:[y,b,x]}),t[27]=u,t[28]=v,t[29]=y,t[30]=b,t[31]=x,t[32]=S):S=t[32];let C;t[33]!==S||t[34]!==_?(C=(0,$.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[_,S]}),t[33]=S,t[34]=_,t[35]=C):C=t[35];let w;t[36]===n.privacyWarning?w=t[37]:(w=(0,$.jsx)(`p`,{className:`mt-3 max-w-2xl text-xs leading-5 text-fg-subtle`,children:n.privacyWarning}),t[36]=n.privacyWarning,t[37]=w);let E;t[38]!==h.error||t[39]!==h.status?(E=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ve,{status:h.status,error:h.error})}),t[38]=h.error,t[39]=h.status,t[40]=E):E=t[40];let D;t[41]!==h.onBlurCapture||t[42]!==C||t[43]!==w||t[44]!==E?(D=(0,$.jsx)(ft,{children:(0,$.jsxs)(`div`,{onBlurCapture:h.onBlurCapture,children:[C,w,E]})}),t[41]=h.onBlurCapture,t[42]=C,t[43]=w,t[44]=E,t[45]=D):D=t[45];let O;return t[46]!==D||t[47]!==g?(O=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[g,D]}),t[46]=D,t[47]=g,t[48]=O):O=t[48],O}export{vt 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{p as i,t as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as o}from"./check-DUBLcKHA.js";import{n as s,r as c}from"./popover-select-BzdnTy3h.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./external-link-DjqjBmc3.js";import{t as d}from"./eye-off-DEAzt3g1.js";import{t as f}from"./eye-CABVeTq0.js";import{t as p}from"./loader-circle-CifKLtgG.js";import{t as m}from"./plus-Q2yW6OE7.js";import{t as h}from"./x-B_N4OPjy.js";import{t as g}from"./button-CSEbl4zT.js";import{n as _}from"./locale-store-iKjqemWG.js";import{a as v,i as y,n as b,o as x,r as S,s as C,t as w}from"./dist-BPoKqzeH.js";import{i as T}from"./vendor-swr-BIWyz7Rc.js";import{As as E,Co as D,Dl as O,Do as k,Dt as A,Eo as j,Fs as M,Gl as N,Ml as P,Nl as F,Ol as I,Oo as L,Ot as R,Rs as z,So as B,To as V,Wc as H,Ya as U,_o as W,bo as G,bs as K,cc as ee,fo as q,gc as te,go as ne,gs as re,ho as ie,ko as ae,lc as J,ls as oe,mo as se,ol as ce,po as le,tc as Y,uo as X,us as ue,vo as de,wo as fe,wt as pe,xo as me,yl as he,yo as ge,zc as _e}from"./index-EvA8c7fo.js";import{n as ve,t as ye}from"./use-autosave-DcktF1j1.js";import{t as be}from"./tab-completion-input-D64VNmiA.js";import{t as xe}from"./page-tabs-BaEQMYm_.js";var Z=e(t(),1),Q=n(),Se=new Set([`candidate`,`needs_review`,`stale`]),Ce=new Set([`archived`,`rejected`]),we=new Set([`preference`,`boundary`,`relationship`,`routine`,`current_state`,`long_term_goal`]),Te=new Set([`and`,`are`,`for`,`from`,`into`,`that`,`the`,`this`,`with`,`you`,`your`]);function Ee(e,t){return t.updatedAt-e.updatedAt}function De(e,t){return{currentFocuses:e.filter(e=>e.status===`active`).sort(Ee),activeUnderstandings:t.filter(e=>e.status===`active`).sort(Ee),reviewQueue:[...e.filter(e=>e.status===`candidate`).map(e=>({type:`focus`,id:e.id,updatedAt:e.updatedAt,focus:e})),...t.filter(e=>Se.has(e.status)).map(e=>({type:`understanding`,id:e.id,updatedAt:e.updatedAt,understanding:e}))].sort(Ee),history:[...e.filter(e=>e.status===`paused`||e.status===`completed`||e.status===`rejected`).map(e=>({type:`focus`,id:e.id,updatedAt:e.updatedAt,focus:e})),...t.filter(e=>Ce.has(e.status)).map(e=>({type:`understanding`,id:e.id,updatedAt:e.updatedAt,understanding:e}))].sort(Ee),timeline:[...e.map(e=>({type:`focus`,id:e.id,updatedAt:e.updatedAt,focus:e})),...t.map(e=>({type:`understanding`,id:e.id,updatedAt:e.updatedAt,understanding:e}))].sort(Ee)}}function Oe(e){let t=new Set,n=e.toLocaleLowerCase().match(/[\p{Script=Han}]+|[\p{L}\p{N}]+/gu)??[];for(let e of n){if(/^\p{Script=Han}+$/u.test(e)){e.length===1&&t.add(e);for(let n=0;n<e.length-1;n+=1)t.add(e.slice(n,n+2));continue}e.length>=3&&!Te.has(e)&&t.add(e)}return t}function ke(e,t){let n=Oe(e),r=Oe(t);if(!n.size||!r.size)return 0;let i=0;for(let e of n)r.has(e)&&(i+=1);return i/Math.min(n.size,r.size)}function Ae(e,t,n=6){let r=`${e.title} ${e.summary}`;return t.filter(e=>[`active`,`candidate`,`needs_review`,`stale`].includes(e.status)).map(t=>{let n=[],i=0;e.scope.type===`project`&&t.scope.type===`project`&&t.scope.id===e.scope.id&&(n.push(`project_scope`),i+=.75);let a=ke(r,t.statement);return a>=.12&&(n.push(`topic_overlap`),i+=Math.min(.65,.18+a*.55)),t.status===`active`&&t.scope.type===`global`&&we.has(t.kind)&&(n.push(`global_context`),i+=.16),n.length?{understanding:t,reasons:n,score:Math.min(1,i)}:null}).filter(e=>e!==null).sort((e,t)=>t.score-e.score||t.understanding.updatedAt-e.understanding.updatedAt).slice(0,Math.max(0,n))}var je={preference:{en:`Preference`,zh:`偏好`},boundary:{en:`Boundary`,zh:`边界`},relationship:{en:`Relationship`,zh:`关系`},routine:{en:`Routine`,zh:`习惯`},current_state:{en:`Current state`,zh:`当前状态`},long_term_goal:{en:`Long-term goal`,zh:`长期目标`},project_context:{en:`Project context`,zh:`项目背景`},task_lesson:{en:`Task lesson`,zh:`任务经验`},derived_insight:{en:`Insight`,zh:`洞察`}},$=r(),Me=[{x:15,y:17},{x:14,y:51},{x:19,y:83},{x:85,y:17},{x:86,y:51},{x:81,y:83}],Ne={en:{focus:`Focus`,selectFocus:`Focus in view`,you:`You`,active:`Active`,pending:`Needs review`,hint:`A local map around one focus — enough context to explain xopc’s help, without turning your portrait into a database.`,confirmed:`Confirmed`,possible:`Possible`,weak:`Show weak signals`,hideWeak:`Hide weak signals`,noFocus:`Confirm a focus first, then xopc can show the context that affects it.`,noRelations:`No relationship is strong enough to show yet.`,why:`Why this relationship is shown`,project_scope:`Both belong to the same project.`,topic_overlap:`They share a meaningful topic signal.`,global_context:`This confirmed context may shape work across projects.`,projectEdge:`same project`,topicEdge:`shared topic`,contextEdge:`shapes work`,edit:`Edit`,pause:`Pause`,complete:`Complete`,incorrect:`Not true`,archive:`Move to history`,save:`Save`,cancel:`Cancel`,review:`Review this suggestion`,explicit:`You said this directly`,observed:`Observed across work`,inferred:`Inferred — may be wrong`,relatedCount:`relationships`},zh:{focus:`当前关注`,selectFocus:`图中关注`,you:`你`,active:`进行中`,pending:`待确认`,hint:`只围绕一个当前重点展开局部关系:足以解释 xopc 为什么这样帮助你,又不会把画像变成数据库。`,confirmed:`已确认`,possible:`可能关联`,weak:`显示弱信号`,hideWeak:`隐藏弱信号`,noFocus:`先确认一项关注,xopc 才能展示会影响它的上下文。`,noRelations:`目前还没有足够明确的关系。`,why:`为什么展示这条关系`,project_scope:`它们属于同一个项目。`,topic_overlap:`它们共享了有意义的主题信号。`,global_context:`这条已确认的上下文可能影响不同项目中的工作。`,projectEdge:`同一项目`,topicEdge:`主题相关`,contextEdge:`影响工作方式`,edit:`编辑`,pause:`暂停`,complete:`完成`,incorrect:`不正确`,archive:`移入历史`,save:`保存`,cancel:`取消`,review:`去确认这条建议`,explicit:`由你直接告知`,observed:`从过往工作中观察到`,inferred:`推断内容,可能有误`,relatedCount:`条关系`}},Pe=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent/60 focus:ring-2 focus:ring-accent/20`;function Fe(e){let t=(0,Q.c)(128),{focuses:n,understandings:r,language:i,onRefresh:a,onOpenReview:o}=e,c=Ne[i],[l,u]=(0,Z.useState)(n[0]?.id??``),p;t[0]!==l||t[1]!==n?(p=n.find(e=>e.id===l)??n[0],t[0]=l,t[1]=n,t[2]=p):p=t[2];let m=p,h;t[3]!==m||t[4]!==r?(h=m?Ae(m,r):[],t[3]=m,t[4]=r,t[5]=h):h=t[5];let g=h,[_,v]=(0,Z.useState)(!1),y;t[6]!==g||t[7]!==_?(y=_?g:g.filter(ze),t[6]=g,t[7]=_,t[8]=y):y=t[8];let b=y,[x,S]=(0,Z.useState)(null),C;t[9]!==b||t[10]!==x?(C=b.find(e=>e.understanding.id===x)??null,t[9]=b,t[10]=x,t[11]=C):C=t[11];let w=C,T,E;t[12]!==m||t[13]!==l?(T=()=>{!m||m.id===l||u(m.id)},E=[m,l],t[12]=m,t[13]=l,t[14]=T,t[15]=E):(T=t[14],E=t[15]),(0,Z.useEffect)(T,E);let D,O;if(t[16]!==b||t[17]!==x?(D=()=>{x&&!b.some(e=>e.understanding.id===x)&&S(null)},O=[b,x],t[16]=b,t[17]=x,t[18]=D,t[19]=O):(D=t[18],O=t[19]),(0,Z.useEffect)(D,O),!m){let e;return t[20]===c.noFocus?e=t[21]:(e=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-16 text-center text-sm text-fg-muted`,children:c.noFocus}),t[20]=c.noFocus,t[21]=e),e}let k;t[22]===c.hint?k=t[23]:(k=(0,$.jsx)(`p`,{className:`max-w-2xl text-xs leading-5 text-fg-muted`,children:c.hint}),t[22]=c.hint,t[23]=k);let A;t[24]!==m.id||t[25]!==n||t[26]!==c.selectFocus?(A=n.length>1?(0,$.jsxs)(`label`,{className:`flex shrink-0 items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:c.selectFocus}),(0,$.jsx)(s,{value:m.id,onChange:e=>{u(e.target.value),S(null)},triggerClassName:`min-w-44 bg-surface-base`,children:n.map(Re)})]}):null,t[24]=m.id,t[25]=n,t[26]=c.selectFocus,t[27]=A):A=t[27];let j;t[28]!==A||t[29]!==k?(j=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[k,A]}),t[28]=A,t[29]=k,t[30]=j):j=t[30];let M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(`span`,{className:`h-px w-5 bg-edge-strong`}),t[31]=M):M=t[31];let N;t[32]===c.confirmed?N=t[33]:(N=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[M,c.confirmed]}),t[32]=c.confirmed,t[33]=N);let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(`span`,{className:`w-5 border-t border-dashed border-warning`}),t[34]=P):P=t[34];let F;t[35]===c.possible?F=t[36]:(F=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[P,c.possible]}),t[35]=c.possible,t[36]=F);let I;t[37]!==g||t[38]!==_||t[39]!==c.hideWeak||t[40]!==c.weak?(I=g.some(Le)?(0,$.jsxs)(`button`,{type:`button`,className:`ml-auto inline-flex items-center gap-1.5 rounded-md text-fg-muted hover:text-accent`,onClick:()=>v(Ie),children:[_?(0,$.jsx)(d,{className:`size-3.5`}):(0,$.jsx)(f,{className:`size-3.5`}),_?c.hideWeak:c.weak]}):null,t[37]=g,t[38]=_,t[39]=c.hideWeak,t[40]=c.weak,t[41]=I):I=t[41];let L;t[42]!==N||t[43]!==F||t[44]!==I?(L=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 text-[11px] text-fg-subtle`,children:[N,F,I]}),t[42]=N,t[43]=F,t[44]=I,t[45]=L):L=t[45];let R;t[46]!==j||t[47]!==L?(R=(0,$.jsxs)(`header`,{className:`flex flex-col gap-3 border-b border-edge px-4 py-3`,children:[j,L]}),t[46]=j,t[47]=L,t[48]=R):R=t[48];let z;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(`div`,{className:`absolute inset-0 opacity-50 [background-image:radial-gradient(var(--color-edge)_0.7px,transparent_0.7px)] [background-size:20px_20px]`,"aria-hidden":`true`}),t[49]=z):z=t[49];let B;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(`line`,{x1:`50`,y1:`13`,x2:`50`,y2:`50`,className:`stroke-edge-strong`,strokeWidth:`0.35`,vectorEffect:`non-scaling-stroke`}),t[50]=B):B=t[50];let V;if(t[51]!==b||t[52]!==x){let e;t[54]===x?e=t[55]:(e=(e,t)=>(0,$.jsx)(`line`,{x1:`50`,y1:`50`,x2:Me[t]?.x??50,y2:Me[t]?.y??50,className:e.understanding.status===`active`?`stroke-edge-strong`:`stroke-warning`,strokeWidth:x===e.understanding.id?`0.55`:`0.3`,strokeDasharray:e.understanding.status===`active`?void 0:`1.4 1.4`,vectorEffect:`non-scaling-stroke`},e.understanding.id),t[54]=x,t[55]=e),V=b.map(e),t[51]=b,t[52]=x,t[53]=V}else V=t[53];let H;t[56]===V?H=t[57]:(H=(0,$.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0 size-full`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[B,V]}),t[56]=V,t[57]=H);let U;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(oe,{className:`size-5`}),t[58]=U):U=t[58];let W;t[59]===c.you?W=t[60]:(W=(0,$.jsxs)(`div`,{className:`absolute left-1/2 top-[13%] z-10 flex size-12 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-accent text-white shadow-surface`,children:[U,(0,$.jsx)(`span`,{className:`sr-only`,children:c.you})]}),t[59]=c.you,t[60]=W);let G;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>S(null),t[61]=G):G=t[61];let ee=`absolute left-1/2 top-1/2 z-10 flex w-44 -translate-x-1/2 -translate-y-1/2 items-center gap-2 rounded-xl border px-3 py-3 text-left text-sm font-medium shadow-surface transition-colors ${w?`border-edge bg-surface-panel hover:bg-surface-hover`:`border-accent bg-accent-soft text-accent-fg ring-2 ring-accent/15`}`,q;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(K,{className:`size-4 shrink-0`}),t[62]=q):q=t[62];let te;t[63]===m.title?te=t[64]:(te=(0,$.jsx)(`span`,{className:`line-clamp-2`,children:m.title}),t[63]=m.title,t[64]=te);let ne;t[65]!==ee||t[66]!==te?(ne=(0,$.jsxs)(`button`,{type:`button`,onClick:G,className:ee,children:[q,te]}),t[65]=ee,t[66]=te,t[67]=ne):ne=t[67];let re;if(t[68]!==b||t[69]!==c){let e;t[71]===c?e=t[72]:(e=(e,t)=>{let n=Me[t]??Me[0];return(0,$.jsx)(`span`,{style:{left:`${(50+n.x)/2}%`,top:`${(50+n.y)/2}%`},className:`pointer-events-none absolute z-[5] -translate-x-1/2 -translate-y-1/2 rounded bg-surface-base/90 px-1.5 py-0.5 text-[9px] text-fg-subtle`,children:Be(e,c)},`edge:${e.understanding.id}`)},t[71]=c,t[72]=e),re=b.map(e),t[68]=b,t[69]=c,t[70]=re}else re=t[70];let ie;if(t[73]!==i||t[74]!==b||t[75]!==x){let e;t[77]!==i||t[78]!==x?(e=(e,t)=>(0,$.jsx)(Ve,{relation:e,position:Me[t]??Me[0],language:i,selected:x===e.understanding.id,onSelect:()=>S(e.understanding.id)},e.understanding.id),t[77]=i,t[78]=x,t[79]=e):e=t[79],ie=b.map(e),t[73]=i,t[74]=b,t[75]=x,t[76]=ie}else ie=t[76];let ae;t[80]!==b.length||t[81]!==c.noRelations?(ae=b.length?null:(0,$.jsx)(`p`,{className:`absolute inset-x-0 bottom-8 text-center text-xs text-fg-muted`,children:c.noRelations}),t[80]=b.length,t[81]=c.noRelations,t[82]=ae):ae=t[82];let J;t[83]!==H||t[84]!==W||t[85]!==ne||t[86]!==re||t[87]!==ie||t[88]!==ae?(J=(0,$.jsxs)(`div`,{className:`relative hidden h-[30rem] overflow-hidden rounded-xl border border-edge bg-surface-base sm:block`,children:[z,H,W,ne,re,ie,ae]}),t[83]=H,t[84]=W,t[85]=ne,t[86]=re,t[87]=ie,t[88]=ae,t[89]=J):J=t[89];let se;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>S(null),t[90]=se):se=t[90];let ce=`rounded-xl border p-3 text-left ${w?`border-edge bg-surface-panel`:`border-accent bg-accent-soft`}`,le;t[91]===c.focus?le=t[92]:(le=(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:c.focus}),t[91]=c.focus,t[92]=le);let Y;t[93]===m.title?Y=t[94]:(Y=(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium text-fg`,children:m.title}),t[93]=m.title,t[94]=Y);let X;t[95]!==ce||t[96]!==le||t[97]!==Y?(X=(0,$.jsxs)(`button`,{type:`button`,onClick:se,className:ce,children:[le,Y]}),t[95]=ce,t[96]=le,t[97]=Y,t[98]=X):X=t[98];let ue;if(t[99]!==i||t[100]!==b||t[101]!==x||t[102]!==c){let e;t[104]!==i||t[105]!==x||t[106]!==c?(e=e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>S(e.understanding.id),className:`rounded-xl border p-3 text-left ${x===e.understanding.id?`border-accent bg-accent-soft`:e.understanding.status===`active`?`border-edge bg-surface-panel`:`border-dashed border-warning/40 bg-warning-soft`}`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:je[e.understanding.kind][i]}),(0,$.jsx)(`span`,{children:Be(e,c)})]}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg`,children:e.understanding.statement})]},e.understanding.id),t[104]=i,t[105]=x,t[106]=c,t[107]=e):e=t[107],ue=b.map(e),t[99]=i,t[100]=b,t[101]=x,t[102]=c,t[103]=ue}else ue=t[103];let de;t[108]!==X||t[109]!==ue?(de=(0,$.jsxs)(`div`,{className:`grid gap-2 sm:hidden`,children:[X,ue]}),t[108]=X,t[109]=ue,t[110]=de):de=t[110];let fe;t[111]!==J||t[112]!==de?(fe=(0,$.jsxs)(`div`,{className:`min-w-0 bg-surface-base/45 p-3 sm:p-4`,children:[J,de]}),t[111]=J,t[112]=de,t[113]=fe):fe=t[113];let pe;t[114]!==m||t[115]!==i||t[116]!==o||t[117]!==a||t[118]!==b.length||t[119]!==w||t[120]!==c?(pe=(0,$.jsx)(He,{focus:m,relation:w,relationCount:b.length,language:i,t:c,onRefresh:a,onOpenReview:o}),t[114]=m,t[115]=i,t[116]=o,t[117]=a,t[118]=b.length,t[119]=w,t[120]=c,t[121]=pe):pe=t[121];let me;t[122]!==fe||t[123]!==pe?(me=(0,$.jsxs)(`div`,{className:`grid lg:grid-cols-[minmax(0,1fr)_19rem]`,children:[fe,pe]}),t[122]=fe,t[123]=pe,t[124]=me):me=t[124];let he;return t[125]!==R||t[126]!==me?(he=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[R,me]}),t[125]=R,t[126]=me,t[127]=he):he=t[127],he}function Ie(e){return!e}function Le(e){return e.score<.25}function Re(e){return(0,$.jsx)(c,{value:e.id,children:e.title},e.id)}function ze(e){return e.score>=.25}function Be(e,t){return e.reasons.includes(`project_scope`)?t.projectEdge:e.reasons.includes(`topic_overlap`)?t.topicEdge:t.contextEdge}function Ve(e){let t=(0,Q.c)(18),{relation:n,position:r,language:i,selected:a,onSelect:o}=e,s=n.understanding.status!==`active`,c=`${r.x}%`,l=`${r.y}%`,u;t[0]!==c||t[1]!==l?(u={left:c,top:l},t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=`absolute z-10 flex max-w-40 -translate-x-1/2 -translate-y-1/2 items-start gap-2 rounded-xl border px-3 py-2.5 text-left text-xs leading-5 shadow-surface transition-colors ${a?`border-accent bg-accent-soft ring-2 ring-accent/15`:s?`border-dashed border-warning/60 bg-warning-soft hover:border-warning`:`border-edge bg-surface-panel hover:bg-surface-hover`}`,f=`mt-1.5 size-1.5 shrink-0 rounded-full ${s?`bg-warning`:`bg-success`}`,p;t[3]===f?p=t[4]:(p=(0,$.jsx)(`span`,{className:f}),t[3]=f,t[4]=p);let m=je[n.understanding.kind][i],h;t[5]===m?h=t[6]:(h=(0,$.jsx)(`span`,{className:`block text-[10px] text-fg-subtle`,children:m}),t[5]=m,t[6]=h);let g;t[7]===n.understanding.statement?g=t[8]:(g=(0,$.jsx)(`span`,{className:`line-clamp-2 text-fg`,children:n.understanding.statement}),t[7]=n.understanding.statement,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,$.jsxs)(`span`,{className:`min-w-0`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;return t[12]!==o||t[13]!==_||t[14]!==u||t[15]!==d||t[16]!==p?(v=(0,$.jsxs)(`button`,{type:`button`,onClick:o,style:u,className:d,children:[p,_]}),t[12]=o,t[13]=_,t[14]=u,t[15]=d,t[16]=p,t[17]=v):v=t[17],v}function He({focus:e,relation:t,relationCount:n,language:r,t:i,onRefresh:a,onOpenReview:o}){let[s,c]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(e.title),[f,p]=(0,Z.useState)(t?.understanding.statement??e.summary),[m,h]=(0,Z.useState)(!1),_=t?.understanding;(0,Z.useEffect)(()=>{c(!1),d(e.title),p(_?.statement??e.summary)},[e.id,e.summary,e.title,_?.id,_?.statement]);let v=async e=>{h(!0);try{await e(),await a()}finally{h(!1)}},y=async t=>{t.preventDefault(),!(!f.trim()||!_&&!u.trim())&&(await v(()=>_?j(_.id,{statement:f}):L(e.id,{title:u,summary:f})),c(!1))},b=_?_.explicitness===`explicit`?i.explicit:_.explicitness===`observed`?i.observed:i.inferred:`${n} ${i.relatedCount}`,x=_?.status===`active`||!_?i.active:i.pending;return(0,$.jsxs)(`aside`,{className:`border-t border-edge bg-surface-panel p-5 lg:border-l lg:border-t-0`,children:[(0,$.jsx)(`p`,{className:`text-[11px] font-medium text-accent`,children:_?je[_.kind][r]:i.focus}),s?(0,$.jsxs)(`form`,{className:`mt-3 space-y-3`,onSubmit:y,children:[_?null:(0,$.jsx)(`input`,{className:Pe,value:u,onChange:e=>d(e.target.value)}),(0,$.jsx)(`textarea`,{autoFocus:!0,className:Pe,rows:5,value:f,onChange:e=>p(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(g,{type:`button`,disabled:m,onClick:()=>c(!1),children:i.cancel}),(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:m||!f.trim()||!_&&!u.trim(),children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h2`,{className:`mt-2 text-base font-semibold leading-6 text-fg`,children:_?.statement??e.title}),_?null:(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.summary}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full ${_?.status===`active`||!_?`bg-success`:`bg-warning`}`}),x,(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:b})]}),t?(0,$.jsxs)(`div`,{className:`mt-6`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.why}),(0,$.jsx)(`div`,{className:`mt-2 grid gap-2`,children:t.reasons.map(e=>(0,$.jsx)(`p`,{className:`rounded-xl bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-muted`,children:i[e]},e))})]}):null,(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2`,children:[_?_.status===`active`?(0,$.jsxs)(g,{disabled:m,onClick:()=>c(!0),children:[(0,$.jsx)(Y,{className:`size-3.5`}),i.edit]}):(0,$.jsx)(g,{variant:`primary`,onClick:o,children:i.review}):(0,$.jsxs)(g,{disabled:m,onClick:()=>c(!0),children:[(0,$.jsx)(Y,{className:`size-3.5`}),i.edit]}),_?_.status===`active`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{variant:`ghost`,disabled:m,onClick:()=>void v(()=>j(_.id,{status:`archived`})),children:i.archive}),(0,$.jsx)(g,{variant:`ghost`,className:`text-danger`,disabled:m,onClick:()=>void v(()=>j(_.id,{status:`rejected`})),children:i.incorrect})]}):null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{disabled:m,onClick:()=>void v(()=>L(e.id,{status:`paused`})),children:i.pause}),(0,$.jsxs)(g,{variant:`ghost`,disabled:m,onClick:()=>void v(()=>L(e.id,{status:`completed`})),children:[(0,$.jsx)(l,{className:`size-3.5`}),i.complete]})]})]})]})]})}var Ue={en:{eyebrow:`YOU, NOW`,intro:`A living, correctable portrait of what matters now and what remains true over time.`,add:`Add understanding`,portrait:`Now`,map:`Relationships`,changes:`Recent changes`,review:`Review`,portraitHint:`This is the context xopc will use when helping you now.`,importantNow:`Important now`,lastingPortrait:`What continues to shape the portrait`,lastingHint:`Confirmed context that can travel across conversations.`,noFocus:`No active focus yet. Tell xopc what matters now, or confirm a suggested focus.`,noUnderstanding:`No confirmed understanding yet. Add one directly or review a suggestion.`,selectedDetail:`Selected understanding`,focusDetail:`Selected focus`,scope:`Scope`,source:`Origin`,global:`Across xopc`,workspace:`Workspace`,project:`Project`,session:`Conversation`,active:`Active`,horizonCurrent:`Right now`,horizonOngoing:`Ongoing`,horizonLongTerm:`Long term`,moreFocuses:`more active focuses`,explicit:`Told by you`,observed:`Observed over time`,inferred:`Inferred — may be wrong`,validSince:`Valid since`,validUntil:`Valid until`,updated:`Updated`,reviewDue:`Review due`,edit:`Edit`,save:`Save`,cancel:`Cancel`,pause:`Pause`,complete:`Complete`,archive:`Archive`,incorrect:`Not true`,evidence:`View evidence`,evidenceTitle:`Why xopc holds this`,evidenceLoading:`Loading evidence…`,evidenceEmpty:`No displayable evidence is linked.`,evidenceError:`Evidence could not be loaded.`,changesIntro:`A timeline of when the portrait formed, changed, or stopped applying. It shows state changes without inventing a diff.`,timelineEmpty:`There are no changes yet.`,formed:`Formed`,changed:`Updated`,proposed:`Proposed`,needsReview:`Needs review`,paused:`Paused`,completed:`Completed`,rejected:`Marked incorrect`,archived:`Archived`,reviewTitle:`One decision at a time`,reviewHint:`Suggestions do not affect xopc until you confirm them.`,later:`Later`,yes:`Yes`,change:`Needs changes`,wrong:`Not true`,saveConfirm:`Save and confirm`,confidence:`confidence`,focusCandidate:`Suggested focus`,understandingCandidate:`Suggested understanding`,high:`high`,medium:`medium`,low:`low`,noReview:`Nothing needs your review.`,statement:`What should xopc understand?`,type:`Type`,create:`Add`},zh:{eyebrow:`此刻的你`,intro:`一份会随时间生长、可以随时纠正的画像:既看此刻重要的事,也保留长期成立的理解。`,add:`添加理解`,portrait:`此刻`,map:`关系`,changes:`最近变化`,review:`待确认`,portraitHint:`这是 xopc 此刻帮助你时会使用的上下文。`,importantNow:`此刻重要`,lastingPortrait:`持续构成画像的理解`,lastingHint:`已经确认、可以跨对话使用的上下文。`,noFocus:`还没有进行中的关注。你可以告诉 xopc 此刻什么最重要,或确认一条候选关注。`,noUnderstanding:`还没有已确认的理解。你可以直接添加,或确认一条建议。`,selectedDetail:`选中的理解`,focusDetail:`选中的关注`,scope:`适用范围`,source:`形成方式`,global:`全局适用`,workspace:`工作区`,project:`项目`,session:`当前对话`,active:`生效中`,horizonCurrent:`当下`,horizonOngoing:`持续推进`,horizonLongTerm:`长期方向`,moreFocuses:`项进行中的关注`,explicit:`由你直接告知`,observed:`从长期共事中观察到`,inferred:`推断内容,可能有误`,validSince:`开始成立`,validUntil:`有效至`,updated:`最近更新`,reviewDue:`建议复核`,edit:`编辑`,save:`保存`,cancel:`取消`,pause:`暂停`,complete:`完成`,archive:`归档`,incorrect:`不正确`,evidence:`查看依据`,evidenceTitle:`xopc 为什么这样理解`,evidenceLoading:`正在读取依据…`,evidenceEmpty:`暂时没有可展示的依据。`,evidenceError:`暂时无法读取依据。`,changesIntro:`按时间呈现画像何时形成、更新或不再适用;只表达状态变化,不虚构具体差异。`,timelineEmpty:`还没有画像变化。`,formed:`形成`,changed:`更新`,proposed:`提出建议`,needsReview:`需要复核`,paused:`已暂停`,completed:`已完成`,rejected:`标记为不正确`,archived:`已归档`,reviewTitle:`一次只确认一条`,reviewHint:`建议内容在你确认前不会影响 xopc 的行动。`,later:`稍后`,yes:`是的`,change:`需要修改`,wrong:`不是这样`,saveConfirm:`保存并确认`,confidence:`把握`,focusCandidate:`候选关注`,understandingCandidate:`候选理解`,high:`高`,medium:`中`,low:`低`,noReview:`目前没有需要你确认的内容。`,statement:`希望 xopc 了解什么?`,type:`类型`,create:`添加`}},We=`w-full rounded-xl border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/60 focus:ring-2 focus:ring-accent/20`;function Ge(e){let t=(0,Q.c)(83),{focuses:n,understandings:r,language:i,onRefresh:a}=e,o=Ue[i],s;t[0]!==n||t[1]!==r?(s=De(n,r),t[0]=n,t[1]=r,t[2]=s):s=t[2];let c=s,[l,u]=(0,Z.useState)(`portrait`),[d,f]=(0,Z.useState)(!1),p;t[3]===o.eyebrow?p=t[4]:(p=(0,$.jsx)(`p`,{className:`text-[11px] font-semibold uppercase tracking-[0.18em] text-accent`,children:o.eyebrow}),t[3]=o.eyebrow,t[4]=p);let h;t[5]===o.intro?h=t[6]:(h=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:o.intro}),t[5]=o.intro,t[6]=h);let _;t[7]!==p||t[8]!==h?(_=(0,$.jsxs)(`div`,{className:`max-w-2xl`,children:[p,h]}),t[7]=p,t[8]=h,t[9]=_):_=t[9];let v,y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>f(!0),y=(0,$.jsx)(m,{className:`size-4`}),t[10]=v,t[11]=y):(v=t[10],y=t[11]);let b;t[12]===o.add?b=t[13]:(b=(0,$.jsxs)(g,{variant:`primary`,className:`shrink-0`,onClick:v,children:[y,o.add]}),t[12]=o.add,t[13]=b);let x;t[14]!==_||t[15]!==b?(x=(0,$.jsxs)(`header`,{className:`flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between`,children:[_,b]}),t[14]=_,t[15]=b,t[16]=x):x=t[16];let S=i===`zh`?`共同理解视图`:`Shared understanding views`,C=l===`portrait`,w,T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>u(`portrait`),T=(0,$.jsx)(K,{className:`size-3.5`}),t[17]=w,t[18]=T):(w=t[17],T=t[18]);let D;t[19]!==c.currentFocuses.length||t[20]!==o.portrait||t[21]!==C?(D=(0,$.jsx)(Ke,{selected:C,onClick:w,icon:T,label:o.portrait,count:c.currentFocuses.length}),t[19]=c.currentFocuses.length,t[20]=o.portrait,t[21]=C,t[22]=D):D=t[22];let O=l===`map`,k,A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>u(`map`),A=(0,$.jsx)(ee,{className:`size-3.5`}),t[23]=k,t[24]=A):(k=t[23],A=t[24]);let j;t[25]!==o.map||t[26]!==O?(j=(0,$.jsx)(Ke,{selected:O,onClick:k,icon:A,label:o.map}),t[25]=o.map,t[26]=O,t[27]=j):j=t[27];let M=l===`changes`,N,P;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>u(`changes`),P=(0,$.jsx)(_e,{className:`size-3.5`}),t[28]=N,t[29]=P):(N=t[28],P=t[29]);let F;t[30]!==o.changes||t[31]!==M?(F=(0,$.jsx)(Ke,{selected:M,onClick:N,icon:P,label:o.changes}),t[30]=o.changes,t[31]=M,t[32]=F):F=t[32];let I=l===`review`,L,R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>u(`review`),R=(0,$.jsx)(E,{className:`size-3.5`}),t[33]=L,t[34]=R):(L=t[33],R=t[34]);let z=c.reviewQueue.length>0,B;t[35]!==c.reviewQueue.length||t[36]!==o.review||t[37]!==I||t[38]!==z?(B=(0,$.jsx)(Ke,{selected:I,onClick:L,icon:R,label:o.review,count:c.reviewQueue.length,emphasize:z}),t[35]=c.reviewQueue.length,t[36]=o.review,t[37]=I,t[38]=z,t[39]=B):B=t[39];let V;t[40]!==D||t[41]!==j||t[42]!==F||t[43]!==B||t[44]!==S?(V=(0,$.jsxs)(`div`,{className:`flex gap-1 overflow-x-auto border-b border-edge`,role:`tablist`,"aria-label":S,children:[D,j,F,B]}),t[40]=D,t[41]=j,t[42]=F,t[43]=B,t[44]=S,t[45]=V):V=t[45];let H;t[46]!==i||t[47]!==c.activeUnderstandings||t[48]!==c.currentFocuses||t[49]!==a||t[50]!==o||t[51]!==l?(H=l===`portrait`?(0,$.jsx)(qe,{focuses:c.currentFocuses,understandings:c.activeUnderstandings,language:i,t:o,onRefresh:a}):null,t[46]=i,t[47]=c.activeUnderstandings,t[48]=c.currentFocuses,t[49]=a,t[50]=o,t[51]=l,t[52]=H):H=t[52];let U;t[53]!==i||t[54]!==c.currentFocuses||t[55]!==a||t[56]!==r||t[57]!==l?(U=l===`map`?(0,$.jsx)(Fe,{focuses:c.currentFocuses,understandings:r,language:i,onRefresh:a,onOpenReview:()=>u(`review`)}):null,t[53]=i,t[54]=c.currentFocuses,t[55]=a,t[56]=r,t[57]=l,t[58]=U):U=t[58];let W;t[59]!==i||t[60]!==c.timeline||t[61]!==o||t[62]!==l?(W=l===`changes`?(0,$.jsx)($e,{items:c.timeline,language:i,t:o}):null,t[59]=i,t[60]=c.timeline,t[61]=o,t[62]=l,t[63]=W):W=t[63];let G;t[64]!==i||t[65]!==c.reviewQueue||t[66]!==a||t[67]!==o||t[68]!==l?(G=l===`review`?(0,$.jsx)(it,{items:c.reviewQueue,language:i,t:o,onRefresh:a}):null,t[64]=i,t[65]=c.reviewQueue,t[66]=a,t[67]=o,t[68]=l,t[69]=G):G=t[69];let q;t[70]!==d||t[71]!==i||t[72]!==a||t[73]!==o?(q=(0,$.jsx)(ot,{open:d,onOpenChange:f,language:i,t:o,onCreated:a}),t[70]=d,t[71]=i,t[72]=a,t[73]=o,t[74]=q):q=t[74];let te;return t[75]!==V||t[76]!==H||t[77]!==U||t[78]!==W||t[79]!==G||t[80]!==q||t[81]!==x?(te=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[x,V,H,U,W,G,q]}),t[75]=V,t[76]=H,t[77]=U,t[78]=W,t[79]=G,t[80]=q,t[81]=x,t[82]=te):te=t[82],te}function Ke(e){let t=(0,Q.c)(12),{selected:n,onClick:r,icon:i,label:a,count:o,emphasize:s}=e,c=s===void 0?!1:s,l=`inline-flex min-h-10 shrink-0 items-center gap-1.5 border-b-2 px-3 text-sm transition-colors ${n?`border-accent text-fg`:`border-transparent text-fg-muted hover:text-fg`}`,u;t[0]===a?u=t[1]:(u=(0,$.jsx)(`span`,{children:a}),t[0]=a,t[1]=u);let d;t[2]!==o||t[3]!==c?(d=o===void 0?null:(0,$.jsx)(`span`,{className:`rounded-full px-1.5 py-0.5 text-[10px] ${c?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:o}),t[2]=o,t[3]=c,t[4]=d):d=t[4];let f;return t[5]!==i||t[6]!==r||t[7]!==n||t[8]!==l||t[9]!==u||t[10]!==d?(f=(0,$.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n,onClick:r,className:l,children:[i,u,d]}),t[5]=i,t[6]=r,t[7]=n,t[8]=l,t[9]=u,t[10]=d,t[11]=f):f=t[11],f}function qe(e){let t=(0,Q.c)(62),{focuses:n,understandings:r,language:i,t:a,onRefresh:o}=e,s;t[0]!==n[0]||t[1]!==r?(s=n[0]?{type:`focus`,item:n[0]}:r[0]?{type:`understanding`,item:r[0]}:null,t[0]=n[0],t[1]=r,t[2]=s):s=t[2];let c=s,[l,u]=(0,Z.useState)(c?`${c.type}:${c.item.id}`:``),d;t[3]!==n||t[4]!==c||t[5]!==l||t[6]!==r?(d=Je(l,n,r)??c,t[3]=n,t[4]=c,t[5]=l,t[6]=r,t[7]=d):d=t[7];let f=d,p=n[0],m=Ye(n),h=m.slice(0,5),g=Math.max(0,m.length-h.length),_,v;if(t[8]!==c||t[9]!==f?(_=()=>{f||!c||u(`${c.type}:${c.item.id}`)},v=[c,f],t[8]=c,t[9]=f,t[10]=_,t[11]=v):(_=t[10],v=t[11]),(0,Z.useEffect)(_,v),!p&&!r.length){let e;return t[12]===a.noFocus?e=t[13]:(e=(0,$.jsx)(st,{children:a.noFocus}),t[12]=a.noFocus,t[13]=e),e}let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-accent/45 to-transparent`,"aria-hidden":`true`}),t[14]=y):y=t[14];let b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(E,{className:`size-3.5`}),t[15]=b):b=t[15];let x;t[16]===a.portraitHint?x=t[17]:(x=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.16em] text-accent`,children:[b,a.portraitHint]}),t[16]=a.portraitHint,t[17]=x);let S;t[18]!==i||t[19]!==p||t[20]!==a?(S=p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,className:`mt-7 block max-w-3xl text-left`,onClick:()=>u(`focus:${p.id}`),children:[(0,$.jsx)(`h2`,{className:`text-2xl font-semibold leading-tight tracking-tight text-fg sm:text-3xl`,children:p.title}),(0,$.jsx)(`p`,{className:`mt-3 max-w-2xl text-sm leading-7 text-fg-muted sm:text-base`,children:p.summary})]}),(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-4 gap-y-2 pt-8 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`}),a.active]}),(0,$.jsx)(`span`,{children:nt(p.horizon,a)}),(0,$.jsx)(`span`,{children:tt(p.scope,a)}),(0,$.jsxs)(`span`,{children:[a.updated,` · `,rt(p.updatedAt,i)]})]})]}):(0,$.jsx)(`p`,{className:`mt-7 max-w-2xl text-base leading-7 text-fg-muted`,children:a.noFocus}),t[18]=i,t[19]=p,t[20]=a,t[21]=S):S=t[21];let C;t[22]!==x||t[23]!==S?(C=(0,$.jsxs)(`div`,{className:`flex min-h-[18rem] min-w-0 flex-col`,children:[x,S]}),t[22]=x,t[23]=S,t[24]=C):C=t[24];let w;t[25]===a.importantNow?w=t[26]:(w=(0,$.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.12em] text-fg-subtle`,children:a.importantNow}),t[25]=a.importantNow,t[26]=w);let T=n.length?(0,$.jsxs)(`div`,{className:`mt-4 space-y-1`,children:[h.map((e,t)=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>u(`focus:${e.id}`),className:`group flex w-full items-start gap-3 rounded-xl px-2.5 py-2.5 text-left transition-colors ${f?.type===`focus`&&f.item.id===e.id?`bg-accent-soft`:`hover:bg-surface-hover`}`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full ${t===0?`bg-accent`:`bg-success`}`}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`line-clamp-2 text-sm leading-6 text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-fg-subtle`,children:rt(e.updatedAt,i)})]}),(0,$.jsx)(O,{className:`mt-1 size-3.5 shrink-0 text-fg-subtle opacity-0 transition-opacity group-hover:opacity-100`})]},e.id)),g?(0,$.jsxs)(`p`,{className:`border-t border-edge px-2.5 pt-3 text-[11px] text-fg-subtle`,children:[`+`,g,` `,a.moreFocuses]}):null]}):(0,$.jsx)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:a.noFocus}),D;t[27]!==w||t[28]!==T?(D=(0,$.jsxs)(`div`,{className:`self-start rounded-2xl border border-edge bg-surface-base/70 p-5`,children:[w,T]}),t[27]=w,t[28]=T,t[29]=D):D=t[29];let k;t[30]!==C||t[31]!==D?(k=(0,$.jsxs)(`div`,{className:`grid gap-8 px-5 py-7 sm:px-8 sm:py-9 lg:grid-cols-[minmax(0,1fr)_18rem] lg:gap-12 lg:px-10 lg:py-11`,children:[C,D]}),t[30]=C,t[31]=D,t[32]=k):k=t[32];let A;t[33]!==k||t[34]!==y?(A=(0,$.jsxs)(`section`,{className:`relative overflow-hidden rounded-3xl border border-edge bg-surface-panel`,children:[y,k]}),t[33]=k,t[34]=y,t[35]=A):A=t[35];let j;t[36]===a.lastingPortrait?j=t[37]:(j=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.lastingPortrait}),t[36]=a.lastingPortrait,t[37]=j);let M;t[38]===a.lastingHint?M=t[39]:(M=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a.lastingHint}),t[38]=a.lastingHint,t[39]=M);let N;t[40]!==j||t[41]!==M?(N=(0,$.jsxs)(`div`,{children:[j,M]}),t[40]=j,t[41]=M,t[42]=N):N=t[42];let P;t[43]!==i||t[44]!==f||t[45]!==a.noUnderstanding||t[46]!==r?(P=r.length?(0,$.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:r.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>u(`understanding:${e.id}`),className:`group min-h-28 rounded-xl border p-3.5 text-left transition-colors ${f?.type===`understanding`&&f.item.id===e.id?`border-accent bg-accent-soft ring-2 ring-accent/10`:`border-edge bg-surface-base/50 hover:bg-surface-hover`}`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:je[e.kind][i]}),(0,$.jsx)(`span`,{children:rt(e.updatedAt,i)})]}),(0,$.jsx)(`span`,{className:`mt-2 line-clamp-3 block text-sm leading-6 text-fg`,children:e.statement})]},e.id))}):(0,$.jsx)(`p`,{className:`mt-5 rounded-xl border border-dashed border-edge px-4 py-8 text-center text-sm leading-6 text-fg-muted`,children:a.noUnderstanding}),t[43]=i,t[44]=f,t[45]=a.noUnderstanding,t[46]=r,t[47]=P):P=t[47];let F;t[48]!==N||t[49]!==P?(F=(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:[N,P]}),t[48]=N,t[49]=P,t[50]=F):F=t[50];let I;t[51]!==i||t[52]!==o||t[53]!==f||t[54]!==a?(I=f?(0,$.jsx)(Xe,{selection:f,language:i,t:a,onRefresh:o}):null,t[51]=i,t[52]=o,t[53]=f,t[54]=a,t[55]=I):I=t[55];let L;t[56]!==F||t[57]!==I?(L=(0,$.jsxs)(`div`,{className:`grid gap-5 lg:grid-cols-[minmax(0,1fr)_20rem]`,children:[F,I]}),t[56]=F,t[57]=I,t[58]=L):L=t[58];let R;return t[59]!==A||t[60]!==L?(R=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[A,L]}),t[59]=A,t[60]=L,t[61]=R):R=t[61],R}function Je(e,t,n){let[r,i]=e.split(`:`,2);if(r===`focus`){let e=t.find(e=>e.id===i);return e?{type:`focus`,item:e}:null}if(r===`understanding`){let e=n.find(e=>e.id===i);return e?{type:`understanding`,item:e}:null}return null}function Ye(e){let t=new Set;return e.filter(e=>{let n=e.title.trim().toLocaleLowerCase();return t.has(n)?!1:(t.add(n),!0)})}function Xe({selection:e,language:t,t:n,onRefresh:r}){let i=e.item,a=e.type===`understanding`?e.item:null,[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(e.type===`focus`?e.item.title:``),[d,p]=(0,Z.useState)(e.type===`focus`?e.item.summary:e.item.statement),[m,h]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(`idle`),[y,b]=(0,Z.useState)([]);(0,Z.useEffect)(()=>{c(!1),u(e.type===`focus`?e.item.title:``),p(e.type===`focus`?e.item.summary:e.item.statement),v(`idle`),b([])},[e.type,e.item.id]);let x=async e=>{h(!0);try{await e(),await r()}finally{h(!1)}},S=async t=>{t.preventDefault(),!(!d.trim()||e.type===`focus`&&!l.trim())&&(await x(()=>e.type===`focus`?L(e.item.id,{title:l.trim(),summary:d.trim()}):j(e.item.id,{statement:d.trim()})),c(!1))},C=async()=>{if(!(!a||_===`loading`)){v(`loading`);try{b((await W(a.id)).evidence),v(`loaded`)}catch{v(`error`)}}},w=i.explicitness===`explicit`?n.explicit:i.explicitness===`observed`?n.observed:n.inferred;return(0,$.jsxs)(`aside`,{className:`self-start overflow-hidden rounded-2xl border border-edge bg-surface-panel lg:sticky lg:top-5`,children:[(0,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,$.jsx)(`p`,{className:`text-[11px] font-semibold uppercase tracking-[0.12em] text-accent`,children:e.type===`focus`?n.focusDetail:n.selectedDetail}),s?(0,$.jsxs)(`form`,{className:`mt-3 space-y-3`,onSubmit:S,children:[e.type===`focus`?(0,$.jsx)(`input`,{className:We,value:l,onChange:e=>u(e.target.value)}):null,(0,$.jsx)(`textarea`,{autoFocus:!0,className:We,rows:5,value:d,onChange:e=>p(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(g,{type:`button`,disabled:m,onClick:()=>c(!1),children:n.cancel}),(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:m||!d.trim()||e.type===`focus`&&!l.trim(),children:n.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{className:`mt-3 text-base font-semibold leading-6 text-fg`,children:e.type===`focus`?e.item.title:e.item.statement}),e.type===`focus`?(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.item.summary}):null]})]}),s?null:(0,$.jsxs)(`div`,{className:`space-y-5 px-5 py-4`,children:[(0,$.jsxs)(`dl`,{className:`space-y-3 text-xs`,children:[(0,$.jsx)(Ze,{label:n.source,value:w}),(0,$.jsx)(Ze,{label:n.scope,value:tt(i.scope,n)}),(0,$.jsx)(Ze,{label:n.updated,value:rt(i.updatedAt,t,!0)}),i.validFrom?(0,$.jsx)(Ze,{label:n.validSince,value:rt(i.validFrom,t,!0)}):null,i.validTo?(0,$.jsx)(Ze,{label:n.validUntil,value:rt(i.validTo,t,!0)}):null,i.reviewAt?(0,$.jsx)(Ze,{label:n.reviewDue,value:rt(i.reviewAt,t,!0)}):null]}),a?(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>void C(),className:`inline-flex items-center gap-1.5 text-xs font-medium text-accent hover:underline`,children:[(0,$.jsx)(f,{className:`size-3.5`}),n.evidence]}),_===`idle`?null:(0,$.jsxs)(`div`,{className:`mt-2 rounded-xl bg-surface-muted p-3`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n.evidenceTitle}),_===`loading`?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.evidenceLoading}):null,_===`error`?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:n.evidenceError}):null,_===`loaded`&&!y.length?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.evidenceEmpty}):null,y.length?(0,$.jsx)(`div`,{className:`mt-2 space-y-2`,children:y.slice(0,4).map(e=>(0,$.jsx)(Qe,{evidence:e,language:t},e.id))}):null]})]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2 border-t border-edge pt-4`,children:[(0,$.jsxs)(g,{disabled:m,onClick:()=>c(!0),children:[(0,$.jsx)(Y,{className:`size-3.5`}),n.edit]}),e.type===`focus`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{variant:`ghost`,disabled:m,onClick:()=>void x(()=>L(e.item.id,{status:`paused`})),children:n.pause}),(0,$.jsxs)(g,{variant:`ghost`,disabled:m,onClick:()=>void x(()=>L(e.item.id,{status:`completed`})),children:[(0,$.jsx)(o,{className:`size-3.5`}),n.complete]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{variant:`ghost`,disabled:m,onClick:()=>void x(()=>j(e.item.id,{status:`archived`})),children:n.archive}),(0,$.jsx)(g,{variant:`ghost`,className:`text-danger`,disabled:m,onClick:()=>void x(()=>j(e.item.id,{status:`rejected`})),children:n.incorrect})]})]})]})]})}function Ze(e){let t=(0,Q.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`dt`,{className:`shrink-0 text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,$.jsx)(`dd`,{className:`text-right leading-5 text-fg-muted`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Qe(e){let t=(0,Q.c)(12),{evidence:n,language:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={conversation:{en:`Conversation`,zh:`对话`},connector:{en:`Connected source`,zh:`连接的数据源`},user:{en:`Direct input`,zh:`直接输入`},runtime:{en:`Work context`,zh:`工作过程`}},t[0]=i):i=t[0];let a=i[n.sourceType][r],o;t[1]!==n.observedAt||t[2]!==r?(o=rt(n.observedAt,r),t[1]=n.observedAt,t[2]=r,t[3]=o):o=t[3];let s;t[4]!==a||t[5]!==o?(s=(0,$.jsxs)(`p`,{className:`text-[11px] text-fg-subtle`,children:[a,` · `,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===n.redactedExcerpt?c=t[8]:(c=n.redactedExcerpt?(0,$.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.redactedExcerpt}):null,t[7]=n.redactedExcerpt,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,$.jsxs)(`div`,{className:`border-l-2 border-edge-strong pl-2.5`,children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function $e(e){let t=(0,Q.c)(17),{items:n,language:r,t:i}=e;if(!n.length){let e;return t[0]===i.timelineEmpty?e=t[1]:(e=(0,$.jsx)(st,{children:i.timelineEmpty}),t[0]=i.timelineEmpty,t[1]=e),e}let a;t[2]===i.changesIntro?a=t[3]:(a=(0,$.jsx)(`header`,{className:`border-b border-edge px-5 py-4`,children:(0,$.jsx)(`p`,{className:`max-w-2xl text-xs leading-5 text-fg-muted`,children:i.changesIntro})}),t[2]=i.changesIntro,t[3]=a);let o;if(t[4]!==n||t[5]!==r||t[6]!==i){let e;t[8]!==n.length||t[9]!==r||t[10]!==i?(e=(e,t)=>{let a=e.type===`focus`?e.focus.status:e.understanding.status,o=e.type===`focus`?e.focus:e.understanding,s=e.type===`focus`?e.focus.title:e.understanding.statement,c=et(a,o.createdAt===o.updatedAt,i),l=e.type===`focus`?i.importantNow:je[e.understanding.kind][r],u=[`paused`,`completed`,`rejected`,`archived`].includes(a);return(0,$.jsxs)(`article`,{className:`relative grid grid-cols-[1.25rem_minmax(0,1fr)] gap-3 py-4 sm:grid-cols-[6.5rem_1.25rem_minmax(0,1fr)] sm:gap-4`,children:[(0,$.jsx)(`time`,{className:`hidden pt-0.5 text-right text-[11px] tabular-nums text-fg-subtle sm:block`,children:rt(e.updatedAt,r)}),t<n.length-1?(0,$.jsx)(`span`,{className:`absolute bottom-0 left-[0.6rem] top-7 w-px bg-edge sm:left-[7.9rem]`,"aria-hidden":`true`}):null,(0,$.jsx)(`span`,{className:`relative z-10 mt-1 size-2.5 rounded-full border-2 border-surface-panel ${u?`bg-fg-subtle`:a===`active`?`bg-success`:`bg-warning`}`,"aria-hidden":`true`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-accent`,children:c}),(0,$.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:l}),(0,$.jsx)(`time`,{className:`text-[11px] text-fg-subtle sm:hidden`,children:rt(e.updatedAt,r)})]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 ${u?`text-fg-muted`:`text-fg`}`,children:s})]})]},`${e.type}:${e.id}`)},t[8]=n.length,t[9]=r,t[10]=i,t[11]=e):e=t[11],o=n.map(e),t[4]=n,t[5]=r,t[6]=i,t[7]=o}else o=t[7];let s;t[12]===o?s=t[13]:(s=(0,$.jsx)(`div`,{className:`px-4 py-2 sm:px-6`,children:o}),t[12]=o,t[13]=s);let c;return t[14]!==a||t[15]!==s?(c=(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[a,s]}),t[14]=a,t[15]=s,t[16]=c):c=t[16],c}function et(e,t,n){return e===`candidate`?n.proposed:e===`needs_review`||e===`stale`?n.needsReview:e===`paused`?n.paused:e===`completed`?n.completed:e===`rejected`?n.rejected:e===`archived`?n.archived:t?n.formed:n.changed}function tt(e,t){let n=e.type===`global`?t.global:e.type===`workspace`?t.workspace:e.type===`project`?t.project:t.session;return e.id?`${n} · ${e.id}`:n}function nt(e,t){return e===`long_term`?t.horizonLongTerm:e===`ongoing`?t.horizonOngoing:t.horizonCurrent}function rt(e,t,n=!1){return new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en`,{...n?{year:`numeric`}:{},month:`short`,day:`numeric`}).format(new Date(e))}function it({items:e,language:t,t:n,onRefresh:r}){let[i,a]=(0,Z.useState)(0),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d=e.length?i%e.length:0,f=e[d];if((0,Z.useEffect)(()=>{a(0),c(!1)},[e.length]),!f)return(0,$.jsx)(st,{children:n.noReview});let p=async e=>{u(!0);try{f.type===`focus`?await L(f.id,{status:e?`active`:`rejected`}):await j(f.id,{status:e?`active`:`rejected`}),await r()}finally{u(!1)}};return(0,$.jsxs)(`section`,{className:`mx-auto max-w-2xl`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:n.reviewTitle}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[d+1,` / `,e.length]})]}),(0,$.jsxs)(`article`,{className:`mt-3 rounded-2xl border border-edge bg-surface-panel p-5 sm:p-6`,children:[(0,$.jsx)(at,{item:f,language:t,t:n,editing:s,pending:l,onCancelEdit:()=>c(!1),onSaved:r}),s?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`mt-5 rounded-xl bg-surface-muted px-3 py-2.5 text-xs leading-5 text-fg-muted`,children:n.reviewHint}),(0,$.jsxs)(`div`,{className:`mt-5 grid gap-2 sm:grid-cols-3`,children:[(0,$.jsxs)(g,{variant:`primary`,disabled:l,onClick:()=>void p(!0),children:[(0,$.jsx)(o,{className:`size-4`}),n.yes]}),(0,$.jsx)(g,{disabled:l,onClick:()=>c(!0),children:n.change}),(0,$.jsx)(g,{variant:`ghost`,className:`text-danger`,disabled:l,onClick:()=>void p(!1),children:n.wrong})]}),e.length>1?(0,$.jsx)(`button`,{type:`button`,className:`mx-auto mt-3 block rounded-md px-2 py-1 text-xs text-fg-muted hover:text-fg`,onClick:()=>a(t=>(t+1)%e.length),children:n.later}):null]})]})]})}function at({item:e,language:t,t:n,editing:r,pending:i,onCancelEdit:a,onSaved:o}){let[s,c]=(0,Z.useState)(e.type===`focus`?e.focus.title:``),[l,u]=(0,Z.useState)(e.type===`focus`?e.focus.summary:e.understanding.statement),[d,f]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{c(e.type===`focus`?e.focus.title:``),u(e.type===`focus`?e.focus.summary:e.understanding.statement)},[e]);let p=e.type===`focus`?e.focus.confidence:e.understanding.confidence,m=p>=.85?n.high:p>=.65?n.medium:n.low,h=async t=>{if(t.preventDefault(),!(!l.trim()||e.type===`focus`&&!s.trim())){f(!0);try{e.type===`focus`?await L(e.id,{title:s,summary:l,status:`active`}):await j(e.id,{statement:l,status:`active`}),await o()}finally{f(!1)}}};if(r)return(0,$.jsxs)(`form`,{onSubmit:h,className:`space-y-3`,children:[e.type===`focus`?(0,$.jsx)(`input`,{autoFocus:!0,className:We,value:s,onChange:e=>c(e.target.value)}):null,(0,$.jsx)(`textarea`,{autoFocus:e.type===`understanding`,className:We,rows:4,value:l,onChange:e=>u(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(g,{type:`button`,disabled:d,onClick:a,children:n.cancel}),(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:i||d||!l.trim()||e.type===`focus`&&!s.trim(),children:n.saveConfirm})]})]});let _=e.type===`understanding`?e.understanding:null,v=_?_.explicitness===`explicit`?n.explicit:_.explicitness===`observed`?n.observed:n.inferred:n.inferred;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`font-medium text-accent`,children:e.type===`focus`?n.focusCandidate:n.understandingCandidate}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[n.confidence,` `,m]}),_?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:je[_.kind][t]})]}):null]}),e.type===`focus`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h2`,{className:`mt-4 text-lg font-semibold leading-7 text-fg`,children:e.focus.title}),(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:e.focus.summary})]}):(0,$.jsx)(`p`,{className:`mt-4 text-lg font-semibold leading-8 text-fg`,children:e.understanding.statement}),(0,$.jsx)(`p`,{className:`mt-4 text-xs text-fg-subtle`,children:v})]})}function ot(e){let t=(0,Q.c)(56),{open:n,onOpenChange:r,language:i,t:a,onCreated:o}=e,[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(`preference`),p;t[0]!==d||t[1]!==o||t[2]!==r||t[3]!==l?(p=async e=>{e.preventDefault(),l.trim()&&(await le({statement:l,kind:d}),u(``),r(!1),await o())},t[0]=d,t[1]=o,t[2]=r,t[3]=l,t[4]=p):p=t[4];let m=p,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(v,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[5]=_):_=t[5];let y;t[6]===a.add?y=t[7]:(y=(0,$.jsx)(C,{className:`text-base font-semibold text-fg`,children:a.add}),t[6]=a.add,t[7]=y);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(h,{className:`size-4`}),t[8]=T):T=t[8];let E;t[9]===a.cancel?E=t[10]:(E=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":a.cancel,children:T})}),t[9]=a.cancel,t[10]=E);let D;t[11]!==y||t[12]!==E?(D=(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[y,E]}),t[11]=y,t[12]=E,t[13]=D):D=t[13];let O;t[14]===a.statement?O=t[15]:(O=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.statement}),t[14]=a.statement,t[15]=O);let k;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>u(e.target.value),t[16]=k):k=t[16];let A;t[17]===l?A=t[18]:(A=(0,$.jsx)(`textarea`,{autoFocus:!0,className:We,rows:4,value:l,onChange:k}),t[17]=l,t[18]=A);let j;t[19]!==O||t[20]!==A?(j=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[O,A]}),t[19]=O,t[20]=A,t[21]=j):j=t[21];let M;t[22]===a.type?M=t[23]:(M=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.type}),t[22]=a.type,t[23]=M);let N,P;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>f(e.target.value),P=Object.entries(je),t[24]=N,t[25]=P):(N=t[24],P=t[25]);let F;t[26]===i?F=t[27]:(F=P.map(e=>{let[t,n]=e;return(0,$.jsx)(c,{value:t,children:n[i]},t)}),t[26]=i,t[27]=F);let I;t[28]!==d||t[29]!==F?(I=(0,$.jsx)(s,{value:d,onChange:N,children:F}),t[28]=d,t[29]=F,t[30]=I):I=t[30];let L;t[31]!==M||t[32]!==I?(L=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[M,I]}),t[31]=M,t[32]=I,t[33]=L):L=t[33];let R;t[34]!==j||t[35]!==L?(R=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[j,L]}),t[34]=j,t[35]=L,t[36]=R):R=t[36];let z;t[37]===a.cancel?z=t[38]:(z=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{type:`button`,children:a.cancel})}),t[37]=a.cancel,t[38]=z);let B;t[39]===l?B=t[40]:(B=l.trim(),t[39]=l,t[40]=B);let V=!B,H;t[41]!==a.create||t[42]!==V?(H=(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:V,children:a.create}),t[41]=a.create,t[42]=V,t[43]=H):H=t[43];let U;t[44]!==z||t[45]!==H?(U=(0,$.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-3`,children:[z,H]}),t[44]=z,t[45]=H,t[46]=U):U=t[46];let W;t[47]!==m||t[48]!==R||t[49]!==U||t[50]!==D?(W=(0,$.jsxs)(x,{children:[_,(0,$.jsx)(S,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(30rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:m,children:[D,R,U]})})]}),t[47]=m,t[48]=R,t[49]=U,t[50]=D,t[51]=W):W=t[51];let G;return t[52]!==r||t[53]!==n||t[54]!==W?(G=(0,$.jsx)(w,{open:n,onOpenChange:r,children:W}),t[52]=r,t[53]=n,t[54]=W,t[55]=G):G=t[55],G}function st(e){let t=(0,Q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-12 text-center text-sm leading-6 text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}var ct=new Set([`profile`,`understanding`,`collaboration`,`sources`,`dreaming`,`privacy`]),lt=`w-full rounded-xl border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/60 focus:ring-2 focus:ring-accent/20`,ut={en:{title:`You`,subtitle:`A living portrait, shaped together by you and xopc.`,profile:`Your portrait`,understanding:`Shared understanding`,collaboration:`Working together`,sources:`Sources`,dreaming:`Background review`,privacy:`Privacy`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`This is how xopc currently understands you. It grows through your conversations and work — and you always have the final say.`,maintainedTogether:`Shaped together`,youDecide:`You decide what stays`,editProfile:`Edit basics`,talkAboutMe:`Add through conversation`,roleMissing:`Add what you do`,direction:`What matters now`,directionEmpty:`Add a direction so xopc can help keep important work moving.`,portraitUnderstanding:`What xopc understands`,portraitUnderstandingHint:`Confirmed context xopc can use across conversations.`,portraitRules:`How we work together`,portraitRulesHint:`The agreements xopc should follow when helping you.`,reviewWaiting:`waiting for your review`,seeAll:`See all`,addFirstUnderstanding:`Nothing confirmed yet. Tell xopc what matters to you, or review a suggestion when one appears.`,addFirstRule:`No working agreements yet. Add one to make collaboration feel more like yours.`,portraitControl:`How this portrait evolves`,portraitControlHint:`Manage where understanding comes from, how it is reviewed, and what is never retained.`,portraitLearn:`Learn how this portrait is formed`,advanced:`Portrait controls`,backToPortrait:`Back to your portrait`,controlSourcesHint:`See which conversations, connections, and explicit details shape xopc’s understanding.`,controlReviewHint:`Choose how xopc proposes updates and which changes require your confirmation.`,controlPrivacyHint:`Set the boundaries for sensitive content and long-term retention.`,controlTrust:`Inferred understanding is never activated automatically. You can review, correct, or remove it at any time.`,profileHint:`Facts you provide directly. These are available across conversations.`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: product designer, founder, or engineer`,primaryGoal:`What are you mainly trying to achieve?`,primaryGoalPlaceholder:`The outcome you want xopc to optimize for`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,detect:`Use this device`,add:`Add`,cancel:`Cancel`,delete:`Delete`,confirmDelete:`Delete now`,rulesHint:`Explicit instructions for how xopc should collaborate with you. Rules outrank inferred understanding.`,addRule:`Add rule`,ruleStatement:`How should xopc work with you?`,category:`Category`,disable:`Disable`,enable:`Enable`,emptyRules:`No working agreements yet.`,sourcesHint:`Review every granted source, its latest learning result, access mode, and retention. Revoking stops future learning.`,manageSources:`Connect another source`,authorizedSources:`Authorized sources`,connectorsTitle:`Connectors`,openConnector:`Open connector`,noSources:`No sources are authorized.`,noConnectors:`No connectors are installed.`,connected:`Connected`,unavailable:`Needs attention`,revoke:`Revoke source`,revokeHint:`Review the impact before revoking this source`,revoking:`Revoking…`,revokeDone:`Source revoked.`,revokeImpact:`This source exclusively supports {{count}} context objects. Keeping them removes them from planning until reviewed.`,deleteDerived:`Revoke and delete`,retainDerived:`Revoke and keep for review`,refresh:`Update`,refreshing:`Updating…`,refreshStarted:`Update started.`,actionFailed:`Action failed`,once:`One-time`,continuous:`Continuous`,localOnly:`Local only`,derivedOnly:`Derived understanding only`,sourceQueued:`Queued`,sourceRunning:`Learning`,sourceCompleted:`Learned`,sourcePartial:`Partially learned`,sourceFailed:`Learning failed`,sourceNotRun:`Not collected yet`,sourceItems:`items reviewed`,sourceCandidates:`candidates formed`,sourceAccountUnavailable:`The connected account is unavailable. Reconnect it and try again.`,sourceSyncFailed:`This source could not be synchronized. Try updating it again.`,sourceAnalysisFailed:`Content was collected, but deeper understanding could not be completed. Try again later.`,contentReadTitle:`Additional deeper reading`,contentReadHint:`These items still need content to add useful context. Select up to 5 for one bounded read.`,readSelected:`Read selected`,reading:`Reading…`,contentReadDone:`Selected content was read and indexed.`,dreamingHint:`A deterministic daily review checks expiry, contradictory evidence, and corroborated candidates. It never auto-activates an inference.`,mode:`Background review`,on:`On — propose for review`,off:`Off`,reviewTime:`Daily review time`,evidenceThreshold:`Supporting evidence required`,scanLimit:`Maximum items per run`,lastRun:`Last review`,neverRun:`Not run yet`,runCompleted:`Completed`,runFailed:`Failed`,runRunning:`Running`,runItems:`items`,privacyHint:`Choose how generic memory providers handle sensitive content. Structured user understanding applies stricter rules of its own.`,sensitivePolicy:`Sensitive memory writes`,policyDeny:`Do not store`,policyConfirm:`Ask before storing`,policyAllow:`Store when relevant`,privacyWarning:`Secret and regulated content is never stored as structured user understanding, regardless of this setting.`,error:`Could not load your context.`,retry:`Try again`},zh:{title:`你`,subtitle:`一份由你和 xopc 共同塑造、持续生长的画像。`,profile:`你的画像`,understanding:`共同理解`,collaboration:`协作方式`,sources:`数据来源`,dreaming:`后台复核`,privacy:`隐私`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`这是 xopc 此刻对你的理解。它会在对话与共事中逐渐丰富,而你始终拥有最终决定权。`,maintainedTogether:`由你与 xopc 共同维护`,youDecide:`你决定什么被保留`,editProfile:`编辑基本信息`,talkAboutMe:`在对话中补充`,roleMissing:`补充你的角色`,direction:`此刻重要的事`,directionEmpty:`写下你此刻的方向,让 xopc 帮你持续推动真正重要的事。`,portraitUnderstanding:`xopc 对你的理解`,portraitUnderstandingHint:`已经确认、可以在不同对话中帮助你的上下文。`,portraitRules:`我们如何一起工作`,portraitRulesHint:`xopc 在帮助你时应该遵循的约定。`,reviewWaiting:`条等待你确认`,seeAll:`查看全部`,addFirstUnderstanding:`还没有已确认的理解。你可以直接告诉 xopc 什么对你重要,或在它形成建议后确认。`,addFirstRule:`还没有协作约定。添加后,xopc 会更像你熟悉的搭档。`,portraitControl:`这份画像如何更新`,portraitControlHint:`管理理解从哪里来、如何复核,以及哪些内容永远不会被保留。`,portraitLearn:`了解这份画像如何形成`,advanced:`画像管理`,backToPortrait:`返回你的画像`,controlSourcesHint:`查看哪些对话、连接与明确告知的内容塑造了 xopc 的理解。`,controlReviewHint:`决定 xopc 如何提出更新,以及哪些变化需要你确认。`,controlPrivacyHint:`设定敏感内容与长期保留的边界。`,controlTrust:`推断出的理解不会自动生效。你可以随时复核、修正或删除。`,profileHint:`由你直接提供的事实,会在不同对话中使用。`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:产品设计师、创业者、工程师`,primaryGoal:`你目前最想达成什么?`,primaryGoalPlaceholder:`希望 xopc 优先帮助你实现的结果`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,detect:`使用本机时区`,add:`添加`,cancel:`取消`,delete:`删除`,confirmDelete:`确认删除`,rulesHint:`你明确设定的协作方式。协作约定的优先级高于推断出的理解。`,addRule:`添加约定`,ruleStatement:`希望 xopc 如何与你协作?`,category:`类别`,disable:`停用`,enable:`启用`,emptyRules:`还没有协作约定。`,sourcesHint:`查看每项授权最近一次学习结果、访问方式与保留策略;撤销后将停止后续学习。`,manageSources:`连接其他来源`,authorizedSources:`已授权数据来源`,connectorsTitle:`连接器`,openConnector:`打开连接器`,noSources:`尚未授权任何来源。`,noConnectors:`尚未安装连接器。`,connected:`已连接`,unavailable:`需要处理`,revoke:`撤销来源`,revokeHint:`撤销前先查看影响范围`,revoking:`正在撤销…`,revokeDone:`已撤销来源。`,revokeImpact:`此来源是 {{count}} 个上下文对象的唯一依据。若保留,它们会先退出规划,等待复核。`,deleteDerived:`撤销并删除`,retainDerived:`撤销并保留待复核`,refresh:`更新`,refreshing:`正在更新…`,refreshStarted:`更新任务已开始。`,actionFailed:`操作失败`,once:`仅一次`,continuous:`持续更新`,localOnly:`仅本地处理`,derivedOnly:`仅保留派生理解`,sourceQueued:`等待中`,sourceRunning:`正在理解`,sourceCompleted:`理解完成`,sourcePartial:`部分完成`,sourceFailed:`理解失败`,sourceNotRun:`尚未采集`,sourceItems:`项已检查`,sourceCandidates:`项候选理解`,sourceAccountUnavailable:`连接的账号不可用,请重新连接后重试。`,sourceSyncFailed:`该来源同步失败,请再次更新。`,sourceAnalysisFailed:`内容已采集,但深入理解未完成,请稍后重试。`,contentReadTitle:`补充深入读取`,contentReadHint:`这些条目还需要正文才能形成有用上下文。你可以选择最多 5 项进行一次有界读取。`,readSelected:`读取所选内容`,reading:`正在读取…`,contentReadDone:`已读取并索引所选内容。`,dreamingHint:`每天进行一次确定性复核,检查过期、矛盾证据和得到佐证的候选理解;推断内容不会自动生效。`,mode:`后台复核`,on:`开启并生成待审核项`,off:`关闭`,reviewTime:`每日复核时间`,evidenceThreshold:`所需支持证据数`,scanLimit:`每次最多检查`,lastRun:`最近一次复核`,neverRun:`尚未运行`,runCompleted:`已完成`,runFailed:`失败`,runRunning:`运行中`,runItems:`项`,privacyHint:`选择通用记忆服务如何处理敏感内容;结构化用户理解有独立且更严格的规则。`,sensitivePolicy:`敏感记忆写入`,policyDeny:`不保存`,policyConfirm:`保存前询问`,policyAllow:`相关时允许保存`,privacyWarning:`无论这里如何设置,秘密和受监管内容都不会保存为结构化用户理解。`,error:`无法加载用户上下文。`,retry:`重试`}},dt={communication:{en:`Communication`,zh:`沟通`},execution:{en:`Execution`,zh:`执行`},boundary:{en:`Boundary`,zh:`边界`},routine:{en:`Routine`,zh:`习惯`},proactive:{en:`Proactive help`,zh:`主动协助`}};function ft(e){let t=(0,Q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:n}),t[0]=n,t[1]=r),r}function pt(e){let t=(0,Q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-10 text-center text-sm text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function mt(e){let t=(0,Q.c)(33),{open:n,onOpenChange:r,title:i,description:a,submitLabel:o,cancelLabel:s,submitDisabled:c,onSubmit:l,children:u}=e,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(v,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=d):d=t[0];let f;t[1]===i?f=t[2]:(f=(0,$.jsx)(C,{className:`text-base font-semibold text-fg`,children:i}),t[1]=i,t[2]=f);let p;t[3]===a?p=t[4]:(p=(0,$.jsx)(y,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a}),t[3]=a,t[4]=p);let m;t[5]!==f||t[6]!==p?(m=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[f,p]}),t[5]=f,t[6]=p,t[7]=m):m=t[7];let _;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(h,{className:`size-4`}),t[8]=_):_=t[8];let T;t[9]===s?T=t[10]:(T=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":s,children:_})}),t[9]=s,t[10]=T);let E;t[11]!==m||t[12]!==T?(E=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[m,T]}),t[11]=m,t[12]=T,t[13]=E):E=t[13];let D;t[14]===u?D=t[15]:(D=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:u}),t[14]=u,t[15]=D);let O;t[16]===s?O=t[17]:(O=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{type:`button`,children:s})}),t[16]=s,t[17]=O);let k;t[18]!==c||t[19]!==o?(k=(0,$.jsx)(g,{type:`submit`,variant:`primary`,disabled:c,children:o}),t[18]=c,t[19]=o,t[20]=k):k=t[20];let A;t[21]!==k||t[22]!==O?(A=(0,$.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[O,k]}),t[21]=k,t[22]=O,t[23]=A):A=t[23];let j;t[24]!==l||t[25]!==A||t[26]!==E||t[27]!==D?(j=(0,$.jsxs)(x,{children:[d,(0,$.jsx)(S,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(30rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:l,children:[E,D,A]})})]}),t[24]=l,t[25]=A,t[26]=E,t[27]=D,t[28]=j):j=t[28];let M;return t[29]!==r||t[30]!==n||t[31]!==j?(M=(0,$.jsx)(w,{open:n,onOpenChange:r,children:j}),t[29]=r,t[30]=n,t[31]=j,t[32]=M):M=t[32],M}function ht(e){return JSON.stringify(e)}function gt(e){let t=(0,Q.c)(10),[n,r]=(0,Z.useState)(e),i;t[0]===e?i=t[1]:(i=ht(e),t[0]=e,t[1]=i);let a=(0,Z.useRef)(i),o;t[2]===e?o=t[3]:(o=ht(e),t[2]=e,t[3]=o);let s=o,c,l;t[4]!==e||t[5]!==s?(c=()=>{if(s===a.current)return;let t=a.current;a.current=s,r(n=>ht(n)===t?e:n)},l=[e,s],t[4]=e,t[5]=s,t[6]=c,t[7]=l):(c=t[6],l=t[7]),(0,Z.useEffect)(c,l);let u;return t[8]===n?u=t[9]:(u=[n,r],t[8]=n,t[9]=u),u}function _t(e){return{callName:e.callName,role:e.role,primaryGoal:e.primaryGoal,pronouns:e.pronouns,timezone:e.timezone,locale:e.locale}}function vt(){let e=(0,Q.c)(67),t=_(Ct),n=ut[t],[r,a]=i(),o;if(e[0]!==r){let t=r.get(`tab`);o=t&&ct.has(t)?t:`profile`,e[0]=r,e[1]=o}else o=e[1];let s=o,c=X(St),l=X(xt),{data:u,error:d,isLoading:f,mutate:p}=T(`/api/you`,G),m;e[2]!==l||e[3]!==c||e[4]!==n.subtitle||e[5]!==n.title?(m=()=>(c({startExtra:null,main:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:n.subtitle})]}),end:null}),l),e[2]=l,e[3]=c,e[4]=n.subtitle,e[5]=n.title,e[6]=m):m=e[6];let h;if(e[7]!==l||e[8]!==c||e[9]!==n?(h=[l,c,n],e[7]=l,e[8]=c,e[9]=n,e[10]=h):h=e[10],(0,Z.useEffect)(m,h),f){let t;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-6`,children:[(0,$.jsx)(U,{className:`h-10 w-96 max-w-full`}),(0,$.jsx)(U,{className:`h-72 rounded-2xl`})]}),e[11]=t):t=e[11],t}if(d||!u){let t;e[12]===p?t=e[13]:(t=()=>void p(),e[12]=p,e[13]=t);let r;e[14]!==n.retry||e[15]!==t?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:t,children:n.retry}),e[14]=n.retry,e[15]=t,e[16]=r):r=e[16];let i;return e[17]!==n.error||e[18]!==r?(i=(0,$.jsx)(`div`,{className:`p-6`,children:(0,$.jsxs)(pt,{children:[n.error,` `,r]})}),e[17]=n.error,e[18]=r,e[19]=i):i=e[19],i}let v=s===`sources`||s===`dreaming`||s===`privacy`,y;e[20]!==v||e[21]!==u||e[22]!==a||e[23]!==n.advanced||e[24]!==n.backToPortrait||e[25]!==n.collaboration||e[26]!==n.profile||e[27]!==n.title||e[28]!==n.understanding||e[29]!==s?(y=v?(0,$.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge pb-4`,children:[(0,$.jsxs)(g,{variant:`ghost`,className:`-ml-2`,onClick:()=>a({tab:`profile`}),children:[(0,$.jsx)(I,{className:`size-4`}),n.backToPortrait]}),(0,$.jsx)(`span`,{className:`h-4 w-px bg-edge`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n.advanced})]}):(0,$.jsx)(xe,{ariaLabel:n.title,activeTab:s,onChange:e=>a({tab:e}),items:[{id:`profile`,label:n.profile,icon:he},{id:`understanding`,label:n.understanding,icon:F,count:u.understandings.filter(bt).length+u.focuses.filter(yt).length||void 0},{id:`collaboration`,label:n.collaboration,icon:H}]}),e[20]=v,e[21]=u,e[22]=a,e[23]=n.advanced,e[24]=n.backToPortrait,e[25]=n.collaboration,e[26]=n.profile,e[27]=n.title,e[28]=n.understanding,e[29]=s,e[30]=y):y=e[30];let b;e[31]!==u||e[32]!==t||e[33]!==p||e[34]!==a||e[35]!==n||e[36]!==s?(b=s===`profile`?(0,$.jsx)(wt,{data:u,language:t,t:n,onNavigate:e=>a({tab:e}),onProfileChanged:e=>p(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[31]=u,e[32]=t,e[33]=p,e[34]=a,e[35]=n,e[36]=s,e[37]=b):b=e[37];let x;e[38]!==u||e[39]!==t||e[40]!==p||e[41]!==s?(x=s===`understanding`?(0,$.jsx)(Ge,{focuses:u.focuses,understandings:u.understandings,language:t,onRefresh:()=>p()}):null,e[38]=u,e[39]=t,e[40]=p,e[41]=s,e[42]=x):x=e[42];let S;e[43]!==u||e[44]!==t||e[45]!==p||e[46]!==n||e[47]!==s?(S=s===`collaboration`?(0,$.jsx)(Pt,{rules:u.rules,language:t,t:n,onChanged:()=>p()}):null,e[43]=u,e[44]=t,e[45]=p,e[46]=n,e[47]=s,e[48]=S):S=e[48];let C;e[49]!==n||e[50]!==s?(C=s===`sources`?(0,$.jsx)(Lt,{t:n}):null,e[49]=n,e[50]=s,e[51]=C):C=e[51];let w;e[52]!==u||e[53]!==n||e[54]!==s?(w=s===`dreaming`?(0,$.jsx)(Rt,{lastRun:u.consolidation?.lastRun??null,t:n}):null,e[52]=u,e[53]=n,e[54]=s,e[55]=w):w=e[55];let E;e[56]!==n||e[57]!==s?(E=s===`privacy`?(0,$.jsx)(Bt,{t:n}):null,e[56]=n,e[57]=s,e[58]=E):E=e[58];let D;return e[59]!==y||e[60]!==b||e[61]!==x||e[62]!==S||e[63]!==C||e[64]!==w||e[65]!==E?(D=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[y,b,x,S,C,w,E]}),e[59]=y,e[60]=b,e[61]=x,e[62]=S,e[63]=C,e[64]=w,e[65]=E,e[66]=D):D=e[66],D}function yt(e){return e.status===`candidate`}function bt(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function xt(e){return e.clearPageHeader}function St(e){return e.setPageHeader}function Ct(e){return e.language}function wt(e){let t=(0,Q.c)(179),{data:n,language:r,t:i,onNavigate:o,onProfileChanged:s}=e,[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),f,p,m,h,_,v,y,b,x,S;if(t[0]!==n.focuses||t[1]!==n.profile.callName||t[2]!==n.profile.primaryGoal||t[3]!==n.profile.role||t[4]!==n.rules||t[5]!==n.understandings||t[6]!==r||t[7]!==o||t[8]!==i.addFirstRule||t[9]!==i.addFirstUnderstanding||t[10]!==i.advanced||t[11]!==i.direction||t[12]!==i.directionEmpty||t[13]!==i.editProfile||t[14]!==i.maintainedTogether||t[15]!==i.portraitEyebrow||t[16]!==i.portraitIntro||t[17]!==i.portraitRules||t[18]!==i.portraitRulesHint||t[19]!==i.portraitUnderstanding||t[20]!==i.portraitUnderstandingHint||t[21]!==i.reviewWaiting||t[22]!==i.roleMissing||t[23]!==i.seeAll||t[24]!==i.talkAboutMe||t[25]!==i.youDecide){let e=n.understandings.filter(Ot),s;t[36]===n.understandings?s=t[37]:(s=n.understandings.filter(Dt),t[36]=n.understandings,t[37]=s);let c=s.length,u;t[38]===n.focuses?u=t[39]:(u=n.focuses.filter(Et),t[38]=n.focuses,t[39]=u);let C=c+u.length,w=n.rules.filter(Tt),T,D;t[40]!==n.profile.callName||t[41]!==r?(T=n.profile.callName.trim()||(r===`zh`?`你`:`You`),D=[...T][0]?.toLocaleUpperCase()??`Y`,t[40]=n.profile.callName,t[41]=r,t[42]=T,t[43]=D):(T=t[42],D=t[43]);let k=D;x=`space-y-5`;let A;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-accent/40 to-transparent`,"aria-hidden":`true`}),t[44]=A):A=t[44];let j;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(E,{className:`size-3.5`}),t[45]=j):j=t[45];let P;t[46]===i.portraitEyebrow?P=t[47]:(P=(0,$.jsxs)(`div`,{className:`mb-7 flex items-center gap-2 text-[11px] font-semibold tracking-[0.18em] text-accent`,children:[j,i.portraitEyebrow]}),t[46]=i.portraitEyebrow,t[47]=P);let I;t[48]===k?I=t[49]:(I=(0,$.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl border border-edge bg-surface-muted text-2xl font-semibold text-fg sm:size-20 sm:text-3xl`,children:k}),t[48]=k,t[49]=I);let L;t[50]===T?L=t[51]:(L=(0,$.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:T}),t[50]=T,t[51]=L);let R;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>l(!0),t[52]=R):R=t[52];let z;t[53]!==n.profile.role||t[54]!==i.roleMissing?(z=n.profile.role.trim()||i.roleMissing,t[53]=n.profile.role,t[54]=i.roleMissing,t[55]=z):z=t[55];let B;t[56]===z?B=t[57]:(B=(0,$.jsx)(`button`,{className:`mt-1 text-left text-sm text-fg-muted transition-colors hover:text-accent`,onClick:R,children:z}),t[56]=z,t[57]=B);let V;t[58]!==L||t[59]!==B?(V=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[L,B]}),t[58]=L,t[59]=B,t[60]=V):V=t[60];let U;t[61]!==I||t[62]!==V?(U=(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[I,V]}),t[61]=I,t[62]=V,t[63]=U):U=t[63];let W;t[64]===i.portraitIntro?W=t[65]:(W=(0,$.jsx)(`p`,{className:`mt-7 max-w-2xl text-base leading-7 text-fg-muted`,children:i.portraitIntro}),t[64]=i.portraitIntro,t[65]=W);let G;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`}),t[66]=G):G=t[66];let K;t[67]===i.maintainedTogether?K=t[68]:(K=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[G,i.maintainedTogether]}),t[67]=i.maintainedTogether,t[68]=K);let ee,q;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>d(!0),q=(0,$.jsx)(M,{className:`size-3.5`}),t[69]=ee,t[70]=q):(ee=t[69],q=t[70]);let ne;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t[71]=ne):ne=t[71];let re;t[72]===i.advanced?re=t[73]:(re=(0,$.jsx)(`span`,{className:`font-medium text-accent`,children:i.advanced}),t[72]=i.advanced,t[73]=re);let ie;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(O,{className:`size-3`}),t[74]=ie):ie=t[74];let ae;t[75]!==i.youDecide||t[76]!==re?(ae=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1.5 rounded-md transition-colors hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,onClick:ee,children:[q,i.youDecide,ne,re,ie]}),t[75]=i.youDecide,t[76]=re,t[77]=ae):ae=t[77];let J;t[78]!==K||t[79]!==ae?(J=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-x-5 gap-y-2 text-xs text-fg-subtle`,children:[K,ae]}),t[78]=K,t[79]=ae,t[80]=J):J=t[80];let oe;t[81]!==P||t[82]!==U||t[83]!==W||t[84]!==J?(oe=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[P,U,W,J]}),t[81]=P,t[82]=U,t[83]=W,t[84]=J,t[85]=oe):oe=t[85];let se;t[86]===i.direction?se=t[87]:(se=(0,$.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.12em] text-fg-subtle`,children:i.direction}),t[86]=i.direction,t[87]=se);let ce=`mt-4 text-base leading-7 ${n.profile.primaryGoal.trim()?`text-fg`:`text-fg-muted`}`,le;t[88]!==n.profile.primaryGoal||t[89]!==i.directionEmpty?(le=n.profile.primaryGoal.trim()||i.directionEmpty,t[88]=n.profile.primaryGoal,t[89]=i.directionEmpty,t[90]=le):le=t[90];let Y;t[91]!==ce||t[92]!==le?(Y=(0,$.jsx)(`p`,{className:ce,children:le}),t[91]=ce,t[92]=le,t[93]=Y):Y=t[93];let X;t[94]!==se||t[95]!==Y?(X=(0,$.jsxs)(`div`,{children:[se,Y]}),t[94]=se,t[95]=Y,t[96]=X):X=t[96];let de;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(te,{className:`size-4`}),t[97]=de):de=t[97];let fe;t[98]===i.talkAboutMe?fe=t[99]:(fe=(0,$.jsx)(g,{variant:`primary`,asChild:!0,children:(0,$.jsxs)(a,{to:`/chat/new`,children:[de,i.talkAboutMe]})}),t[98]=i.talkAboutMe,t[99]=fe);let pe,me;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>l(!0),me=(0,$.jsx)(ue,{className:`size-4`}),t[100]=pe,t[101]=me):(pe=t[100],me=t[101]);let he;t[102]===i.editProfile?he=t[103]:(he=(0,$.jsxs)(g,{onClick:pe,children:[me,i.editProfile]}),t[102]=i.editProfile,t[103]=he);let ge;t[104]!==fe||t[105]!==he?(ge=(0,$.jsxs)(`div`,{className:`mt-8 flex flex-wrap gap-2`,children:[fe,he]}),t[104]=fe,t[105]=he,t[106]=ge):ge=t[106];let _e;t[107]!==X||t[108]!==ge?(_e=(0,$.jsxs)(`div`,{className:`flex flex-col justify-between rounded-2xl border border-edge bg-surface-base/70 p-5 sm:p-6`,children:[X,ge]}),t[107]=X,t[108]=ge,t[109]=_e):_e=t[109],t[110]!==oe||t[111]!==_e?(S=(0,$.jsxs)(`section`,{className:`relative overflow-hidden rounded-3xl border border-edge bg-surface-panel`,children:[A,(0,$.jsxs)(`div`,{className:`grid gap-8 px-5 py-7 sm:px-8 sm:py-9 lg:grid-cols-[minmax(0,1fr)_20rem] lg:gap-12 lg:px-10 lg:py-11`,children:[oe,_e]})]}),t[110]=oe,t[111]=_e,t[112]=S):S=t[112],y=`grid gap-5 lg:grid-cols-2`;let ve;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,$.jsx)(F,{className:`size-4`}),t[113]=ve):ve=t[113];let ye;t[114]===o?ye=t[115]:(ye=()=>o(`understanding`),t[114]=o,t[115]=ye);let be;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,$.jsx)(O,{className:`size-3.5`}),t[116]=be):be=t[116];let xe;t[117]!==i.seeAll||t[118]!==ye?(xe=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,onClick:ye,children:[i.seeAll,be]}),t[117]=i.seeAll,t[118]=ye,t[119]=xe):xe=t[119];let Z;t[120]!==o||t[121]!==C||t[122]!==i.reviewWaiting?(Z=C?(0,$.jsxs)(`button`,{className:`mb-4 flex w-full items-center justify-between rounded-xl border border-accent/20 bg-accent-soft px-3 py-2.5 text-left text-xs text-accent transition-colors hover:border-accent/40`,onClick:()=>o(`understanding`),children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(E,{className:`mr-1.5 inline size-3.5`}),C,` `,i.reviewWaiting]}),(0,$.jsx)(N,{className:`size-3.5`})]}):null,t[120]=o,t[121]=C,t[122]=i.reviewWaiting,t[123]=Z):Z=t[123];let Q=e.length?(0,$.jsx)(`div`,{className:`space-y-1`,children:e.slice(0,4).map(e=>(0,$.jsxs)(`div`,{className:`group flex gap-3 rounded-xl px-2 py-2.5 transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full bg-accent/70`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:je[e.kind][r]})]})]},e.id))}):(0,$.jsx)(`p`,{className:`py-5 text-sm leading-6 text-fg-muted`,children:i.addFirstUnderstanding});t[124]!==i.portraitUnderstanding||t[125]!==i.portraitUnderstandingHint||t[126]!==xe||t[127]!==Z||t[128]!==Q?(b=(0,$.jsxs)(kt,{icon:ve,title:i.portraitUnderstanding,description:i.portraitUnderstandingHint,action:xe,children:[Z,Q]}),t[124]=i.portraitUnderstanding,t[125]=i.portraitUnderstandingHint,t[126]=xe,t[127]=Z,t[128]=Q,t[129]=b):b=t[129],f=kt,t[130]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(H,{className:`size-4`}),t[130]=p):p=t[130],m=i.portraitRules,h=i.portraitRulesHint;let Se;t[131]===o?Se=t[132]:(Se=()=>o(`collaboration`),t[131]=o,t[132]=Se);let Ce;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,$.jsx)(O,{className:`size-3.5`}),t[133]=Ce):Ce=t[133],t[134]!==i.seeAll||t[135]!==Se?(_=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,onClick:Se,children:[i.seeAll,Ce]}),t[134]=i.seeAll,t[135]=Se,t[136]=_):_=t[136],v=w.length?(0,$.jsx)(`div`,{className:`space-y-1`,children:w.slice(0,4).map(e=>(0,$.jsxs)(`div`,{className:`flex gap-3 rounded-xl px-2 py-2.5 transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full bg-fg-subtle`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:dt[e.category][r]})]})]},e.id))}):(0,$.jsx)(`p`,{className:`py-5 text-sm leading-6 text-fg-muted`,children:i.addFirstRule}),t[0]=n.focuses,t[1]=n.profile.callName,t[2]=n.profile.primaryGoal,t[3]=n.profile.role,t[4]=n.rules,t[5]=n.understandings,t[6]=r,t[7]=o,t[8]=i.addFirstRule,t[9]=i.addFirstUnderstanding,t[10]=i.advanced,t[11]=i.direction,t[12]=i.directionEmpty,t[13]=i.editProfile,t[14]=i.maintainedTogether,t[15]=i.portraitEyebrow,t[16]=i.portraitIntro,t[17]=i.portraitRules,t[18]=i.portraitRulesHint,t[19]=i.portraitUnderstanding,t[20]=i.portraitUnderstandingHint,t[21]=i.reviewWaiting,t[22]=i.roleMissing,t[23]=i.seeAll,t[24]=i.talkAboutMe,t[25]=i.youDecide,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=_,t[31]=v,t[32]=y,t[33]=b,t[34]=x,t[35]=S}else f=t[26],p=t[27],m=t[28],h=t[29],_=t[30],v=t[31],y=t[32],b=t[33],x=t[34],S=t[35];let C;t[137]!==f||t[138]!==p||t[139]!==m||t[140]!==h||t[141]!==_||t[142]!==v?(C=(0,$.jsx)(f,{icon:p,title:m,description:h,action:_,children:v}),t[137]=f,t[138]=p,t[139]=m,t[140]=h,t[141]=_,t[142]=v,t[143]=C):C=t[143];let w;t[144]!==C||t[145]!==y||t[146]!==b?(w=(0,$.jsxs)(`div`,{className:y,children:[b,C]}),t[144]=C,t[145]=y,t[146]=b,t[147]=w):w=t[147];let T;t[148]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>d(!0),t[148]=T):T=t[148];let D;t[149]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:(0,$.jsx)(z,{className:`size-4`})}),t[149]=D):D=t[149];let k;t[150]===i.portraitLearn?k=t[151]:(k=(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:i.portraitLearn}),t[150]=i.portraitLearn,t[151]=k);let A;t[152]===i.portraitControlHint?A=t[153]:(A=(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i.portraitControlHint}),t[152]=i.portraitControlHint,t[153]=A);let j;t[154]!==k||t[155]!==A?(j=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[k,A]}),t[154]=k,t[155]=A,t[156]=j):j=t[156];let P;t[157]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(O,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`}),t[157]=P):P=t[157];let I;t[158]===j?I=t[159]:(I=(0,$.jsxs)(`button`,{className:`group flex w-full items-center gap-4 rounded-2xl border border-edge bg-surface-panel px-5 py-4 text-left transition-colors hover:bg-surface-hover sm:px-6`,onClick:T,children:[D,j,P]}),t[158]=j,t[159]=I);let L;t[160]!==n.profile||t[161]!==c||t[162]!==r||t[163]!==s||t[164]!==i?(L=(0,$.jsx)(jt,{open:c,onOpenChange:l,profile:n.profile,language:r,t:i,onChanged:s}),t[160]=n.profile,t[161]=c,t[162]=r,t[163]=s,t[164]=i,t[165]=L):L=t[165];let R;t[166]===o?R=t[167]:(R=e=>{d(!1),o(e)},t[166]=o,t[167]=R);let B;t[168]!==u||t[169]!==i||t[170]!==R?(B=(0,$.jsx)(At,{open:u,onOpenChange:d,t:i,onNavigate:R}),t[168]=u,t[169]=i,t[170]=R,t[171]=B):B=t[171];let V;return t[172]!==w||t[173]!==I||t[174]!==L||t[175]!==B||t[176]!==x||t[177]!==S?(V=(0,$.jsxs)(`div`,{className:x,children:[S,w,I,L,B]}),t[172]=w,t[173]=I,t[174]=L,t[175]=B,t[176]=x,t[177]=S,t[178]=V):V=t[178],V}function Tt(e){return e.status===`active`}function Et(e){return e.status===`candidate`}function Dt(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function Ot(e){return e.status===`active`}function kt(e){let t=(0,Q.c)(20),{icon:n,title:r,description:i,action:a,children:o}=e,s;t[0]===n?s=t[1]:(s=(0,$.jsx)(`span`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==a||t[5]!==c?(l=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,a]}),t[4]=a,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i}),t[7]=i,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]!==s||t[13]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[s,d]}),t[12]=s,t[13]=d,t[14]=f):f=t[14];let p;t[15]===o?p=t[16]:(p=(0,$.jsx)(`div`,{className:`mt-4 border-t border-edge pt-3`,children:o}),t[15]=o,t[16]=p);let m;return t[17]!==f||t[18]!==p?(m=(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5 sm:p-6`,children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function At(e){let t=(0,Q.c)(47),{open:n,onOpenChange:r,t:i,onNavigate:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(P,{className:`size-4`}),t[0]=o):o=t[0];let s;t[1]!==i.controlSourcesHint||t[2]!==i.sources?(s={tab:`sources`,icon:o,label:i.sources,description:i.controlSourcesHint},t[1]=i.controlSourcesHint,t[2]=i.sources,t[3]=s):s=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(J,{className:`size-4`}),t[4]=c):c=t[4];let l;t[5]!==i.controlReviewHint||t[6]!==i.dreaming?(l={tab:`dreaming`,icon:c,label:i.dreaming,description:i.controlReviewHint},t[5]=i.controlReviewHint,t[6]=i.dreaming,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(M,{className:`size-4`}),t[8]=u):u=t[8];let d;t[9]!==i.controlPrivacyHint||t[10]!==i.privacy?(d={tab:`privacy`,icon:u,label:i.privacy,description:i.controlPrivacyHint},t[9]=i.controlPrivacyHint,t[10]=i.privacy,t[11]=d):d=t[11];let f;t[12]!==s||t[13]!==l||t[14]!==d?(f=[s,l,d],t[12]=s,t[13]=l,t[14]=d,t[15]=f):f=t[15];let p=f,m;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(v,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[16]=m):m=t[16];let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`div`,{className:`mb-3 flex size-9 items-center justify-center rounded-xl bg-accent-soft text-accent`,children:(0,$.jsx)(z,{className:`size-4`})}),t[17]=_):_=t[17];let T;t[18]===i.portraitControl?T=t[19]:(T=(0,$.jsx)(C,{className:`text-lg font-semibold tracking-tight text-fg`,children:i.portraitControl}),t[18]=i.portraitControl,t[19]=T);let E;t[20]===i.portraitControlHint?E=t[21]:(E=(0,$.jsx)(y,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:i.portraitControlHint}),t[20]=i.portraitControlHint,t[21]=E);let D;t[22]!==T||t[23]!==E?(D=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[_,T,E]}),t[22]=T,t[23]=E,t[24]=D):D=t[24];let k;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(h,{className:`size-4`}),t[25]=k):k=t[25];let A;t[26]===i.cancel?A=t[27]:(A=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":i.cancel,children:k})}),t[26]=i.cancel,t[27]=A);let j;t[28]!==D||t[29]!==A?(j=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-5 sm:px-6 sm:py-6`,children:[D,A]}),t[28]=D,t[29]=A,t[30]=j):j=t[30];let N;t[31]!==p||t[32]!==a?(N=(0,$.jsx)(`div`,{className:`space-y-3`,children:p.map(e=>(0,$.jsxs)(`button`,{className:`group flex w-full items-start gap-4 rounded-2xl border border-edge bg-surface-base p-4 text-left transition-colors hover:border-edge-strong hover:bg-surface-hover`,onClick:()=>a(e.tab),children:[(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted transition-colors group-hover:text-accent`,children:e.icon}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.label}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.description})]}),(0,$.jsx)(O,{className:`mt-2.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},e.tab))}),t[31]=p,t[32]=a,t[33]=N):N=t[33];let F;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-success`}),t[34]=F):F=t[34];let I;t[35]===i.controlTrust?I=t[36]:(I=(0,$.jsxs)(`div`,{className:`mt-6 flex gap-3 rounded-2xl bg-surface-muted p-4`,children:[F,(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i.controlTrust})]}),t[35]=i.controlTrust,t[36]=I);let L;t[37]!==N||t[38]!==I?(L=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:[N,I]}),t[37]=N,t[38]=I,t[39]=L):L=t[39];let R;t[40]!==j||t[41]!==L?(R=(0,$.jsxs)(x,{children:[m,(0,$.jsx)(S,{className:`fixed inset-y-0 right-0 z-[90] h-full w-[min(30rem,100vw)] overflow-hidden border-l border-edge bg-surface-panel shadow-popover outline-none sm:rounded-l-2xl`,children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[j,L]})})]}),t[40]=j,t[41]=L,t[42]=R):R=t[42];let B;return t[43]!==r||t[44]!==n||t[45]!==R?(B=(0,$.jsx)(w,{open:n,onOpenChange:r,children:R}),t[43]=r,t[44]=n,t[45]=R,t[46]=B):B=t[46],B}function jt(e){let t=(0,Q.c)(26),{open:n,onOpenChange:r,profile:i,language:a,t:o,onChanged:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(v,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=c):c=t[0];let l;t[1]===o.editProfile?l=t[2]:(l=(0,$.jsx)(C,{className:`text-base font-semibold text-fg`,children:o.editProfile}),t[1]=o.editProfile,t[2]=l);let u;t[3]===o.profileHint?u=t[4]:(u=(0,$.jsx)(y,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.profileHint}),t[3]=o.profileHint,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,$.jsxs)(`div`,{children:[l,u]}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(h,{className:`size-4`}),t[8]=f):f=t[8];let p;t[9]===o.cancel?p=t[10]:(p=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(g,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":o.cancel,children:f})}),t[9]=o.cancel,t[10]=p);let m;t[11]!==d||t[12]!==p?(m=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4 sm:px-6`,children:[d,p]}),t[11]=d,t[12]=p,t[13]=m):m=t[13];let _;t[14]!==a||t[15]!==s||t[16]!==i||t[17]!==o?(_=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:(0,$.jsx)(Mt,{profile:i,language:a,t:o,onChanged:s,bare:!0})}),t[14]=a,t[15]=s,t[16]=i,t[17]=o,t[18]=_):_=t[18];let T;t[19]!==m||t[20]!==_?(T=(0,$.jsxs)(x,{children:[c,(0,$.jsx)(S,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(42rem,calc(100vh-2rem))] w-[min(44rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[m,_]})})]}),t[19]=m,t[20]=_,t[21]=T):T=t[21];let E;return t[22]!==r||t[23]!==n||t[24]!==T?(E=(0,$.jsx)(w,{open:n,onOpenChange:r,children:T}),t[22]=r,t[23]=n,t[24]=T,t[25]=E):E=t[25],E}function Mt(e){let t=(0,Q.c)(80),{profile:n,language:r,t:i,onChanged:a,bare:o}=e,s=o===void 0?!1:o,c;t[0]===n?c=t[1]:(c=_t(n),t[0]=n,t[1]=c);let l=c,[u,d]=gt(l),f;t[2]===u?f=t[3]:(f=ht(u),t[2]=u,t[3]=f);let p;t[4]===l?p=t[5]:(p=ht(l),t[4]=l,t[5]=p);let m=f!==p,h;t[6]!==a||t[7]!==n?(h=async e=>{await a((await ae({...e,accessibility:n.accessibility})).profile)},t[6]=a,t[7]=n,t[8]=h):h=t[8];let _;t[9]!==u||t[10]!==m||t[11]!==h?(_={value:u,dirty:m,delayMs:500,onSave:h},t[9]=u,t[10]=m,t[11]=h,t[12]=_):_=t[12];let v=ye(_),y;t[13]!==u||t[14]!==d?(y=(e,t,n)=>(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,$.jsx)(`input`,{className:lt,placeholder:n,value:u[e],onChange:t=>d(n=>({...n,[e]:t.target.value}))})]}),t[13]=u,t[14]=d,t[15]=y):y=t[15];let b=y,x=v.onBlurCapture,S;t[16]!==b||t[17]!==i.callName||t[18]!==i.callNamePlaceholder?(S=b(`callName`,i.callName,i.callNamePlaceholder),t[16]=b,t[17]=i.callName,t[18]=i.callNamePlaceholder,t[19]=S):S=t[19];let C;t[20]!==b||t[21]!==i.role||t[22]!==i.rolePlaceholder?(C=b(`role`,i.role,i.rolePlaceholder),t[20]=b,t[21]=i.role,t[22]=i.rolePlaceholder,t[23]=C):C=t[23];let w;t[24]===i.primaryGoal?w=t[25]:(w=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.primaryGoal}),t[24]=i.primaryGoal,t[25]=w);let T;t[26]===d?T=t[27]:(T=e=>d(t=>({...t,primaryGoal:e.target.value})),t[26]=d,t[27]=T);let E;t[28]!==u.primaryGoal||t[29]!==i.primaryGoalPlaceholder||t[30]!==T?(E=(0,$.jsx)(`textarea`,{className:lt,rows:3,placeholder:i.primaryGoalPlaceholder,value:u.primaryGoal,onChange:T}),t[28]=u.primaryGoal,t[29]=i.primaryGoalPlaceholder,t[30]=T,t[31]=E):E=t[31];let D;t[32]!==w||t[33]!==E?(D=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[w,E]}),t[32]=w,t[33]=E,t[34]=D):D=t[34];let O;t[35]!==b||t[36]!==r||t[37]!==i.pronouns||t[38]!==i.pronounsPlaceholder?(O=r===`en`?b(`pronouns`,i.pronouns,i.pronounsPlaceholder):null,t[35]=b,t[36]=r,t[37]=i.pronouns,t[38]=i.pronounsPlaceholder,t[39]=O):O=t[39];let k;t[40]===i.timezone?k=t[41]:(k=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[40]=i.timezone,t[41]=k);let A;t[42]===d?A=t[43]:(A=e=>d(t=>({...t,timezone:e.target.value})),t[42]=d,t[43]=A);let j;t[44]!==u.timezone||t[45]!==A?(j=(0,$.jsx)(`input`,{className:`${lt} min-w-0 flex-1`,value:u.timezone,onChange:A}),t[44]=u.timezone,t[45]=A,t[46]=j):j=t[46];let M;t[47]===d?M=t[48]:(M=()=>d(Nt),t[47]=d,t[48]=M);let N;t[49]!==i.detect||t[50]!==M?(N=(0,$.jsx)(g,{className:`shrink-0 whitespace-nowrap`,onClick:M,children:i.detect}),t[49]=i.detect,t[50]=M,t[51]=N):N=t[51];let P;t[52]!==j||t[53]!==N?(P=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[j,N]}),t[52]=j,t[53]=N,t[54]=P):P=t[54];let F;t[55]!==k||t[56]!==P?(F=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[k,P]}),t[55]=k,t[56]=P,t[57]=F):F=t[57];let I;t[58]!==b||t[59]!==i.locale?(I=b(`locale`,i.locale),t[58]=b,t[59]=i.locale,t[60]=I):I=t[60];let L;t[61]!==S||t[62]!==C||t[63]!==D||t[64]!==O||t[65]!==F||t[66]!==I?(L=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[S,C,D,O,F,I]}),t[61]=S,t[62]=C,t[63]=D,t[64]=O,t[65]=F,t[66]=I,t[67]=L):L=t[67];let R;t[68]!==v.error||t[69]!==v.status?(R=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ve,{status:v.status,error:v.error})}),t[68]=v.error,t[69]=v.status,t[70]=R):R=t[70];let z;t[71]!==v.onBlurCapture||t[72]!==L||t[73]!==R?(z=(0,$.jsxs)(`div`,{onBlurCapture:x,children:[L,R]}),t[71]=v.onBlurCapture,t[72]=L,t[73]=R,t[74]=z):z=t[74];let B=z;if(s)return B;let V;t[75]===i.profileHint?V=t[76]:(V=(0,$.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-fg-muted`,children:i.profileHint}),t[75]=i.profileHint,t[76]=V);let H;return t[77]!==B||t[78]!==V?(H=(0,$.jsxs)(ft,{children:[V,B]}),t[77]=B,t[78]=V,t[79]=H):H=t[79],H}function Nt(e){return{...e,timezone:ie()}}function Pt(e){let t=(0,Q.c)(80),{rules:n,language:r,t:i,onChanged:a}=e,[o,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(`communication`),[h,_]=(0,Z.useState)(null),v,y,b,x,S,C;if(t[0]!==o||t[1]!==f||t[2]!==h||t[3]!==r||t[4]!==a||t[5]!==n||t[6]!==u||t[7]!==i.add||t[8]!==i.addRule||t[9]!==i.cancel||t[10]!==i.category||t[11]!==i.collaboration||t[12]!==i.confirmDelete||t[13]!==i.delete||t[14]!==i.disable||t[15]!==i.emptyRules||t[16]!==i.enable||t[17]!==i.ruleStatement||t[18]!==i.rulesHint){let e=n.filter(Ft),w;t[25]!==f||t[26]!==a||t[27]!==u?(w=async e=>{e.preventDefault(),u.trim()&&(await q({statement:u,category:f}),d(``),l(!1),await a())},t[25]=f,t[26]=a,t[27]=u,t[28]=w):w=t[28];let T=w;x=`space-y-5`;let E;t[29]===i.rulesHint?E=t[30]:(E=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[29]=i.rulesHint,t[30]=E);let D,O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>l(!0),D=(0,$.jsx)(m,{className:`size-4`}),t[31]=D,t[32]=O):(D=t[31],O=t[32]);let k;t[33]===i.addRule?k=t[34]:(k=(0,$.jsxs)(g,{variant:`primary`,onClick:O,children:[D,i.addRule]}),t[33]=i.addRule,t[34]=k),t[35]!==k||t[36]!==E?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[35]=k,t[36]=E,t[37]=S):S=t[37];let A=i.addRule,j=i.rulesHint,M=i.add,N=i.cancel,P;t[38]===u?P=t[39]:(P=u.trim(),t[38]=u,t[39]=P);let F=!P,I;t[40]===i.ruleStatement?I=t[41]:(I=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.ruleStatement}),t[40]=i.ruleStatement,t[41]=I);let L;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>d(e.target.value),t[42]=L):L=t[42];let R;t[43]!==u||t[44]!==i.ruleStatement?(R=(0,$.jsx)(`textarea`,{autoFocus:!0,className:lt,rows:4,placeholder:i.ruleStatement,value:u,onChange:L}),t[43]=u,t[44]=i.ruleStatement,t[45]=R):R=t[45];let z;t[46]!==I||t[47]!==R?(z=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[I,R]}),t[46]=I,t[47]=R,t[48]=z):z=t[48];let B;t[49]===i.category?B=t[50]:(B=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.category}),t[49]=i.category,t[50]=B);let H,U;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>p(e.target.value),U=Object.entries(dt),t[51]=H,t[52]=U):(H=t[51],U=t[52]);let W;t[53]===r?W=t[54]:(W=U.map(e=>{let[t,n]=e;return(0,$.jsx)(c,{value:t,children:n[r]},t)}),t[53]=r,t[54]=W);let G;t[55]!==f||t[56]!==W?(G=(0,$.jsx)(s,{value:f,onChange:H,children:W}),t[55]=f,t[56]=W,t[57]=G):G=t[57];let K;t[58]!==B||t[59]!==G?(K=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[B,G]}),t[58]=B,t[59]=G,t[60]=K):K=t[60],t[61]!==o||t[62]!==T||t[63]!==i.add||t[64]!==i.addRule||t[65]!==i.cancel||t[66]!==i.rulesHint||t[67]!==F||t[68]!==z||t[69]!==K?(C=(0,$.jsxs)(mt,{open:o,onOpenChange:l,title:A,description:j,submitLabel:M,cancelLabel:N,submitDisabled:F,onSubmit:T,children:[z,K]}),t[61]=o,t[62]=T,t[63]=i.add,t[64]=i.addRule,t[65]=i.cancel,t[66]=i.rulesHint,t[67]=F,t[68]=z,t[69]=K,t[70]=C):C=t[70],v=`space-y-2`,y=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.collaboration,` · `,e.length]}),b=e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-2 px-4 py-3 sm:flex-row sm:items-start sm:gap-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 ${e.status===`disabled`?`text-fg-subtle line-through`:`text-fg`}`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:dt[e.category][r]}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[`P`,e.priority]}),e.status===`disabled`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:i.disable})]}):null]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[(0,$.jsx)(g,{variant:`ghost`,onClick:async()=>{await V(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,$.jsxs)(g,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(h!==e.id){_(e.id);return}await se(e.id),_(null),await a()},children:[(0,$.jsx)(re,{className:`size-3.5`}),h===e.id?i.confirmDelete:i.delete]})]})]},e.id))}):(0,$.jsx)(pt,{children:i.emptyRules}),t[0]=o,t[1]=f,t[2]=h,t[3]=r,t[4]=a,t[5]=n,t[6]=u,t[7]=i.add,t[8]=i.addRule,t[9]=i.cancel,t[10]=i.category,t[11]=i.collaboration,t[12]=i.confirmDelete,t[13]=i.delete,t[14]=i.disable,t[15]=i.emptyRules,t[16]=i.enable,t[17]=i.ruleStatement,t[18]=i.rulesHint,t[19]=v,t[20]=y,t[21]=b,t[22]=x,t[23]=S,t[24]=C}else v=t[19],y=t[20],b=t[21],x=t[22],S=t[23],C=t[24];let w;t[71]!==v||t[72]!==y||t[73]!==b?(w=(0,$.jsxs)(`section`,{className:v,children:[y,b]}),t[71]=v,t[72]=y,t[73]=b,t[74]=w):w=t[74];let T;return t[75]!==x||t[76]!==S||t[77]!==C||t[78]!==w?(T=(0,$.jsxs)(`div`,{className:x,children:[S,C,w]}),t[75]=x,t[76]=S,t[77]=C,t[78]=w,t[79]=T):T=t[79],T}function Ft(e){return e.status!==`archived`}async function It(){let[e,t,n]=await Promise.all([de(),R(),A()]);return{...e,connectors:t,catalog:n}}function Lt({t:e}){let{data:t,error:n,isLoading:r,mutate:i}=T(`you-understanding-sources`,It,{refreshInterval:5e3}),{data:o=[],mutate:s}=T(`you-connected-content-candidates`,ne),[c,l]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),[m,h]=(0,Z.useState)(null),[_,v]=(0,Z.useState)([]),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(null);if(r)return(0,$.jsx)(U,{className:`h-64 rounded-2xl`});if(n)return(0,$.jsxs)(pt,{children:[e.error,` `,(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:()=>void i(),children:e.retry})]});let C=t?.grants??[],w=t?.connectors??[],E=new Map((t?.catalog??[]).map(e=>[e.id,e])),k=t?.latestRuns??{},A=t=>t?t.status===`completed`?e.sourceCompleted:t.status===`partial`?e.sourcePartial:t.status===`failed`||t.status===`canceled`?e.sourceFailed:t.status===`running`?e.sourceRunning:e.sourceQueued:e.sourceNotRun,j=e=>e?e.status===`completed`?`bg-success-soft text-success`:e.status===`partial`?`bg-warning-soft text-warning`:e.status===`failed`||e.status===`canceled`?`bg-danger/10 text-danger`:`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-muted`,M=t=>t===`connected_account_unavailable`?e.sourceAccountUnavailable:t===`connected_source_sync_failed`?e.sourceSyncFailed:t===`connected_source_analysis_failed`?e.sourceAnalysisFailed:t,N=e=>{let t=e.displayName.trim().toLocaleLowerCase(),n=w.find(e=>e.displayName.trim().toLocaleLowerCase()===t);return n?E.get(n.connectorId):[...E.values()].find(n=>n.displayName.trim().toLocaleLowerCase()===t||e.sourceKey.toLocaleLowerCase().includes(n.id.toLocaleLowerCase()))},P=t=>`${e.actionFailed}: ${t instanceof Error?t.message:String(t)}`,F=async t=>{S(null),f(null),l({grantId:t.id,kind:`refresh`});try{await D(t.id),await i().catch(()=>void 0),S({tone:`success`,message:`${t.displayName}: ${e.refreshStarted}`})}catch(e){S({tone:`error`,message:P(e)})}finally{l(null)}},I=async(t,n)=>{if(d!==t.id){try{let e=await ge(t.id);f(t.id),h({grantId:t.id,impact:e.impact}),S(null)}catch(e){S({tone:`error`,message:P(e)})}return}if(n){l({grantId:t.id,kind:`revoke`});try{await fe(t.id,{derived:n,raw:`delete`}),await i().catch(()=>void 0),f(null),h(null),S({tone:`success`,message:`${t.displayName}: ${e.revokeDone}`})}catch(e){S({tone:`error`,message:P(e)})}finally{l(null)}}},L=async()=>{if(_.length){b(!0),S(null);try{let t=await B(_);t.result.failed.length?S({tone:`error`,message:t.result.failed.map(e=>e.error).join(`; `)}):S({tone:`success`,message:e.contentReadDone}),v([]),await s()}catch(e){S({tone:`error`,message:P(e)})}finally{b(!1)}}};return(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:e.sourcesHint}),(0,$.jsx)(g,{asChild:!0,variant:`primary`,children:(0,$.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[e.manageSources,(0,$.jsx)(u,{className:`size-4`})]})})]}),x?(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`rounded-xl px-3 py-2 text-sm ${x.tone===`success`?`bg-success-soft text-success`:`bg-danger/10 text-danger`}`,children:x.message}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.authorizedSources,` · `,C.length]}),C.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:C.map(t=>{let n=N(t),r=k[t.id],i=typeof r?.metadata.candidatesCreated==`number`?r.metadata.candidatesCreated:0,a=M(r?.errorMessage??(typeof r?.metadata.semanticError==`string`?r.metadata.semanticError:void 0));return(0,$.jsxs)(`article`,{className:`flex min-h-28 flex-wrap items-start gap-3 rounded-2xl border border-edge bg-surface-panel p-4`,children:[n?(0,$.jsx)(pe,{connector:n,size:`sm`}):(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base`,children:(0,$.jsx)(ce,{className:`size-4 text-fg-muted`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] ${j(r)}`,children:A(r)})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:[t.accessMode===`continuous`?e.continuous:e.once,` · `,t.processingPolicy===`local_only`?e.localOnly:t.retentionPolicy===`derived_only`?e.derivedOnly:t.retentionPolicy]}),r?(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[r.itemsSeen,` `,e.sourceItems,i?` · ${i} ${e.sourceCandidates}`:``,` · `,new Date(r.completedAt??r.startedAt).toLocaleString()]}):t.lastCollectedAt?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:new Date(t.lastCollectedAt).toLocaleString()}):null,a?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-danger`,title:a,children:a}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:[t.accessMode===`continuous`?(0,$.jsx)(g,{variant:`ghost`,disabled:c!==null,"aria-busy":c?.grantId===t.id&&c.kind===`refresh`,onClick:()=>void F(t),children:c?.grantId===t.id&&c.kind===`refresh`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`size-4 animate-spin`}),e.refreshing]}):e.refresh}):null,(0,$.jsx)(g,{variant:`ghost`,className:`text-danger`,title:e.revokeHint,"aria-label":`${e.revoke}: ${t.displayName}`,disabled:c!==null,"aria-busy":c?.grantId===t.id&&c.kind===`revoke`,onClick:()=>{d===t.id?(f(null),h(null)):I(t)},children:c?.grantId===t.id&&c.kind===`revoke`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`size-4 animate-spin`}),e.revoking]}):d===t.id?e.cancel:e.revoke})]}),m?.grantId===t.id?(0,$.jsxs)(`div`,{className:`basis-full rounded-xl border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:e.revokeImpact.replace(`{{count}}`,String(m.impact.derivedCount))}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-2`,children:[(0,$.jsx)(g,{variant:`ghost`,onClick:()=>{f(null),h(null)},children:e.cancel}),(0,$.jsx)(g,{variant:`ghost`,onClick:()=>void I(t,`retain`),children:e.retainDerived}),(0,$.jsx)(g,{variant:`primary`,onClick:()=>void I(t,`delete`),children:e.deleteDerived})]})]}):null]},t.id)})}):(0,$.jsx)(pt,{children:e.noSources})]}),o.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.contentReadTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-xs leading-5 text-fg-muted`,children:e.contentReadHint})]}),(0,$.jsx)(g,{variant:`primary`,disabled:!_.length||y,onClick:()=>void L(),children:y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`size-4 animate-spin`}),e.reading]}):`${e.readSelected} · ${_.length}`})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:o.map(e=>{let t=_.includes(e.sourceItemId),n=_.length>=5&&!t;return(0,$.jsxs)(`label`,{className:`flex items-center gap-3 px-4 py-3 ${n?`opacity-50`:`cursor-pointer hover:bg-surface-hover`}`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-[var(--color-accent)]`,checked:t,disabled:n||y,onChange:t=>v(n=>t.target.checked?[...n,e.sourceItemId]:n.filter(t=>t!==e.sourceItemId))}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm text-fg`,children:e.title}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[e.toolkit===`gmail`?`Gmail`:`Google Drive`,e.occurredAt?` · ${new Date(e.occurredAt).toLocaleDateString()}`:``]})]})]},e.sourceItemId)})})]}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.connectorsTitle,` · `,w.length]}),w.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:w.map(t=>{let n=t.enabled&&(t.status===`connected`||t.connectionStatus===`connected`||t.authStatus===`connected`),r=E.get(t.connectorId);return(0,$.jsxs)(a,{to:`/connectors?tab=connected&instance=${encodeURIComponent(t.instanceId)}`,"aria-label":`${e.openConnector}: ${t.displayName}`,className:`group flex min-h-24 items-center gap-3 rounded-2xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,$.jsx)(pe,{connector:r??{displayName:t.displayName}}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:t.connectorId})]}),(0,$.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-1 text-xs ${n?`bg-success-soft text-success`:`bg-warning-soft text-warning`}`,children:n?e.connected:e.unavailable}),(0,$.jsx)(O,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},t.instanceId)})}):(0,$.jsx)(pt,{children:e.noConnectors})]})]})}function Rt(e){let t=(0,Q.c)(115),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:o,mutate:l}=T(`you-context-settings`,me),u=i?.dreaming??null,[d,f]=gt(u),p;t[0]!==d||t[1]!==u?(p=d&&u&&ht(d)!==ht(u),t[0]=d,t[1]=u,t[2]=p):p=t[2];let m=!!p,h;t[3]===l?h=t[4]:(h=async e=>{await k({dreaming:e}),await l()},t[3]=l,t[4]=h);let _;t[5]!==d||t[6]!==m||t[7]!==h?(_={value:d,dirty:m,delayMs:500,onSave:h},t[5]=d,t[6]=m,t[7]=h,t[8]=_):_=t[8];let v=ye(_);if(a){let e;t[9]===l?e=t[10]:(e=()=>void l(),t[9]=l,t[10]=e);let n;t[11]!==r.retry||t[12]!==e?(n=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:r.retry}),t[11]=r.retry,t[12]=e,t[13]=n):n=t[13];let i;return t[14]!==r.error||t[15]!==n?(i=(0,$.jsxs)(pt,{children:[r.error,` `,n]}),t[14]=r.error,t[15]=n,t[16]=i):i=t[16],i}if(o||!d){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(U,{className:`h-72 rounded-2xl`}),t[17]=e):e=t[17],e}let y=n?.status===`completed`?r.runCompleted:n?.status===`failed`?r.runFailed:r.runRunning,b;t[18]===r.dreamingHint?b=t[19]:(b=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:r.dreamingHint}),t[18]=r.dreamingHint,t[19]=b);let x=v.onBlurCapture,S;t[20]===r.mode?S=t[21]:(S=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.mode}),t[20]=r.mode,t[21]=S);let C;t[22]===f?C=t[23]:(C=e=>f(t=>t&&{...t,mode:e.target.value}),t[22]=f,t[23]=C);let w;t[24]===r.on?w=t[25]:(w=(0,$.jsx)(c,{value:`review`,children:r.on}),t[24]=r.on,t[25]=w);let E;t[26]===r.off?E=t[27]:(E=(0,$.jsx)(c,{value:`off`,children:r.off}),t[26]=r.off,t[27]=E);let D;t[28]!==d.mode||t[29]!==E||t[30]!==C||t[31]!==w?(D=(0,$.jsxs)(s,{value:d.mode,onChange:C,children:[w,E]}),t[28]=d.mode,t[29]=E,t[30]=C,t[31]=w,t[32]=D):D=t[32];let O;t[33]!==D||t[34]!==S?(O=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[S,D]}),t[33]=D,t[34]=S,t[35]=O):O=t[35];let A;t[36]===r.reviewTime?A=t[37]:(A=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=A);let j;t[38]===f?j=t[39]:(j=e=>f(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=f,t[39]=j);let M;t[40]!==d.schedule.time||t[41]!==j?(M=(0,$.jsx)(`input`,{type:`time`,className:lt,value:d.schedule.time,onChange:j}),t[40]=d.schedule.time,t[41]=j,t[42]=M):M=t[42];let N;t[43]!==A||t[44]!==M?(N=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[A,M]}),t[43]=A,t[44]=M,t[45]=N):N=t[45];let P;t[46]===r.timezone?P=t[47]:(P=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=P);let F=d.timezone??``,I,L;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(I=ie(),L=ie(),t[48]=I,t[49]=L):(I=t[48],L=t[49]);let R,z;t[50]===f?(R=t[51],z=t[52]):(R=e=>f(t=>t&&{...t,timezone:e}),z=e=>f(t=>t&&{...t,timezone:e.target.value||void 0}),t[50]=f,t[51]=R,t[52]=z);let B;t[53]!==F||t[54]!==R||t[55]!==z?(B=(0,$.jsx)(be,{className:`${lt} min-w-0 flex-1`,value:F,placeholder:I,suggestion:L,onAcceptSuggestion:R,onChange:z}),t[53]=F,t[54]=R,t[55]=z,t[56]=B):B=t[56];let V;t[57]===f?V=t[58]:(V=()=>f(zt),t[57]=f,t[58]=V);let H;t[59]!==r.detect||t[60]!==V?(H=(0,$.jsx)(g,{className:`shrink-0 whitespace-nowrap`,onClick:V,children:r.detect}),t[59]=r.detect,t[60]=V,t[61]=H):H=t[61];let W;t[62]!==B||t[63]!==H?(W=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[B,H]}),t[62]=B,t[63]=H,t[64]=W):W=t[64];let G;t[65]!==P||t[66]!==W?(G=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[P,W]}),t[65]=P,t[66]=W,t[67]=G):G=t[67];let K;t[68]===r.evidenceThreshold?K=t[69]:(K=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.evidenceThreshold}),t[68]=r.evidenceThreshold,t[69]=K);let ee;t[70]===f?ee=t[71]:(ee=e=>f(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[70]=f,t[71]=ee);let q;t[72]!==d.minEvidenceSources||t[73]!==ee?(q=(0,$.jsx)(`input`,{type:`number`,min:2,max:10,className:lt,value:d.minEvidenceSources,onChange:ee}),t[72]=d.minEvidenceSources,t[73]=ee,t[74]=q):q=t[74];let te;t[75]!==K||t[76]!==q?(te=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[K,q]}),t[75]=K,t[76]=q,t[77]=te):te=t[77];let ne;t[78]===r.scanLimit?ne=t[79]:(ne=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.scanLimit}),t[78]=r.scanLimit,t[79]=ne);let re;t[80]===f?re=t[81]:(re=e=>f(t=>t&&{...t,limit:Number(e.target.value)}),t[80]=f,t[81]=re);let ae;t[82]!==d.limit||t[83]!==re?(ae=(0,$.jsx)(`input`,{type:`number`,min:1,max:2e3,className:lt,value:d.limit,onChange:re}),t[82]=d.limit,t[83]=re,t[84]=ae):ae=t[84];let J;t[85]!==ne||t[86]!==ae?(J=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[ne,ae]}),t[85]=ne,t[86]=ae,t[87]=J):J=t[87];let oe;t[88]!==O||t[89]!==N||t[90]!==G||t[91]!==te||t[92]!==J?(oe=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[O,N,G,te,J]}),t[88]=O,t[89]=N,t[90]=G,t[91]=te,t[92]=J,t[93]=oe):oe=t[93];let se;t[94]!==v.error||t[95]!==v.status?(se=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ve,{status:v.status,error:v.error})}),t[94]=v.error,t[95]=v.status,t[96]=se):se=t[96];let ce;t[97]!==v.onBlurCapture||t[98]!==oe||t[99]!==se?(ce=(0,$.jsx)(ft,{children:(0,$.jsxs)(`div`,{onBlurCapture:x,children:[oe,se]})}),t[97]=v.onBlurCapture,t[98]=oe,t[99]=se,t[100]=ce):ce=t[100];let le;t[101]===r.lastRun?le=t[102]:(le=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[101]=r.lastRun,t[102]=le);let Y;t[103]!==n||t[104]!==y||t[105]!==r.neverRun||t[106]!==r.runItems?(Y=n?(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{children:y}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`time`,{children:new Date(n.startedAt).toLocaleString()}),typeof n.metrics.scanned==`number`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[String(n.metrics.scanned),` `,r.runItems]})]}):null]}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.neverRun}),t[103]=n,t[104]=y,t[105]=r.neverRun,t[106]=r.runItems,t[107]=Y):Y=t[107];let X;t[108]!==le||t[109]!==Y?(X=(0,$.jsxs)(ft,{children:[le,Y]}),t[108]=le,t[109]=Y,t[110]=X):X=t[110];let ue;return t[111]!==ce||t[112]!==X||t[113]!==b?(ue=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[b,ce,X]}),t[111]=ce,t[112]=X,t[113]=b,t[114]=ue):ue=t[114],ue}function zt(e){return e&&{...e,timezone:ie()}}function Bt(e){let t=(0,Q.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=T(`you-context-settings`,me),l=r?.privacy.sensitiveWritePolicy??null,[u,d]=gt(l),f=!!(u&&l&&u!==l),p;t[0]===o?p=t[1]:(p=async e=>{await k({privacy:{sensitiveWritePolicy:e}}),await o()},t[0]=o,t[1]=p);let m;t[2]!==u||t[3]!==f||t[4]!==p?(m={value:u,dirty:f,delayMs:350,onSave:p},t[2]=u,t[3]=f,t[4]=p,t[5]=m):m=t[5];let h=ye(m);if(i){let e;t[6]===o?e=t[7]:(e=()=>void o(),t[6]=o,t[7]=e);let r;t[8]!==n.retry||t[9]!==e?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[8]=n.retry,t[9]=e,t[10]=r):r=t[10];let i;return t[11]!==n.error||t[12]!==r?(i=(0,$.jsxs)(pt,{children:[n.error,` `,r]}),t[11]=n.error,t[12]=r,t[13]=i):i=t[13],i}if(a||!u){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(U,{className:`h-56 rounded-2xl`}),t[14]=e):e=t[14],e}let g;t[15]===n.privacyHint?g=t[16]:(g=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=g);let _;t[17]===n.sensitivePolicy?_=t[18]:(_=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=_);let v;t[19]===d?v=t[20]:(v=e=>d(e.target.value),t[19]=d,t[20]=v);let y;t[21]===n.policyDeny?y=t[22]:(y=(0,$.jsx)(c,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=y);let b;t[23]===n.policyConfirm?b=t[24]:(b=(0,$.jsx)(c,{value:`confirm`,children:n.policyConfirm}),t[23]=n.policyConfirm,t[24]=b);let x;t[25]===n.policyAllow?x=t[26]:(x=(0,$.jsx)(c,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=x);let S;t[27]!==u||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==x?(S=(0,$.jsxs)(s,{value:u,onChange:v,children:[y,b,x]}),t[27]=u,t[28]=v,t[29]=y,t[30]=b,t[31]=x,t[32]=S):S=t[32];let C;t[33]!==S||t[34]!==_?(C=(0,$.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[_,S]}),t[33]=S,t[34]=_,t[35]=C):C=t[35];let w;t[36]===n.privacyWarning?w=t[37]:(w=(0,$.jsx)(`p`,{className:`mt-3 max-w-2xl text-xs leading-5 text-fg-subtle`,children:n.privacyWarning}),t[36]=n.privacyWarning,t[37]=w);let E;t[38]!==h.error||t[39]!==h.status?(E=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ve,{status:h.status,error:h.error})}),t[38]=h.error,t[39]=h.status,t[40]=E):E=t[40];let D;t[41]!==h.onBlurCapture||t[42]!==C||t[43]!==w||t[44]!==E?(D=(0,$.jsx)(ft,{children:(0,$.jsxs)(`div`,{onBlurCapture:h.onBlurCapture,children:[C,w,E]})}),t[41]=h.onBlurCapture,t[42]=C,t[43]=w,t[44]=E,t[45]=D):D=t[45];let O;return t[46]!==D||t[47]!==g?(O=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[g,D]}),t[46]=D,t[47]=g,t[48]=O):O=t[48],O}export{vt as UserContextPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-iKjqemWG.js";import{n as o}from"./gateway-config-swr-BzTbnu4O.js";import{$o as s}from"./index-EvA8c7fo.js";e();var c=t(),l=`xopc-local-voice-model-install-started`;async function u(e,t){return(await a(i(`/api/voice/tts-voices?${new URLSearchParams({provider:e,model:t}).toString()}`))).payload?.voices??[]}function d(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`},groq:{model:`whisper-large-v3-turbo`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function f(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{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 p(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function m(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function h(e){let t=d();if(!p(e))return t;let n=m(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(p(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...p(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,p(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function g(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function _(e){let t=f();if(!p(e))return t;let n=g(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...p(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,p(t)?{...t}:{}])):{}};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,providers:i}}function v(e){return{...e}}function y(e){return{...e}}function b(e){let t=p(e)?e:{},n=p(t.voice)?t.voice:{},r=p(n.input)?n.input:{},i=p(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:h(t.stt),tts:_(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 x(){return b((await a(i(`/api/config`))).payload?.config??{})}async function S(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:v(e.stt),tts:y(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await a(i(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),o()}async function C(){let e=await a(i(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function w(){let e=await a(i(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function T(){let e=await a(i(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function E(){let e=await a(i(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function D(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function O(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function k(e){let t=await a(i(`/api/voice/tts-test`),{method:`POST`,body:JSON.stringify(e)});if(t.ok===!1){let e=typeof t.error==`string`?t.error:t.error?.message;throw Error(e||`TTS test failed`)}if(!t.payload||typeof t.payload.audio!=`string`||!t.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return t.payload}async function A(e){let t=await a(i(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}var j=n();function M(e){let t=(0,c.c)(15),{kind:n,providerId:i,fieldId:a,value:o,onChange:l,labels:u,placeholder:d,className:f}=e,p=d===void 0?`sk-...`:d,m;t[0]!==n||t[1]!==i?(m=()=>A({kind:n,provider:i}).then(N),t[0]=n,t[1]=i,t[2]=m):m=t[2];let h=m,g;t[3]===f?g=t[4]:(g=r(`flex min-w-0 flex-col gap-1.5`,f),t[3]=f,t[4]=g);let _;t[5]!==a||t[6]!==u||t[7]!==l||t[8]!==p||t[9]!==h||t[10]!==o?(_=(0,j.jsx)(s,{id:a,value:o,onChange:l,placeholder:p,labels:u,reveal:h,loadFailedLabel:u.loadFailed,maskedHelp:u.maskedHelp,notInConfigFile:u.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=u,t[7]=l,t[8]=p,t[9]=h,t[10]=o,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,j.jsx)(`div`,{className:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function N(e){return e.apiKey??null}export{C as a,T as c,S as d,O as f,u as i,D as l,l as n,w as o,k as p,E as r,x as s,M as t,b as u};
|