@bigduu/lotus-next 2026.11.13 → 2026.11.14

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.
@@ -100,8 +100,8 @@
100
100
  "_runtimeConfig-DNyol2mX.js"
101
101
  ]
102
102
  },
103
- "_appStore-DhQwkuOp.js": {
104
- "file": "assets/appStore-DhQwkuOp.js",
103
+ "_appStore-C9vSUDXg.js": {
104
+ "file": "assets/appStore-C9vSUDXg.js",
105
105
  "name": "appStore",
106
106
  "imports": [
107
107
  "_rolldown-runtime-QTnfLwEv.js",
@@ -172,8 +172,8 @@
172
172
  "file": "assets/clipboard-CyQ_pZV9.js",
173
173
  "name": "clipboard"
174
174
  },
175
- "_command-CIuEm3dl.js": {
176
- "file": "assets/command-CIuEm3dl.js",
175
+ "_command-C2qhILAZ.js": {
176
+ "file": "assets/command-C2qhILAZ.js",
177
177
  "name": "command",
178
178
  "imports": [
179
179
  "_rolldown-runtime-QTnfLwEv.js",
@@ -729,7 +729,7 @@
729
729
  ]
730
730
  },
731
731
  "index.html": {
732
- "file": "assets/index-D6ZjT3if.js",
732
+ "file": "assets/index-DB2hXQ9j.js",
733
733
  "name": "index",
734
734
  "src": "index.html",
735
735
  "isEntry": true,
@@ -6725,7 +6725,7 @@
6725
6725
  ]
6726
6726
  },
6727
6727
  "src/Root.tsx": {
6728
- "file": "assets/Root-kgWSyvAi.js",
6728
+ "file": "assets/Root-_T_3-N3f.js",
6729
6729
  "name": "Root",
6730
6730
  "src": "src/Root.tsx",
6731
6731
  "isDynamicEntry": true,
@@ -6735,7 +6735,7 @@
6735
6735
  "_runtimeConfig-DNyol2mX.js",
6736
6736
  "_preload-helper-DYl5dUZ5.js",
6737
6737
  "_ui-DHEY0Lgx.js",
6738
- "_command-CIuEm3dl.js",
6738
+ "_command-C2qhILAZ.js",
6739
6739
  "_createLucideIcon-5m7IB1Aa.js",
6740
6740
  "_popover-Csd6fbme.js",
6741
6741
  "_circle-question-mark-psZ0qSH-.js",
@@ -6758,7 +6758,7 @@
6758
6758
  "_x-CH9nNoJJ.js",
6759
6759
  "_clipboard-CyQ_pZV9.js",
6760
6760
  "_react-BqtYw2Yd.js",
6761
- "_appStore-DhQwkuOp.js",
6761
+ "_appStore-C9vSUDXg.js",
6762
6762
  "_api-CPcpMjoM.js",
6763
6763
  "_AgentService-BxkDZijx.js",
6764
6764
  "_project-Bes6r3Er.js",
@@ -6898,7 +6898,7 @@
6898
6898
  ]
6899
6899
  },
6900
6900
  "src/components/app/SidebarProjectDrag.tsx": {
6901
- "file": "assets/SidebarProjectDrag-CsY9x3a_.js",
6901
+ "file": "assets/SidebarProjectDrag-BXnEyWZA.js",
6902
6902
  "name": "SidebarProjectDrag",
6903
6903
  "src": "src/components/app/SidebarProjectDrag.tsx",
6904
6904
  "isDynamicEntry": true,
@@ -6907,7 +6907,7 @@
6907
6907
  "_vendor-react-CCIEwYL0.js",
6908
6908
  "_ui-DHEY0Lgx.js",
6909
6909
  "_workbenchSensors-t4FKs4U1.js",
6910
- "_appStore-DhQwkuOp.js",
6910
+ "_appStore-C9vSUDXg.js",
6911
6911
  "_projectSidebarPreferences-BReX5c6j.js"
6912
6912
  ]
6913
6913
  },
@@ -6959,7 +6959,7 @@
6959
6959
  ]
6960
6960
  },
6961
6961
  "src/components/chat/ConversationClearDialogContent.tsx": {
6962
- "file": "assets/ConversationClearDialogContent-BjUzjlW5.js",
6962
+ "file": "assets/ConversationClearDialogContent-Crm59otF.js",
6963
6963
  "name": "ConversationClearDialogContent",
6964
6964
  "src": "src/components/chat/ConversationClearDialogContent.tsx",
6965
6965
  "isDynamicEntry": true,
@@ -6967,7 +6967,7 @@
6967
6967
  "_rolldown-runtime-QTnfLwEv.js",
6968
6968
  "_vendor-react-CCIEwYL0.js",
6969
6969
  "_ui-DHEY0Lgx.js",
6970
- "_appStore-DhQwkuOp.js",
6970
+ "_appStore-C9vSUDXg.js",
6971
6971
  "_button-Cfb4l-V4.js",
6972
6972
  "_responsive-dialog-D6zJ6jIQ.js"
6973
6973
  ]
@@ -7017,7 +7017,7 @@
7017
7017
  ]
7018
7018
  },
7019
7019
  "src/components/chat/Settings.tsx": {
7020
- "file": "assets/Settings-DWx59xvd.js",
7020
+ "file": "assets/Settings-CJZ0B2vK.js",
7021
7021
  "name": "Settings",
7022
7022
  "src": "src/components/chat/Settings.tsx",
7023
7023
  "isDynamicEntry": true,
@@ -7027,7 +7027,7 @@
7027
7027
  "_runtimeConfig-DNyol2mX.js",
7028
7028
  "_preload-helper-DYl5dUZ5.js",
7029
7029
  "_ui-DHEY0Lgx.js",
7030
- "_command-CIuEm3dl.js",
7030
+ "_command-C2qhILAZ.js",
7031
7031
  "_createLucideIcon-5m7IB1Aa.js",
7032
7032
  "_popover-Csd6fbme.js",
7033
7033
  "_loader-circle-B9fKDSy8.js",
@@ -7044,7 +7044,7 @@
7044
7044
  "_x-CH9nNoJJ.js",
7045
7045
  "_clipboard-CyQ_pZV9.js",
7046
7046
  "_react-BqtYw2Yd.js",
7047
- "_appStore-DhQwkuOp.js",
7047
+ "_appStore-C9vSUDXg.js",
7048
7048
  "_api-CPcpMjoM.js",
7049
7049
  "_AgentService-BxkDZijx.js",
7050
7050
  "_dist-F2p7j0vG.js",
@@ -7175,7 +7175,7 @@
7175
7175
  ]
7176
7176
  },
7177
7177
  "src/components/chat/settings/JianduProjectMemories.tsx": {
7178
- "file": "assets/JianduProjectMemories-bTTYZdJm.js",
7178
+ "file": "assets/JianduProjectMemories-rD8x44mY.js",
7179
7179
  "name": "JianduProjectMemories",
7180
7180
  "src": "src/components/chat/settings/JianduProjectMemories.tsx",
7181
7181
  "isDynamicEntry": true,
@@ -7184,7 +7184,7 @@
7184
7184
  "_vendor-react-CCIEwYL0.js",
7185
7185
  "_ui-DHEY0Lgx.js",
7186
7186
  "_select-CmSs2Iud.js",
7187
- "_appStore-DhQwkuOp.js",
7187
+ "_appStore-C9vSUDXg.js",
7188
7188
  "_button-Cfb4l-V4.js",
7189
7189
  "_responsive-dialog-D6zJ6jIQ.js",
7190
7190
  "_input-BDZy7WK3.js",
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./vendor-react-CCIEwYL0.js";import{a as r}from"./ui-DHEY0Lgx.js";import{i}from"./appStore-DhQwkuOp.js";import{t as a}from"./button-Cfb4l-V4.js";import{i as o,n as s,r as c,t as l}from"./responsive-dialog-D6zJ6jIQ.js";var u=e(t(),1),d=n(),f={active_run:`conversation_clear_active_run`,pending_approval:`conversation_clear_pending_approval`,state_unavailable:`conversation_clear_state_unavailable`,authority_conflict:`conversation_clear_authority_conflict`,incompatible:`conversation_clear_incompatible`,unsupported:`conversation_clear_unsupported`,unknown:`conversation_clear_unknown`,readback_failed:`conversation_clear_readback_failed`};function p({sessionId:e,title:t,onClose:n}){let p=r(),m=i(t=>t.conversationClears[e]),h=(0,u.useRef)(!1),g=m?.error===`unknown`||m?.error===`readback_failed`,_=()=>{i.getState().conversationClears[e]?.busy||(i.getState().dismissConversationClear(e),n())},v=async t=>{if(!h.current){h.current=!0;try{let n=i.getState();await(t?g?n.verifyConversationClear(e):n.refreshConversationClear(e):n.clearConversation(e))}catch{}finally{h.current=!1}}};return(0,d.jsx)(l,{open:!0,onOpenChange:e=>{e||_()},children:(0,d.jsxs)(s,{showCloseButton:!m?.busy,dismissable:!m?.busy,className:`gap-3 overflow-y-auto p-4 sm:pb-4 sm:max-w-lg`,children:[(0,d.jsx)(o,{children:p(`conversation_clear_title`)}),(0,d.jsx)(c,{asChild:!0,children:(0,d.jsxs)(`div`,{className:`space-y-2 text-sm text-muted-foreground`,children:[(0,d.jsxs)(`p`,{className:`break-all font-medium text-foreground`,children:[t,` · `,e]}),(0,d.jsx)(`p`,{children:p(`conversation_clear_impact`)}),(0,d.jsx)(`p`,{children:p(`conversation_clear_limits`)})]})}),m?.confirmed?(0,d.jsx)(`p`,{role:`status`,className:`text-sm`,children:p(`conversation_clear_confirmed`)}):null,m?.error?(0,d.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:p(f[m.error])}):null,m?.readbackConfirmed?(0,d.jsx)(`p`,{role:`status`,className:`text-sm`,children:p(`conversation_clear_readback_only`)}):null,m?.refreshFailed?(0,d.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:p(`conversation_clear_refresh_failed`)}):null,(0,d.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,d.jsx)(a,{variant:`secondary`,size:`sm`,disabled:m?.busy,onClick:_,children:m?.confirmed||g?p(`close_3fd47edc`):p(`cancel_2cd0f3be`)}),m?.error?(0,d.jsx)(a,{variant:`outline`,size:`sm`,disabled:m?.busy,onClick:()=>void v(!0),children:m?.busy?p(`processing_d3d21191`):p(`conversation_clear_refresh`)}):null,!g&&!m?.confirmed?(0,d.jsx)(a,{variant:`destructive`,size:`sm`,disabled:m?.busy,onClick:()=>void v(!1),children:m?.busy?p(`processing_d3d21191`):p(`conversation_clear_action`)}):null]})]})})}export{p as ConversationClearDialogContent};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./vendor-react-CCIEwYL0.js";import{a as r}from"./ui-DHEY0Lgx.js";import{i}from"./appStore-C9vSUDXg.js";import{t as a}from"./button-Cfb4l-V4.js";import{i as o,n as s,r as c,t as l}from"./responsive-dialog-D6zJ6jIQ.js";var u=e(t(),1),d=n(),f={active_run:`conversation_clear_active_run`,pending_approval:`conversation_clear_pending_approval`,state_unavailable:`conversation_clear_state_unavailable`,authority_conflict:`conversation_clear_authority_conflict`,incompatible:`conversation_clear_incompatible`,unsupported:`conversation_clear_unsupported`,unknown:`conversation_clear_unknown`,readback_failed:`conversation_clear_readback_failed`};function p({sessionId:e,title:t,onClose:n}){let p=r(),m=i(t=>t.conversationClears[e]),h=(0,u.useRef)(!1),g=m?.error===`unknown`||m?.error===`readback_failed`,_=()=>{i.getState().conversationClears[e]?.busy||(i.getState().dismissConversationClear(e),n())},v=async t=>{if(!h.current){h.current=!0;try{let n=i.getState();await(t?g?n.verifyConversationClear(e):n.refreshConversationClear(e):n.clearConversation(e))}catch{}finally{h.current=!1}}};return(0,d.jsx)(l,{open:!0,onOpenChange:e=>{e||_()},children:(0,d.jsxs)(s,{showCloseButton:!m?.busy,dismissable:!m?.busy,className:`gap-3 overflow-y-auto p-4 sm:pb-4 sm:max-w-lg`,children:[(0,d.jsx)(o,{children:p(`conversation_clear_title`)}),(0,d.jsx)(c,{asChild:!0,children:(0,d.jsxs)(`div`,{className:`space-y-2 text-sm text-muted-foreground`,children:[(0,d.jsxs)(`p`,{className:`break-all font-medium text-foreground`,children:[t,` · `,e]}),(0,d.jsx)(`p`,{children:p(`conversation_clear_impact`)}),(0,d.jsx)(`p`,{children:p(`conversation_clear_limits`)})]})}),m?.confirmed?(0,d.jsx)(`p`,{role:`status`,className:`text-sm`,children:p(`conversation_clear_confirmed`)}):null,m?.error?(0,d.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:p(f[m.error])}):null,m?.readbackConfirmed?(0,d.jsx)(`p`,{role:`status`,className:`text-sm`,children:p(`conversation_clear_readback_only`)}):null,m?.refreshFailed?(0,d.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:p(`conversation_clear_refresh_failed`)}):null,(0,d.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,d.jsx)(a,{variant:`secondary`,size:`sm`,disabled:m?.busy,onClick:_,children:m?.confirmed||g?p(`close_3fd47edc`):p(`cancel_2cd0f3be`)}),m?.error?(0,d.jsx)(a,{variant:`outline`,size:`sm`,disabled:m?.busy,onClick:()=>void v(!0),children:m?.busy?p(`processing_d3d21191`):p(`conversation_clear_refresh`)}):null,!g&&!m?.confirmed?(0,d.jsx)(a,{variant:`destructive`,size:`sm`,disabled:m?.busy,onClick:()=>void v(!1),children:m?.busy?p(`processing_d3d21191`):p(`conversation_clear_action`)}):null]})]})})}export{p as ConversationClearDialogContent};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./vendor-react-CCIEwYL0.js";import{u as r}from"./ui-DHEY0Lgx.js";import{a as i,i as a,n as o,r as s,s as c,t as ee}from"./select-CmSs2Iud.js";import{i as te}from"./appStore-DhQwkuOp.js";import{t as l}from"./button-Cfb4l-V4.js";import{i as ne,n as re,r as ie,t as ae}from"./responsive-dialog-D6zJ6jIQ.js";import{t as oe}from"./input-BDZy7WK3.js";import{t as se}from"./textarea-BKzYyWL5.js";import{a as u,c as ce,i as le,l as ue,n as de,o as fe,s as pe,t as me,u as d}from"./jianduMemoryApi-Bg3hZQEs.js";var f=e(t(),1),p=n(),m={title:``,type:`project`,content:``,tags:``,keywords:``,entities:``,granularity:``},h=e=>{if(!(e instanceof u))return`unavailable`;switch(e.code){case`invalid_input`:return`invalid`;case`context_unavailable`:return`context`;case`access_denied`:return`denied`;case`action_rejected`:return`rejected`;case`malformed_response`:return`malformed`;case`request_failed`:return`unavailable`}},g=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),he=e=>({title:e.title,type:e.type,content:e.content,tags:g(e.tags),keywords:g(e.keywords),entities:g(e.entities),...e.granularity?{granularity:e.granularity}:{}}),ge=(e,t)=>{let n=new Map(e.map(e=>[e.id,e]));return t.forEach(e=>n.set(e.id,e)),[...n.values()]};function _({api:e=pe}){let{t}=r(),n=te(e=>e.currentSessionId),u=(0,f.useRef)(n);u.current=n;let g=(0,f.useRef)(0),_=(0,f.useRef)(0),v=(0,f.useRef)(0),y=(0,f.useRef)(0),b=(0,f.useRef)(0),[_e,ve]=(0,f.useState)(0),[x,ye]=(0,f.useState)(null),[be,S]=(0,f.useState)(!1),[xe,C]=(0,f.useState)(null),[Se,w]=(0,f.useState)(``),[T,Ce]=(0,f.useState)(``),[we,Te]=(0,f.useState)(`active`),[E,Ee]=(0,f.useState)(`active`),[De,D]=(0,f.useState)([]),[O,k]=(0,f.useState)(null),[A,j]=(0,f.useState)(!1),[Oe,M]=(0,f.useState)(null),[N,P]=(0,f.useState)(null),[ke,F]=(0,f.useState)(null),[Ae,I]=(0,f.useState)(null),[je,L]=(0,f.useState)(!1),[R,z]=(0,f.useState)(m),[B,V]=(0,f.useState)(null),[Me,H]=(0,f.useState)(!1),[Ne,U]=(0,f.useState)(null),[W,G]=(0,f.useState)(null),[Pe,K]=(0,f.useState)(null),[Fe,q]=(0,f.useState)(null),[Ie,J]=(0,f.useState)(null),Y=(0,f.useCallback)(async(t,n,r,i,a,o)=>{let s=++_.current;j(!0),M(null);try{let c=await e.queryProjectMemories(t,{query:n,filters:{status:[r]},...i?{cursor:i}:{}});return g.current!==o||_.current!==s?`stale`:(D(e=>a?ge(e,c.items):c.items),k(c),`ok`)}catch(e){return g.current!==o||_.current!==s?`stale`:(M(h(e)),a||(D([]),k(null)),`failed`)}finally{g.current===o&&_.current===s&&j(!1)}},[e]),Le=(0,f.useCallback)(e=>{let t=g.current;t===e&&(g.current=t+1)},[]);(0,f.useEffect)(()=>{let t=++g.current;if(++_.current,++v.current,++y.current,++b.current,ye(null),C(null),S(!!n),w(``),Ce(``),Te(`active`),Ee(`active`),D([]),k(null),M(null),j(!1),P(null),F(null),I(null),L(!1),z(m),V(null),H(!1),U(null),G(null),K(null),q(null),J(null),!n){C(`context`);return}return e.resolveProjectContext(n).then(e=>{g.current!==t||u.current!==n||(ye(e),S(!1),Y(e,``,`active`,void 0,!1,t))}).catch(e=>{g.current!==t||u.current!==n||(S(!1),C(h(e)))}),()=>Le(t)},[e,n,Le,Y,_e]);let Re=(0,f.useCallback)(e=>{++g.current,++_.current,++v.current,++y.current,++b.current,ye(null),w(``),Ce(``),Te(`active`),Ee(`active`),D([]),k(null),j(!1),M(null),P(null),F(null),I(null),L(!1),z(m),V(null),H(!1),U(null),G(null),K(null),q(null),J(null),C(e),S(!1)},[]),ze=(0,f.useCallback)(async(t,n)=>{let r=u.current;if(!r||g.current!==n)return null;try{let i=await e.resolveProjectContext(r);return g.current!==n||u.current!==r?null:ue(t,i)?i:(Re(`context`),null)}catch(e){return g.current===n&&Re(h(e)),null}},[e,Re]),Be=()=>{if(!x)return;let e=Se.trim(),t=we;Ce(e),Ee(t),J(null),Y(x,e,t,void 0,!1,g.current)},Ve=async t=>{if(!x)return;let n=++v.current,r=g.current;P(null),I(null),F(t.id);try{let i=await e.getProjectMemory(x,t.id);if(g.current!==r||v.current!==n)return;P(i)}catch(e){g.current===r&&v.current===n&&I(h(e))}finally{g.current===r&&v.current===n&&F(null)}},He=()=>{++v.current,P(null),I(null),F(null),K(null),q(null)},Ue=(0,f.useMemo)(()=>JSON.stringify(R),[R]),X=(e,t)=>{++y.current,z(n=>({...n,[e]:t})),V(null),H(!1),U(null)},We=()=>{z(m),V(null),U(null),L(!0)},Ge=()=>{W!==`create`&&(++y.current,L(!1),z(m),V(null),U(null))},Ke=async()=>{if(!x||Me||W)return;let t=he(R);try{ce(t)}catch(e){U(h(e));return}let n=Ue,r=++y.current,i=g.current;H(!0),V(null),U(null);try{let a=await e.queryProjectMemories(x,{query:``,limit:1});if(g.current!==i||y.current!==r)return;let o=a.matchedCount===0?a:await e.queryProjectMemories(x,{query:fe(t),limit:5});if(g.current!==i||y.current!==r)return;V({fingerprint:n,items:o.items,truncated:o.truncated})}catch(e){g.current===i&&y.current===r&&U(h(e))}finally{g.current===i&&y.current===r&&H(!1)}},qe=async()=>{if(!x||W||!B||B.fingerprint!==Ue)return;let t=he(R);try{ce(t)}catch(e){U(h(e));return}let n=g.current,r=++b.current;G(`create`),U(null);let i=await ze(x,n);if(!i||g.current!==n||b.current!==r){b.current===r&&G(null);return}try{let a=await e.createProjectMemory(i,t);if(g.current!==n||b.current!==r)return;L(!1),V(null),J({kind:`created`,title:a.title}),await Y(i,T,E,void 0,!1,n)===`failed`&&b.current===r&&J({kind:`createdRefreshFailed`,title:a.title})}catch(e){g.current===n&&b.current===r&&U(h(e))}finally{g.current===n&&b.current===r&&G(null)}},Je=async()=>{let t=Pe;if(!x||!t||W)return;let n=g.current,r=++b.current;G(`archive`),q(null);let i=await ze(x,n);if(!i||g.current!==n||b.current!==r){b.current===r&&G(null);return}try{if(await e.archiveProjectMemory(i,t.id),g.current!==n||b.current!==r)return;K(null),He(),J({kind:`archived`,title:t.title}),await Y(i,T,E,void 0,!1,n)===`failed`&&b.current===r&&J({kind:`archivedRefreshFailed`,title:t.title})}catch(e){g.current===n&&b.current===r&&q(h(e))}finally{g.current===n&&b.current===r&&G(null)}},Z=e=>t(`settings.jiandu.errors.${e}`),Q=e=>t(`settings.jiandu.types.${e}`),$=e=>t(`settings.jiandu.statuses.${e}`);return(0,p.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-4`,children:[(0,p.jsx)(`header`,{className:`space-y-1`,children:(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h2`,{className:`text-lg font-semibold`,children:t(`settings.jiandu.title`)}),(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`settings.jiandu.description`)})]}),(0,p.jsx)(l,{onClick:We,disabled:!x||be,children:t(`settings.jiandu.create.open`)})]})}),(0,p.jsxs)(`section`,{className:`rounded-lg border p-3`,"aria-label":t(`settings.jiandu.context.label`),children:[(0,p.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:t(`settings.jiandu.context.label`)}),be?(0,p.jsx)(`p`,{className:`mt-1 text-sm`,children:t(`settings.jiandu.context.loading`)}):x?(0,p.jsxs)(`dl`,{className:`mt-2 grid gap-2 text-sm sm:grid-cols-2`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`settings.jiandu.context.session`)}),(0,p.jsx)(`dd`,{className:`break-words font-medium`,children:x.activeSessionTitle})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`settings.jiandu.context.project`)}),(0,p.jsx)(`dd`,{className:`break-all font-mono text-xs`,children:x.projectId})]}),x.activeSessionId===x.authoritySessionId?null:(0,p.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,p.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`settings.jiandu.context.rootSession`)}),(0,p.jsx)(`dd`,{children:x.authoritySessionTitle})]})]}):(0,p.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,p.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(xe??`context`)}),n?(0,p.jsx)(l,{variant:`outline`,size:`sm`,onClick:()=>ve(e=>e+1),children:t(`settings.jiandu.context.retry`)}):null]})]}),Ie?(0,p.jsx)(`p`,{role:`status`,className:`rounded-lg border border-primary/30 bg-primary/5 p-3 text-sm`,children:t(`settings.jiandu.notices.${Ie.kind}`,{title:Ie.title})}):null,x?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:e=>{e.preventDefault(),Be()},children:[(0,p.jsx)(oe,{"aria-label":t(`settings.jiandu.search.label`),value:Se,maxLength:de.queryChars,onChange:e=>w(e.target.value),placeholder:t(`settings.jiandu.search.placeholder`)}),(0,p.jsxs)(ee,{value:we,disabled:A,onValueChange:e=>Te(e),children:[(0,p.jsx)(a,{className:`w-full sm:w-36`,"aria-label":t(`settings.jiandu.search.statusLabel`),children:(0,p.jsx)(i,{})}),(0,p.jsxs)(o,{className:`z-[150]`,children:[(0,p.jsx)(s,{value:`active`,children:$(`active`)}),(0,p.jsx)(s,{value:`archived`,children:$(`archived`)})]})]}),(0,p.jsx)(l,{type:`submit`,disabled:A,children:t(`settings.jiandu.search.action`)}),(0,p.jsx)(l,{type:`button`,variant:`outline`,disabled:A,onClick:()=>void Y(x,T,E,void 0,!1,g.current),children:t(`settings.jiandu.search.refresh`)})]}),Oe?(0,p.jsx)(`p`,{role:`alert`,className:`rounded-lg border border-destructive/40 p-3 text-sm text-destructive`,children:Z(Oe)}):null,O?(0,p.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,p.jsx)(`span`,{children:t(`settings.jiandu.list.count`,{visible:De.length,matched:O.matchedCount})}),O.truncated?(0,p.jsx)(`span`,{children:t(`settings.jiandu.list.truncated`)}):null,O.remainingCount>0?(0,p.jsx)(`span`,{children:t(`settings.jiandu.list.remaining`,{count:O.remainingCount})}):null]}):null,De.length>0?(0,p.jsx)(`ul`,{className:`space-y-2`,"aria-label":t(`settings.jiandu.list.label`),children:De.map(e=>(0,p.jsxs)(`li`,{className:`rounded-lg border p-3`,children:[(0,p.jsx)(`button`,{type:`button`,className:`max-w-full break-words text-left text-sm font-semibold hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,disabled:ke===e.id,onClick:()=>void Ve(e),children:e.title}),(0,p.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[(0,p.jsx)(c,{variant:`outline`,children:Q(e.type)}),(0,p.jsx)(c,{variant:e.status===`archived`?`secondary`:`outline`,children:$(e.status)}),e.granularity?(0,p.jsx)(c,{variant:`outline`,children:e.granularity}):null]}),(0,p.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-muted-foreground`,children:e.summary})]},e.id))}):O&&!A?(0,p.jsx)(`p`,{className:`rounded-lg border p-4 text-sm text-muted-foreground`,children:t(`settings.jiandu.list.empty`)}):null,A?(0,p.jsx)(`p`,{role:`status`,children:t(`settings.jiandu.list.loading`)}):null,O?.nextCursor?(0,p.jsx)(l,{variant:`outline`,className:`w-full`,disabled:A,onClick:()=>void Y(x,T,E,O.nextCursor,!0,g.current),children:t(`settings.jiandu.list.more`)}):null]}):null,(0,p.jsx)(ae,{open:!!(N||ke||Ae),onOpenChange:e=>e?null:He(),children:(0,p.jsxs)(re,{showCloseButton:!1,className:`gap-4 p-5 sm:max-w-2xl`,children:[(0,p.jsx)(ne,{children:N?.title??t(`settings.jiandu.detail.title`)}),ke?(0,p.jsx)(`p`,{role:`status`,children:t(`settings.jiandu.detail.loading`)}):null,Ae?(0,p.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(Ae)}):null,N?(0,p.jsxs)(`div`,{className:`min-h-0 space-y-3 overflow-y-auto`,children:[(0,p.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,p.jsx)(c,{variant:`outline`,children:Q(N.type)}),(0,p.jsx)(c,{variant:N.status===`archived`?`secondary`:`outline`,children:$(N.status)})]}),N.bodyTruncated||N.retrievalMetadataTruncated?(0,p.jsx)(`p`,{role:`status`,className:`text-xs text-amber-600 dark:text-amber-400`,children:N.bodyTruncated?t(`settings.jiandu.detail.bodyTruncated`):t(`settings.jiandu.detail.metadataTruncated`)}):null,(0,p.jsx)(`pre`,{className:`max-h-[50dvh] overflow-auto whitespace-pre-wrap break-words rounded-lg bg-muted p-3 font-sans text-sm`,children:N.body})]}):null,(0,p.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[N&&N.status!==`archived`?(0,p.jsx)(l,{variant:`destructive`,onClick:()=>{q(null),K(N)},children:t(`settings.jiandu.archive.open`)}):null,(0,p.jsx)(l,{variant:`outline`,onClick:He,children:t(`settings.jiandu.detail.close`)})]})]})}),(0,p.jsx)(ae,{open:je,onOpenChange:e=>e?null:Ge(),children:(0,p.jsxs)(re,{showCloseButton:!1,dismissable:W!==`create`,className:`gap-4 p-5 sm:max-w-2xl`,children:[(0,p.jsx)(ne,{children:t(`settings.jiandu.create.title`)}),(0,p.jsx)(ie,{children:t(`settings.jiandu.create.description`)}),(0,p.jsxs)(`div`,{className:`min-h-0 space-y-3 overflow-y-auto pr-1`,children:[(0,p.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,p.jsx)(d,{htmlFor:`jiandu-title`,children:t(`settings.jiandu.create.titleLabel`)}),(0,p.jsx)(oe,{id:`jiandu-title`,value:R.title,maxLength:de.titleChars,disabled:!!W,onChange:e=>X(`title`,e.target.value)})]}),(0,p.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,p.jsx)(d,{children:t(`settings.jiandu.create.typeLabel`)}),(0,p.jsxs)(ee,{value:R.type,disabled:!!W,onValueChange:e=>X(`type`,e),children:[(0,p.jsx)(a,{className:`w-full`,"aria-label":t(`settings.jiandu.create.typeLabel`),children:(0,p.jsx)(i,{})}),(0,p.jsx)(o,{className:`z-[150]`,children:le.map(e=>(0,p.jsx)(s,{value:e,children:Q(e)},e))})]})]}),(0,p.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,p.jsx)(d,{htmlFor:`jiandu-body`,children:t(`settings.jiandu.create.bodyLabel`)}),(0,p.jsx)(se,{id:`jiandu-body`,rows:7,value:R.content,maxLength:de.bodyChars,disabled:!!W,onChange:e=>X(`content`,e.target.value)})]}),(0,p.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[[`tags`,`keywords`,`entities`].map(e=>(0,p.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,p.jsx)(d,{htmlFor:`jiandu-${e}`,children:t(`settings.jiandu.create.${e}Label`)}),(0,p.jsx)(oe,{id:`jiandu-${e}`,value:R[e],disabled:!!W,onChange:t=>X(e,t.target.value),placeholder:t(`settings.jiandu.create.csvHint`)})]},e)),(0,p.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,p.jsx)(d,{children:t(`settings.jiandu.create.granularityLabel`)}),(0,p.jsxs)(ee,{value:R.granularity||`none`,disabled:!!W,onValueChange:e=>X(`granularity`,e===`none`?``:e),children:[(0,p.jsx)(a,{className:`w-full`,"aria-label":t(`settings.jiandu.create.granularityLabel`),children:(0,p.jsx)(i,{})}),(0,p.jsxs)(o,{className:`z-[150]`,children:[(0,p.jsx)(s,{value:`none`,children:t(`settings.jiandu.create.noGranularity`)}),me.map(e=>(0,p.jsx)(s,{value:e,children:e},e))]})]})]})]}),Ne?(0,p.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(Ne)}):null,B?(0,p.jsxs)(`section`,{className:`rounded-lg border p-3`,"aria-label":t(`settings.jiandu.create.matchesLabel`),children:[(0,p.jsx)(`h3`,{className:`text-sm font-medium`,children:B.items.length>0?t(`settings.jiandu.create.matches`):t(`settings.jiandu.create.noMatches`)}),B.items.length>0?(0,p.jsx)(`ul`,{className:`mt-2 space-y-1 text-sm`,children:B.items.map(e=>(0,p.jsxs)(`li`,{children:[e.title,` · `,$(e.status)]},e.id))}):null,B.truncated?(0,p.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:t(`settings.jiandu.create.matchesTruncated`)}):null]}):null]}),(0,p.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,p.jsx)(l,{variant:`outline`,disabled:W===`create`,onClick:Ge,children:t(`settings.jiandu.create.close`)}),(0,p.jsx)(l,{variant:`secondary`,disabled:Me||!!W,onClick:()=>void Ke(),children:t(Me?`settings.jiandu.create.lookingUp`:`settings.jiandu.create.lookup`)}),(0,p.jsx)(l,{disabled:W===`create`||!B||B.fingerprint!==Ue,onClick:()=>void qe(),children:t(W===`create`?`settings.jiandu.create.creating`:`settings.jiandu.create.confirm`)})]})]})}),(0,p.jsx)(ae,{open:!!Pe,onOpenChange:e=>{!e&&W!==`archive`&&(K(null),q(null))},children:(0,p.jsxs)(re,{showCloseButton:!1,dismissable:W!==`archive`,className:`gap-4 p-5`,children:[(0,p.jsx)(ne,{children:t(`settings.jiandu.archive.title`,{title:Pe?.title??``})}),(0,p.jsx)(ie,{children:t(`settings.jiandu.archive.description`)}),Fe?(0,p.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(Fe)}):null,(0,p.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,p.jsx)(l,{variant:`outline`,disabled:W===`archive`,onClick:()=>{K(null),q(null)},children:t(`settings.jiandu.archive.cancel`)}),(0,p.jsx)(l,{variant:`destructive`,disabled:W===`archive`,onClick:()=>void Je(),children:t(W===`archive`?`settings.jiandu.archive.archiving`:`settings.jiandu.archive.confirm`)})]})]})})]})}export{_ as JianduProjectMemories};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./vendor-react-CCIEwYL0.js";import{u as r}from"./ui-DHEY0Lgx.js";import{a as i,i as a,n as o,r as s,s as c,t as ee}from"./select-CmSs2Iud.js";import{i as te}from"./appStore-C9vSUDXg.js";import{t as l}from"./button-Cfb4l-V4.js";import{i as ne,n as re,r as ie,t as ae}from"./responsive-dialog-D6zJ6jIQ.js";import{t as oe}from"./input-BDZy7WK3.js";import{t as se}from"./textarea-BKzYyWL5.js";import{a as u,c as ce,i as le,l as ue,n as de,o as fe,s as pe,t as me,u as d}from"./jianduMemoryApi-Bg3hZQEs.js";var f=e(t(),1),p=n(),m={title:``,type:`project`,content:``,tags:``,keywords:``,entities:``,granularity:``},h=e=>{if(!(e instanceof u))return`unavailable`;switch(e.code){case`invalid_input`:return`invalid`;case`context_unavailable`:return`context`;case`access_denied`:return`denied`;case`action_rejected`:return`rejected`;case`malformed_response`:return`malformed`;case`request_failed`:return`unavailable`}},g=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),he=e=>({title:e.title,type:e.type,content:e.content,tags:g(e.tags),keywords:g(e.keywords),entities:g(e.entities),...e.granularity?{granularity:e.granularity}:{}}),ge=(e,t)=>{let n=new Map(e.map(e=>[e.id,e]));return t.forEach(e=>n.set(e.id,e)),[...n.values()]};function _({api:e=pe}){let{t}=r(),n=te(e=>e.currentSessionId),u=(0,f.useRef)(n);u.current=n;let g=(0,f.useRef)(0),_=(0,f.useRef)(0),v=(0,f.useRef)(0),y=(0,f.useRef)(0),b=(0,f.useRef)(0),[_e,ve]=(0,f.useState)(0),[x,ye]=(0,f.useState)(null),[be,S]=(0,f.useState)(!1),[xe,C]=(0,f.useState)(null),[Se,w]=(0,f.useState)(``),[T,Ce]=(0,f.useState)(``),[we,Te]=(0,f.useState)(`active`),[E,Ee]=(0,f.useState)(`active`),[De,D]=(0,f.useState)([]),[O,k]=(0,f.useState)(null),[A,j]=(0,f.useState)(!1),[Oe,M]=(0,f.useState)(null),[N,P]=(0,f.useState)(null),[ke,F]=(0,f.useState)(null),[Ae,I]=(0,f.useState)(null),[je,L]=(0,f.useState)(!1),[R,z]=(0,f.useState)(m),[B,V]=(0,f.useState)(null),[Me,H]=(0,f.useState)(!1),[Ne,U]=(0,f.useState)(null),[W,G]=(0,f.useState)(null),[Pe,K]=(0,f.useState)(null),[Fe,q]=(0,f.useState)(null),[Ie,J]=(0,f.useState)(null),Y=(0,f.useCallback)(async(t,n,r,i,a,o)=>{let s=++_.current;j(!0),M(null);try{let c=await e.queryProjectMemories(t,{query:n,filters:{status:[r]},...i?{cursor:i}:{}});return g.current!==o||_.current!==s?`stale`:(D(e=>a?ge(e,c.items):c.items),k(c),`ok`)}catch(e){return g.current!==o||_.current!==s?`stale`:(M(h(e)),a||(D([]),k(null)),`failed`)}finally{g.current===o&&_.current===s&&j(!1)}},[e]),Le=(0,f.useCallback)(e=>{let t=g.current;t===e&&(g.current=t+1)},[]);(0,f.useEffect)(()=>{let t=++g.current;if(++_.current,++v.current,++y.current,++b.current,ye(null),C(null),S(!!n),w(``),Ce(``),Te(`active`),Ee(`active`),D([]),k(null),M(null),j(!1),P(null),F(null),I(null),L(!1),z(m),V(null),H(!1),U(null),G(null),K(null),q(null),J(null),!n){C(`context`);return}return e.resolveProjectContext(n).then(e=>{g.current!==t||u.current!==n||(ye(e),S(!1),Y(e,``,`active`,void 0,!1,t))}).catch(e=>{g.current!==t||u.current!==n||(S(!1),C(h(e)))}),()=>Le(t)},[e,n,Le,Y,_e]);let Re=(0,f.useCallback)(e=>{++g.current,++_.current,++v.current,++y.current,++b.current,ye(null),w(``),Ce(``),Te(`active`),Ee(`active`),D([]),k(null),j(!1),M(null),P(null),F(null),I(null),L(!1),z(m),V(null),H(!1),U(null),G(null),K(null),q(null),J(null),C(e),S(!1)},[]),ze=(0,f.useCallback)(async(t,n)=>{let r=u.current;if(!r||g.current!==n)return null;try{let i=await e.resolveProjectContext(r);return g.current!==n||u.current!==r?null:ue(t,i)?i:(Re(`context`),null)}catch(e){return g.current===n&&Re(h(e)),null}},[e,Re]),Be=()=>{if(!x)return;let e=Se.trim(),t=we;Ce(e),Ee(t),J(null),Y(x,e,t,void 0,!1,g.current)},Ve=async t=>{if(!x)return;let n=++v.current,r=g.current;P(null),I(null),F(t.id);try{let i=await e.getProjectMemory(x,t.id);if(g.current!==r||v.current!==n)return;P(i)}catch(e){g.current===r&&v.current===n&&I(h(e))}finally{g.current===r&&v.current===n&&F(null)}},He=()=>{++v.current,P(null),I(null),F(null),K(null),q(null)},Ue=(0,f.useMemo)(()=>JSON.stringify(R),[R]),X=(e,t)=>{++y.current,z(n=>({...n,[e]:t})),V(null),H(!1),U(null)},We=()=>{z(m),V(null),U(null),L(!0)},Ge=()=>{W!==`create`&&(++y.current,L(!1),z(m),V(null),U(null))},Ke=async()=>{if(!x||Me||W)return;let t=he(R);try{ce(t)}catch(e){U(h(e));return}let n=Ue,r=++y.current,i=g.current;H(!0),V(null),U(null);try{let a=await e.queryProjectMemories(x,{query:``,limit:1});if(g.current!==i||y.current!==r)return;let o=a.matchedCount===0?a:await e.queryProjectMemories(x,{query:fe(t),limit:5});if(g.current!==i||y.current!==r)return;V({fingerprint:n,items:o.items,truncated:o.truncated})}catch(e){g.current===i&&y.current===r&&U(h(e))}finally{g.current===i&&y.current===r&&H(!1)}},qe=async()=>{if(!x||W||!B||B.fingerprint!==Ue)return;let t=he(R);try{ce(t)}catch(e){U(h(e));return}let n=g.current,r=++b.current;G(`create`),U(null);let i=await ze(x,n);if(!i||g.current!==n||b.current!==r){b.current===r&&G(null);return}try{let a=await e.createProjectMemory(i,t);if(g.current!==n||b.current!==r)return;L(!1),V(null),J({kind:`created`,title:a.title}),await Y(i,T,E,void 0,!1,n)===`failed`&&b.current===r&&J({kind:`createdRefreshFailed`,title:a.title})}catch(e){g.current===n&&b.current===r&&U(h(e))}finally{g.current===n&&b.current===r&&G(null)}},Je=async()=>{let t=Pe;if(!x||!t||W)return;let n=g.current,r=++b.current;G(`archive`),q(null);let i=await ze(x,n);if(!i||g.current!==n||b.current!==r){b.current===r&&G(null);return}try{if(await e.archiveProjectMemory(i,t.id),g.current!==n||b.current!==r)return;K(null),He(),J({kind:`archived`,title:t.title}),await Y(i,T,E,void 0,!1,n)===`failed`&&b.current===r&&J({kind:`archivedRefreshFailed`,title:t.title})}catch(e){g.current===n&&b.current===r&&q(h(e))}finally{g.current===n&&b.current===r&&G(null)}},Z=e=>t(`settings.jiandu.errors.${e}`),Q=e=>t(`settings.jiandu.types.${e}`),$=e=>t(`settings.jiandu.statuses.${e}`);return(0,p.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-4`,children:[(0,p.jsx)(`header`,{className:`space-y-1`,children:(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h2`,{className:`text-lg font-semibold`,children:t(`settings.jiandu.title`)}),(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`settings.jiandu.description`)})]}),(0,p.jsx)(l,{onClick:We,disabled:!x||be,children:t(`settings.jiandu.create.open`)})]})}),(0,p.jsxs)(`section`,{className:`rounded-lg border p-3`,"aria-label":t(`settings.jiandu.context.label`),children:[(0,p.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:t(`settings.jiandu.context.label`)}),be?(0,p.jsx)(`p`,{className:`mt-1 text-sm`,children:t(`settings.jiandu.context.loading`)}):x?(0,p.jsxs)(`dl`,{className:`mt-2 grid gap-2 text-sm sm:grid-cols-2`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`settings.jiandu.context.session`)}),(0,p.jsx)(`dd`,{className:`break-words font-medium`,children:x.activeSessionTitle})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`settings.jiandu.context.project`)}),(0,p.jsx)(`dd`,{className:`break-all font-mono text-xs`,children:x.projectId})]}),x.activeSessionId===x.authoritySessionId?null:(0,p.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,p.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`settings.jiandu.context.rootSession`)}),(0,p.jsx)(`dd`,{children:x.authoritySessionTitle})]})]}):(0,p.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,p.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(xe??`context`)}),n?(0,p.jsx)(l,{variant:`outline`,size:`sm`,onClick:()=>ve(e=>e+1),children:t(`settings.jiandu.context.retry`)}):null]})]}),Ie?(0,p.jsx)(`p`,{role:`status`,className:`rounded-lg border border-primary/30 bg-primary/5 p-3 text-sm`,children:t(`settings.jiandu.notices.${Ie.kind}`,{title:Ie.title})}):null,x?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:e=>{e.preventDefault(),Be()},children:[(0,p.jsx)(oe,{"aria-label":t(`settings.jiandu.search.label`),value:Se,maxLength:de.queryChars,onChange:e=>w(e.target.value),placeholder:t(`settings.jiandu.search.placeholder`)}),(0,p.jsxs)(ee,{value:we,disabled:A,onValueChange:e=>Te(e),children:[(0,p.jsx)(a,{className:`w-full sm:w-36`,"aria-label":t(`settings.jiandu.search.statusLabel`),children:(0,p.jsx)(i,{})}),(0,p.jsxs)(o,{className:`z-[150]`,children:[(0,p.jsx)(s,{value:`active`,children:$(`active`)}),(0,p.jsx)(s,{value:`archived`,children:$(`archived`)})]})]}),(0,p.jsx)(l,{type:`submit`,disabled:A,children:t(`settings.jiandu.search.action`)}),(0,p.jsx)(l,{type:`button`,variant:`outline`,disabled:A,onClick:()=>void Y(x,T,E,void 0,!1,g.current),children:t(`settings.jiandu.search.refresh`)})]}),Oe?(0,p.jsx)(`p`,{role:`alert`,className:`rounded-lg border border-destructive/40 p-3 text-sm text-destructive`,children:Z(Oe)}):null,O?(0,p.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,p.jsx)(`span`,{children:t(`settings.jiandu.list.count`,{visible:De.length,matched:O.matchedCount})}),O.truncated?(0,p.jsx)(`span`,{children:t(`settings.jiandu.list.truncated`)}):null,O.remainingCount>0?(0,p.jsx)(`span`,{children:t(`settings.jiandu.list.remaining`,{count:O.remainingCount})}):null]}):null,De.length>0?(0,p.jsx)(`ul`,{className:`space-y-2`,"aria-label":t(`settings.jiandu.list.label`),children:De.map(e=>(0,p.jsxs)(`li`,{className:`rounded-lg border p-3`,children:[(0,p.jsx)(`button`,{type:`button`,className:`max-w-full break-words text-left text-sm font-semibold hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,disabled:ke===e.id,onClick:()=>void Ve(e),children:e.title}),(0,p.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[(0,p.jsx)(c,{variant:`outline`,children:Q(e.type)}),(0,p.jsx)(c,{variant:e.status===`archived`?`secondary`:`outline`,children:$(e.status)}),e.granularity?(0,p.jsx)(c,{variant:`outline`,children:e.granularity}):null]}),(0,p.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-muted-foreground`,children:e.summary})]},e.id))}):O&&!A?(0,p.jsx)(`p`,{className:`rounded-lg border p-4 text-sm text-muted-foreground`,children:t(`settings.jiandu.list.empty`)}):null,A?(0,p.jsx)(`p`,{role:`status`,children:t(`settings.jiandu.list.loading`)}):null,O?.nextCursor?(0,p.jsx)(l,{variant:`outline`,className:`w-full`,disabled:A,onClick:()=>void Y(x,T,E,O.nextCursor,!0,g.current),children:t(`settings.jiandu.list.more`)}):null]}):null,(0,p.jsx)(ae,{open:!!(N||ke||Ae),onOpenChange:e=>e?null:He(),children:(0,p.jsxs)(re,{showCloseButton:!1,className:`gap-4 p-5 sm:max-w-2xl`,children:[(0,p.jsx)(ne,{children:N?.title??t(`settings.jiandu.detail.title`)}),ke?(0,p.jsx)(`p`,{role:`status`,children:t(`settings.jiandu.detail.loading`)}):null,Ae?(0,p.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(Ae)}):null,N?(0,p.jsxs)(`div`,{className:`min-h-0 space-y-3 overflow-y-auto`,children:[(0,p.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,p.jsx)(c,{variant:`outline`,children:Q(N.type)}),(0,p.jsx)(c,{variant:N.status===`archived`?`secondary`:`outline`,children:$(N.status)})]}),N.bodyTruncated||N.retrievalMetadataTruncated?(0,p.jsx)(`p`,{role:`status`,className:`text-xs text-amber-600 dark:text-amber-400`,children:N.bodyTruncated?t(`settings.jiandu.detail.bodyTruncated`):t(`settings.jiandu.detail.metadataTruncated`)}):null,(0,p.jsx)(`pre`,{className:`max-h-[50dvh] overflow-auto whitespace-pre-wrap break-words rounded-lg bg-muted p-3 font-sans text-sm`,children:N.body})]}):null,(0,p.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[N&&N.status!==`archived`?(0,p.jsx)(l,{variant:`destructive`,onClick:()=>{q(null),K(N)},children:t(`settings.jiandu.archive.open`)}):null,(0,p.jsx)(l,{variant:`outline`,onClick:He,children:t(`settings.jiandu.detail.close`)})]})]})}),(0,p.jsx)(ae,{open:je,onOpenChange:e=>e?null:Ge(),children:(0,p.jsxs)(re,{showCloseButton:!1,dismissable:W!==`create`,className:`gap-4 p-5 sm:max-w-2xl`,children:[(0,p.jsx)(ne,{children:t(`settings.jiandu.create.title`)}),(0,p.jsx)(ie,{children:t(`settings.jiandu.create.description`)}),(0,p.jsxs)(`div`,{className:`min-h-0 space-y-3 overflow-y-auto pr-1`,children:[(0,p.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,p.jsx)(d,{htmlFor:`jiandu-title`,children:t(`settings.jiandu.create.titleLabel`)}),(0,p.jsx)(oe,{id:`jiandu-title`,value:R.title,maxLength:de.titleChars,disabled:!!W,onChange:e=>X(`title`,e.target.value)})]}),(0,p.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,p.jsx)(d,{children:t(`settings.jiandu.create.typeLabel`)}),(0,p.jsxs)(ee,{value:R.type,disabled:!!W,onValueChange:e=>X(`type`,e),children:[(0,p.jsx)(a,{className:`w-full`,"aria-label":t(`settings.jiandu.create.typeLabel`),children:(0,p.jsx)(i,{})}),(0,p.jsx)(o,{className:`z-[150]`,children:le.map(e=>(0,p.jsx)(s,{value:e,children:Q(e)},e))})]})]}),(0,p.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,p.jsx)(d,{htmlFor:`jiandu-body`,children:t(`settings.jiandu.create.bodyLabel`)}),(0,p.jsx)(se,{id:`jiandu-body`,rows:7,value:R.content,maxLength:de.bodyChars,disabled:!!W,onChange:e=>X(`content`,e.target.value)})]}),(0,p.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[[`tags`,`keywords`,`entities`].map(e=>(0,p.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,p.jsx)(d,{htmlFor:`jiandu-${e}`,children:t(`settings.jiandu.create.${e}Label`)}),(0,p.jsx)(oe,{id:`jiandu-${e}`,value:R[e],disabled:!!W,onChange:t=>X(e,t.target.value),placeholder:t(`settings.jiandu.create.csvHint`)})]},e)),(0,p.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,p.jsx)(d,{children:t(`settings.jiandu.create.granularityLabel`)}),(0,p.jsxs)(ee,{value:R.granularity||`none`,disabled:!!W,onValueChange:e=>X(`granularity`,e===`none`?``:e),children:[(0,p.jsx)(a,{className:`w-full`,"aria-label":t(`settings.jiandu.create.granularityLabel`),children:(0,p.jsx)(i,{})}),(0,p.jsxs)(o,{className:`z-[150]`,children:[(0,p.jsx)(s,{value:`none`,children:t(`settings.jiandu.create.noGranularity`)}),me.map(e=>(0,p.jsx)(s,{value:e,children:e},e))]})]})]})]}),Ne?(0,p.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(Ne)}):null,B?(0,p.jsxs)(`section`,{className:`rounded-lg border p-3`,"aria-label":t(`settings.jiandu.create.matchesLabel`),children:[(0,p.jsx)(`h3`,{className:`text-sm font-medium`,children:B.items.length>0?t(`settings.jiandu.create.matches`):t(`settings.jiandu.create.noMatches`)}),B.items.length>0?(0,p.jsx)(`ul`,{className:`mt-2 space-y-1 text-sm`,children:B.items.map(e=>(0,p.jsxs)(`li`,{children:[e.title,` · `,$(e.status)]},e.id))}):null,B.truncated?(0,p.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:t(`settings.jiandu.create.matchesTruncated`)}):null]}):null]}),(0,p.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,p.jsx)(l,{variant:`outline`,disabled:W===`create`,onClick:Ge,children:t(`settings.jiandu.create.close`)}),(0,p.jsx)(l,{variant:`secondary`,disabled:Me||!!W,onClick:()=>void Ke(),children:t(Me?`settings.jiandu.create.lookingUp`:`settings.jiandu.create.lookup`)}),(0,p.jsx)(l,{disabled:W===`create`||!B||B.fingerprint!==Ue,onClick:()=>void qe(),children:t(W===`create`?`settings.jiandu.create.creating`:`settings.jiandu.create.confirm`)})]})]})}),(0,p.jsx)(ae,{open:!!Pe,onOpenChange:e=>{!e&&W!==`archive`&&(K(null),q(null))},children:(0,p.jsxs)(re,{showCloseButton:!1,dismissable:W!==`archive`,className:`gap-4 p-5`,children:[(0,p.jsx)(ne,{children:t(`settings.jiandu.archive.title`,{title:Pe?.title??``})}),(0,p.jsx)(ie,{children:t(`settings.jiandu.archive.description`)}),Fe?(0,p.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:Z(Fe)}):null,(0,p.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,p.jsx)(l,{variant:`outline`,disabled:W===`archive`,onClick:()=>{K(null),q(null)},children:t(`settings.jiandu.archive.cancel`)}),(0,p.jsx)(l,{variant:`destructive`,disabled:W===`archive`,onClick:()=>void Je(),children:t(W===`archive`?`settings.jiandu.archive.archiving`:`settings.jiandu.archive.confirm`)})]})]})})]})}export{_ as JianduProjectMemories};