pisper 0.6.25 → 0.6.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/package.json +6 -6
  2. package/web/.vite/manifest.json +573 -573
  3. package/web/assets/{AppDialog-CuxO26Km.js → AppDialog-B9y7rq_4.js} +1 -1
  4. package/web/assets/{AppOverlays-Bt5SL3PY.js → AppOverlays-CzdCHrpC.js} +1 -1
  5. package/web/assets/{AssetsPage-BE6AzOGC.js → AssetsPage-MzCklx_a.js} +1 -1
  6. package/web/assets/{BoardPage-DX0fJ_ap.js → BoardPage-CjQXbluj.js} +3 -3
  7. package/web/assets/{ChannelsPage-CyT7oDYZ.js → ChannelsPage-C6HqgnP7.js} +1 -1
  8. package/web/assets/{ChatAppearancePage-B6Dzj2Bj.js → ChatAppearancePage-BRlvWkJX.js} +1 -1
  9. package/web/assets/{ChatHistoryPage-Cq20l93c.js → ChatHistoryPage-D3jSE4oY.js} +1 -1
  10. package/web/assets/{ChatPage-DgiS-Qj_.js → ChatPage-BfG3KbJi.js} +3 -3
  11. package/web/assets/{ConfigPage-CgrWdzb5.js → ConfigPage-CshLFv2D.js} +1 -1
  12. package/web/assets/{DesktopWindowControls-D8axeuEx.js → DesktopWindowControls-BZu-eiS1.js} +1 -1
  13. package/web/assets/{FeaturePage-BB1TeMlr.js → FeaturePage-DD_32h19.js} +1 -1
  14. package/web/assets/{FileAttachmentPreview-DPjT_iYk.js → FileAttachmentPreview-DDX_cRzm.js} +1 -1
  15. package/web/assets/{FloatingWidgets-FI1S4hdn.js → FloatingWidgets-Dc4Lhl5d.js} +1 -1
  16. package/web/assets/{FocusRuntimeControls-CvAx-KDV.js → FocusRuntimeControls-CkYJXBrP.js} +1 -1
  17. package/web/assets/{GitDiffViewer-DwFfeFOA.js → GitDiffViewer-DeVUAwce.js} +1 -1
  18. package/web/assets/{ManageProjectsDialog-BSLNf6qD.js → ManageProjectsDialog-DPzESWUB.js} +1 -1
  19. package/web/assets/{MarkdownMessage-NK7Ixb4Y.js → MarkdownMessage-BfSy1Cg4.js} +1 -1
  20. package/web/assets/{McpPage-Cn-yDgC5.js → McpPage-CcJDe2nE.js} +1 -1
  21. package/web/assets/MemoryEvolution-Cwdreg5P.js +1 -0
  22. package/web/assets/{MemoryPage-ZwoG_oj6.js → MemoryPage-BkALQ2WN.js} +2 -2
  23. package/web/assets/{MobileNavigation-DK5a0kZU.js → MobileNavigation-C1mjjmqO.js} +1 -1
  24. package/web/assets/{MorePage-BL8nDnTQ.js → MorePage-C7kCRfpo.js} +1 -1
  25. package/web/assets/{NewFolderDialog-COkq83LW.js → NewFolderDialog-sqiEXqxJ.js} +1 -1
  26. package/web/assets/{PageHeader-BBTCMqXc.js → PageHeader-DDaW4Sdv.js} +1 -1
  27. package/web/assets/{PhoneDrawer-BcPKJWl-.js → PhoneDrawer-Be7C0xLf.js} +1 -1
  28. package/web/assets/{PhoneMenuButton-D6vdTZdF.js → PhoneMenuButton-1dPMDaRV.js} +1 -1
  29. package/web/assets/{PhoneTopBar-MqNeI69v.js → PhoneTopBar-BLXoPO6P.js} +1 -1
  30. package/web/assets/{PluginsPage-Bp71HpKD.js → PluginsPage-Bjp82DPO.js} +1 -1
  31. package/web/assets/{SafeModePrompt-CpvvU5wL.js → SafeModePrompt-D_OCmR6G.js} +1 -1
  32. package/web/assets/{SchedulesPage-Drs10rEV.js → SchedulesPage-DCOhjQ8W.js} +1 -1
  33. package/web/assets/{SessionBrowserPane-DjtB4MCI.js → SessionBrowserPane-Cvmqo12R.js} +2 -2
  34. package/web/assets/{SessionContextPanel-ETfnp4pT.js → SessionContextPanel-B9KtrMwl.js} +2 -2
  35. package/web/assets/{SessionHome-CHBw3ZvP.js → SessionHome-DMAZBF3M.js} +1 -1
  36. package/web/assets/{SessionInspector-DVaRflQy.js → SessionInspector-DfinUUs5.js} +1 -1
  37. package/web/assets/{SessionShell-CwfQAX7i.js → SessionShell-BxYZQh_O.js} +1 -1
  38. package/web/assets/{SettingsSidebar-FgC-tlY2.js → SettingsSidebar-DWXc-Z4_.js} +1 -1
  39. package/web/assets/{ShortcutHelpDialog-DKbIkUnk.js → ShortcutHelpDialog-QBYqmifG.js} +1 -1
  40. package/web/assets/{ShortcutKeys-BuHXNKVW.js → ShortcutKeys-B6hllpKE.js} +1 -1
  41. package/web/assets/{SidebarUpdateStatus-LKwNKESF.js → SidebarUpdateStatus-C-ebi4wI.js} +1 -1
  42. package/web/assets/{SkillsPage-BbnerW44.js → SkillsPage-CcNononn.js} +1 -1
  43. package/web/assets/{TaskProcessesPane-B2fyZEK9.js → TaskProcessesPane-D442bSux.js} +1 -1
  44. package/web/assets/{TaskTerminalView-CKApgF75.js → TaskTerminalView-B4fD3kVF.js} +1 -1
  45. package/web/assets/{TerminalPanel-D03WycYm.js → TerminalPanel-64E97AR4.js} +1 -1
  46. package/web/assets/{WebDesktopPet-K2dbcbnQ.js → WebDesktopPet-DUpnoJ1_.js} +1 -1
  47. package/web/assets/{WorkflowsPage-CmzftCtz.js → WorkflowsPage-Cj0mQmb3.js} +1 -1
  48. package/web/assets/{WorkspacePicker-DbdbTOV2.js → WorkspacePicker-_dbgAw5b.js} +1 -1
  49. package/web/assets/{api-BW_X0FMZ.js → api-_MWfl2VL.js} +1 -1
  50. package/web/assets/{app-update-DYFXTosD.js → app-update-CJSjwHEp.js} +1 -1
  51. package/web/assets/{approval-confirm-DQ5N_lJB.js → approval-confirm-D9j-l9WE.js} +1 -1
  52. package/web/assets/{board-projects-CrejrMrn.js → board-projects-BI5ssHIa.js} +1 -1
  53. package/web/assets/{bots-store-CNXTx3UY.js → bots-store-D8M80DQa.js} +1 -1
  54. package/web/assets/{chat-api-Bo6nhq40.js → chat-api-9V8j4rSS.js} +1 -1
  55. package/web/assets/{client-store-DzgOPMlh.js → client-store-xZC2AfqC.js} +1 -1
  56. package/web/assets/{config-search-BiQmWst4.js → config-search-VE6brXfx.js} +1 -1
  57. package/web/assets/{dialog-DFZX_Dek.js → dialog-BgFAhLng.js} +1 -1
  58. package/web/assets/{events-PfANjkHx.js → events-C96FsPEU.js} +1 -1
  59. package/web/assets/{focus-session-composer-bits-C_LOpJH_.js → focus-session-composer-bits-DJHZmmrf.js} +1 -1
  60. package/web/assets/{folder-paths-aRRH_MYq.js → folder-paths-BguW7FsR.js} +1 -1
  61. package/web/assets/{hosts-lvoPwC3T.js → hosts-D2X7ud3S.js} +1 -1
  62. package/web/assets/i18n-zKD1z9i9.js +1 -0
  63. package/web/assets/{index-D_zLThH_.js → index-CwdjZZLG.js} +2 -2
  64. package/web/assets/{memory-api-DkPje--t.js → memory-api-DilYLnpG.js} +1 -1
  65. package/web/assets/{mount-app-7pFSwVLO.js → mount-app-Dc-WeJ9N.js} +3 -3
  66. package/web/assets/{permission-rules-api-CAJsSBA5.js → permission-rules-api-CW4GK6hJ.js} +1 -1
  67. package/web/assets/{pick-system-directory-yk6L7wR2.js → pick-system-directory-UTgPstWX.js} +1 -1
  68. package/web/assets/{placements-CMrgmg3t.js → placements-Cw2TcTmd.js} +2 -2
  69. package/web/assets/{popover--q2hs_pT.js → popover-Cw7QFeII.js} +1 -1
  70. package/web/assets/{public-DkqrpWXx.js → public-4OSY9BE4.js} +2 -2
  71. package/web/assets/{public-DWbrDr0p.js → public-DaL-1TT_.js} +1 -1
  72. package/web/assets/{public-62LVX7HU.js → public-DdhGlwHC.js} +1 -1
  73. package/web/assets/{public-components-DHMvCgH2.js → public-components-C0KUBrxH.js} +1 -1
  74. package/web/assets/public-diff-ooK8-fn0.js +1 -0
  75. package/web/assets/public-events-ntCr-b1Y.js +1 -0
  76. package/web/assets/{public-flags-D9LdpQwJ.js → public-flags-D6y-DU98.js} +1 -1
  77. package/web/assets/{public-greeting-DEKYruJJ.js → public-greeting-JGqTdWhf.js} +1 -1
  78. package/web/assets/{public-session-B9UHA6rN.js → public-session-fPM64rB7.js} +1 -1
  79. package/web/assets/{public-sidebar-Lne86i_K.js → public-sidebar-CvLw1vam.js} +1 -1
  80. package/web/assets/{runtime-capabilities-store-BNM5Ug-5.js → runtime-capabilities-store-CWJvmV83.js} +1 -1
  81. package/web/assets/{safe-mode-instance-DnTP7EUr.js → safe-mode-instance-Dz4-ObZg.js} +1 -1
  82. package/web/assets/safe-mode-sentinel-Bg8pbnu-.js +1 -0
  83. package/web/assets/{session-change-summary-api-DMTwGz7o.js → session-change-summary-api-C3QE98fZ.js} +1 -1
  84. package/web/assets/{session-home-DUpZt2dn.js → session-home-CLGrhgld.js} +1 -1
  85. package/web/assets/{session-organization-api-BGyp66Uv.js → session-organization-api-B2UGOx0B.js} +1 -1
  86. package/web/assets/{session-scope-DZITSvZr.js → session-scope-okdygSiV.js} +1 -1
  87. package/web/assets/{session-tree-actions-CRWyFqAD.js → session-tree-actions-9m9DHqIx.js} +1 -1
  88. package/web/assets/{session-tree-summary-HTmAo_9V.js → session-tree-summary-u-RSxXXY.js} +1 -1
  89. package/web/assets/{shortcuts-D72gQCwH.js → shortcuts-CVPFuAiJ.js} +1 -1
  90. package/web/assets/{side-chat-context-D1hZOT7g.js → side-chat-context-By5GbAvl.js} +4 -4
  91. package/web/assets/{sidebar-sj8X80Y9.js → sidebar-BWHi3RGN.js} +1 -1
  92. package/web/assets/{sidebar-store-CXZ7QrOr.js → sidebar-store-CLA6EfOm.js} +1 -1
  93. package/web/assets/{speech-session-D2GQEOAL.js → speech-session-CFUz5f6J.js} +1 -1
  94. package/web/assets/{startup-queries-CuEXV1Zu.js → startup-queries-Xa-I9BT7.js} +1 -1
  95. package/web/assets/{use-i18n-_vdxObu5.js → use-i18n-CIheiCov.js} +1 -1
  96. package/web/assets/{use-open-bot-BTxzOAbZ.js → use-open-bot-zjJ_Tnfv.js} +1 -1
  97. package/web/assets/{use-studio-actions-CbMHRZpd.js → use-studio-actions-BiRUtcRX.js} +1 -1
  98. package/web/assets/{useCatalogProjects-BEkCpADy.js → useCatalogProjects-CbyrRuIn.js} +1 -1
  99. package/web/assets/{useNewProjectPicker-CUtLjwYE.js → useNewProjectPicker-6iK1xIT3.js} +2 -2
  100. package/web/assets/{useNow-eQeBCqQk.js → useNow-CE8ZJGxH.js} +1 -1
  101. package/web/assets/{usePhoneShell-DZHZWXnN.js → usePhoneShell-sWQz-gv8.js} +1 -1
  102. package/web/assets/{useSessionListQuery-BoUzmjZC.js → useSessionListQuery-K7Hh_V_2.js} +1 -1
  103. package/web/assets/{useSessionRowActions-DCqDrGZY.js → useSessionRowActions-Geuo0bzR.js} +1 -1
  104. package/web/assets/{useSidebarModel-CZAfH4Fa.js → useSidebarModel-BuyZjTgh.js} +1 -1
  105. package/web/assets/{web-preview-XrRFo42l.js → web-preview-0hEXH_IN.js} +1 -1
  106. package/web/assets/{web-preview-events-Ba6duwGi.js → web-preview-events-B5w8DSl2.js} +1 -1
  107. package/web/assets/{workspace-order-store-Ao4OZ13V.js → workspace-order-store-GwJH1aiS.js} +1 -1
  108. package/web/index.html +1 -1
  109. package/web/assets/MemoryEvolution-B8IeSLcd.js +0 -1
  110. package/web/assets/i18n-EVP8yIdy.js +0 -1
  111. package/web/assets/public-diff-WjbTu91T.js +0 -1
  112. package/web/assets/public-events-CTdTIu5Q.js +0 -1
  113. package/web/assets/safe-mode-sentinel-DOhqH4gj.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-CIheiCov.js";import{t as i}from"./createLucideIcon-Cd-3GVxJ.js";import{t as a}from"./info-DATxy0fb.js";import{t as o}from"./pause-CYWpPg1R.js";import{t as s}from"./play-DNDjDNGn.js";import{t as c}from"./x-07u4-129.js";import{i as l,n as u,t as d}from"./popover-Cw7QFeII.js";import{t as f}from"./slider-De8rWVNs.js";import{t as p}from"./segmented-control-xkrEOP_d.js";import{t as m}from"./utils-C8uzG5AZ.js";import{n as h,t as g}from"./button-CCcCN8tE.js";import{n as ee,t as te}from"./PageState-Cz6vFMXv.js";import{t as _}from"./motion-DTR4ZVle.js";import{d as v,l as y}from"./memory-api-DilYLnpG.js";var ne=i(`skip-forward`,[[`path`,{d:`M21 4v16`,key:`7j8fe9`}],[`path`,{d:`M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`zs4d6`}]]),b=e(t(),1);function re(e={}){let{rootMargin:t=`96px 0px`,threshold:n=0}=e,[r,i]=(0,b.useState)(null),[a,o]=(0,b.useState)(()=>!document.hidden),[s,c]=(0,b.useState)(!0),l=(0,b.useCallback)(e=>{i(e)},[]);return(0,b.useEffect)(()=>{let e=()=>o(!document.hidden);return e(),document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),(0,b.useEffect)(()=>{if(!r||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(([e])=>{e&&c(e.isIntersecting)},{rootMargin:t,threshold:n});return e.observe(r),()=>e.disconnect()},[r,t,n]),{ref:l,playing:a&&s}}var x=864e5,S=Math.PI*2,C=.055,ie=.85,w=1e3,T=.72,E=2.6,ae=1.75,oe=30,se=1.1,D=.34,ce=6e3,le=[`decision`,`preference`,`fact`,`concept`,`risk`,`file`,`task`];function O(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}var ue=e=>O(e)/4294967296,k=e=>Math.min(1,Math.max(0,e));function A(e,t){let n=Date.parse(String(e||``));return Number.isNaN(n)?t:n}function de(e,t){let n=Math.max(1,e.end-e.start);return C+.945*k((t-e.start)/n)**ie}function fe(e,t){return t*(1+.046*(.62*Math.sin(3*e+1.1+1.9*t)+.28*Math.sin(5*e+4.2-2.7*t)+.1*Math.sin(11*e+2.3+5.1*t))*Math.min(1,t*2.2))}var j=.042,pe=-.03;function M(e,t){return fe(e,t)*Math.cos(e)+j*(1-t)}function N(e,t){return fe(e,t)*Math.sin(e)+pe*(1-t)}function me(e){let t=(e.end-e.start)/x;return t<=21?`day`:t<=120?`week`:t<=1e3?`month`:t<=3e3?`quarter`:`year`}function he(e,t){let n=new Date(e);if(t===`day`)return new Date(n.getFullYear(),n.getMonth(),n.getDate()+1);if(t===`week`){let e=(8-n.getDay())%7||7;return new Date(n.getFullYear(),n.getMonth(),n.getDate()+e)}return t===`month`?new Date(n.getFullYear(),n.getMonth()+1,1):t===`quarter`?new Date(n.getFullYear(),Math.floor(n.getMonth()/3)*3+3,1):new Date(n.getFullYear()+1,0,1)}function ge(e,t){return t===`day`?new Date(e.getFullYear(),e.getMonth(),e.getDate()+1):t===`week`?new Date(e.getFullYear(),e.getMonth(),e.getDate()+7):t===`month`?new Date(e.getFullYear(),e.getMonth()+1,1):t===`quarter`?new Date(e.getFullYear(),e.getMonth()+3,1):new Date(e.getFullYear()+1,0,1)}function _e(e,t){return t===`day`?e.getDay()===1:t===`week`?e.getDate()<=7:t===`month`?e.getMonth()%3==0:t!==`quarter`||e.getMonth()===0}function ve(e,t,n){let r=[],i=he(e.start,t);for(;i.getTime()<e.end&&r.length<400;)r.push(i),i=ge(i,t);let a=Array(r.length).fill(0);for(let e of n){let t=0,n=r.length;for(;t<n;){let i=t+n>>1;r[i].getTime()<e?t=i+1:n=i}t<a.length&&(a[t]+=1)}let o=Math.max(1,...a);return r.map((n,r)=>{let i=n.getTime();return{at:i,rho:de(e,i),major:_e(n,t),activity:a[r]/o}})}var ye=new Set([`project`,`projects`,`user`,`users`,`global`,`repo`,`app`,`pisper`,`general`,`misc`,`title`]);function be(e){let t=String(e||``).split(`.`).filter(Boolean);for(;t.length>1&&ye.has(t[0]);)t.shift();return t[0]||``}function P(e,t){let n=A(e.createdAt,t),r=A(e.validFrom,n);return{created:n,valid:r,appear:Math.max(n,r)}}function xe(e,t){if(!e.length)return{start:t-180*x,end:t};let n=1/0,r=t;for(let i of e){let{valid:e,appear:a}=P(i,t);n=Math.min(n,e,a),a<=t&&(r=Math.max(r,a))}let i=Math.max(x,r-n);return{start:Math.min(n-Math.max(i*.02,x/4),r-7*x),end:r}}function Se(e){let t=new Map,n=e.map(e=>be(e.topicKey));e.forEach((e,r)=>{let i=`${e.spaceId}\u0000${n[r]}`,a=t.get(i);a?a.push(r):t.set(i,[r])});let r=Math.max(2,Math.ceil(e.length*.012)),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])},o=new Map,s=new Map,c=[...t.entries()].sort((e,t)=>t[1].length-e[1].length||e[0].localeCompare(t[0]));for(let[t,n]of c){let[i,c]=t.split(`\0`),l=s.get(i)||0;if(c&&n.length>=r&&l<16){s.set(i,l+1),a(i,{key:t,label:c,kind:`topic`,spaceId:i,members:n});continue}for(let t of n){let n=`${i}\u0000type:${e[t].type}`,r=o.get(n);r?r.push(t):o.set(n,[t])}}for(let[e,t]of o){let[n,r]=e.split(`\0`);a(n,{key:e,label:r.slice(5),kind:`type`,spaceId:n,members:t})}return i}function Ce(e,t,n){let r=Se(e),i=[...r.keys()].sort((e,t)=>e===`global`?-1:t===`global`?1:O(e)-O(t)),a=[],o=new Int16Array(e.length),s=new Float32Array(e.length),c=[],l=i.length>1?.09:0,u=i.reduce((e,t)=>e+(r.get(t)?.length||0),0),d=Math.min(.022,S*.25/Math.max(1,u)),f=e=>(r.get(e)||[]).reduce((e,t)=>e+Math.sqrt(t.members.length)+.6,0),p=i.reduce((e,t)=>e+f(t),0)||1,m=S-l*i.length-d*u,h=-Math.PI/2+l/2;for(let u of i){let i=[...r.get(u)||[]].sort((e,t)=>O(e.key)-O(t.key)),f=h;for(let n of i){let r=m*(Math.sqrt(n.members.length)+.6)/p,i=a.length;a.push({key:n.key.split(`\0`)[1],label:n.label,kind:n.kind,spaceId:u,start:h,end:h+r,count:n.members.length});let c=[...n.members].sort((n,r)=>t[n]-t[r]||e[n].id.localeCompare(e[r].id)),l=ue(n.key);c.forEach((e,t)=>{o[e]=i;let n=(l+t*.61803398875)%1;s[e]=h+r*(.05+.9*n)}),h+=r+d}c.push({spaceId:u,name:n.find(e=>e.id===u)?.name||u,start:f,end:h-d}),h+=l}return{sectors:a,sectorOf:o,theta:s,spaceArcs:i.length>1?c:[]}}function we(e){return Float64Array.from(e).sort()}function Te(e,{histogramBins:t=160}={}){let n=A(e.now,Date.now()),r=[...e.facts].sort((e,t)=>e.id.localeCompare(t.id)),i=r.length,a=xe(r,n),o=a.end-a.start,s=Math.max(x,o*.015),c=new Map(r.map((e,t)=>[e.id,t])),l=new Float64Array(i),u=new Float64Array(i),d=new Float64Array(i).fill(1/0),f=new Float64Array(i).fill(1/0),p=new Int32Array(i).fill(-1),m=new Uint8Array(i),h=new Uint8Array(i),g=new Map;r.forEach((e,t)=>{let{created:r,valid:i,appear:a}=P(e,n);l[t]=i,u[t]=a;let o=le.indexOf(e.type);h[t]=o>=0?o:le.indexOf(`concept`);let d=0;e.pinned&&(d|=1),e.tainted&&(d|=2),e.status===`stale`&&(d|=8),r-i>s&&(d|=4),m[t]=d;let f=e.supersededBy?c.get(e.supersededBy):void 0;if(f!==void 0&&f!==t){p[t]=f;let e=g.get(f);e?e.push(t):g.set(f,[t])}}),r.forEach((e,t)=>{let n=A(e.supersededAt,NaN)||A(e.validTo,NaN)||(e.status===`superseded`?p[t]>=0?u[p[t]]:a.end:NaN);Number.isFinite(n)&&(d[t]=Math.max(n,u[t]));let r=A(e.archivedAt,NaN)||(e.status===`archived`?a.end:NaN);Number.isFinite(r)&&(f[t]=Math.max(r,u[t]))});let{sectors:ee,sectorOf:te,theta:_,spaceArcs:v}=Ce(r,u,e.spaces),y=new Float32Array(i),ne=new Float32Array(i),b=new Float32Array(i),re=new Float32Array(i),C=new Float32Array(i),ie=new Float32Array(i),w=new Float32Array(i);r.forEach((e,t)=>{y[t]=de(a,l[t]),ne[t]=M(_[t],y[t]),b[t]=N(_[t],y[t]);let n=k(Number(e.importance)||0),r=k((Number(e.authority)||0)/100);C[t]=.16+.84*n**1.5,ie[t]=(.4+.22*r+.38*n)*(e.tainted?.6:1),re[t]=.016+.105*n**1.5+(e.pinned?.03:0),w[t]=ue(e.id)*S});let T=[];r.forEach((e,t)=>{Number.isFinite(d[t])&&T.push({at:d[t],from:t,to:p[t]})}),T.sort((e,t)=>e.at-t.at||e.from-t.from);let E=Math.max(1,t),ae=new Uint16Array(E),oe=new Uint16Array(E),se=e=>Math.min(E-1,Math.floor(k((e-a.start)/o)*E));for(let e=0;e<i;e+=1)u[e]<=a.end&&(ae[se(u[e])]+=1);for(let e of T)e.at<=a.end&&(oe[se(e.at)]+=1);let D=[...u],ce=[],O=[];for(let e=0;e<i;e+=1){let t=Math.min(d[e],f[e]);Number.isFinite(t)&&ce.push(t),Number.isFinite(f[e])&&O.push(f[e])}let fe=e.digests.map(e=>{let t=A(e.windowEnd,a.end),n=A(e.windowStart,t),r=v.find(t=>t.spaceId===e.spaceId),i=r?.start??-Math.PI,o=(r?.end??Math.PI)-i,s=o*(e.level===`month`?.16:e.level===`week`?.085:.045),c=i+ue(e.id)*Math.max(0,o-s);return{id:e.id,level:e.level,at:t,rho:de(a,(n+t)/2),start:c,end:c+s}}),j=me(a);return{facts:r,count:i,indexById:c,domain:a,unit:j,rings:ve(a,j,D),bornWindow:Math.max(o*.012,1),validAt:l,appearAt:u,replacedAt:d,archivedAt:f,theta:_,rho:y,x:ne,y:b,lift:re,size:C,brightness:ie,phase:w,typeIndex:h,sector:te,flags:m,successor:p,predecessors:g,replacements:T,sectors:ee,spaceArcs:v,digests:fe,histogram:ae,histogramReplacements:oe,truncated:!!e.truncated,sortedAppear:we(D),sortedEnded:we(ce),sortedArchived:we(O)}}function Ee(e,t,n){return n<e.appearAt[t]?0:n>=e.archivedAt[t]?3:n>=e.replacedAt[t]?2:1}function De(e,t,n,r=e.bornWindow){let i=Ee(e,t,n);return i===0?`hidden`:i===3?`archived`:i===2?`superseded`:n-e.appearAt[t]<r?`born`:`active`}function Oe(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>1;e[i]<=t?n=i+1:r=i}return n}function ke(e,t){let n=Oe(e.sortedAppear,t),r=Oe(e.sortedEnded,t),i=Oe(e.sortedArchived,t);return{active:n-r,superseded:r-i,archived:i,known:n}}function Ae(e,t){let n=new Set([t]),r=[],i=[t];for(;i.length;)for(let t of e.predecessors.get(i.pop())||[])n.has(t)||(n.add(t),r.push(t),i.push(t));let a=[],o=e.successor[t];for(;o>=0&&!n.has(o);)n.add(o),a.push(o),o=e.successor[o];return[...r,t,...a].sort((t,n)=>e.appearAt[t]-e.appearAt[n]||t-n)}function je(e){return Math.min(E,Math.max(T,e))}function Me(e,t){return e<720&&t>=oe?ae:1}function Ne(e){let t=k((e-1)/.5);return t*t*(3-2*t)}function Pe(e,t){return Math.max(1,e/t)*se}function F(e,t){let n=k(e/Math.max(t,.001));return D+.6599999999999999*n*n*(3-2*n)}function Fe(e,t,n){return je(e*n/Math.max(1,t))}function Ie(e,t){return e.start+(e.end-e.start)*k(t/w)}function Le(e,t){let n=Math.max(1,e.end-e.start);return Math.round(k((t-e.start)/n)*w)}function Re(e,t=ce){let n=k(e/t);return n<.5?4*n*n*n:1-(-2*n+2)**3/2}var I=Math.PI*2,ze=144,L=72,Be=.2,R=96,z=620,B=55e5,Ve=[{inner:.965,alpha:.05},{inner:.9,alpha:.032},{inner:.78,alpha:.018}],V=.0012,He=.6,Ue={decision:[255,196,92],preference:[186,164,255],fact:[176,214,255],concept:[104,176,255],risk:[255,104,158],file:[92,226,176],task:[92,222,240]},H=[255,96,44],U=[96,118,164],We=[156,164,178],W=[236,208,164],Ge=[255,232,192],Ke=[255,176,104],qe=[255,236,204],G=[255,206,138],K=[255,222,180],Je=[176,202,255],q=([e,t,n],r=1)=>`rgba(${e}, ${t}, ${n}, ${r})`;function J(e,t,n){let r=Math.min(1,Math.max(0,(e-t)/(n-t)));return r*r*(3-2*r)}function Y(e,t){let n=document.createElement(`canvas`);return n.width=Math.max(1,Math.round(e)),n.height=Math.max(1,Math.round(t)),n}function Ye([e,t,n]){let r=Y(R,R),i=r.getContext(`2d`);if(!i)return r;let a=R/2,o=i.createRadialGradient(a,a,0,a,a,a),s=r=>[255+(e-255)*r,255+(t-255)*r,255+(n-255)*r],c=(e,t)=>{let[n,r,i]=s(e);return`rgba(${n|0}, ${r|0}, ${i|0}, ${t})`};return o.addColorStop(0,c(.12,1)),o.addColorStop(.08,c(.5,.96)),o.addColorStop(.16,c(1,.62)),o.addColorStop(.3,c(1,.22)),o.addColorStop(.56,c(1,.06)),o.addColorStop(1,c(1,0)),i.fillStyle=o,i.fillRect(0,0,R,R),r}function Xe([e,t,n]){let r=Y(R,R),i=r.getContext(`2d`);if(!i)return r;let a=R/2,o=i.createRadialGradient(a,a,0,a,a,a);return o.addColorStop(0,`rgba(${e}, ${t}, ${n}, 0.55)`),o.addColorStop(.35,`rgba(${e}, ${t}, ${n}, 0.16)`),o.addColorStop(.7,`rgba(${e}, ${t}, ${n}, 0.035)`),o.addColorStop(1,`rgba(${e}, ${t}, ${n}, 0)`),i.fillStyle=o,i.fillRect(0,0,R,R),r}var Ze=class{canvas;ctx;camera={yaw:0,tilt:.92,zoom:1,rim:0};quality;scene=null;width=1;height=1;dpr=1;maxDpr=2;insets={top:0,right:0,bottom:0,left:0};targetInsets={top:0,right:0,bottom:0,left:0};typeSprites;emberSprite;archiveSprite;untrustedSprite;pulseSprite;coreSprite;discSprite;pinnedHalo;background=null;bloomA=null;bloomB=null;ringPaths=[];grainPaths=[];frontierPath=new Float32Array(288);rimPath=new Float32Array(288);bandPaths=Ve.map(()=>new Float32Array(288));screenX=new Float32Array;screenY=new Float32Array;screenR=new Float32Array;liftNow=new Float32Array;worldX=new Float32Array;worldY=new Float32Array;morphX=null;morphY=null;morphStart=0;slowWindows=0;chainMask=new Uint8Array;ringLabels=[];sectorOrder=[];selected=-1;selectedSector=-1;hovered=-1;ringFormatter=()=>``;dust;rippleQueue=new Int32Array(48);lateQueue=new Int32Array(24);typeCss;ambientPulses=[];nextAmbientPulse=0;frameTimes=0;frameCount=0;px=0;py=0;ps=1;cx=0;cy=0;unit=1;cosYaw=1;sinYaw=0;cosTilt=1;sinTilt=0;constructor(e,{quality:t=3}={}){this.canvas=e;let n=e.getContext(`2d`,{alpha:!1});if(!n)throw Error(`canvas 2d unavailable`);this.ctx=n,this.quality=t,this.typeSprites=le.map(e=>Ye(Ue[e])),this.typeCss=le.map(e=>q(Ue[e])),this.emberSprite=Ye(H),this.archiveSprite=Ye(U),this.untrustedSprite=Ye(We),this.pulseSprite=Ye(qe),this.coreSprite=Xe(G),this.discSprite=Xe([206,158,104]),this.pinnedHalo=Xe(Ge),this.dust=new Float32Array(1e3);let r=20261105,i=()=>(r=Math.imul(r,1664525)+1013904223>>>0,r/4294967296);for(let e=0;e<200;e+=1){let t=i()*I,n=.08+Math.sqrt(i())*1.42;this.dust[e*5]=Math.cos(t)*n,this.dust[e*5+1]=Math.sin(t)*n,this.dust[e*5+2]=(i()-.35)*.42,this.dust[e*5+3]=i()*I,this.dust[e*5+4]=.15+i()*.55}}setRingFormatter(e){this.ringFormatter=e,this.refreshLabels()}setScene(e,{animate:t=!1,now:n=0}={}){let r=this.scene,i=this.worldX,a=this.worldY;if(this.scene=e,this.ambientPulses=[],this.morphX=null,this.morphY=null,!e)return!1;let o=!1;if(t&&r&&r.count&&e.count){let t=Float32Array.from(e.x),s=Float32Array.from(e.y),c=0;e.facts.forEach((e,n)=>{let o=r.indexById.get(e.id);o!==void 0&&(t[n]=i[o],s[n]=a[o],c+=1)}),c>=Math.max(1,e.count*.3)&&(this.morphX=t,this.morphY=s,this.morphStart=n,o=!0)}return this.worldX=Float32Array.from(this.morphX??e.x),this.worldY=Float32Array.from(this.morphY??e.y),this.screenX=new Float32Array(e.count),this.screenY=new Float32Array(e.count),this.screenR=new Float32Array(e.count),this.liftNow=new Float32Array(e.count),this.chainMask=new Uint8Array(e.count),this.ringPaths=e.rings.map(e=>{let t=new Float32Array(288);return this.fillRingPath(t,e.rho),t}),this.fillRingPath(this.rimPath,1),this.grainPaths=this.buildGrain(),this.sectorOrder=e.sectors.map((e,t)=>({sector:e,index:t})).filter(({sector:e})=>e.kind===`topic`).sort((e,t)=>t.sector.count-e.sector.count).slice(0,10).map(e=>e.index),this.refreshLabels(),this.setSelection(this.selected<e.count?this.selected:-1),this.hovered=-1,o}buildGrain(){let e=[],t=7;for(let n=.07;n<1;n+=.0115){t=Math.imul(t,1664525)+1013904223>>>0;let r=((t>>>8)/16777216-.5)*.006,i=new Float32Array(144);for(let e=0;e<L;e+=1){let t=e/L*I;i[e*2]=M(t,n+r),i[e*2+1]=N(t,n+r)}e.push({rho:n+r,path:i})}return e}refreshLabels(){this.ringLabels=this.scene?this.scene.rings.map(e=>this.ringFormatter(e.at)):[]}setSelection(e){let{scene:t}=this;if(this.selected=e,this.chainMask.fill(0),this.selectedSector=-1,!t||e<0||e>=t.count){this.selected=-1;return}for(let n of Ae(t,e))this.chainMask[n]=1;this.selectedSector=t.sector[e]}setHover(e){this.hovered=e}resize(e,t,n){let r=Math.max(1,e),i=Math.max(1,t);(r!==this.width||i!==this.height||n!==this.maxDpr)&&(this.width=r,this.height=i,this.maxDpr=n,this.applyResolution())}setInsets(e,{animate:t=!1}={}){this.targetInsets=e,t||(this.insets=e)}get settling(){let{insets:e,targetInsets:t}=this;return e.top!==t.top||e.right!==t.right||e.bottom!==t.bottom||e.left!==t.left}stepInsets(){let e=(e,t)=>Math.abs(t-e)<.5?t:e+(t-e)*.14,{insets:t,targetInsets:n}=this;this.settling&&(this.insets={top:e(t.top,n.top),right:e(t.right,n.right),bottom:e(t.bottom,n.bottom),left:e(t.left,n.left)})}applyResolution(){let e=typeof devicePixelRatio==`number`?devicePixelRatio:1,t=this.quality===1?1:this.maxDpr,n=Math.sqrt(B/(this.width*this.height));this.dpr=Math.max(1,Math.min(e||1,t,n)),this.canvas.width=Math.max(1,Math.round(this.width*this.dpr)),this.canvas.height=Math.max(1,Math.round(this.height*this.dpr)),this.background=this.paintBackground(),this.bloomA=Y(this.canvas.width/4,this.canvas.height/4),this.bloomB=Y(this.canvas.width/10,this.canvas.height/10)}noteFrameInterval(e){if(this.frameTimes+=e,this.frameCount+=1,this.frameCount<45)return;let t=this.frameTimes/this.frameCount;this.frameTimes=0,this.frameCount=0,this.slowWindows=t>30?this.slowWindows+1:0,this.slowWindows>=2&&this.quality>1&&(this.slowWindows=0,--this.quality,this.applyResolution())}paintBackground(){let e=Y(Math.min(1024,this.width),Math.min(1024,this.height)),t=e.getContext(`2d`);if(!t)return e;let{width:n,height:r}=e;t.fillStyle=`#05060a`,t.fillRect(0,0,n,r);let i=this.layoutCenter(),a=t.createRadialGradient(i.x/this.width*n,i.y/this.height*r,0,i.x/this.width*n,i.y/this.height*r,Math.max(n,r)*.72);return a.addColorStop(0,`rgba(30, 27, 32, 0.8)`),a.addColorStop(.42,`rgba(10, 13, 22, 0.7)`),a.addColorStop(1,`rgba(3, 4, 8, 0)`),t.fillStyle=a,t.fillRect(0,0,n,r),e}layoutCenter(){let{top:e,bottom:t,left:n,right:r}=this.insets;return{x:n+(this.width-n-r)/2,y:e+(this.height-e-t)/2}}fillRingPath(e,t){for(let n=0;n<ze;n+=1){let r=n/ze*I;e[n*2]=M(r,t),e[n*2+1]=N(r,t)}}project(e,t,n){let r=e*this.cosYaw-t*this.sinYaw,i=e*this.sinYaw+t*this.cosYaw,a=1/(1-Be*(i*this.sinTilt+n*this.cosTilt));this.px=this.cx+this.unit*r*a,this.py=this.cy+this.unit*(i*this.cosTilt-n*this.sinTilt)*a,this.ps=a}traceRing(e){let{ctx:t}=this;for(let n=0;n<ze;n+=1)this.project(e[n*2],e[n*2+1],0),n===0?t.moveTo(this.px,this.py):t.lineTo(this.px,this.py);t.closePath()}applyCamera(e){let{camera:t}=this;this.stepInsets(),this.cosYaw=Math.cos(t.yaw),this.sinYaw=Math.sin(t.yaw),this.cosTilt=Math.cos(t.tilt),this.sinTilt=Math.sin(t.tilt);let{top:n,bottom:r,left:i,right:a}=this.insets,o=Math.max(40,this.width-i-a),s=Math.max(40,this.height-n-r),c=this.layoutCenter(),l=1+Be*this.sinTilt*.55,u=Math.min(o/(2.08*l),s/(2.08*Math.max(this.cosTilt,.34)*l+.14*this.sinTilt)),d=1+.72*(1-e)**2;this.unit=u*t.zoom*d,this.cx=c.x,this.cy=c.y+this.sinTilt*this.unit*.02;let f=J(e,.35,.75),p=t.rim*f;if(p>0){let t=this.unit*e*this.cosTilt/(1-Be*e*this.sinTilt),r=n+s*.94-t;this.cy+=(Math.min(this.cy,r)-this.cy)*p}}pick(e,t,n,r){let{scene:i}=this;if(!i)return-1;let a=-1,o=n*n;for(let n=0;n<i.count;n+=1){let s=this.screenX[n];if(Number.isNaN(s))continue;let c=s-e,l=this.screenY[n]-t,u=c*c+l*l;(r>=i.replacedAt[n]||r>=i.archivedAt[n])&&(u*=1.8),u<o&&(o=u,a=n)}return a}screenPosition(e){let t=this.screenX[e];return t===void 0||Number.isNaN(t)?null:{x:t,y:this.screenY[e]}}draw(e){let{ctx:t,scene:n,dpr:r}=this;t.setTransform(r,0,0,r,0,0),t.globalCompositeOperation=`source-over`,t.globalAlpha=1,this.background?t.drawImage(this.background,0,0,this.width,this.height):(t.fillStyle=`#05060a`,t.fillRect(0,0,this.width,this.height));let i=n?de(n.domain,e.at):1;this.applyCamera(i),t.globalCompositeOperation=`lighter`,t.lineCap=`round`,t.lineJoin=`round`,this.drawDust(e),n&&(this.stepMorph(n,e),this.drawDiscBody(n,e,i),this.drawNewestBand(e,i),this.drawDigests(n,e,i),this.computePositions(n,e),this.drawThreads(n,e,i),this.drawStems(n,e,i),this.drawFacts(n,e,i),this.drawPulses(n,e),this.drawFrontier(e,i)),this.applyBloom(),t.setTransform(r,0,0,r,0,0),t.globalCompositeOperation=`source-over`,t.globalAlpha=1,n&&this.drawLabels(n,e,i),e.fade<1&&(t.globalAlpha=1-e.fade,t.fillStyle=`#05060a`,t.fillRect(0,0,this.width,this.height),t.globalAlpha=1)}stepMorph(e,t){let{morphX:n,morphY:r}=this;if(!n||!r)return;let i=Math.min(1,Math.max(0,(t.wall-this.morphStart)/z)),a=i*i*(3-2*i);for(let t=0;t<e.count;t+=1)this.worldX[t]=n[t]+(e.x[t]-n[t])*a,this.worldY[t]=r[t]+(e.y[t]-r[t])*a;i>=1&&(this.morphX=null,this.morphY=null)}get morphing(){return this.morphX!==null}drawDust(e){let{ctx:t,dust:n}=this,r=this.quality===3?200:this.quality===2?110:40,i=e.ambient?e.wall*12e-6:0;for(let a=0;a<r;a+=1){let r=a*5,o=.55+a%7*.05,s=Math.cos(i*o),c=Math.sin(i*o),l=n[r]*s-n[r+1]*c,u=n[r]*c+n[r+1]*s;if(this.project(l,u,n[r+2]),this.px<-4||this.py<-4||this.px>this.width+4||this.py>this.height+4)continue;let d=e.ambient?.55+.45*Math.sin(e.wall*7e-4+n[r+3]):.7,f=(.7+n[r+4]*1.1)*this.ps;t.globalAlpha=n[r+4]*d*.5,t.fillStyle=q(a%3==0?Je:K),t.fillRect(this.px-f/2,this.py-f/2,f,f)}t.globalAlpha=1}drawDiscBody(e,t,n){let{ctx:r}=this,i=this.selected>=0?.55:1;this.project(M(0,0),N(0,0),0);let a=this.px,o=this.py,s=1-.72*J(n,.2,.7),c=this.unit*Math.max(n,.1)*1.32;if(r.globalAlpha=.5*s*i,r.drawImage(this.discSprite,this.cx-c,this.cy-c*this.cosTilt,c*2,c*2*this.cosTilt),n<.995&&(r.beginPath(),this.traceRing(this.rimPath),r.globalAlpha=.06,r.strokeStyle=q(W),r.lineWidth=.8,r.stroke()),this.quality>=2){let e=this.quality===3?1:2;r.strokeStyle=q(W),r.lineWidth=.5;let t=n*He;for(let a of[!1,!0]){r.globalAlpha=(a?.075:.03)*e*i,r.beginPath();for(let i=0;i<this.grainPaths.length;i+=e){let{rho:e,path:o}=this.grainPaths[i];if(e>n)break;if(e>=t===a){for(let e=0;e<L;e+=1)this.project(o[e*2],o[e*2+1],0),e===0?r.moveTo(this.px,this.py):r.lineTo(this.px,this.py);r.closePath()}}r.stroke()}}let{rings:l}=e,u=-1;for(let e=0;e<l.length&&!(l[e].at>t.at);e+=1)u=e;r.fillStyle=q(W);for(let e=0;e<=u;e+=2){let t=l[e];r.beginPath(),this.traceRing(this.ringPaths[e]),e>0&&this.traceRing(this.ringPaths[e-1]),r.globalAlpha=(.012+.03*t.activity)*i*F(t.rho,n),r.fill(`evenodd`)}r.strokeStyle=q(W);for(let e=0;e<=u;e+=1){let t=l[e];r.beginPath(),this.traceRing(this.ringPaths[e]),r.globalAlpha=(.11+.17*t.activity+(t.major?.13:0))*i*F(t.rho,n),r.lineWidth=t.major?1:.65,r.stroke()}let d=this.knownCount(e,t.at),f=t.ambient?1+.08*Math.sin(t.wall*.0011):1,p=this.unit*(.17+.028*Math.log1p(d))*f;r.globalAlpha=.62*s*i,r.drawImage(this.coreSprite,a-p,o-p,p*2,p*2),r.globalAlpha=1}drawNewestBand(e,t){let{ctx:n}=this,r=(e.ambient?.82+.18*Math.sin(e.wall*V):.9)*(e.moving?1.2:1)*(this.selected>=0?.35:1),i=this.quality===1?1:Ve.length;n.fillStyle=q(W),this.fillRingPath(this.frontierPath,t);for(let e=0;e<i;e+=1){let{inner:i,alpha:a}=Ve[e],o=this.bandPaths[e];this.fillRingPath(o,t*i),n.beginPath(),this.traceRing(this.frontierPath),this.traceRing(o),n.globalAlpha=a*r,n.fill(`evenodd`)}n.globalAlpha=1}knownCount(e,t){let n=0,r=e.sortedAppear.length;for(;n<r;){let i=n+r>>1;e.sortedAppear[i]<=t?n=i+1:r=i}return n}drawDigests(e,t,n){let{ctx:r}=this;if(!e.digests.length)return;r.strokeStyle=q(Ge),r.lineWidth=1.25;let i=n*He;for(let n of[!1,!0]){r.globalAlpha=this.selected>=0?.1:n?.34:.14,r.beginPath();for(let a of e.digests){if(a.at>t.at||a.rho>=i!==n)continue;let e=Math.max(4,Math.ceil((a.end-a.start)/I*ze));for(let t=0;t<=e;t+=1){let n=a.start+(a.end-a.start)*t/e;this.project(M(n,a.rho),N(n,a.rho),0),t===0?r.moveTo(this.px,this.py):r.lineTo(this.px,this.py)}}r.stroke()}r.globalAlpha=1}computePositions(e,t){let{at:n,effectWindow:r}=t,{appearAt:i,replacedAt:a,archivedAt:o,lift:s,count:c}=e,{worldX:l,worldY:u}=this;for(let e=0;e<c;e+=1){if(n<i[e]){this.screenX[e]=NaN;continue}let t=s[e],c=Math.min(a[e],o[e]);if(n>=c){let i=Math.min(1,(n-c)/(r*1.6)),a=i*i*(3-2*i);t=n>=o[e]?s[e]*(1-a)-.035*a:s[e]*(1-a)}this.liftNow[e]=t,this.project(l[e],u[e],t),this.screenX[e]=this.px,this.screenY[e]=this.py,this.screenR[e]=this.ps}}threadControl(e,t){let n=this.worldX[e],r=this.worldY[e],i=this.worldX[t],a=this.worldY[t],o=i-n,s=a-r,c=Math.sqrt(o*o+s*s);this.project((n+i)/2,(r+a)/2,(this.liftNow[e]+this.liftNow[t])/2+.018+c*.46)}drawThreads(e,t,n){let{ctx:r,selected:i,chainMask:a}=this,{at:o}=t;r.strokeStyle=q(Ke),r.lineWidth=.95;let s=n*He;for(let t of[!1,!0]){r.globalAlpha=i>=0?.06:t?.42:.16,r.beginPath();for(let n of e.replacements){if(n.at>o)break;n.to<0||o<e.appearAt[n.to]||i>=0&&a[n.from]&&a[n.to]||e.rho[n.to]>=s===t&&(this.threadControl(n.from,n.to),r.moveTo(this.screenX[n.from],this.screenY[n.from]),r.quadraticCurveTo(this.px,this.py,this.screenX[n.to],this.screenY[n.to]))}r.stroke()}if(i>=0){r.strokeStyle=q(Ge),r.lineWidth=1.5,r.globalAlpha=.8,r.beginPath();for(let t of e.replacements){if(t.at>o)break;t.to<0||o<e.appearAt[t.to]||!a[t.from]||!a[t.to]||(this.threadControl(t.from,t.to),r.moveTo(this.screenX[t.from],this.screenY[t.from]),r.quadraticCurveTo(this.px,this.py,this.screenX[t.to],this.screenY[t.to]))}r.stroke()}r.globalAlpha=1}drawStems(e,t,n){if(this.sinTilt<.2||this.quality<2||this.quality===2&&e.count>800)return;let{ctx:r,selected:i}=this,{at:a}=t,{appearAt:o,replacedAt:s,archivedAt:c,count:l}=e,{worldX:u,worldY:d}=this;r.strokeStyle=q(W),r.lineWidth=.6;let f=n*He;for(let t of[!1,!0]){r.globalAlpha=i>=0?.05:t?.3:.12,r.beginPath();for(let n=0;n<l;n+=1)a<o[n]||a>=s[n]||a>=c[n]||e.rho[n]>=f===t&&(this.project(u[n],d[n],0),r.moveTo(this.px,this.py),r.lineTo(this.screenX[n],this.screenY[n]));r.stroke()}if(this.quality===3&&l<=1500&&i<0){let t=Math.max(.2,this.cosTilt);for(let i=0;i<l;i+=1){if(a<o[i]||a>=s[i]||a>=c[i])continue;this.project(u[i],d[i],0);let l=12*(.5+e.size[i])*this.ps;r.globalAlpha=.2*F(e.rho[i],n),r.drawImage(this.typeSprites[e.typeIndex[i]],this.px-l/2,this.py-l*t/2,l,l*t)}}r.globalAlpha=1}drawFacts(e,t,n){let{ctx:r,selected:i,selectedSector:a,chainMask:o,hovered:s}=this,{at:c,effectWindow:l,wall:u,ambient:d}=t,{appearAt:f,replacedAt:p,archivedAt:m,size:h,brightness:g,phase:ee,typeIndex:te,flags:_,count:v}=e,y=Math.min(1.75,Math.max(.74,(420/Math.max(1,v))**.26)),ne=Math.min(1.35,Math.max(.7,this.unit/330))*y,b=this.quality===3?48:this.quality===2?24:8,re=v>2200||v>800&&this.quality<3?.34:this.quality===1&&v>300?.26:0,x=0,S=0;for(let y=0;y<v;y+=1){if(c<f[y])continue;let v=this.screenX[y],C=this.screenY[y],ie=this.screenR[y],w=1;i>=0&&(w=o[y]?1.3:e.sector[y]===a?.5:.11),y===s&&(w=Math.max(w,1.5)),w*=.62+.42*Math.min(1,Math.max(0,(ie-.84)/.3));let T=i>=0||y===s||_[y]&1?1:F(e.rho[y],n),E=(6+19*h[y])*ne*ie*(.72+.28*T),ae=Math.min(p[y],m[y]);if(c>=m[y]){let e=Math.min(1,(c-m[y])/(l*1.6)),t=E*(.62+.25*(1-e));r.globalAlpha=Math.min(1,(.2*T+.4*(1-e))*w),r.drawImage(this.archiveSprite,v-t/2,C-t/2,t,t);continue}if(c>=ae){let e=Math.min(1,(c-ae)/l),t=d?.82+.18*Math.sin(u*.0016+ee[y]):.9,n=E*(.86+.9*(1-e)*(1-e));if(e<1){r.globalAlpha=Math.min(1,(1-e)*g[y]*w);let t=this.spriteFor(y,te,_);r.drawImage(t,v-n/2,C-n/2,n,n)}r.globalAlpha=Math.min(1,(.62*T+.38*(1-e))*t*w),r.drawImage(this.emberSprite,v-n/2,C-n/2,n,n);continue}let oe=c-f[y],se=oe<l?(1-oe/l)*t.effectGain:0;if(h[y]<re&&se===0&&y!==s&&i<0){let e=1.7*ie;r.globalAlpha=Math.min(1,g[y]*w*T),r.fillStyle=this.typeCss[te[y]],r.fillRect(v-e/2,C-e/2,e,e);continue}let D=.08+.1*T,ce=d?1-D+D*Math.sin(u*.0013+ee[y]):.95,le=g[y]*ce*w*T;_[y]&8&&(le*=.72);let O=E*(1+2.4*se*se);r.globalAlpha=Math.min(1,le+se*.5);let ue=this.spriteFor(y,te,_);if(r.drawImage(ue,v-O/2,C-O/2,O,O),_[y]&1){let e=E*2.9;r.globalAlpha=Math.min(1,.5*w*ce),r.drawImage(this.pinnedHalo,v-e/2,C-e/2,e,e)}se>0&&(x<b&&(this.rippleQueue[x++]=y),_[y]&4&&S<this.lateQueue.length&&(this.lateQueue[S++]=y))}r.globalAlpha=1,this.drawRipples(e,t,x),this.drawLateBeams(e,t,S),this.drawSelectionMarks(e,t)}spriteFor(e,t,n){return n[e]&2?this.untrustedSprite:this.typeSprites[t[e]]}drawRipples(e,t,n){if(!n)return;let{ctx:r}=this;r.lineWidth=1;for(let i=0;i<n;i+=1){let n=this.rippleQueue[i],a=(t.at-e.appearAt[n])/t.effectWindow;if(a<0||a>=1)continue;this.project(this.worldX[n],this.worldY[n],0);let o=this.unit*(.006+.052*Math.sqrt(a))*this.ps;r.globalAlpha=(1-a)*(1-a)*.42*t.effectGain,r.strokeStyle=q(Ue[le[e.typeIndex[n]]]),r.beginPath(),r.ellipse(this.px,this.py,o,o*Math.max(.2,this.cosTilt),0,0,I),r.stroke()}r.globalAlpha=1}drawLateBeams(e,t,n){if(!n)return;let{ctx:r}=this,i=de(e.domain,t.at);r.strokeStyle=q(Ge),r.lineWidth=1.2;for(let a=0;a<n;a+=1){let n=this.lateQueue[a],o=(t.at-e.appearAt[n])/t.effectWindow;if(o<0||o>=1)continue;let s=e.theta[n];this.project(M(s,i),N(s,i),0),r.globalAlpha=(1-o)*.8*t.effectGain,r.beginPath(),r.moveTo(this.px,this.py),r.lineTo(this.screenX[n],this.screenY[n]),r.stroke()}r.globalAlpha=1}drawSelectionMarks(e,t){let{ctx:n,selected:r,hovered:i,chainMask:a}=this,o=(r,i,a)=>{r<0||r>=e.count||t.at<e.appearAt[r]||(n.globalAlpha=a,n.beginPath(),n.arc(this.screenX[r],this.screenY[r],i,0,I),n.stroke())};if(n.strokeStyle=q(Ge),n.lineWidth=1,r>=0)for(let t=0;t<e.count;t+=1)a[t]&&o(t,t===r?12:7,t===r?.95:.55);i>=0&&i!==r&&o(i,9,.7),n.globalAlpha=1}drawPulseAlong(e,t,n,r){let{ctx:i}=this;this.threadControl(e,t);let a=this.px,o=this.py,s=this.screenX[e],c=this.screenY[e],l=this.screenX[t],u=this.screenY[t],d=e=>{let t=1-e;this.px=t*t*s+2*t*e*a+e*e*l,this.py=t*t*c+2*t*e*o+e*e*u},f=Math.min(1,n*1.3),p=Math.max(0,f-.42),m=r*(n>.75?(1-n)/.25:1);i.strokeStyle=q(qe);for(let e=0;e<9;e+=1){let t=p+(f-p)*e/9,n=p+(f-p)*(e+1)/9;d(t);let r=this.px,a=this.py;d(n),i.globalAlpha=Math.min(1,((e+1)/9)**2*m),i.lineWidth=.7+1.5*((e+1)/9),i.beginPath(),i.moveTo(r,a),i.lineTo(this.px,this.py),i.stroke()}d(f);let h=20*Math.min(1.2,this.unit/300);i.globalAlpha=Math.min(1,m),i.drawImage(this.pulseSprite,this.px-h/2,this.py-h/2,h,h)}drawPulses(e,t){let{at:n,effectWindow:r,wall:i,ambient:a}=t,{replacements:o}=e;if(!o.length)return;let s=this.quality===3?36:this.quality===2?18:6,c=0,l=o.length;for(;c<l;){let e=c+l>>1;o[e].at<=n?c=e+1:l=e}let u=c,d=r*1.8,f=0;for(let r=u-1;r>=0&&f<s;--r){let i=o[r],a=(n-i.at)/d;if(a>=1)break;i.to<0||n<e.appearAt[i.to]||(t.effectGain>.02&&this.drawPulseAlong(i.from,i.to,a,t.effectGain),f+=1)}if(!a){this.ctx.globalAlpha=1;return}if(this.selected>=0){let e=0;for(let t of o){if(t.to<0||t.at>n||!this.chainMask[t.from]||!this.chainMask[t.to])continue;let r=((i*45e-5+e*.27)%1+1)%1;this.drawPulseAlong(t.from,t.to,r,.9),e+=1}}else if(u){if(i>=this.nextAmbientPulse&&this.ambientPulses.length<3){this.nextAmbientPulse=i+650+(Math.sin(i)+1)*500;let e=Math.floor(Math.abs(Math.sin(i*12.9898))*u)%u;this.ambientPulses.push({replacement:e,start:i})}for(let t=this.ambientPulses.length-1;t>=0;--t){let r=this.ambientPulses[t],a=(i-r.start)/1900,s=o[r.replacement];if(a>=1||!s||s.at>n){this.ambientPulses.splice(t,1);continue}s.to<0||n<e.appearAt[s.to]||this.drawPulseAlong(s.from,s.to,a,.55)}}this.ctx.globalAlpha=1}drawFrontier(e,t){let{ctx:n}=this,r=this.frontierPath;n.strokeStyle=q(Ge);let i=e.ambient?.78+.22*Math.sin(e.wall*V):.85,a=(e.moving?1.1:i)*(this.selected>=0?.5:1),o=this.quality===1?1:3;for(let e=0;e<o;e+=1)n.beginPath(),this.traceRing(r),e===o-1?(n.lineWidth=1.1,n.globalAlpha=.72*a):e===0?(n.lineWidth=9,n.globalAlpha=.035*a):(n.lineWidth=3.6,n.globalAlpha=.09*a),n.stroke();if(e.ambient&&this.quality>=2){let r=Math.min(46,this.unit*.11)*(e.moving?1.25:1);for(let i=0;i<3;i+=1){let o=e.wall*17e-5*(i===1?-1:1)+i*2.1;this.project(M(o,t),N(o,t),0),n.globalAlpha=(.32+.3*Math.max(0,Math.sin(e.wall*6e-4+i*2)))*a,n.drawImage(this.pulseSprite,this.px-r/2,this.py-r/2,r,r)}}n.globalAlpha=1}applyBloom(){let{ctx:e,canvas:t}=this;if(this.quality<2||!this.bloomA)return;let n=this.bloomA.getContext(`2d`);if(n){if(n.globalCompositeOperation=`copy`,n.imageSmoothingEnabled=!0,n.drawImage(t,0,0,this.bloomA.width,this.bloomA.height),e.setTransform(1,0,0,1,0,0),e.imageSmoothingEnabled=!0,e.globalCompositeOperation=`lighter`,e.globalAlpha=.34,e.drawImage(this.bloomA,0,0,t.width,t.height),this.quality>=3&&this.bloomB){let n=this.bloomB.getContext(`2d`);n&&(n.globalCompositeOperation=`copy`,n.imageSmoothingEnabled=!0,n.drawImage(this.bloomA,0,0,this.bloomB.width,this.bloomB.height),e.globalAlpha=.3,e.drawImage(this.bloomB,0,0,t.width,t.height))}e.globalAlpha=1}}drawLabels(e,t,n){let{ctx:r}=this;if(this.width<280||!e.count)return;r.textBaseline=`middle`,r.textAlign=`left`,r.font=`10.5px ui-sans-serif, system-ui, sans-serif`;let i=this.selected>=0?.45:1,a=Math.PI*.2-this.camera.yaw,o=1/0,s=1/0;for(let c=e.rings.length-1;c>=0;--c){let l=e.rings[c];if(l.at>t.at||!l.major||(this.project(M(a,l.rho),N(a,l.rho),0),Math.hypot(this.px-o,this.py-s)<34))continue;o=this.px,s=this.py,r.globalAlpha=.62*i*F(l.rho,n),r.fillStyle=q(W);let u=this.ringLabels[c]||``;r.fillText(u,Math.min(this.px+4,this.width-8-r.measureText(u).width),this.py)}let c=Math.min(1.09,n+.07),l=Math.min(1.14,n+.12);if(this.width>=560&&n>.32){r.textAlign=`center`;for(let t of this.sectorOrder){let i=e.sectors[t],a=(i.start+i.end)/2;if(e.spaceArcs.some(e=>e.name.includes(i.label)))continue;this.project(M(a,c),N(a,c),0);let o=(.14+.5*Math.min(1,Math.max(0,(this.ps-.86)/.24)))*Math.min(1,(n-.32)*4);this.selected>=0&&(o=t===this.selectedSector?.95:.1),r.globalAlpha=o,r.fillStyle=q(W),r.fillText(i.label.slice(0,18),this.px,this.py)}}if(e.spaceArcs.length){r.textAlign=`center`;for(let t of e.spaceArcs){let e=Math.max(6,Math.ceil((t.end-t.start)/I*ze));r.beginPath();for(let n=0;n<=e;n+=1){let i=t.start+(t.end-t.start)*n/e;this.project(M(i,l),N(i,l),0),n===0?r.moveTo(this.px,this.py):r.lineTo(this.px,this.py)}r.strokeStyle=q(W),r.lineWidth=1,r.globalAlpha=.34*i,r.stroke();let n=(t.start+t.end)/2;this.project(M(n,l+.035),N(n,l+.035),0),r.globalAlpha=.72*i,r.fillStyle=q(Ge),r.fillText(t.name.slice(0,22),this.px,this.py)}}r.globalAlpha=1}};function Qe(e,t,n,r,i){let a=e.getContext(`2d`);if(!a)return;let o=Math.min((typeof devicePixelRatio==`number`?devicePixelRatio:1)||1,2),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o));(e.width!==s||e.height!==c)&&(e.width=s,e.height=c),a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,r,i);let{histogram:l,histogramReplacements:u,domain:d}=t,f=l.length,p=Math.max(1,d.end-d.start),m=Math.min(1,Math.max(0,(n-d.start)/p))*r,h=1;for(let e=0;e<f;e+=1)h=Math.max(h,l[e]);let g=r/f,ee=i-5;for(let e=0;e<f;e+=1){let t=l[e],n=e*g,r=n+g/2<=m;if(t){let e=Math.max(1.5,Math.sqrt(t/h)*ee);a.fillStyle=r?q(W,.78):q(W,.2),a.fillRect(n+.5,i-e,Math.max(1,g-1),e)}if(u[e]){let t=Math.min(ee,3+u[e]*1.5);a.fillStyle=r?q(H,.95):q(H,.34),a.fillRect(n+g/2-.75,0,1.5,t)}}}var X=n(),$e=400,et=540,tt=880,nt=16,rt={colorScheme:`dark`,"--text":`rgba(246, 240, 228, 0.96)`,"--foreground":`rgba(246, 240, 228, 0.96)`,"--text-soft":`rgba(246, 240, 228, 0.86)`,"--text-secondary":`rgba(240, 232, 218, 0.74)`,"--text-muted":`rgba(232, 224, 208, 0.58)`,"--text-faint":`rgba(232, 224, 208, 0.38)`,"--surface-hover":`rgba(255, 244, 224, 0.1)`,"--surface-active":`rgba(255, 244, 224, 0.17)`,"--surface-muted":`rgba(255, 244, 224, 0.07)`,"--surface-subtle":`rgba(255, 244, 224, 0.1)`,"--stroke":`rgba(255, 244, 224, 0.13)`,"--stroke-soft":`rgba(255, 244, 224, 0.08)`,"--stroke-strong":`rgba(255, 244, 224, 0.22)`,"--solid":`rgba(255, 244, 224, 0.14)`,"--star":`rgba(255, 232, 192, 0.92)`,"--star-hover":`rgba(255, 240, 214, 1)`,"--key-bg":`rgba(255, 240, 214, 1)`,"--key-border":`rgba(255, 244, 224, 0.2)`,"--key-shadow":`0 0 14px rgba(255, 214, 150, 0.55)`,"--control-border":`rgba(255, 240, 214, 0.9)`,"--focus":`rgba(255, 222, 170, 1)`,"--focus-ring":`rgba(255, 222, 170, 0.32)`,"--danger":`rgba(255, 150, 130, 1)`,"--evo-panel":`rgba(13, 14, 19, 0.74)`,"--evo-line":`rgba(255, 244, 224, 0.13)`,"--evo-scrim":`rgba(5, 6, 10, 0.86)`,"--evo-scrim-clear":`rgba(5, 6, 10, 0)`,"--evo-base":`rgba(5, 6, 10, 1)`,"--evo-active":`rgba(255, 232, 192, 1)`},it=q(H),at=q(U),ot=24e3,st=[`0.5`,`1`,`2`],ct=-.38,lt=.94,ut=.68,dt=.24,ft=26e-6,pt=450,mt=2e4,ht=Math.PI*.62,gt=320,_t=30,vt=30,yt=7,bt=!1;function xt(e){let t=navigator.deviceMemory;return t!==void 0&&t<=2?1:e||t!==void 0&&t<=4?2:3}function St(e){let t=Math.min(1,Math.max(0,e));return t*t*(3-2*t)}var Ct=e=>e instanceof Error?e.message:String(e),wt=e=>e instanceof DOMException&&e.name===`AbortError`;function Tt({spaceId:e,refreshKey:t=0,selectedId:n=null,onSelect:i}){let{t:x,language:S}=r(),[C,ie]=(0,b.useState)(null),[w,T]=(0,b.useState)(!0),[E,ae]=(0,b.useState)(``),[oe,se]=(0,b.useState)(0),[D,ce]=(0,b.useState)(0),[O,ue]=(0,b.useState)(0),[k,A]=(0,b.useState)(!1),[de,fe]=(0,b.useState)(`1`),[j,pe]=(0,b.useState)(null),[M,N]=(0,b.useState)(null),[me,he]=(0,b.useState)(null),[ge,_e]=(0,b.useState)(0),[ve,ye]=(0,b.useState)(0),be=(0,b.useRef)(null),P=(0,b.useRef)(null),xe=(0,b.useRef)(null),Se=(0,b.useRef)(null),Ce=(0,b.useRef)(null),we=(0,b.useRef)(null),Ee=(0,b.useRef)(null),Oe=(0,b.useRef)(null),F=(0,b.useRef)(null),I=(0,b.useRef)(null),ze=(0,b.useRef)(-1),L=(0,b.useRef)(-1),Be=(0,b.useRef)(`1`),R=(0,b.useRef)(0),z=(0,b.useRef)(0),B=(0,b.useRef)(`idle`),Ve=(0,b.useRef)(0),V=(0,b.useRef)(1),He=(0,b.useRef)(0),H=(0,b.useRef)(!0),U=(0,b.useRef)(0),We=(0,b.useRef)(!1),W=(0,b.useRef)(0),Ge=(0,b.useRef)(0),Ke=(0,b.useRef)(0),qe=(0,b.useRef)(0),G=(0,b.useRef)(ct),K=(0,b.useRef)(lt),Je=(0,b.useRef)(!1),J=(0,b.useRef)(null),Y=(0,b.useRef)(1),Ye=(0,b.useRef)(1),Xe=(0,b.useRef)(!1),Tt=(0,b.useRef)(null),Et=(0,b.useRef)(null),Dt=(0,b.useRef)(()=>{}),Ot=(0,b.useRef)(null),kt=(0,b.useRef)(!1),{ref:At,playing:jt}=re(),Mt=(0,b.useCallback)(e=>{P.current=e,At(e)},[At]),Nt=(0,b.useCallback)((e=!1)=>{if(!I.current)return;let t=performance.now();!e&&t-Ke.current<33||(Ke.current=t,ce(R.current))},[]),Pt=(0,b.useCallback)(e=>{U.current=0;let t=F.current;if(!t)return;let n=I.current,r=kt.current,i=W.current?Math.min(64,e-W.current):16;W.current=e;let a=!1;if(n){let{start:e,end:o}=n.domain,s=Math.max(1,o-e);if(B.current===`opening`){Ve.current+=i;let n=Re(Ve.current);R.current=e+s*n,t.camera.tilt=dt+(K.current-dt)*St(n*1.15),t.camera.yaw=G.current-1.3*(1-n)**2,a=!0,Ve.current>=6e3&&(R.current=o,B.current=`idle`,A(!1),Nt(!0))}else B.current===`play`&&(R.current+=i*s*Number(Be.current)/ot,a=!0,R.current>=o&&(R.current=o,B.current=`idle`,A(!1),Nt(!0)));let c=z.current,l=R.current-c;B.current!==`idle`||Math.abs(l)<s*2e-4?z.current=R.current:z.current=c+l*(1-Math.exp(-i/85)),z.current!==c&&(a=!0);let u=Math.abs(z.current-c)/Math.max(1,i),d=Math.min(s*.08,Math.max(s*.002,u*520)),f=d>V.current?90:420;r?V.current=s*.002:(V.current+=(d-V.current)*(1-Math.exp(-i/f)),Math.abs(d-V.current)>s*2e-4&&(a=!0))}let o=!!(Ot.current?.moved||Tt.current);if(!r&&!o&&B.current!==`opening`&&L.current<0&&ze.current<0&&(G.current+=i*ft),J.current!==null&&!o){let e=Math.atan2(Math.sin(J.current-G.current),Math.cos(J.current-G.current));Math.abs(e)<.002||r?(G.current=J.current,J.current=null):(G.current+=e*(1-Math.exp(-i/240)),a=!0)}let s=ze.current>=0,c=s?Pe(Y.current,Ye.current):Y.current,l=s?0:Ne(Y.current);if((Math.abs(t.camera.zoom-c)>.001||Math.abs(t.camera.rim-l)>.001)&&!r){let e=1-Math.exp(-i/(Tt.current?50:240));t.camera.zoom+=(c-t.camera.zoom)*e,t.camera.rim+=(l-t.camera.rim)*e,a=!0}else t.camera.zoom=c,t.camera.rim=l;t.settling&&(a=!0),B.current!==`opening`&&(t.camera.yaw=G.current);let u=Math.min(1,(e-He.current)/pt);(a||o)&&(qe.current=e);let d=e-qe.current>mt?66:t.quality===3?32:48;(a||H.current||o||u<1||t.morphing||!r&&e-Ge.current>=d)&&(t.draw({at:z.current,wall:e,effectWindow:V.current,effectGain:n?Math.min(1,Math.max(0,(V.current/(Math.max(1,n.domain.end-n.domain.start)*.002)-1.05)/1.6)):0,ambient:!r,fade:r?1:u,moving:B.current!==`idle`||o}),Ge.current=e,H.current=!1),r||t.noteFrameInterval(i),a&&Nt(),We.current&&(!r||a||u<1||H.current||t.morphing)?U.current=requestAnimationFrame(Pt):a||Nt(!0)},[Nt]),Z=(0,b.useCallback)(()=>{H.current=!0,We.current&&!U.current&&(U.current=requestAnimationFrame(Pt))},[Pt]),Ft=(0,b.useCallback)(()=>{let e=P.current;e&&(Ye.current=Me(e.clientWidth,I.current?.count??0),!Xe.current&&(Y.current=Ye.current,e.setAttribute(`data-zoom`,Y.current.toFixed(2))))},[]),It=(0,b.useCallback)(e=>{let t=je(e);Xe.current=!0,Y.current=t,P.current?.setAttribute(`data-zoom`,t.toFixed(2)),Z()},[Z]),Lt=(0,b.useCallback)(()=>{let e=F.current;B.current===`opening`&&e&&(e.camera.tilt=K.current,e.camera.yaw=G.current),B.current!==`idle`&&(B.current=`idle`,A(!1))},[]),Rt=(0,b.useCallback)(e=>{let t=I.current;t&&(Lt(),R.current=Math.min(t.domain.end,Math.max(t.domain.start,e)),Nt(!0),Z())},[Nt,Lt,Z]),zt=(0,b.useCallback)(()=>{let e=I.current;if(!e||!e.count)return;if(B.current!==`idle`){Lt(),Nt(!0),Z();return}let{start:t,end:n}=e.domain;R.current>=n-(n-t)*.002&&(R.current=t,z.current=t),B.current=`play`,A(!0),Z()},[Nt,Lt,Z]);(0,b.useLayoutEffect)(()=>{let e=be.current;if(!e)return;let t=e.closest(`[data-feature-scroller]`);if(!t)return;let n=()=>{let n=t.clientWidth,r=Math.min(n-(n<=650?0:24)*2,1280),i=e.clientWidth;he(r>i?{width:r,offset:(i-r)/2}:{width:i,offset:0});let a=P.current;if(a){let e=a.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop,r=t.clientHeight-e-nt;_e(Math.round(Math.min(tt,Math.max(n<=650?et:$e,r))))}};n();let r=new ResizeObserver(n);return r.observe(t),r.observe(e),()=>r.disconnect()},[]),(0,b.useLayoutEffect)(()=>{let e=xe.current;if(!e)return;let t=matchMedia(`(pointer: coarse)`).matches;kt.current=_();let n;try{n=new Ze(e,{quality:xt(t)})}catch{return}n.camera.yaw=G.current,F.current=n;let r=(e=!1)=>{let r=P.current;if(!r)return;let i=r.clientWidth,a=r.clientHeight,o=i>=720,s=Se.current?.offsetHeight??0,c=we.current?.offsetHeight??0;r.style.setProperty(`--evo-controls`,`${c}px`),Je.current||(K.current=o?lt:ut,B.current!==`opening`&&(n.camera.tilt=K.current)),Ft(),n.resize(i,a,t?1.5:2);let l=o?0:Ce.current?.offsetHeight??0;n.setInsets({top:o?18:s+10,bottom:c+4+(l?l+4:0),left:o?28:6,right:o?28:6},{animate:e&&!kt.current}),H.current=!0,We.current&&(U.current&&cancelAnimationFrame(U.current),U.current=0,Pt(performance.now()))};r(),Dt.current=r;let i=new ResizeObserver(()=>r());return P.current&&i.observe(P.current),Se.current&&i.observe(Se.current),we.current&&i.observe(we.current),()=>{i.disconnect(),F.current=null}},[Ft,Pt]),(0,b.useEffect)(()=>(We.current=jt,jt&&(W.current=0,Z()),()=>{We.current=!1,U.current&&cancelAnimationFrame(U.current),U.current=0}),[jt,Z]),(0,b.useEffect)(()=>{let e=xe.current;if(!e)return;let t=e=>{!e.ctrlKey&&!e.metaKey||(e.preventDefault(),F.current&&It(Y.current*Math.exp(-e.deltaY*.0022)))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[It]),(0,b.useEffect)(()=>{let e=xe.current;if(!e)return;let t=e=>{Tt.current=e.length>=2?{spread:Math.hypot(e[0].clientX-e[1].clientX,e[0].clientY-e[1].clientY),zoom:Y.current}:null},n=e=>{e.targetTouches.length<2||e.cancelable&&(e.preventDefault(),Ot.current=null,t(e.targetTouches),B.current===`opening`&&Lt(),Z())},r=e=>{let t=Tt.current;if(!t||e.targetTouches.length<2)return;e.cancelable&&e.preventDefault();let[n,r]=[e.targetTouches[0],e.targetTouches[1]];It(Fe(t.zoom,t.spread,Math.hypot(n.clientX-r.clientX,n.clientY-r.clientY)))},i=e=>{Tt.current&&t(e.targetTouches)},a=new AbortController,o={passive:!1,signal:a.signal};return e.addEventListener(`touchstart`,n,o),e.addEventListener(`touchmove`,r,o),e.addEventListener(`touchend`,i,{signal:a.signal}),e.addEventListener(`touchcancel`,i,{signal:a.signal}),()=>{a.abort(),Tt.current=null}},[It,Lt,Z]),(0,b.useEffect)(()=>{let t=new AbortController;return T(!0),ae(``),v(e,t.signal).then(e=>{t.signal.aborted||(ie(Te(e)),T(!1))}).catch(e=>{t.signal.aborted||wt(e)||(ae(Ct(e)),T(!1))}),()=>t.abort()},[e,t,oe]);let Bt=(0,b.useMemo)(()=>{let e=C?.unit===`day`||C?.unit===`week`?{month:`short`,day:`numeric`}:{year:`numeric`,month:`short`};return new Intl.DateTimeFormat(S,e)},[S,C?.unit]),Vt=(0,b.useMemo)(()=>new Intl.DateTimeFormat(S,{year:`numeric`,month:`long`,day:`numeric`}),[S]),Ht=(0,b.useMemo)(()=>new Intl.DateTimeFormat(S,{year:`numeric`,month:`2-digit`,day:`2-digit`}),[S]);(0,b.useEffect)(()=>{let e=F.current;e&&(e.setRingFormatter(e=>Bt.format(e)),H.current=!0)},[Bt]),(0,b.useEffect)(()=>{if(!C)return;let e=I.current,t=F.current,{start:n,end:r}=C.domain,i=r;if(e){let t=e.domain.end-e.domain.start;R.current>=e.domain.end-t*.002||(i=Math.min(r,Math.max(n,R.current))),B.current!==`idle`&&(B.current=`idle`,A(!1))}else!bt&&!kt.current&&C.count>0&&(bt=!0,B.current=`opening`,Ve.current=0,i=n,A(!0));I.current=C,R.current=i,z.current=i,V.current=(r-n)*.002;let a=performance.now();t?.setScene(C,{animate:!!e&&!kt.current,now:a})||(He.current=a),Ft(),!e&&t&&(t.camera.zoom=Y.current,t.camera.rim=Ne(Y.current)),ce(i),ue(i),pe(null),L.current=-1,Z()},[C,Ft,Z]);let Q=(0,b.useMemo)(()=>!C||!n?-1:C.indexById.get(n)??-1,[C,n]);(0,b.useEffect)(()=>{let e=F.current;ze.current=Q,e?.setSelection(Q);let t=I.current;t&&Q>=0?(J.current=ht-t.theta[Q],R.current<t.appearAt[Q]&&Rt(t.appearAt[Q])):J.current=null,Z()},[Rt,Q,Z]),(0,b.useEffect)(()=>{if(N(null),!n)return;let e=new AbortController;return y(n,e.signal).then(t=>{e.signal.aborted||N(t)}).catch(()=>{}),()=>e.abort()},[n,t]);let Ut=(0,b.useMemo)(()=>C&&Q>=0?Ae(C,Q):[],[C,Q]);(0,b.useLayoutEffect)(()=>{Dt.current(!0),Z()},[Ut,M,Z]),(0,b.useEffect)(()=>{if(!n)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[role="dialog"], [data-slot="popover-content"]`)||i(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[i,n]),(0,b.useEffect)(()=>{if(k)return;let e=window.setTimeout(()=>ue(D),700);return()=>window.clearTimeout(e)},[D,k]),(0,b.useEffect)(()=>{let e=Oe.current;if(!e)return;let t=new ResizeObserver(()=>ye(e.clientWidth));return t.observe(e),ye(e.clientWidth),()=>t.disconnect()},[]),(0,b.useEffect)(()=>{let e=Ee.current;!e||!C||!ve||Qe(e,C,D,ve,vt)},[D,ve,C]);let Wt=(0,b.useMemo)(()=>C?ke(C,D):{active:0,superseded:0,archived:0,known:0},[D,C]),Gt=(0,b.useMemo)(()=>C?ke(C,O):Wt,[O,C,Wt]),$=!!C?.count,Kt=!C||D>=C.domain.end-(C.domain.end-C.domain.start)*.002,qt=C?Vt.format(D):``,Jt=x(`memory:memoryEvolution.stageLabel`,{date:C?Vt.format(O):``,active:Gt.active,superseded:Gt.superseded,archived:Gt.archived}),Yt=e=>x(e===`decision`?`memory:memoryEvolution.typeDecision`:e===`preference`?`memory:memoryEvolution.typePreference`:e===`fact`?`memory:memoryEvolution.typeFact`:e===`risk`?`memory:memoryEvolution.typeRisk`:e===`file`?`memory:memoryEvolution.typeFile`:e===`task`?`memory:memoryEvolution.typeTask`:`memory:memoryEvolution.typeConcept`),Xt=e=>x(e===`superseded`?`memory:memoryEvolution.superseded`:e===`archived`?`memory:memoryEvolution.archived`:e===`hidden`?`memory:memoryEvolution.notYet`:`memory:memoryEvolution.active`),Zt=e=>{let t=e.target,n=!!t.closest(`[data-slot="segmented-control"], [data-slot="popover-content"]`);if(e.key===` `){if(t.closest(`button, a, [role="radio"]`))return;e.preventDefault(),zt();return}let r=I.current;if(!r||!r.count||n)return;let i=(r.domain.end-r.domain.start)*(e.shiftKey?.05:.01),a=null;e.key===`ArrowLeft`?a=R.current-i:e.key===`ArrowRight`?a=R.current+i:e.key===`Home`?a=r.domain.start:e.key===`End`&&(a=r.domain.end),a!==null&&(e.preventDefault(),e.stopPropagation(),Rt(a))},Qt=e=>{e.button!==0||!e.isPrimary||(Ot.current={id:e.pointerId,x:e.clientX,y:e.clientY,lastX:e.clientX,lastY:e.clientY,moved:!1},e.currentTarget.setPointerCapture?.(e.pointerId))},$t=e=>{let t=F.current;if(!t)return;let n=Ot.current;if(n&&n.id===e.pointerId){let r=e.clientX-n.lastX,i=e.clientY-n.lastY;if(!n.moved&&Math.hypot(e.clientX-n.x,e.clientY-n.y)<5)return;n.moved=!0,J.current=null,n.lastX=e.clientX,n.lastY=e.clientY,G.current+=r*.0062,e.pointerType===`mouse`&&(Je.current=!0,K.current=Math.min(1.16,Math.max(0,K.current-i*.0042)),t.camera.tilt=K.current),B.current===`opening`&&Lt(),L.current=-1,t.setHover(-1),pe(null),Z();return}if(e.pointerType!==`mouse`)return;let r=e.currentTarget.getBoundingClientRect(),i=e.clientX-r.left,a=e.clientY-r.top,o=t.pick(i,a,15,z.current);o!==L.current&&(L.current=o,t.setHover(o),Z()),pe(o>=0?{index:o,x:i,y:a}:null)},en=e=>{let t=Ot.current;Ot.current=null;let n=F.current;if(!n||!I.current||!t||t.moved)return;if(e.pointerType!==`mouse`){let t=Et.current,n=t!==null&&e.timeStamp-t.at<gt&&Math.hypot(e.clientX-t.x,e.clientY-t.y)<_t;if(Et.current=n?null:{at:e.timeStamp,x:e.clientX,y:e.clientY},n){nn();return}}let r=e.currentTarget.getBoundingClientRect(),a=n.pick(e.clientX-r.left,e.clientY-r.top,e.pointerType===`mouse`?16:28,z.current);i(a>=0?I.current.facts[a].id:null)},tn=()=>{L.current>=0&&(L.current=-1,F.current?.setHover(-1),Z()),pe(null)},nn=()=>{let e=F.current;e&&(It(Ye.current),Xe.current=!1,Je.current=!1,K.current=(P.current?.clientWidth??800)>=720?lt:ut,e.camera.tilt=K.current,Z())},rn=j&&C?C.facts[j.index]:null,an=(0,b.useMemo)(()=>{let e=new Map;M?.item&&e.set(M.item.id,M.item.content);for(let t of M?.history||[])e.set(t.id,t.content);return e},[M]),on=e=>(0,X.jsx)(p,{size:`sm`,className:e,"aria-label":x(`memory:memoryEvolution.speed`),value:de,onValueChange:e=>{Be.current=e,fe(e)},options:st.map(e=>({value:e,label:`${e}×`}))}),sn=me?.width??null,cn=(()=>{if(!j)return;let e=P.current?.clientWidth??800,t=P.current?.clientHeight??600;return{left:Math.min(e-272,j.x+16),...j.y>t-150?{bottom:t-j.y+16}:{top:j.y+16}}})();return(0,X.jsx)(`div`,{ref:be,className:`min-w-0`,children:(0,X.jsxs)(`div`,{ref:Mt,role:`group`,"aria-label":x(`memory:memoryEvolution.regionLabel`),"data-memory-evolution":!0,"data-at":C?new Date(D).toISOString():void 0,"data-active-count":Wt.active,"data-playing":k||void 0,onKeyDownCapture:Zt,style:{...rt,...sn?{width:sn,marginLeft:me?.offset??0}:{},...ge?{height:ge}:{}},className:`@container relative isolate h-[clamp(560px,calc(100dvh-196px),880px)] overflow-hidden rounded-xl bg-[var(--evo-base)] text-content select-none max-[650px]:h-[clamp(540px,calc(100dvh-132px),780px)] max-[650px]:rounded-none`,children:[(0,X.jsx)(`canvas`,{ref:xe,role:`img`,"aria-label":Jt,tabIndex:0,onPointerDown:Qt,onPointerMove:$t,onPointerUp:en,onPointerCancel:()=>{Ot.current=null},onPointerLeave:tn,onDoubleClick:nn,className:`absolute inset-0 size-full cursor-grab touch-pan-y outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-inset active:cursor-grabbing`}),(0,X.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,role:`status`,children:C&&!k?Jt:``}),(0,X.jsxs)(`div`,{ref:Se,className:`pointer-events-none absolute top-5 left-6 z-10 flex max-w-[min(70%,420px)] flex-col gap-1.5 @max-[719px]:top-3.5 @max-[719px]:right-4 @max-[719px]:left-4 @max-[719px]:max-w-none`,children:[(0,X.jsxs)(`div`,{className:`flex items-baseline gap-2.5`,children:[$&&(0,X.jsx)(`span`,{"data-memory-evolution-date":!0,className:`text-[30px] leading-9 font-light tracking-[-0.015em] text-content tabular-nums @max-[719px]:text-2xl @max-[719px]:leading-8`,children:qt}),$&&Kt&&(0,X.jsx)(`span`,{className:`text-xs text-[var(--evo-active)]`,children:x(`memory:memoryEvolution.now`)})]}),$&&(0,X.jsxs)(`dl`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-content-muted tabular-nums`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-[var(--evo-active)] shadow-[0_0_8px_var(--evo-active)]`}),(0,X.jsx)(`dt`,{children:x(`memory:memoryEvolution.active`)}),(0,X.jsx)(`dd`,{"data-memory-evolution-active":!0,className:`font-medium text-content`,children:Wt.active})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full`,style:{backgroundColor:it,boxShadow:`0 0 8px ${it}`}}),(0,X.jsx)(`dt`,{children:x(`memory:memoryEvolution.superseded`)}),(0,X.jsx)(`dd`,{className:`font-medium text-content`,children:Wt.superseded})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full`,style:{backgroundColor:at}}),(0,X.jsx)(`dt`,{children:x(`memory:memoryEvolution.archived`)}),(0,X.jsx)(`dd`,{className:`font-medium text-content`,children:Wt.archived})]})]}),C?.truncated&&(0,X.jsx)(`p`,{className:`m-0 text-xs text-content-faint`,children:x(`memory:memoryEvolution.truncated`,{count:C.count})}),E&&C&&(0,X.jsx)(`p`,{className:`m-0 text-xs text-danger`,children:E})]}),$&&Q<0&&(0,X.jsx)(`ul`,{"aria-label":x(`memory:memoryEvolution.legend`),className:`pointer-events-none absolute top-1/2 right-6 z-10 hidden -translate-y-[62%] list-none flex-col gap-1.5 p-0 text-[11px] text-content-muted @min-[880px]:flex`,children:le.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center justify-end gap-2`,children:[Yt(e),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full`,style:{backgroundColor:q(Ue[e]),boxShadow:`0 0 7px ${q(Ue[e])}`}})]},e))}),$&&(0,X.jsx)(`div`,{className:`absolute top-3.5 right-4 z-10 @max-[719px]:top-2.5 @max-[719px]:right-2.5`,children:(0,X.jsxs)(d,{children:[(0,X.jsx)(l,{asChild:!0,children:(0,X.jsx)(g,{variant:`ghost`,size:`icon-sm`,"aria-label":x(`memory:memoryEvolution.howToRead`),title:x(`memory:memoryEvolution.howToRead`),children:(0,X.jsx)(a,{"aria-hidden":`true`})})}),(0,X.jsxs)(u,{align:`end`,className:`w-80 gap-2 text-xs`,children:[(0,X.jsx)(`p`,{className:`m-0 leading-relaxed`,children:x(`memory:memoryEvolution.howToReadBody`)}),(0,X.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-2 gap-x-3 gap-y-1 p-0`,children:le.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center gap-2 text-content-secondary`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 rounded-full`,style:{backgroundColor:q(Ue[e])}}),Yt(e)]},e))}),(0,X.jsx)(`p`,{className:`m-0 leading-relaxed text-content-muted`,children:x(`memory:memoryEvolution.gestures`)})]})]})}),rn&&j&&C&&j.index!==Q&&(0,X.jsxs)(`div`,{role:`tooltip`,"data-memory-evolution-tooltip":!0,style:cn,className:`pointer-events-none absolute z-20 flex w-max max-w-64 flex-col gap-0.5 rounded-md border border-[var(--evo-line)] bg-[var(--evo-panel)] px-2.5 py-1.5 text-xs backdrop-blur-md`,children:[(0,X.jsx)(`strong`,{className:`line-clamp-2 font-medium text-content`,children:rn.title}),(0,X.jsxs)(`span`,{className:`text-content-muted tabular-nums`,children:[Yt(rn.type),` · `,Ht.format(C.validAt[j.index]),` ·`,` `,Xt(De(C,j.index,D))]}),!!(C.flags[j.index]&4)&&(0,X.jsx)(`span`,{className:`text-content-muted tabular-nums`,children:x(`memory:memoryEvolution.learnedLate`,{date:Ht.format(C.appearAt[j.index])})})]}),C&&Q>=0&&(0,X.jsxs)(`section`,{ref:Ce,"data-memory-evolution-card":!0,"aria-label":C.facts[Q].title,className:`absolute top-14 right-4 z-20 flex max-h-[calc(100%-230px)] w-[320px] flex-col gap-2 overflow-y-auto rounded-lg border border-[var(--evo-line)] bg-[var(--evo-panel)] p-3 backdrop-blur-md @max-[719px]:top-auto @max-[719px]:right-2.5 @max-[719px]:bottom-[calc(var(--evo-controls,160px)+4px)] @max-[719px]:left-2.5 @max-[719px]:max-h-[32%] @max-[719px]:w-auto`,children:[(0,X.jsxs)(`header`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,X.jsx)(`h3`,{className:`m-0 min-w-0 text-[13px] leading-5 font-medium break-words text-content`,children:C.facts[Q].title}),(0,X.jsx)(g,{variant:`ghost`,size:`icon-sm`,className:`-mt-1 -mr-1 flex-none`,"aria-label":x(`memory:memoryEvolution.closeCard`),onClick:()=>i(null),children:(0,X.jsx)(c,{"aria-hidden":`true`})})]}),(0,X.jsxs)(`p`,{className:`m-0 flex flex-wrap gap-x-2 text-[11px] text-content-muted`,children:[(0,X.jsx)(`span`,{children:Yt(C.facts[Q].type)}),!!(C.flags[Q]&1)&&(0,X.jsx)(`span`,{children:x(`memory:memoryEvolution.pinned`)}),!!(C.flags[Q]&2)&&(0,X.jsx)(`span`,{children:x(`memory:memoryEvolution.untrusted`)}),!!(C.flags[Q]&8)&&(0,X.jsx)(`span`,{children:x(`memory:memoryEvolution.stale`)})]}),(0,X.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:Ut.map(e=>{let t=C.facts[e],n=De(C,e,D),r=an.get(t.id);return(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,"aria-current":e===Q||void 0,onClick:()=>{Rt(C.appearAt[e]),i(t.id)},className:m(`flex w-full min-w-0 flex-col gap-0.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-focus focus-visible:outline-none pointer-coarse:min-h-11`,e===Q&&`bg-surface-muted`),children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] text-content-muted tabular-nums`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 flex-none rounded-full`,style:{backgroundColor:n===`superseded`?it:n===`archived`?at:q(Ue[t.type]??Ue.concept)}}),Ht.format(C.validAt[e]),` · `,Xt(n)]}),(0,X.jsx)(`span`,{className:`line-clamp-3 text-xs leading-[1.45] break-words text-content-soft`,children:r||t.title})]})},t.id)})})]}),C&&!$&&(0,X.jsx)(`div`,{className:`absolute inset-x-0 bottom-5 z-10 flex justify-center px-6`,children:(0,X.jsx)(te,{compact:!0,illustration:(0,X.jsx)(`span`,{}),title:x(`memory:memoryEvolution.emptyTitle`),description:x(`memory:memoryEvolution.emptyDescription`)})}),!C&&w&&(0,X.jsx)(`div`,{role:`status`,className:`absolute inset-0 z-10 grid place-items-center text-xs text-content-muted`,children:(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(h,{className:`size-4`}),x(`memory:memoryEvolution.loading`)]})}),!C&&!w&&E&&(0,X.jsx)(`div`,{className:`absolute inset-0 z-10 grid place-items-center`,children:(0,X.jsx)(ee,{kind:`error`,title:x(`memory:memoryEvolution.loadFailed`),description:E,action:(0,X.jsx)(g,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>se(e=>e+1),children:x(`memory:memoryEvolution.retry`)})})}),(0,X.jsx)(`div`,{ref:we,className:m(`absolute inset-x-0 bottom-0 z-10 bg-gradient-to-t from-[var(--evo-scrim)] via-[var(--evo-scrim)] via-40% to-[var(--evo-scrim-clear)] px-5 pt-7 pb-3.5 @max-[719px]:px-3 @max-[719px]:pt-5 @max-[719px]:pb-3`,!$&&`invisible`),children:(0,X.jsxs)(`div`,{className:`flex items-end gap-3 @max-[719px]:flex-col @max-[719px]:items-stretch @max-[719px]:gap-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-none items-center gap-1 pb-1 @max-[719px]:order-2 @max-[719px]:justify-between @max-[719px]:pb-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(g,{variant:`ghost`,size:`icon`,"data-memory-evolution-play":!0,className:`max-[650px]:size-11`,"aria-label":x(k?`memory:memoryEvolution.pause`:`memory:memoryEvolution.play`),title:x(k?`memory:memoryEvolution.pause`:`memory:memoryEvolution.play`),disabled:!$,onClick:zt,children:k?(0,X.jsx)(o,{"aria-hidden":`true`}):(0,X.jsx)(s,{"aria-hidden":`true`})}),(0,X.jsxs)(g,{variant:`ghost`,size:`sm`,"data-memory-evolution-now":!0,className:`aria-disabled:opacity-50 max-[650px]:h-11`,"aria-disabled":!$||Kt&&!k,onClick:()=>{C&&!(Kt&&!k)&&Rt(C.domain.end)},children:[(0,X.jsx)(ne,{"aria-hidden":`true`}),x(`memory:memoryEvolution.backToNow`)]})]}),on(`hidden @max-[719px]:inline-flex`)]}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 @max-[719px]:order-1`,children:[(0,X.jsx)(`div`,{ref:Oe,"aria-hidden":`true`,style:{marginLeft:yt,marginRight:yt,height:vt},children:(0,X.jsx)(`canvas`,{ref:Ee,className:`block size-full`})}),C&&(0,X.jsx)(f,{"aria-label":x(`memory:memoryEvolution.timelineLabel`),valueText:qt,min:0,max:1e3,step:1,value:[Le(C.domain,D)],disabled:!$,className:`h-5 pointer-coarse:h-11 max-[650px]:h-11`,onValueChange:([e])=>Rt(Ie(C.domain,e))}),C&&(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`flex justify-between px-[7px] text-[11px] text-content-faint tabular-nums`,children:[(0,X.jsx)(`span`,{children:Ht.format(C.domain.start)}),(0,X.jsx)(`span`,{children:Ht.format(C.domain.end)})]})]}),on(`mb-1 flex-none @max-[719px]:hidden`)]})})]})})}export{Tt as MemoryEvolution,Tt as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryEvolution-B8IeSLcd.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-_vdxObu5.js","assets/i18n-EVP8yIdy.js","assets/vendor-router-CSN_DGvx.js","assets/index-D_zLThH_.js","assets/index-l96Dl6z6.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/info-DATxy0fb.js","assets/pause-CYWpPg1R.js","assets/play-DNDjDNGn.js","assets/x-07u4-129.js","assets/popover--q2hs_pT.js","assets/dist-41X0pdUs.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/dialog-DFZX_Dek.js","assets/dist-BHkR6BLP.js","assets/button-CCcCN8tE.js","assets/slider-De8rWVNs.js","assets/dist-DzGQ7sLi.js","assets/dist-BS3ekNDj.js","assets/segmented-control-xkrEOP_d.js","assets/dist-BaBySQmo.js","assets/PageState-Cz6vFMXv.js","assets/motion-DTR4ZVle.js","assets/memory-api-DkPje--t.js","assets/api-BW_X0FMZ.js","assets/abort-signal-f4JsiYKX.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{t as n}from"./index-D_zLThH_.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{t as a}from"./use-i18n-_vdxObu5.js";import{t as o}from"./storage-DtvZ_lEu.js";import{u as s}from"./api-BW_X0FMZ.js";import{t as c}from"./createLucideIcon-Cd-3GVxJ.js";import{t as l}from"./archive-ojKJT7Fp.js";import{t as u}from"./book-open-BuHHD9os.js";import{t as d}from"./ellipsis-CfGKfbq6.js";import{t as f}from"./file-code-corner-BnE1ljT0.js";import{n as p,r as m,t as h}from"./undo-2-C-xQ0UVT.js";import{t as g}from"./pencil-U08v_vV9.js";import{t as _}from"./pin-off-BpRu_vrC.js";import{t as v}from"./pin-CU0FG0lI.js";import{t as y}from"./plus-fQbSqB1n.js";import{t as b}from"./refresh-cw-TbWxTY4K.js";import{t as x}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as S}from"./rotate-ccw-C0v8V77_.js";import{t as C}from"./sliders-horizontal-Dryf1XyC.js";import{t as w}from"./trash-2-CNrPOoPR.js";import{t as T}from"./triangle-alert-CE1q54ci.js";import{t as ee}from"./x-07u4-129.js";import{t as E}from"./more-pages-D_PnxLN0.js";import{c as D,i as O,p as te,r as ne,t as k}from"./dropdown-menu-Ds0gD8S8.js";import{i as A,n as re,r as ie,t as ae}from"./tabs-DsgBuvJv.js";import{t as oe}from"./segmented-control-xkrEOP_d.js";import{t as j}from"./utils-C8uzG5AZ.js";import{n as se,t as M}from"./button-CCcCN8tE.js";import{s as ce}from"./shortcuts-D72gQCwH.js";import{a as N,i as P,l as F,o as I,s as le,t as L}from"./dialog-DFZX_Dek.js";import{t as R}from"./input-CPw-zkYh.js";import{t as ue}from"./textarea-DmATpOqT.js";import{n as z,t as de}from"./PageState-Cz6vFMXv.js";import{a as fe,i as pe,n as me,o as he,r as ge,s as _e,t as ve}from"./FeaturePage-BB1TeMlr.js";import{n as B}from"./field-DoLEb0np.js";import{t as ye}from"./AppSelect-DQYKUW5E.js";import{t as be}from"./badge-CWB3lj2H.js";import{i as V}from"./app-primitives-Drz_SjnR.js";import{a as H,c as xe,f as U,h as Se,i as Ce,l as W,m as we,n as Te,o as Ee,p as De,r as G,s as Oe,t as ke,u as K}from"./memory-api-DkPje--t.js";var Ae=c(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),je=c(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Me=c(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),q=c(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Ne=c(`milestone`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M12 3v3`,key:`1n5kay`}],[`path`,{d:`M18.172 6a2 2 0 0 1 1.414.586l2.06 2.06a1.207 1.207 0 0 1 0 1.708l-2.06 2.06a2 2 0 0 1-1.414.586H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z`,key:`8gz4t4`}]]),Pe=c(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),J=e(r(),1),Fe={concept:m,file:f,risk:T,preference:C,decision:Ne,fact:u,task:p};function Ie(e,t){return t(e===`file`?`memory:memoryPage.fileType`:e===`risk`?`memory:memoryPage.riskType`:e===`preference`?`memory:memoryPage.preferenceType`:e===`decision`?`memory:memoryPage.decisionType`:e===`fact`?`memory:memoryPage.factType`:e===`task`?`memory:memoryPage.taskType`:`memory:memoryPage.conceptType`)}function Le(e,t){return t(e===`manual`?`memory:memoryPage.sourceManual`:e===`user_confirmed`?`memory:memoryPage.sourceUserRequest`:e===`agent`?`memory:memoryPage.sourceAgent`:e===`tool_verified`?`memory:memoryPage.sourceTool`:e===`external`?`memory:memoryPage.sourceExternal`:`memory:memoryPage.sourceConversation`)}function Re(e,t){return t(e===`assistant`?`memory:memoryPage.roleAssistant`:e===`tool`?`memory:memoryPage.roleTool`:e===`external`?`memory:memoryPage.roleExternal`:e===`manual`?`memory:memoryPage.roleManual`:`memory:memoryPage.roleUser`)}function ze(e,t){return[e.pinned&&t(`memory:memoryPage.pinnedBadge`),e.status===`stale`&&t(`memory:memoryPage.staleBadge`),e.tainted&&t(`memory:memoryPage.taintedBadge`),e.status===`archived`&&t(`memory:memoryPage.archivedBadge`),e.status===`superseded`&&t(`memory:memoryPage.supersededBadge`)].filter(e=>!!e)}function Be(e,t){return e?.kind===`global`?t(`memory:memoryPage.globalMemorySpace`):e?.name||``}function Y(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(n)}function Ve(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`}).format(n)}function He(e,t){let n={add:{icon:y,label:()=>t(`memory:memoryPage.eventAdd`)},supersede:{icon:Pe,label:()=>t(`memory:memoryPage.eventSupersede`)},merge:{icon:q,label:()=>t(`memory:memoryPage.eventMerge`)},archive:{icon:l,label:()=>t(`memory:memoryPage.eventArchive`)},expire:{icon:je,label:()=>t(`memory:memoryPage.eventExpire`)},stale:{icon:T,label:()=>t(`memory:memoryPage.eventStale`)},confirm:{icon:Ae,label:()=>t(`memory:memoryPage.eventConfirm`)},restore:{icon:S,label:()=>t(`memory:memoryPage.eventRestore`)},edit:{icon:g,label:()=>t(`memory:memoryPage.eventEdit`)},pin:{icon:v,label:()=>t(`memory:memoryPage.eventPin`)},unpin:{icon:_,label:()=>t(`memory:memoryPage.eventUnpin`)},delete:{icon:w,label:()=>t(`memory:memoryPage.eventDelete`)},purge:{icon:Me,label:()=>t(`memory:memoryPage.eventPurge`)},undo:{icon:h,label:()=>t(`memory:memoryPage.eventUndo`)},reinforce:{icon:b,label:()=>t(`memory:memoryPage.eventReinforce`)},migrate:{icon:x,label:()=>t(`memory:memoryPage.eventMigrate`)},consolidate:{icon:q,label:()=>t(`memory:memoryPage.eventConsolidate`)}}[e];return n?{icon:n.icon,label:n.label()}:{icon:x,label:t(`memory:memoryPage.eventGeneric`)}}function Ue(e,t){return e===`user`||e===`manual`||e===`user_confirmed`?t(`memory:memoryPage.actorYou`):[`consolidator`,`reconcile`,`lifecycle`].includes(e)?t(`memory:memoryPage.actorConsolidator`):t(e===`conversation`?`memory:memoryPage.actorConversation`:e===`agent`||e===`tool_verified`?`memory:memoryPage.actorAgent`:e===`external`?`memory:memoryPage.sourceExternal`:`memory:memoryPage.actorSystem`)}function We(e,t){if(e===`same_identity`)return t(`memory:memoryPage.reasonSameIdentity`);if(e===`lower_authority_conflict`)return t(`memory:memoryPage.reasonLowerAuthority`);if(e===`expired`||e===`retention_expired`)return t(`memory:memoryPage.reasonExpired`);if(e===`unused`||e===`low_utility`)return t(`memory:memoryPage.reasonLowUtility`);if(e===`user_deleted`)return t(`memory:memoryPage.reasonUserDeleted`);if(e===`user_requested`)return t(`memory:memoryPage.reasonUserRequested`);let n=/^digests:(\d+) merged:(\d+)$/.exec(e);if(n){let e=Number(n[1]),r=Number(n[2]);return e&&r?t(`memory:memoryPage.reasonConsolidatedBoth`,{digests:e,merged:r}):r?t(`memory:memoryPage.reasonConsolidatedMerged`,{merged:r}):t(`memory:memoryPage.reasonConsolidatedDigests`,{digests:e})}let r=/^promoted (\d+) pending candidates$/.exec(e);return r?t(`memory:memoryPage.reasonPromoted`,{count:Number(r[1])}):e}var X=i(),Ge=50;function Ke({spaceId:e,refreshKey:t,onChanged:n}){let{t:r,language:i}=a(),[o,c]=(0,J.useState)([]),[l,u]=(0,J.useState)(!0),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1),[g,_]=(0,J.useState)(!1),[v,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),S=(0,J.useRef)(0),C=e===`all`?``:e,w=(0,J.useCallback)(async()=>{let e=++S.current;u(!0),y(``);try{let t=await K({spaceId:C,limit:Ge});if(e!==S.current)return;c(t.events),m(t.events.length>=Ge),_(!1)}catch(t){if(e!==S.current)return;t instanceof s&&t.status===404?_(!0):y(t instanceof Error?t.message:String(t))}finally{e===S.current&&u(!1)}},[C]);(0,J.useEffect)(()=>(w(),()=>{S.current+=1}),[w,t]);let T=async()=>{let e=o.at(-1)?.at;if(!e||d)return;let t=S.current;f(!0);try{let n=await K({spaceId:C,before:e,limit:Ge});if(t!==S.current)return;c(e=>{let t=new Set(e.map(e=>e.id));return[...e,...n.events.filter(e=>!t.has(e.id))]}),m(n.events.length>=Ge)}catch(e){t===S.current&&y(e instanceof Error?e.message:String(e))}finally{f(!1)}},ee=async e=>{if(!b){x(e.id),y(``);try{await we(e.id),await n(r(`memory:memoryPage.eventUndone`))}catch(e){y(e instanceof Error?e.message:String(e))}finally{x(``)}}};return g?(0,X.jsx)(de,{compact:!0,title:r(`memory:memoryPage.activityUnsupported`)}):l&&!o.length?(0,X.jsx)(z,{kind:`loading`,title:r(`common:pageTemplate.loading`)}):v&&!o.length?(0,X.jsx)(z,{kind:`error`,title:r(`memory:memoryPage.activityLoadFailed`),description:v,action:(0,X.jsx)(M,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void w(),children:r(`common:pageTemplate.retry`)})}):o.length?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[v&&(0,X.jsx)(ve,{className:`mt-0`,children:v}),(0,X.jsx)(me,{children:o.map(e=>{let{icon:t,label:n}=He(e.action,r),a=e.reason?We(e.reason,r):``;return(0,X.jsx)(pe,{"data-memory-event":e.action,icon:(0,X.jsx)(t,{}),name:n,description:[...new Set(e.titles||[])].join(`、`)||void 0,meta:(0,X.jsxs)(`span`,{className:`truncate tabular-nums`,children:[Y(e.at,i),` · `,Ue(e.actor,r),a?` · ${a}`:``]}),status:e.undoneAt?r(`memory:memoryPage.undone`):void 0,actions:e.undoable?(0,X.jsxs)(M,{variant:`ghost`,size:`sm`,disabled:!!b,"aria-label":`${r(`memory:memoryPage.undo`)}: ${n}`,onClick:()=>void ee(e),children:[(0,X.jsx)(h,{}),r(`memory:memoryPage.undo`)]}):void 0},e.id)})}),p&&(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsx)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,loading:d,disabled:d,onClick:()=>void T(),children:r(`memory:memoryPage.loadMore`)})})]}):(0,X.jsx)(de,{compact:!0,title:r(`memory:memoryPage.noActivity`)})}var Z=`flex min-h-[34px] min-w-0 items-center justify-between gap-4 border-t border-stroke-soft text-sm [&>dd]:min-w-0 [&>dd]:truncate [&>dd]:text-right [&>dd]:text-content [&>dt]:shrink-0 [&>dt]:text-content-muted`;function qe({labels:e}){return(0,X.jsx)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:e.map(e=>(0,X.jsx)(be,{children:e},e))})}function Je({id:e,fallback:t=null,spaces:n,refreshKey:r=0,withHeading:i=!1,onClose:o,onEdit:s,onChanged:c,onDeleted:l,requestConfirm:u}){let{t:d,language:f}=a(),[p,m]=(0,J.useState)(null),[h,y]=(0,J.useState)(!0),[b,x]=(0,J.useState)(``),[C,T]=(0,J.useState)(``),[E,D]=(0,J.useState)(!1),[O,te]=(0,J.useState)(0);(0,J.useEffect)(()=>{let t=new AbortController;return y(!0),x(``),W(e,t.signal).then(e=>{t.signal.aborted||(m(e),y(!1))}).catch(e=>{t.signal.aborted||(x(e instanceof Error?e.message:String(e)),y(!1))}),()=>t.abort()},[e,r,O]);let ne=(0,J.useCallback)(async(e,t)=>{D(!0),T(``);try{await e(),await c(t)}catch(e){T(e instanceof Error?e.message:String(e))}finally{D(!1)}},[c]),k=p?.item?.id===e?p.item:t,A=p?.item?.id===e?p.history:[],re=async()=>{if(k&&await u({title:d(`memory:memoryPage.deleteMemory`),message:d(`memory:memoryPage.deleteMemoryName`,{name:k.title}),confirmLabel:d(`memory:memoryPage.delete`)})){D(!0),T(``);try{await H(k.id),await l(d(`memory:memoryPage.memoryDeleted`))}catch(e){T(e instanceof Error?e.message:String(e)),D(!1)}}};if(!k)return(0,X.jsx)(`div`,{className:`flex min-h-16 items-center gap-2 text-xs text-content-muted`,children:h?(0,X.jsx)(se,{className:`size-4`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(V,{className:`my-0`,children:b||d(`memory:memoryPage.detailLoadFailed`)}),(0,X.jsx)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>te(e=>e+1),children:d(`memory:memoryPage.retry`)})]})});let ie=n.find(e=>e.id===k.spaceId),ae=k.status===`active`||k.status===`stale`||!k.status,oe=ze(k,d);return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,"aria-busy":h||E||void 0,children:[i&&(0,X.jsxs)(`header`,{className:`flex min-w-0 items-start gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`h3`,{className:`text-[15px] leading-6 font-medium break-words text-content`,children:k.title}),oe.length>0&&(0,X.jsx)(qe,{labels:oe})]}),o&&(0,X.jsx)(M,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`-mt-0.5 flex-none max-[650px]:size-11`,"aria-label":d(`memory:memoryPage.closeDetail`),onClick:o,children:(0,X.jsx)(ee,{})})]}),(0,X.jsx)(`p`,{className:`text-[13px] leading-normal break-words whitespace-pre-wrap text-content-secondary`,children:k.content}),k.status===`stale`&&(0,X.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:d(`memory:memoryPage.staleHint`)}),k.tainted&&(0,X.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:d(`memory:memoryPage.taintedHint`)}),(0,X.jsxs)(`dl`,{className:`m-0`,children:[(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.memoryType`)}),(0,X.jsx)(`dd`,{children:Ie(k.type,d)})]}),ie&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.memorySpace`)}),(0,X.jsx)(`dd`,{children:Be(ie,d)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.source`)}),(0,X.jsx)(`dd`,{children:Le(k.sourceType,d)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.validFrom`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(k.validFrom,f)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.validTo`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:k.validTo?Y(k.validTo,f):d(`memory:memoryPage.stillValid`)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.created`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(k.createdAt,f)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.confirmCount`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:k.confirmCount??1})]}),k.expiresAt&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.expires`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(k.expiresAt,f)})]}),k.sourcePath&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.relatedFilePath`)}),(0,X.jsx)(`dd`,{className:`font-mono text-xs`,title:k.sourcePath,children:k.sourcePath})]}),k.archiveReason&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.archiveReason`)}),(0,X.jsx)(`dd`,{title:We(k.archiveReason,d),children:We(k.archiveReason,d)})]})]}),k.evidence&&(0,X.jsxs)(`section`,{className:`min-w-0`,"aria-label":d(`memory:memoryPage.evidence`),children:[(0,X.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted`,children:[d(`memory:memoryPage.evidenceFrom`),` · `,Re(k.evidenceRole,d)]}),(0,X.jsx)(`blockquote`,{className:`m-0 border-l-2 border-stroke pl-2.5 text-xs leading-normal break-words whitespace-pre-wrap text-content-secondary`,children:k.evidence})]}),A.length>1&&(0,X.jsxs)(`section`,{className:`min-w-0`,"aria-label":d(`memory:memoryPage.versionHistory`),children:[(0,X.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[d(`memory:memoryPage.versionHistory`),` · `,A.length]}),(0,X.jsx)(`ol`,{"data-memory-history":!0,className:`m-0 flex list-none flex-col p-0`,children:A.map(e=>{let t=e.status===`active`||e.status===`stale`;return(0,X.jsxs)(`li`,{"aria-current":e.id===k.id||void 0,className:j(`flex min-w-0 flex-col gap-0.5 border-t border-stroke-soft py-1.5 text-xs leading-normal`,!t&&`text-content-muted`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1.5 tabular-nums`,children:[Ve(e.validFrom,f),t&&(0,X.jsx)(be,{children:d(`memory:memoryPage.currentVersion`)})]}),(0,X.jsx)(`span`,{className:`break-words whitespace-pre-wrap`,children:e.content})]},e.id)})})]}),C&&(0,X.jsx)(V,{className:`my-0`,children:C}),(0,X.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,X.jsxs)(M,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,disabled:E,onClick:()=>void re(),children:[(0,X.jsx)(w,{}),d(`memory:memoryPage.delete`)]}),ae?(0,X.jsxs)(X.Fragment,{children:[k.status===`stale`&&(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:E,onClick:()=>void ne(()=>U(k.id,`confirm`),d(`memory:memoryPage.confirmed`)),children:[(0,X.jsx)(Ae,{}),d(`memory:memoryPage.confirmStillValid`)]}),(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:E,onClick:()=>void ne(()=>U(k.id,k.pinned?`unpin`:`pin`),k.pinned?d(`memory:memoryPage.unpinned`):d(`memory:memoryPage.pinned`)),children:[k.pinned?(0,X.jsx)(_,{}):(0,X.jsx)(v,{}),k.pinned?d(`memory:memoryPage.unpin`):d(`memory:memoryPage.pin`)]}),(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:E,onClick:()=>s(k),children:[(0,X.jsx)(g,{}),d(`memory:memoryPage.edit`)]})]}):(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:E,onClick:()=>void ne(()=>U(k.id,`restore`),d(`memory:memoryPage.restored`)),children:[(0,X.jsx)(S,{}),d(`memory:memoryPage.restore`)]})]})]})}var Ye=[`concept`,`file`,`risk`,`preference`,`decision`,`fact`,`task`],Xe=[.3,.5,.8,1];function Ze(e){let t=e??.5;return Xe.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e)}function Qe(e){return e instanceof Error?e.message:String(e)}function $e({spaces:e,node:t,initialSpaceId:n,onClose:r,onSaved:i}){let{t:o}=a(),[s,c]=(0,J.useState)({spaceId:t?.spaceId||n||e[0]?.id||``,title:t?.title||``,content:t?.content||``,type:t?.type||`concept`,sourcePath:t?.sourcePath||``,importance:Ze(t?.importance)}),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(``),p=o(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`),m=async e=>{if(e.preventDefault(),!l){u(!0),f(``);try{t?await Se(t.id,s):await G(s),await i(o(t?`memory:memoryPage.memoryUpdated`:`memory:memoryPage.memoryCreated`))}catch(e){f(Qe(e))}finally{u(!1)}}};return(0,X.jsx)(L,{open:!0,busy:l,onOpenChange:e=>!e&&r(),children:(0,X.jsx)(P,{size:`compact`,children:(0,X.jsxs)(`form`,{className:`grid min-w-0 gap-3`,onSubmit:e=>void m(e),children:[(0,X.jsxs)(le,{children:[(0,X.jsx)(F,{children:p}),(0,X.jsx)(N,{children:o(`memory:memoryPage.memoryDialogHint`)})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.memoryTitle`),(0,X.jsx)(R,{value:s.title,onChange:e=>c({...s,title:e.target.value}),placeholder:o(`memory:memoryPage.forExampleProjectUIConstraints`)})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.memoryContent`),(0,X.jsx)(ue,{value:s.content,onChange:e=>c({...s,content:e.target.value}),placeholder:o(`memory:memoryPage.recordStandaloneReusableMemoryForFutureChats`)})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.memorySpace`),(0,X.jsx)(ye,{value:s.spaceId,onChange:e=>c({...s,spaceId:e.target.value}),children:e.map(e=>(0,X.jsx)(`option`,{value:e.id,children:Be(e,o)},e.id))})]}),(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-x-2.5 gap-y-3 sm:grid-cols-2`,children:[(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.memoryType`),(0,X.jsx)(ye,{value:s.type,onChange:e=>c({...s,type:e.target.value}),children:Ye.map(e=>(0,X.jsx)(`option`,{value:e,children:Ie(e,o)},e))})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.importance`),(0,X.jsxs)(ye,{value:s.importance,onChange:e=>c({...s,importance:Number(e.target.value)}),children:[(0,X.jsx)(`option`,{value:`0.3`,children:o(`memory:memoryPage.normal`)}),(0,X.jsx)(`option`,{value:`0.5`,children:o(`memory:memoryPage.common`)}),(0,X.jsx)(`option`,{value:`0.8`,children:o(`memory:memoryPage.important`)}),(0,X.jsx)(`option`,{value:`1`,children:o(`memory:memoryPage.strict`)})]})]})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.relatedFilePath`),(0,X.jsx)(R,{value:s.sourcePath,onChange:e=>c({...s,sourcePath:e.target.value}),placeholder:o(`memory:memoryPage.optionalForExampleECodeProjectREADMEMd`)})]}),d&&(0,X.jsx)(V,{children:d}),(0,X.jsxs)(I,{children:[(0,X.jsx)(M,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:l,onClick:r,children:o(`memory:memoryPage.cancel`)}),(0,X.jsxs)(M,{type:`submit`,size:`dialogAction`,disabled:l||!s.spaceId||!s.title.trim()||!s.content.trim(),children:[l&&(0,X.jsx)(se,{className:`text-current`}),o(l?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})})}function et({space:e,onClose:t,onSaved:n}){let{t:r}=a(),[i,o]=(0,J.useState)(e?.name||``),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(``),d=r(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`),f=async t=>{if(t.preventDefault(),!s){c(!0),u(``);try{await n(e?await De(e.id,i):await Ce(i),r(e?`memory:memoryPage.memorySpaceRenamed`:`memory:memoryPage.memorySpaceCreated`))}catch(e){u(Qe(e))}finally{c(!1)}}};return(0,X.jsx)(L,{open:!0,busy:s,onOpenChange:e=>!e&&t(),children:(0,X.jsx)(P,{size:`compact`,children:(0,X.jsxs)(`form`,{className:`grid min-w-0 gap-3`,onSubmit:e=>void f(e),children:[(0,X.jsxs)(le,{children:[(0,X.jsx)(F,{children:d}),(0,X.jsx)(N,{children:r(`memory:memoryPage.memorySpaceHint`)})]}),(0,X.jsxs)(B,{variant:`control`,children:[r(`memory:memoryPage.memorySpaceName`),(0,X.jsx)(R,{value:i,onChange:e=>o(e.target.value),placeholder:r(`memory:memoryPage.forExampleProductDesignGuidelines`),autoFocus:!0})]}),l&&(0,X.jsx)(V,{children:l}),(0,X.jsxs)(I,{children:[(0,X.jsx)(M,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:s,onClick:t,children:r(`memory:memoryPage.cancel`)}),(0,X.jsxs)(M,{type:`submit`,size:`dialogAction`,disabled:s||!i.trim(),children:[s&&(0,X.jsx)(se,{className:`text-current`}),r(s?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})})}var tt=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate());function nt(e){let t=tt(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate()-(t.getDay()+6)%7)}function rt(e,t,n=Date.now()){let r=new Date(n),i=tt(r).getTime(),a=i-864e5,o=nt(r).getTime(),s=new Map,c=(e,t)=>{let n=s.get(e.key);n?n.items.push(t):s.set(e.key,{...e,items:[t]})};for(let n of e){let e=Date.parse(t(n)||``);if(Number.isNaN(e))c({key:`unknown`,kind:`unknown`},n);else if(e>=i)c({key:`today`,kind:`today`},n);else if(e>=a)c({key:`yesterday`,kind:`yesterday`},n);else if(e>=o)c({key:`week`,kind:`week`},n);else{let t=new Date(e);c({key:`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}`,kind:`month`,month:new Date(t.getFullYear(),t.getMonth(),1)},n)}}return[...s.values()]}var it=(0,J.lazy)(()=>t(()=>import(`./MemoryEvolution-B8IeSLcd.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]))),Q=`all`;function at(){try{let e=n.getItem(o.memoryView);return e===`timeline`||e===`activity`?e:`evolution`}catch{return`evolution`}}function ot(e){try{n.setItem(o.memoryView,e)}catch{}}function $(e){return e instanceof Error?e.message:String(e)}var st={spaces:[],selectedSpaceId:``,nodes:[]};function ct({notify:e,onBack:t,requestConfirm:n}){let{t:r,language:i}=a(),o=ce(`focusSearch`),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(at),[f,p]=(0,J.useState)(Q),[m,h]=(0,J.useState)(`current`),[g,_]=(0,J.useState)(st),[v,x]=(0,J.useState)(!0),[S,C]=(0,J.useState)(!1),[w,T]=(0,J.useState)(!1),[ee,j]=(0,J.useState)(``),[se,N]=(0,J.useState)(``),[P,F]=(0,J.useState)(null),[I,le]=(0,J.useState)(0),[L,R]=(0,J.useState)(null),[ue,B]=(0,J.useState)(null),[be,V]=(0,J.useState)(!1),H=(0,J.useRef)(0),U=(0,J.useCallback)(async()=>{let e=++H.current;x(!0),j(``);try{let t=await xe({spaceId:f,query:s,status:m});if(e!==H.current)return;_(t),T(!0),t.selectedSpaceId&&t.selectedSpaceId!==f&&p(t.selectedSpaceId)}catch(t){e===H.current&&j($(t))}finally{e===H.current&&x(!1)}},[s,f,m]);(0,J.useEffect)(()=>(U(),()=>{H.current+=1}),[U,I]);let Se=async()=>{let e=g.nodes.at(-1),t=e?.validFrom||e?.createdAt;if(!t||S)return;let n=H.current;C(!0);try{let e=await xe({spaceId:f,status:m,before:t});if(n!==H.current)return;_(t=>{let n=new Set(t.nodes.map(e=>e.id));return{...e,nodes:[...t.nodes,...e.nodes.filter(e=>!n.has(e.id))]}})}catch(e){n===H.current&&j($(e))}finally{C(!1)}},Ce=(0,J.useCallback)(()=>le(e=>e+1),[]),W=(0,J.useCallback)(t=>{e(t),Ce()},[e,Ce]),we=(0,J.useCallback)(e=>{N(``),F(null),W(e)},[W]),De=(0,J.useMemo)(()=>[...g.spaces].sort((e,t)=>Number(t.kind===`global`)-Number(e.kind===`global`)),[g.spaces]),G=g.spaces.find(e=>e.id===f)||null,K=!!s.trim(),Ae=(0,J.useMemo)(()=>rt(g.nodes,e=>e.validFrom||e.createdAt),[g.nodes]),je=e=>{let t=e;u(t),ot(t)},Me=e=>{c(e),N(``),e.trim()&&l!==`timeline`&&u(`timeline`)},q=e=>{p(e),N(``),F(null)},Ne=async()=>{if(G&&await n({title:r(`memory:memoryPage.deleteMemorySpace`),message:r(`memory:memoryPage.deleteMemorySpaceNameAndAllMemoriesInIt`,{name:Be(G,r)}),confirmLabel:r(`memory:memoryPage.delete`)}))try{await Ee(G.id),q(Q),W(r(`memory:memoryPage.memorySpaceDeleted`))}catch(e){j($(e))}},Pe=async()=>{try{let{markdown:t}=await Oe(f===Q?``:f),n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),i=document.createElement(`a`);i.href=n,i.download=`pisper-memory-${new Date().toISOString().slice(0,10)}.md`,i.click(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3),e(r(`memory:memoryPage.exported`))}catch(e){j($(e))}},Re=async()=>{if(!be){V(!0),j(``);try{let e=await Te();W(e.ran?r(`memory:memoryPage.consolidated`):r(`memory:memoryPage.nothingToConsolidate`))}catch(e){j($(e))}finally{V(!1)}}},Y=async()=>{if(await n({title:r(`memory:memoryPage.clearEpisodes`),message:r(`memory:memoryPage.clearEpisodesConfirm`),confirmLabel:r(`memory:memoryPage.clearEpisodesAction`)}))try{let{cleared:e}=await ke(f===Q?``:f);W(r(`memory:memoryPage.episodesCleared`,{count:e}))}catch(e){j($(e))}},He=!!G&&G?.kind!==`global`,Ue=e=>(0,X.jsx)(Je,{id:e.id,fallback:e,spaces:g.spaces,refreshKey:I,onEdit:R,onChanged:W,onDeleted:we,requestConfirm:n}),We=e=>{let t=Fe[e.type]||Fe.concept,n=ze(e,r),a=g.spaces.find(t=>t.id===e.spaceId);return(0,X.jsx)(pe,{"data-memory-node":e.id,icon:(0,X.jsx)(t,{}),name:e.title,nameMeta:Ie(e.type,r),description:se===e.id?void 0:e.content,meta:(0,X.jsxs)(`span`,{className:`truncate tabular-nums`,children:[Ve(e.validFrom||e.createdAt,i),f===Q&&a?` · ${Be(a,r)}`:``,` · ${Le(e.sourceType,r)}`]}),status:n.length?(0,X.jsx)(qe,{labels:n}):void 0,expanded:se===e.id,onExpandedChange:t=>N(t?e.id:``),toggleLabel:e.title,detail:Ue(e)},e.id)},Ge=e=>e.kind===`today`?r(`memory:memoryPage.groupToday`):e.kind===`yesterday`?r(`memory:memoryPage.groupYesterday`):e.kind===`week`?r(`memory:memoryPage.groupThisWeek`):e.kind===`unknown`||!e.month?r(`memory:memoryPage.groupUnknown`):new Intl.DateTimeFormat(i,{year:`numeric`,month:`long`}).format(e.month),Z=r(K?`memory:memoryPage.noMatchingMemories`:m===`archived`?`memory:memoryPage.noArchivedMemories`:m===`history`?`memory:memoryPage.noHistoryVersions`:`memory:memoryPage.noMemoriesInSpace`);return(0,X.jsx)(ae,{asChild:!0,value:l,onValueChange:je,className:`gap-0`,children:(0,X.jsxs)(ge,{title:r(`navigation:navigation.memory`),description:r(`memory:memoryPage.lede`),back:t&&{label:r(`navigation:sidebar.features`),ariaLabel:r(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,X.jsx)(_e,{search:(0,X.jsx)(fe,{id:E,value:s,onValueChange:Me,placeholder:r(`navigation:pageHeader.searchMemoriesOrFiles`),shortcut:o,clearLabel:r(`navigation:more.clearSearch`)}),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(M,{type:`button`,className:`h-9`,disabled:!w,onClick:()=>R({spaceId:f===Q?`global`:f}),children:[(0,X.jsx)(y,{}),r(`memory:memoryPage.addMemory`)]}),(0,X.jsxs)(k,{children:[(0,X.jsx)(te,{asChild:!0,children:(0,X.jsx)(M,{type:`button`,variant:`secondary`,size:`icon-lg`,className:`max-[650px]:max-w-11`,disabled:!w,"aria-label":r(`memory:memoryPage.moreActions`),title:r(`memory:memoryPage.moreActions`),children:(0,X.jsx)(d,{})})}),(0,X.jsxs)(ne,{align:`end`,children:[(0,X.jsx)(O,{onSelect:()=>B(`new`),children:r(`memory:memoryPage.newMemorySpace`)}),(0,X.jsx)(O,{disabled:!He,onSelect:()=>G&&B(G),children:r(`memory:memoryPage.renameMemorySpace`)}),(0,X.jsx)(O,{variant:`destructive`,disabled:!He,onSelect:()=>void Ne(),children:r(`memory:memoryPage.deleteMemorySpace`)}),(0,X.jsx)(D,{}),(0,X.jsx)(O,{onSelect:()=>void Pe(),children:r(`memory:memoryPage.exportMarkdown`)}),(0,X.jsx)(O,{disabled:be,onSelect:()=>void Re(),children:r(`memory:memoryPage.consolidateNow`)}),(0,X.jsx)(O,{onSelect:()=>void Y(),children:r(`memory:memoryPage.clearEpisodes`)})]})]})]}),filters:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(ie,{"aria-label":r(`memory:memoryPage.viewsLabel`),children:[(0,X.jsx)(A,{value:`evolution`,children:r(`memory:memoryPage.evolutionView`)}),(0,X.jsx)(A,{value:`timeline`,children:r(`memory:memoryPage.timelineView`)}),(0,X.jsx)(A,{value:`activity`,children:r(`memory:memoryPage.activityView`)})]}),(0,X.jsxs)(ye,{className:`w-[200px] max-w-full max-[650px]:w-full`,"aria-label":r(`memory:memoryPage.memorySpace`),value:f,disabled:!w,onChange:e=>q(e.target.value),children:[(0,X.jsx)(`option`,{value:Q,children:r(`memory:memoryPage.allSpaces`)}),De.map(e=>(0,X.jsx)(`option`,{value:e.id,children:`${Be(e,r)} · ${e.nodeCount}`},e.id))]})]}),l===`timeline`&&w&&(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[K?(0,X.jsxs)(`p`,{className:`m-0 text-[13px] font-medium text-content-muted tabular-nums`,children:[r(`memory:memoryPage.searchResults`),` · `,g.nodes.length]}):(0,X.jsx)(oe,{"aria-label":r(`memory:memoryPage.statusFilterLabel`),value:m,onValueChange:e=>{h(e),N(``)},options:[{value:`current`,label:r(`memory:memoryPage.statusCurrent`),count:g.counts?.current},{value:`archived`,label:r(`memory:memoryPage.statusArchived`),count:g.counts?.archived},{value:`history`,label:r(`memory:memoryPage.statusHistory`),count:g.counts?.history}]}),(0,X.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted max-[650px]:size-11`,loading:v,disabled:v,"aria-label":r(`memory:memoryPage.refresh`),title:r(`memory:memoryPage.refresh`),onClick:Ce,children:(0,X.jsx)(b,{})})]})]})}),children:[!w&&v?(0,X.jsx)(z,{kind:`loading`,title:r(`common:pageTemplate.loading`)}):w?(0,X.jsxs)(X.Fragment,{children:[ee&&(0,X.jsx)(ve,{children:ee}),(0,X.jsxs)(`div`,{className:`mt-5 min-w-0`,"aria-busy":v,children:[(0,X.jsxs)(re,{value:`evolution`,className:`flex min-w-0 flex-col gap-3`,children:[(0,X.jsx)(J.Suspense,{fallback:(0,X.jsx)(z,{kind:`loading`,title:r(`common:pageTemplate.loading`)}),children:(0,X.jsx)(it,{spaceId:f,refreshKey:I,selectedId:P,onSelect:F})}),(0,X.jsx)(`div`,{role:`region`,"data-memory-detail":!0,"aria-label":r(`memory:memoryPage.selectedMemory`),className:`min-w-0 rounded-[var(--r-md)] border border-stroke px-4 py-3`,children:P?(0,X.jsx)(Je,{id:P,spaces:g.spaces,refreshKey:I,withHeading:!0,onClose:()=>F(null),onEdit:R,onChanged:W,onDeleted:we,requestConfirm:n}):(0,X.jsx)(`p`,{className:`m-0 text-xs leading-normal text-content-muted`,children:r(`memory:memoryPage.selectAMemoryToViewDetails`)})})]}),(0,X.jsxs)(re,{value:`timeline`,className:`min-w-0`,"data-memory-timeline":!0,children:[g.nodes.length?K?(0,X.jsx)(me,{children:g.nodes.map(We)}):Ae.map(e=>(0,X.jsx)(he,{"data-memory-group":e.key,className:`mt-5 first:mt-0`,title:Ge(e),count:e.items.length,children:(0,X.jsx)(me,{children:e.items.map(We)})},e.key)):(0,X.jsx)(de,{compact:!0,title:Z}),!K&&g.hasMore&&(0,X.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,X.jsx)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,loading:S,disabled:S,onClick:()=>void Se(),children:r(`memory:memoryPage.loadMore`)})})]}),(0,X.jsx)(re,{value:`activity`,className:`min-w-0`,children:(0,X.jsx)(Ke,{spaceId:f,refreshKey:I,onChanged:W})})]})]}):(0,X.jsx)(z,{kind:`error`,title:r(`memory:memoryPage.loadFailed`),description:ee,action:(0,X.jsx)(M,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void U(),children:r(`common:pageTemplate.retry`)})}),L&&(0,X.jsx)($e,{spaces:De,node:`id`in L?L:null,initialSpaceId:L.spaceId,onClose:()=>R(null),onSaved:e=>{R(null),W(e)}}),ue&&(0,X.jsx)(et,{space:ue===`new`?null:ue,onClose:()=>B(null),onSaved:(e,t)=>{B(null),q(e.id),W(t)}})]})})}export{ct as MemoryPage};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryEvolution-Cwdreg5P.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-CIheiCov.js","assets/i18n-zKD1z9i9.js","assets/vendor-router-CSN_DGvx.js","assets/index-CwdjZZLG.js","assets/index-l96Dl6z6.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/info-DATxy0fb.js","assets/pause-CYWpPg1R.js","assets/play-DNDjDNGn.js","assets/x-07u4-129.js","assets/popover-Cw7QFeII.js","assets/dist-41X0pdUs.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/dialog-BgFAhLng.js","assets/dist-BHkR6BLP.js","assets/button-CCcCN8tE.js","assets/slider-De8rWVNs.js","assets/dist-DzGQ7sLi.js","assets/dist-BS3ekNDj.js","assets/segmented-control-xkrEOP_d.js","assets/dist-BaBySQmo.js","assets/PageState-Cz6vFMXv.js","assets/motion-DTR4ZVle.js","assets/memory-api-DilYLnpG.js","assets/api-_MWfl2VL.js","assets/abort-signal-f4JsiYKX.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{t as n}from"./index-CwdjZZLG.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{t as a}from"./use-i18n-CIheiCov.js";import{t as o}from"./storage-DtvZ_lEu.js";import{u as s}from"./api-_MWfl2VL.js";import{t as c}from"./createLucideIcon-Cd-3GVxJ.js";import{t as l}from"./archive-ojKJT7Fp.js";import{t as u}from"./book-open-BuHHD9os.js";import{t as d}from"./ellipsis-CfGKfbq6.js";import{t as f}from"./file-code-corner-BnE1ljT0.js";import{n as p,r as m,t as h}from"./undo-2-C-xQ0UVT.js";import{t as g}from"./pencil-U08v_vV9.js";import{t as _}from"./pin-off-BpRu_vrC.js";import{t as v}from"./pin-CU0FG0lI.js";import{t as y}from"./plus-fQbSqB1n.js";import{t as b}from"./refresh-cw-TbWxTY4K.js";import{t as x}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as S}from"./rotate-ccw-C0v8V77_.js";import{t as C}from"./sliders-horizontal-Dryf1XyC.js";import{t as w}from"./trash-2-CNrPOoPR.js";import{t as T}from"./triangle-alert-CE1q54ci.js";import{t as ee}from"./x-07u4-129.js";import{t as E}from"./more-pages-D_PnxLN0.js";import{c as D,i as O,p as te,r as ne,t as k}from"./dropdown-menu-Ds0gD8S8.js";import{i as A,n as re,r as ie,t as ae}from"./tabs-DsgBuvJv.js";import{t as oe}from"./segmented-control-xkrEOP_d.js";import{t as j}from"./utils-C8uzG5AZ.js";import{n as se,t as M}from"./button-CCcCN8tE.js";import{s as ce}from"./shortcuts-CVPFuAiJ.js";import{a as N,i as P,l as F,o as I,s as le,t as L}from"./dialog-BgFAhLng.js";import{t as R}from"./input-CPw-zkYh.js";import{t as ue}from"./textarea-DmATpOqT.js";import{n as z,t as de}from"./PageState-Cz6vFMXv.js";import{a as fe,i as pe,n as me,o as he,r as ge,s as _e,t as ve}from"./FeaturePage-DD_32h19.js";import{n as B}from"./field-DoLEb0np.js";import{t as ye}from"./AppSelect-DQYKUW5E.js";import{t as be}from"./badge-CWB3lj2H.js";import{i as V}from"./app-primitives-Drz_SjnR.js";import{a as H,c as xe,f as U,h as Se,i as Ce,l as W,m as we,n as Te,o as Ee,p as De,r as G,s as Oe,t as ke,u as K}from"./memory-api-DilYLnpG.js";var Ae=c(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),je=c(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Me=c(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),q=c(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Ne=c(`milestone`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M12 3v3`,key:`1n5kay`}],[`path`,{d:`M18.172 6a2 2 0 0 1 1.414.586l2.06 2.06a1.207 1.207 0 0 1 0 1.708l-2.06 2.06a2 2 0 0 1-1.414.586H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z`,key:`8gz4t4`}]]),Pe=c(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),J=e(r(),1),Fe={concept:m,file:f,risk:T,preference:C,decision:Ne,fact:u,task:p};function Ie(e,t){return t(e===`file`?`memory:memoryPage.fileType`:e===`risk`?`memory:memoryPage.riskType`:e===`preference`?`memory:memoryPage.preferenceType`:e===`decision`?`memory:memoryPage.decisionType`:e===`fact`?`memory:memoryPage.factType`:e===`task`?`memory:memoryPage.taskType`:`memory:memoryPage.conceptType`)}function Le(e,t){return t(e===`manual`?`memory:memoryPage.sourceManual`:e===`user_confirmed`?`memory:memoryPage.sourceUserRequest`:e===`agent`?`memory:memoryPage.sourceAgent`:e===`tool_verified`?`memory:memoryPage.sourceTool`:e===`external`?`memory:memoryPage.sourceExternal`:`memory:memoryPage.sourceConversation`)}function Re(e,t){return t(e===`assistant`?`memory:memoryPage.roleAssistant`:e===`tool`?`memory:memoryPage.roleTool`:e===`external`?`memory:memoryPage.roleExternal`:e===`manual`?`memory:memoryPage.roleManual`:`memory:memoryPage.roleUser`)}function ze(e,t){return[e.pinned&&t(`memory:memoryPage.pinnedBadge`),e.status===`stale`&&t(`memory:memoryPage.staleBadge`),e.tainted&&t(`memory:memoryPage.taintedBadge`),e.status===`archived`&&t(`memory:memoryPage.archivedBadge`),e.status===`superseded`&&t(`memory:memoryPage.supersededBadge`)].filter(e=>!!e)}function Be(e,t){return e?.kind===`global`?t(`memory:memoryPage.globalMemorySpace`):e?.name||``}function Y(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(n)}function Ve(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`}).format(n)}function He(e,t){let n={add:{icon:y,label:()=>t(`memory:memoryPage.eventAdd`)},supersede:{icon:Pe,label:()=>t(`memory:memoryPage.eventSupersede`)},merge:{icon:q,label:()=>t(`memory:memoryPage.eventMerge`)},archive:{icon:l,label:()=>t(`memory:memoryPage.eventArchive`)},expire:{icon:je,label:()=>t(`memory:memoryPage.eventExpire`)},stale:{icon:T,label:()=>t(`memory:memoryPage.eventStale`)},confirm:{icon:Ae,label:()=>t(`memory:memoryPage.eventConfirm`)},restore:{icon:S,label:()=>t(`memory:memoryPage.eventRestore`)},edit:{icon:g,label:()=>t(`memory:memoryPage.eventEdit`)},pin:{icon:v,label:()=>t(`memory:memoryPage.eventPin`)},unpin:{icon:_,label:()=>t(`memory:memoryPage.eventUnpin`)},delete:{icon:w,label:()=>t(`memory:memoryPage.eventDelete`)},purge:{icon:Me,label:()=>t(`memory:memoryPage.eventPurge`)},undo:{icon:h,label:()=>t(`memory:memoryPage.eventUndo`)},reinforce:{icon:b,label:()=>t(`memory:memoryPage.eventReinforce`)},migrate:{icon:x,label:()=>t(`memory:memoryPage.eventMigrate`)},consolidate:{icon:q,label:()=>t(`memory:memoryPage.eventConsolidate`)}}[e];return n?{icon:n.icon,label:n.label()}:{icon:x,label:t(`memory:memoryPage.eventGeneric`)}}function Ue(e,t){return e===`user`||e===`manual`||e===`user_confirmed`?t(`memory:memoryPage.actorYou`):[`consolidator`,`reconcile`,`lifecycle`].includes(e)?t(`memory:memoryPage.actorConsolidator`):t(e===`conversation`?`memory:memoryPage.actorConversation`:e===`agent`||e===`tool_verified`?`memory:memoryPage.actorAgent`:e===`external`?`memory:memoryPage.sourceExternal`:`memory:memoryPage.actorSystem`)}function We(e,t){if(e===`same_identity`)return t(`memory:memoryPage.reasonSameIdentity`);if(e===`lower_authority_conflict`)return t(`memory:memoryPage.reasonLowerAuthority`);if(e===`expired`||e===`retention_expired`)return t(`memory:memoryPage.reasonExpired`);if(e===`unused`||e===`low_utility`)return t(`memory:memoryPage.reasonLowUtility`);if(e===`user_deleted`)return t(`memory:memoryPage.reasonUserDeleted`);if(e===`user_requested`)return t(`memory:memoryPage.reasonUserRequested`);let n=/^digests:(\d+) merged:(\d+)$/.exec(e);if(n){let e=Number(n[1]),r=Number(n[2]);return e&&r?t(`memory:memoryPage.reasonConsolidatedBoth`,{digests:e,merged:r}):r?t(`memory:memoryPage.reasonConsolidatedMerged`,{merged:r}):t(`memory:memoryPage.reasonConsolidatedDigests`,{digests:e})}let r=/^promoted (\d+) pending candidates$/.exec(e);return r?t(`memory:memoryPage.reasonPromoted`,{count:Number(r[1])}):e}var X=i(),Ge=50;function Ke({spaceId:e,refreshKey:t,onChanged:n}){let{t:r,language:i}=a(),[o,c]=(0,J.useState)([]),[l,u]=(0,J.useState)(!0),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1),[g,_]=(0,J.useState)(!1),[v,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),S=(0,J.useRef)(0),C=e===`all`?``:e,w=(0,J.useCallback)(async()=>{let e=++S.current;u(!0),y(``);try{let t=await K({spaceId:C,limit:Ge});if(e!==S.current)return;c(t.events),m(t.events.length>=Ge),_(!1)}catch(t){if(e!==S.current)return;t instanceof s&&t.status===404?_(!0):y(t instanceof Error?t.message:String(t))}finally{e===S.current&&u(!1)}},[C]);(0,J.useEffect)(()=>(w(),()=>{S.current+=1}),[w,t]);let T=async()=>{let e=o.at(-1)?.at;if(!e||d)return;let t=S.current;f(!0);try{let n=await K({spaceId:C,before:e,limit:Ge});if(t!==S.current)return;c(e=>{let t=new Set(e.map(e=>e.id));return[...e,...n.events.filter(e=>!t.has(e.id))]}),m(n.events.length>=Ge)}catch(e){t===S.current&&y(e instanceof Error?e.message:String(e))}finally{f(!1)}},ee=async e=>{if(!b){x(e.id),y(``);try{await we(e.id),await n(r(`memory:memoryPage.eventUndone`))}catch(e){y(e instanceof Error?e.message:String(e))}finally{x(``)}}};return g?(0,X.jsx)(de,{compact:!0,title:r(`memory:memoryPage.activityUnsupported`)}):l&&!o.length?(0,X.jsx)(z,{kind:`loading`,title:r(`common:pageTemplate.loading`)}):v&&!o.length?(0,X.jsx)(z,{kind:`error`,title:r(`memory:memoryPage.activityLoadFailed`),description:v,action:(0,X.jsx)(M,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void w(),children:r(`common:pageTemplate.retry`)})}):o.length?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[v&&(0,X.jsx)(ve,{className:`mt-0`,children:v}),(0,X.jsx)(me,{children:o.map(e=>{let{icon:t,label:n}=He(e.action,r),a=e.reason?We(e.reason,r):``;return(0,X.jsx)(pe,{"data-memory-event":e.action,icon:(0,X.jsx)(t,{}),name:n,description:[...new Set(e.titles||[])].join(`、`)||void 0,meta:(0,X.jsxs)(`span`,{className:`truncate tabular-nums`,children:[Y(e.at,i),` · `,Ue(e.actor,r),a?` · ${a}`:``]}),status:e.undoneAt?r(`memory:memoryPage.undone`):void 0,actions:e.undoable?(0,X.jsxs)(M,{variant:`ghost`,size:`sm`,disabled:!!b,"aria-label":`${r(`memory:memoryPage.undo`)}: ${n}`,onClick:()=>void ee(e),children:[(0,X.jsx)(h,{}),r(`memory:memoryPage.undo`)]}):void 0},e.id)})}),p&&(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsx)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,loading:d,disabled:d,onClick:()=>void T(),children:r(`memory:memoryPage.loadMore`)})})]}):(0,X.jsx)(de,{compact:!0,title:r(`memory:memoryPage.noActivity`)})}var Z=`flex min-h-[34px] min-w-0 items-center justify-between gap-4 border-t border-stroke-soft text-sm [&>dd]:min-w-0 [&>dd]:truncate [&>dd]:text-right [&>dd]:text-content [&>dt]:shrink-0 [&>dt]:text-content-muted`;function qe({labels:e}){return(0,X.jsx)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:e.map(e=>(0,X.jsx)(be,{children:e},e))})}function Je({id:e,fallback:t=null,spaces:n,refreshKey:r=0,withHeading:i=!1,onClose:o,onEdit:s,onChanged:c,onDeleted:l,requestConfirm:u}){let{t:d,language:f}=a(),[p,m]=(0,J.useState)(null),[h,y]=(0,J.useState)(!0),[b,x]=(0,J.useState)(``),[C,T]=(0,J.useState)(``),[E,D]=(0,J.useState)(!1),[O,te]=(0,J.useState)(0);(0,J.useEffect)(()=>{let t=new AbortController;return y(!0),x(``),W(e,t.signal).then(e=>{t.signal.aborted||(m(e),y(!1))}).catch(e=>{t.signal.aborted||(x(e instanceof Error?e.message:String(e)),y(!1))}),()=>t.abort()},[e,r,O]);let ne=(0,J.useCallback)(async(e,t)=>{D(!0),T(``);try{await e(),await c(t)}catch(e){T(e instanceof Error?e.message:String(e))}finally{D(!1)}},[c]),k=p?.item?.id===e?p.item:t,A=p?.item?.id===e?p.history:[],re=async()=>{if(k&&await u({title:d(`memory:memoryPage.deleteMemory`),message:d(`memory:memoryPage.deleteMemoryName`,{name:k.title}),confirmLabel:d(`memory:memoryPage.delete`)})){D(!0),T(``);try{await H(k.id),await l(d(`memory:memoryPage.memoryDeleted`))}catch(e){T(e instanceof Error?e.message:String(e)),D(!1)}}};if(!k)return(0,X.jsx)(`div`,{className:`flex min-h-16 items-center gap-2 text-xs text-content-muted`,children:h?(0,X.jsx)(se,{className:`size-4`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(V,{className:`my-0`,children:b||d(`memory:memoryPage.detailLoadFailed`)}),(0,X.jsx)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>te(e=>e+1),children:d(`memory:memoryPage.retry`)})]})});let ie=n.find(e=>e.id===k.spaceId),ae=k.status===`active`||k.status===`stale`||!k.status,oe=ze(k,d);return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,"aria-busy":h||E||void 0,children:[i&&(0,X.jsxs)(`header`,{className:`flex min-w-0 items-start gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`h3`,{className:`text-[15px] leading-6 font-medium break-words text-content`,children:k.title}),oe.length>0&&(0,X.jsx)(qe,{labels:oe})]}),o&&(0,X.jsx)(M,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`-mt-0.5 flex-none max-[650px]:size-11`,"aria-label":d(`memory:memoryPage.closeDetail`),onClick:o,children:(0,X.jsx)(ee,{})})]}),(0,X.jsx)(`p`,{className:`text-[13px] leading-normal break-words whitespace-pre-wrap text-content-secondary`,children:k.content}),k.status===`stale`&&(0,X.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:d(`memory:memoryPage.staleHint`)}),k.tainted&&(0,X.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:d(`memory:memoryPage.taintedHint`)}),(0,X.jsxs)(`dl`,{className:`m-0`,children:[(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.memoryType`)}),(0,X.jsx)(`dd`,{children:Ie(k.type,d)})]}),ie&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.memorySpace`)}),(0,X.jsx)(`dd`,{children:Be(ie,d)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.source`)}),(0,X.jsx)(`dd`,{children:Le(k.sourceType,d)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.validFrom`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(k.validFrom,f)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.validTo`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:k.validTo?Y(k.validTo,f):d(`memory:memoryPage.stillValid`)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.created`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(k.createdAt,f)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.confirmCount`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:k.confirmCount??1})]}),k.expiresAt&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.expires`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(k.expiresAt,f)})]}),k.sourcePath&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.relatedFilePath`)}),(0,X.jsx)(`dd`,{className:`font-mono text-xs`,title:k.sourcePath,children:k.sourcePath})]}),k.archiveReason&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.archiveReason`)}),(0,X.jsx)(`dd`,{title:We(k.archiveReason,d),children:We(k.archiveReason,d)})]})]}),k.evidence&&(0,X.jsxs)(`section`,{className:`min-w-0`,"aria-label":d(`memory:memoryPage.evidence`),children:[(0,X.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted`,children:[d(`memory:memoryPage.evidenceFrom`),` · `,Re(k.evidenceRole,d)]}),(0,X.jsx)(`blockquote`,{className:`m-0 border-l-2 border-stroke pl-2.5 text-xs leading-normal break-words whitespace-pre-wrap text-content-secondary`,children:k.evidence})]}),A.length>1&&(0,X.jsxs)(`section`,{className:`min-w-0`,"aria-label":d(`memory:memoryPage.versionHistory`),children:[(0,X.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[d(`memory:memoryPage.versionHistory`),` · `,A.length]}),(0,X.jsx)(`ol`,{"data-memory-history":!0,className:`m-0 flex list-none flex-col p-0`,children:A.map(e=>{let t=e.status===`active`||e.status===`stale`;return(0,X.jsxs)(`li`,{"aria-current":e.id===k.id||void 0,className:j(`flex min-w-0 flex-col gap-0.5 border-t border-stroke-soft py-1.5 text-xs leading-normal`,!t&&`text-content-muted`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1.5 tabular-nums`,children:[Ve(e.validFrom,f),t&&(0,X.jsx)(be,{children:d(`memory:memoryPage.currentVersion`)})]}),(0,X.jsx)(`span`,{className:`break-words whitespace-pre-wrap`,children:e.content})]},e.id)})})]}),C&&(0,X.jsx)(V,{className:`my-0`,children:C}),(0,X.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,X.jsxs)(M,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,disabled:E,onClick:()=>void re(),children:[(0,X.jsx)(w,{}),d(`memory:memoryPage.delete`)]}),ae?(0,X.jsxs)(X.Fragment,{children:[k.status===`stale`&&(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:E,onClick:()=>void ne(()=>U(k.id,`confirm`),d(`memory:memoryPage.confirmed`)),children:[(0,X.jsx)(Ae,{}),d(`memory:memoryPage.confirmStillValid`)]}),(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:E,onClick:()=>void ne(()=>U(k.id,k.pinned?`unpin`:`pin`),k.pinned?d(`memory:memoryPage.unpinned`):d(`memory:memoryPage.pinned`)),children:[k.pinned?(0,X.jsx)(_,{}):(0,X.jsx)(v,{}),k.pinned?d(`memory:memoryPage.unpin`):d(`memory:memoryPage.pin`)]}),(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:E,onClick:()=>s(k),children:[(0,X.jsx)(g,{}),d(`memory:memoryPage.edit`)]})]}):(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:E,onClick:()=>void ne(()=>U(k.id,`restore`),d(`memory:memoryPage.restored`)),children:[(0,X.jsx)(S,{}),d(`memory:memoryPage.restore`)]})]})]})}var Ye=[`concept`,`file`,`risk`,`preference`,`decision`,`fact`,`task`],Xe=[.3,.5,.8,1];function Ze(e){let t=e??.5;return Xe.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e)}function Qe(e){return e instanceof Error?e.message:String(e)}function $e({spaces:e,node:t,initialSpaceId:n,onClose:r,onSaved:i}){let{t:o}=a(),[s,c]=(0,J.useState)({spaceId:t?.spaceId||n||e[0]?.id||``,title:t?.title||``,content:t?.content||``,type:t?.type||`concept`,sourcePath:t?.sourcePath||``,importance:Ze(t?.importance)}),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(``),p=o(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`),m=async e=>{if(e.preventDefault(),!l){u(!0),f(``);try{t?await Se(t.id,s):await G(s),await i(o(t?`memory:memoryPage.memoryUpdated`:`memory:memoryPage.memoryCreated`))}catch(e){f(Qe(e))}finally{u(!1)}}};return(0,X.jsx)(L,{open:!0,busy:l,onOpenChange:e=>!e&&r(),children:(0,X.jsx)(P,{size:`compact`,children:(0,X.jsxs)(`form`,{className:`grid min-w-0 gap-3`,onSubmit:e=>void m(e),children:[(0,X.jsxs)(le,{children:[(0,X.jsx)(F,{children:p}),(0,X.jsx)(N,{children:o(`memory:memoryPage.memoryDialogHint`)})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.memoryTitle`),(0,X.jsx)(R,{value:s.title,onChange:e=>c({...s,title:e.target.value}),placeholder:o(`memory:memoryPage.forExampleProjectUIConstraints`)})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.memoryContent`),(0,X.jsx)(ue,{value:s.content,onChange:e=>c({...s,content:e.target.value}),placeholder:o(`memory:memoryPage.recordStandaloneReusableMemoryForFutureChats`)})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.memorySpace`),(0,X.jsx)(ye,{value:s.spaceId,onChange:e=>c({...s,spaceId:e.target.value}),children:e.map(e=>(0,X.jsx)(`option`,{value:e.id,children:Be(e,o)},e.id))})]}),(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-x-2.5 gap-y-3 sm:grid-cols-2`,children:[(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.memoryType`),(0,X.jsx)(ye,{value:s.type,onChange:e=>c({...s,type:e.target.value}),children:Ye.map(e=>(0,X.jsx)(`option`,{value:e,children:Ie(e,o)},e))})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.importance`),(0,X.jsxs)(ye,{value:s.importance,onChange:e=>c({...s,importance:Number(e.target.value)}),children:[(0,X.jsx)(`option`,{value:`0.3`,children:o(`memory:memoryPage.normal`)}),(0,X.jsx)(`option`,{value:`0.5`,children:o(`memory:memoryPage.common`)}),(0,X.jsx)(`option`,{value:`0.8`,children:o(`memory:memoryPage.important`)}),(0,X.jsx)(`option`,{value:`1`,children:o(`memory:memoryPage.strict`)})]})]})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.relatedFilePath`),(0,X.jsx)(R,{value:s.sourcePath,onChange:e=>c({...s,sourcePath:e.target.value}),placeholder:o(`memory:memoryPage.optionalForExampleECodeProjectREADMEMd`)})]}),d&&(0,X.jsx)(V,{children:d}),(0,X.jsxs)(I,{children:[(0,X.jsx)(M,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:l,onClick:r,children:o(`memory:memoryPage.cancel`)}),(0,X.jsxs)(M,{type:`submit`,size:`dialogAction`,disabled:l||!s.spaceId||!s.title.trim()||!s.content.trim(),children:[l&&(0,X.jsx)(se,{className:`text-current`}),o(l?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})})}function et({space:e,onClose:t,onSaved:n}){let{t:r}=a(),[i,o]=(0,J.useState)(e?.name||``),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(``),d=r(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`),f=async t=>{if(t.preventDefault(),!s){c(!0),u(``);try{await n(e?await De(e.id,i):await Ce(i),r(e?`memory:memoryPage.memorySpaceRenamed`:`memory:memoryPage.memorySpaceCreated`))}catch(e){u(Qe(e))}finally{c(!1)}}};return(0,X.jsx)(L,{open:!0,busy:s,onOpenChange:e=>!e&&t(),children:(0,X.jsx)(P,{size:`compact`,children:(0,X.jsxs)(`form`,{className:`grid min-w-0 gap-3`,onSubmit:e=>void f(e),children:[(0,X.jsxs)(le,{children:[(0,X.jsx)(F,{children:d}),(0,X.jsx)(N,{children:r(`memory:memoryPage.memorySpaceHint`)})]}),(0,X.jsxs)(B,{variant:`control`,children:[r(`memory:memoryPage.memorySpaceName`),(0,X.jsx)(R,{value:i,onChange:e=>o(e.target.value),placeholder:r(`memory:memoryPage.forExampleProductDesignGuidelines`),autoFocus:!0})]}),l&&(0,X.jsx)(V,{children:l}),(0,X.jsxs)(I,{children:[(0,X.jsx)(M,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:s,onClick:t,children:r(`memory:memoryPage.cancel`)}),(0,X.jsxs)(M,{type:`submit`,size:`dialogAction`,disabled:s||!i.trim(),children:[s&&(0,X.jsx)(se,{className:`text-current`}),r(s?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})})}var tt=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate());function nt(e){let t=tt(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate()-(t.getDay()+6)%7)}function rt(e,t,n=Date.now()){let r=new Date(n),i=tt(r).getTime(),a=i-864e5,o=nt(r).getTime(),s=new Map,c=(e,t)=>{let n=s.get(e.key);n?n.items.push(t):s.set(e.key,{...e,items:[t]})};for(let n of e){let e=Date.parse(t(n)||``);if(Number.isNaN(e))c({key:`unknown`,kind:`unknown`},n);else if(e>=i)c({key:`today`,kind:`today`},n);else if(e>=a)c({key:`yesterday`,kind:`yesterday`},n);else if(e>=o)c({key:`week`,kind:`week`},n);else{let t=new Date(e);c({key:`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}`,kind:`month`,month:new Date(t.getFullYear(),t.getMonth(),1)},n)}}return[...s.values()]}var it=(0,J.lazy)(()=>t(()=>import(`./MemoryEvolution-Cwdreg5P.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]))),Q=`all`;function at(){try{let e=n.getItem(o.memoryView);return e===`timeline`||e===`activity`?e:`evolution`}catch{return`evolution`}}function ot(e){try{n.setItem(o.memoryView,e)}catch{}}function $(e){return e instanceof Error?e.message:String(e)}var st={spaces:[],selectedSpaceId:``,nodes:[]};function ct({notify:e,onBack:t,requestConfirm:n}){let{t:r,language:i}=a(),o=ce(`focusSearch`),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(at),[f,p]=(0,J.useState)(Q),[m,h]=(0,J.useState)(`current`),[g,_]=(0,J.useState)(st),[v,x]=(0,J.useState)(!0),[S,C]=(0,J.useState)(!1),[w,T]=(0,J.useState)(!1),[ee,j]=(0,J.useState)(``),[se,N]=(0,J.useState)(``),[P,F]=(0,J.useState)(null),[I,le]=(0,J.useState)(0),[L,R]=(0,J.useState)(null),[ue,B]=(0,J.useState)(null),[be,V]=(0,J.useState)(!1),H=(0,J.useRef)(0),U=(0,J.useCallback)(async()=>{let e=++H.current;x(!0),j(``);try{let t=await xe({spaceId:f,query:s,status:m});if(e!==H.current)return;_(t),T(!0),t.selectedSpaceId&&t.selectedSpaceId!==f&&p(t.selectedSpaceId)}catch(t){e===H.current&&j($(t))}finally{e===H.current&&x(!1)}},[s,f,m]);(0,J.useEffect)(()=>(U(),()=>{H.current+=1}),[U,I]);let Se=async()=>{let e=g.nodes.at(-1),t=e?.validFrom||e?.createdAt;if(!t||S)return;let n=H.current;C(!0);try{let e=await xe({spaceId:f,status:m,before:t});if(n!==H.current)return;_(t=>{let n=new Set(t.nodes.map(e=>e.id));return{...e,nodes:[...t.nodes,...e.nodes.filter(e=>!n.has(e.id))]}})}catch(e){n===H.current&&j($(e))}finally{C(!1)}},Ce=(0,J.useCallback)(()=>le(e=>e+1),[]),W=(0,J.useCallback)(t=>{e(t),Ce()},[e,Ce]),we=(0,J.useCallback)(e=>{N(``),F(null),W(e)},[W]),De=(0,J.useMemo)(()=>[...g.spaces].sort((e,t)=>Number(t.kind===`global`)-Number(e.kind===`global`)),[g.spaces]),G=g.spaces.find(e=>e.id===f)||null,K=!!s.trim(),Ae=(0,J.useMemo)(()=>rt(g.nodes,e=>e.validFrom||e.createdAt),[g.nodes]),je=e=>{let t=e;u(t),ot(t)},Me=e=>{c(e),N(``),e.trim()&&l!==`timeline`&&u(`timeline`)},q=e=>{p(e),N(``),F(null)},Ne=async()=>{if(G&&await n({title:r(`memory:memoryPage.deleteMemorySpace`),message:r(`memory:memoryPage.deleteMemorySpaceNameAndAllMemoriesInIt`,{name:Be(G,r)}),confirmLabel:r(`memory:memoryPage.delete`)}))try{await Ee(G.id),q(Q),W(r(`memory:memoryPage.memorySpaceDeleted`))}catch(e){j($(e))}},Pe=async()=>{try{let{markdown:t}=await Oe(f===Q?``:f),n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),i=document.createElement(`a`);i.href=n,i.download=`pisper-memory-${new Date().toISOString().slice(0,10)}.md`,i.click(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3),e(r(`memory:memoryPage.exported`))}catch(e){j($(e))}},Re=async()=>{if(!be){V(!0),j(``);try{let e=await Te();W(e.ran?r(`memory:memoryPage.consolidated`):r(`memory:memoryPage.nothingToConsolidate`))}catch(e){j($(e))}finally{V(!1)}}},Y=async()=>{if(await n({title:r(`memory:memoryPage.clearEpisodes`),message:r(`memory:memoryPage.clearEpisodesConfirm`),confirmLabel:r(`memory:memoryPage.clearEpisodesAction`)}))try{let{cleared:e}=await ke(f===Q?``:f);W(r(`memory:memoryPage.episodesCleared`,{count:e}))}catch(e){j($(e))}},He=!!G&&G?.kind!==`global`,Ue=e=>(0,X.jsx)(Je,{id:e.id,fallback:e,spaces:g.spaces,refreshKey:I,onEdit:R,onChanged:W,onDeleted:we,requestConfirm:n}),We=e=>{let t=Fe[e.type]||Fe.concept,n=ze(e,r),a=g.spaces.find(t=>t.id===e.spaceId);return(0,X.jsx)(pe,{"data-memory-node":e.id,icon:(0,X.jsx)(t,{}),name:e.title,nameMeta:Ie(e.type,r),description:se===e.id?void 0:e.content,meta:(0,X.jsxs)(`span`,{className:`truncate tabular-nums`,children:[Ve(e.validFrom||e.createdAt,i),f===Q&&a?` · ${Be(a,r)}`:``,` · ${Le(e.sourceType,r)}`]}),status:n.length?(0,X.jsx)(qe,{labels:n}):void 0,expanded:se===e.id,onExpandedChange:t=>N(t?e.id:``),toggleLabel:e.title,detail:Ue(e)},e.id)},Ge=e=>e.kind===`today`?r(`memory:memoryPage.groupToday`):e.kind===`yesterday`?r(`memory:memoryPage.groupYesterday`):e.kind===`week`?r(`memory:memoryPage.groupThisWeek`):e.kind===`unknown`||!e.month?r(`memory:memoryPage.groupUnknown`):new Intl.DateTimeFormat(i,{year:`numeric`,month:`long`}).format(e.month),Z=r(K?`memory:memoryPage.noMatchingMemories`:m===`archived`?`memory:memoryPage.noArchivedMemories`:m===`history`?`memory:memoryPage.noHistoryVersions`:`memory:memoryPage.noMemoriesInSpace`);return(0,X.jsx)(ae,{asChild:!0,value:l,onValueChange:je,className:`gap-0`,children:(0,X.jsxs)(ge,{title:r(`navigation:navigation.memory`),description:r(`memory:memoryPage.lede`),back:t&&{label:r(`navigation:sidebar.features`),ariaLabel:r(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,X.jsx)(_e,{search:(0,X.jsx)(fe,{id:E,value:s,onValueChange:Me,placeholder:r(`navigation:pageHeader.searchMemoriesOrFiles`),shortcut:o,clearLabel:r(`navigation:more.clearSearch`)}),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(M,{type:`button`,className:`h-9`,disabled:!w,onClick:()=>R({spaceId:f===Q?`global`:f}),children:[(0,X.jsx)(y,{}),r(`memory:memoryPage.addMemory`)]}),(0,X.jsxs)(k,{children:[(0,X.jsx)(te,{asChild:!0,children:(0,X.jsx)(M,{type:`button`,variant:`secondary`,size:`icon-lg`,className:`max-[650px]:max-w-11`,disabled:!w,"aria-label":r(`memory:memoryPage.moreActions`),title:r(`memory:memoryPage.moreActions`),children:(0,X.jsx)(d,{})})}),(0,X.jsxs)(ne,{align:`end`,children:[(0,X.jsx)(O,{onSelect:()=>B(`new`),children:r(`memory:memoryPage.newMemorySpace`)}),(0,X.jsx)(O,{disabled:!He,onSelect:()=>G&&B(G),children:r(`memory:memoryPage.renameMemorySpace`)}),(0,X.jsx)(O,{variant:`destructive`,disabled:!He,onSelect:()=>void Ne(),children:r(`memory:memoryPage.deleteMemorySpace`)}),(0,X.jsx)(D,{}),(0,X.jsx)(O,{onSelect:()=>void Pe(),children:r(`memory:memoryPage.exportMarkdown`)}),(0,X.jsx)(O,{disabled:be,onSelect:()=>void Re(),children:r(`memory:memoryPage.consolidateNow`)}),(0,X.jsx)(O,{onSelect:()=>void Y(),children:r(`memory:memoryPage.clearEpisodes`)})]})]})]}),filters:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(ie,{"aria-label":r(`memory:memoryPage.viewsLabel`),children:[(0,X.jsx)(A,{value:`evolution`,children:r(`memory:memoryPage.evolutionView`)}),(0,X.jsx)(A,{value:`timeline`,children:r(`memory:memoryPage.timelineView`)}),(0,X.jsx)(A,{value:`activity`,children:r(`memory:memoryPage.activityView`)})]}),(0,X.jsxs)(ye,{className:`w-[200px] max-w-full max-[650px]:w-full`,"aria-label":r(`memory:memoryPage.memorySpace`),value:f,disabled:!w,onChange:e=>q(e.target.value),children:[(0,X.jsx)(`option`,{value:Q,children:r(`memory:memoryPage.allSpaces`)}),De.map(e=>(0,X.jsx)(`option`,{value:e.id,children:`${Be(e,r)} · ${e.nodeCount}`},e.id))]})]}),l===`timeline`&&w&&(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[K?(0,X.jsxs)(`p`,{className:`m-0 text-[13px] font-medium text-content-muted tabular-nums`,children:[r(`memory:memoryPage.searchResults`),` · `,g.nodes.length]}):(0,X.jsx)(oe,{"aria-label":r(`memory:memoryPage.statusFilterLabel`),value:m,onValueChange:e=>{h(e),N(``)},options:[{value:`current`,label:r(`memory:memoryPage.statusCurrent`),count:g.counts?.current},{value:`archived`,label:r(`memory:memoryPage.statusArchived`),count:g.counts?.archived},{value:`history`,label:r(`memory:memoryPage.statusHistory`),count:g.counts?.history}]}),(0,X.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted max-[650px]:size-11`,loading:v,disabled:v,"aria-label":r(`memory:memoryPage.refresh`),title:r(`memory:memoryPage.refresh`),onClick:Ce,children:(0,X.jsx)(b,{})})]})]})}),children:[!w&&v?(0,X.jsx)(z,{kind:`loading`,title:r(`common:pageTemplate.loading`)}):w?(0,X.jsxs)(X.Fragment,{children:[ee&&(0,X.jsx)(ve,{children:ee}),(0,X.jsxs)(`div`,{className:`mt-5 min-w-0`,"aria-busy":v,children:[(0,X.jsxs)(re,{value:`evolution`,className:`flex min-w-0 flex-col gap-3`,children:[(0,X.jsx)(J.Suspense,{fallback:(0,X.jsx)(z,{kind:`loading`,title:r(`common:pageTemplate.loading`)}),children:(0,X.jsx)(it,{spaceId:f,refreshKey:I,selectedId:P,onSelect:F})}),(0,X.jsx)(`div`,{role:`region`,"data-memory-detail":!0,"aria-label":r(`memory:memoryPage.selectedMemory`),className:`min-w-0 rounded-[var(--r-md)] border border-stroke px-4 py-3`,children:P?(0,X.jsx)(Je,{id:P,spaces:g.spaces,refreshKey:I,withHeading:!0,onClose:()=>F(null),onEdit:R,onChanged:W,onDeleted:we,requestConfirm:n}):(0,X.jsx)(`p`,{className:`m-0 text-xs leading-normal text-content-muted`,children:r(`memory:memoryPage.selectAMemoryToViewDetails`)})})]}),(0,X.jsxs)(re,{value:`timeline`,className:`min-w-0`,"data-memory-timeline":!0,children:[g.nodes.length?K?(0,X.jsx)(me,{children:g.nodes.map(We)}):Ae.map(e=>(0,X.jsx)(he,{"data-memory-group":e.key,className:`mt-5 first:mt-0`,title:Ge(e),count:e.items.length,children:(0,X.jsx)(me,{children:e.items.map(We)})},e.key)):(0,X.jsx)(de,{compact:!0,title:Z}),!K&&g.hasMore&&(0,X.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,X.jsx)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,loading:S,disabled:S,onClick:()=>void Se(),children:r(`memory:memoryPage.loadMore`)})})]}),(0,X.jsx)(re,{value:`activity`,className:`min-w-0`,children:(0,X.jsx)(Ke,{spaceId:f,refreshKey:I,onChanged:W})})]})]}):(0,X.jsx)(z,{kind:`error`,title:r(`memory:memoryPage.loadFailed`),description:ee,action:(0,X.jsx)(M,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void U(),children:r(`common:pageTemplate.retry`)})}),L&&(0,X.jsx)($e,{spaces:De,node:`id`in L?L:null,initialSpaceId:L.spaceId,onClose:()=>R(null),onSaved:e=>{R(null),W(e)}}),ue&&(0,X.jsx)(et,{space:ue===`new`?null:ue,onClose:()=>B(null),onSaved:(e,t)=>{B(null),q(e.id),W(t)}})]})})}export{ct as MemoryPage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-_vdxObu5.js";import{t as i}from"./runtime-capabilities-store-BNM5Ug-5.js";import{t as a}from"./chevron-left-BAtyp3_6.js";import{t as o}from"./chevron-right-C3t2Rckj.js";import{r as s}from"./settings-navigation-DiP_AM1C.js";var c=e(t(),1),l=n(),u=`flex min-h-14 w-full min-w-0 items-center gap-3 px-4 text-left text-base text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function d({onNavigate:e,onOpenFeatures:t}){let{t:n}=r(),a=i(e=>e.capabilities),d=(0,c.useMemo)(()=>s(n,{capabilities:a}),[a,n]);return(0,l.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto bg-background`,children:[(0,l.jsx)(`h1`,{className:`sr-only`,children:n(`navigation:navigation.settings`)}),(0,l.jsx)(`nav`,{"aria-label":n(`config:settingsShell.settingsNavigation`),"data-mobile-navigation":`settings`,className:`mx-4 mt-2 overflow-hidden rounded-[14px] border border-stroke-soft bg-panel`,children:(0,l.jsx)(`ul`,{className:`m-0 list-none p-0 [&>li+li]:border-t [&>li+li]:border-stroke-soft`,children:d.map(t=>{let n=t.icon;return(0,l.jsx)(`li`,{children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-section":t.section,className:u,onClick:()=>e(t.section),children:[(0,l.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),(0,l.jsx)(o,{className:`size-4 flex-none text-content-faint`,"aria-hidden":`true`})]})},t.section)})})}),(0,l.jsx)(`button`,{type:`button`,"data-settings-features-hint":!0,className:`mx-4 mt-3 flex min-h-11 items-center rounded-[var(--r-md)] px-1 text-left text-sm text-content-muted focus-visible:outline-2 focus-visible:outline-focus active:text-content`,onClick:t,children:n(`config:settingsShell.featuresHint`)})]})}function f({onBack:e}){let{t}=r();return(0,l.jsx)(`div`,{className:`flex flex-none px-2 pt-1`,children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-back":!0,className:`flex h-11 items-center gap-0.5 rounded-[var(--r-md)] pr-3 pl-1 text-sm text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:e,children:[(0,l.jsx)(a,{className:`size-5`,"aria-hidden":`true`}),t(`navigation:navigation.settings`)]})})}export{f as MobileSettingsBack,d as MobileSettingsList};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-CIheiCov.js";import{t as i}from"./runtime-capabilities-store-CWJvmV83.js";import{t as a}from"./chevron-left-BAtyp3_6.js";import{t as o}from"./chevron-right-C3t2Rckj.js";import{r as s}from"./settings-navigation-DiP_AM1C.js";var c=e(t(),1),l=n(),u=`flex min-h-14 w-full min-w-0 items-center gap-3 px-4 text-left text-base text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function d({onNavigate:e,onOpenFeatures:t}){let{t:n}=r(),a=i(e=>e.capabilities),d=(0,c.useMemo)(()=>s(n,{capabilities:a}),[a,n]);return(0,l.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto bg-background`,children:[(0,l.jsx)(`h1`,{className:`sr-only`,children:n(`navigation:navigation.settings`)}),(0,l.jsx)(`nav`,{"aria-label":n(`config:settingsShell.settingsNavigation`),"data-mobile-navigation":`settings`,className:`mx-4 mt-2 overflow-hidden rounded-[14px] border border-stroke-soft bg-panel`,children:(0,l.jsx)(`ul`,{className:`m-0 list-none p-0 [&>li+li]:border-t [&>li+li]:border-stroke-soft`,children:d.map(t=>{let n=t.icon;return(0,l.jsx)(`li`,{children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-section":t.section,className:u,onClick:()=>e(t.section),children:[(0,l.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),(0,l.jsx)(o,{className:`size-4 flex-none text-content-faint`,"aria-hidden":`true`})]})},t.section)})})}),(0,l.jsx)(`button`,{type:`button`,"data-settings-features-hint":!0,className:`mx-4 mt-3 flex min-h-11 items-center rounded-[var(--r-md)] px-1 text-left text-sm text-content-muted focus-visible:outline-2 focus-visible:outline-focus active:text-content`,onClick:t,children:n(`config:settingsShell.featuresHint`)})]})}function f({onBack:e}){let{t}=r();return(0,l.jsx)(`div`,{className:`flex flex-none px-2 pt-1`,children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-back":!0,className:`flex h-11 items-center gap-0.5 rounded-[var(--r-md)] pr-3 pl-1 text-sm text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:e,children:[(0,l.jsx)(a,{className:`size-5`,"aria-hidden":`true`}),t(`navigation:navigation.settings`)]})})}export{f as MobileSettingsBack,d as MobileSettingsList};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-_vdxObu5.js";import{t as i}from"./useQuery-DdcpUQhO.js";import{a,l as o}from"./api-BW_X0FMZ.js";import{a as s,n as c,t as l}from"./runtime-capabilities-CHYOF_hE.js";import{t as u}from"./runtime-capabilities-store-BNM5Ug-5.js";import{m as d}from"./placements-CMrgmg3t.js";import{t as ee}from"./client-store-DzgOPMlh.js";import{t as f}from"./usePhoneShell-DZHZWXnN.js";import{t as p}from"./createLucideIcon-Cd-3GVxJ.js";import{t as m}from"./app-window-CPNdvYNt.js";import{t as h}from"./blocks-Olsdp5Lp.js";import{t as g}from"./bot-B3TaBp_T.js";import{t as _}from"./brain-qxhnKqYP.js";import{t as v}from"./calendar-clock-VIxTaqqy.js";import{t as y}from"./chevron-right-C3t2Rckj.js";import{t as b}from"./image-BY_c3FYU.js";import{t as x}from"./monitor-smartphone-B1gIjItA.js";import{t as S}from"./plug-BsIeHRwC.js";import{t as C}from"./plus-fQbSqB1n.js";import{t as w}from"./radio-tower-jGQwrFWB.js";import{t as T}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as E}from"./search-D0mqDaf_.js";import{t as te}from"./server-BgNvmqwJ.js";import{t as ne}from"./sparkles-S_eeuqn9.js";import{t as re}from"./workflow-Bg94dy8I.js";import{t as D}from"./x-07u4-129.js";import{t as O}from"./brand-DIEc3fK8.js";import{i as k}from"./more-pages-D_PnxLN0.js";import{t as A}from"./utils-C8uzG5AZ.js";import{t as j}from"./button-CCcCN8tE.js";import{t as M}from"./kbd-CAufZTkl.js";import{g as ie}from"./events-PfANjkHx.js";import{n as N,r as P}from"./config-search-BiQmWst4.js";import{s as F}from"./shortcuts-D72gQCwH.js";var I=p(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),L=e(t(),1),R=`add:component`;function z(e,{capabilities:t=l,mobileApp:n=!1,components:r=[]}={}){let i=(e,n,r,i)=>s(t,e)?{key:`page:${e}`,label:n,description:r,icon:i,destination:{type:`page`,id:e}}:null,a=e=>c(t,e,{mobileApp:n}),o=a(`remote-access`),u=a(`desktop-pet`),d=[a(`mobile-server`).supported?{key:`config:mobile-server`,label:e(`config:configPage.mobileServer`),description:e(`navigation:more.mobileServerHint`),icon:x,destination:{type:`config`,id:`mobile-server`}}:o.supported?{key:`config:remote-access`,label:e(`config:configPage.remoteAccess`),description:e(`navigation:more.remoteAccessHint`),icon:x,destination:{type:`config`,id:`remote-access`}}:null,u.supported||u.reason===`desktop-only`?{key:`config:desktop-pet`,label:e(`config:configPage.desktopPet`),description:e(`navigation:more.desktopPetHint`),icon:g,destination:{type:`config`,id:`desktop-pet`},...u.supported?{}:{disabledReason:e(`navigation:more.desktopOnly`)}}:null];return[{id:`sessions`,label:e(`navigation:more.groupSessions`),tiles:[i(`chatHistory`,e(`navigation:navigation.chatHistory`),e(`navigation:more.chatHistoryHint`),T),i(`assets`,e(`navigation:navigation.assets`),e(`navigation:more.assetsHint`),b),i(`memory`,e(`navigation:navigation.memory`),e(`navigation:more.memoryHint`),_)]},{id:`automation`,label:e(`navigation:more.groupAutomation`),tiles:[i(`workflows`,e(`navigation:navigation.workflows`),e(`navigation:more.workflowsHint`),re),i(`schedules`,e(`navigation:navigation.schedules`),e(`navigation:more.schedulesHint`),v),i(`channels`,e(`navigation:navigation.channels`),e(`navigation:more.channelsHint`),w)]},{id:`extensions`,label:e(`navigation:more.groupExtensions`),tiles:[i(`plugins`,e(`navigation:navigation.plugins`),e(`navigation:more.pluginsHint`),S),i(`skills`,e(`navigation:navigation.skills`),e(`navigation:more.skillsHint`),ne),i(`mcp`,e(`navigation:navigation.mcp`),e(`navigation:more.mcpHint`),te),{key:`page:components`,label:e(`navigation:shell.components`),description:e(`navigation:more.componentStudioHint`),icon:h,destination:{type:`page`,id:`components`}}]},{id:`devices`,label:e(`navigation:more.groupDevices`),tiles:d},{id:`components`,label:e(`navigation:more.groupComponents`),tiles:[...r.map(t=>({key:`component:${t.id}`,label:t.name,description:t.description||e(`navigation:more.componentHint`),icon:m,destination:{type:`component`,id:t.id}})),{key:R,label:e(`navigation:more.addComponent`),description:e(`navigation:more.addComponentHint`),icon:C,destination:{type:`page`,id:`components`}}]}].map(e=>({id:e.id,label:e.label,tiles:e.tiles.filter(e=>e!==null)})).filter(e=>e.tiles.length>0)}function B(e,t,n){let r=t.trim().toLocaleLowerCase(n);return r?e.map(e=>({...e,tiles:e.tiles.filter(t=>[t.label,t.description,e.label].some(e=>e.toLocaleLowerCase(n).includes(r)))})).filter(e=>e.tiles.length>0):[...e]}var V=new Set([`connected`,`connecting`,`reconnecting`]);function H(e){let t=e&&typeof e==`object`?e.connections:null;if(!t||typeof t!=`object`||Array.isArray(t))throw o();let n=0;for(let e of Object.values(t)){if(!e||typeof e!=`object`)continue;let{enabled:t,status:r}=e;t!==!1&&(typeof r!=`string`||!V.has(r))&&(n+=1)}return n}function U(e){return a(`/api/channels`,{signal:e,parse:H})}function W(e){let t=e&&typeof e==`object`?e.metrics:null,n=t&&typeof t==`object`?t.onlineServices:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function G(e){return a(`/api/mcp?refresh=0`,{signal:e,parse:W})}function K(e){let t=e&&typeof e==`object`?e.tasks:null;if(!Array.isArray(t))throw o();return t.filter(e=>e&&typeof e==`object`&&e.enabled===!0).length}function q(e){return a(`/api/schedules`,{signal:e,parse:K})}function J(e){let t=e&&typeof e==`object`?e.limits:null,n=t&&typeof t==`object`?t.running:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function ae(e){return a(`/api/workflows`,{signal:e,parse:J})}var Y=[{key:`page:workflows`,load:ae,tone:`run`,interval:15e3},{key:`page:schedules`,load:q,tone:`neutral`,interval:6e4},{key:`page:channels`,load:U,tone:`attn`,interval:3e4},{key:`page:mcp`,load:G,tone:`neutral`,interval:6e4}];function X(e,t){return i({queryKey:[`more-tile-badge`,e.key],queryFn:({signal:t})=>e.load(t),enabled:t,staleTime:1e4,refetchInterval:t?e.interval:!1,retry:!1}).data}function oe(e,t){let n=[X(Y[0],t.has(Y[0].key)),X(Y[1],t.has(Y[1].key)),X(Y[2],t.has(Y[2].key)),X(Y[3],t.has(Y[3].key))],r=[t=>e(`navigation:more.badgeRunning`,{count:t}),t=>e(`navigation:more.badgeEnabled`,{count:t}),t=>e(`navigation:more.badgeDisconnected`,{count:t}),t=>e(`navigation:more.badgeOnline`,{count:t})],i=new Map;return Y.forEach((e,a)=>{let o=n[a];typeof o==`number`&&o>0&&t.has(e.key)&&i.set(e.key,{label:r[a](o),tone:e.tone})}),i}var Z=n(),se=6,Q=`[data-more-tile]`,$=``;function ce(e,t){return e?.querySelector(`[data-more-tile="${CSS.escape(t)}"]`)??null}function le({onOpen:e}){let{t,language:n}=r(),i=(0,L.useId)(),[a,o]=(0,L.useState)(``),s=F(`commandPalette`),c=F(`focusSearch`),l=u(e=>e.capabilities),p=ee(e=>e.client===`mobile-app`),m=f(),h=t(`navigation:more.title`),g=d(),_=(0,L.useMemo)(()=>g.items.map(({componentId:e,name:t,description:n})=>({id:e,name:t,description:n})),[g.items]),v=(0,L.useMemo)(()=>z(t,{capabilities:l,mobileApp:p,components:_}),[l,_,p,t]),b=(0,L.useMemo)(()=>B(v,a,n),[v,n,a]),x=oe(t,(0,L.useMemo)(()=>new Set(v.flatMap(e=>e.tiles.map(e=>e.key))),[v])),S=(0,L.useMemo)(()=>a.trim()?P(a,n,{capabilities:l,mobileApp:p}).slice(0,se):[],[l,n,p,a]);(0,L.useEffect)(()=>(document.title=`${h} · ${O}`,()=>{document.title=O}),[h]);let C=t=>{if(t.entry.card===`interface-custom-ui`){e({type:`page`,id:`components`});return}N(t.entry.card,t.entry.section,{targetId:t.entry.targetId,targetText:t.title,expandGroup:t.entry.expandGroup}),e({type:`config`,id:t.entry.section})},w=(0,Z.jsxs)(j,{variant:`outline`,className:`h-auto min-h-11 w-full justify-start gap-2.5 py-2 text-left whitespace-normal`,"data-more-palette-search":!0,onClick:()=>ie(a.trim()),children:[m?(0,Z.jsx)(E,{className:`flex-none`,"aria-hidden":`true`}):(0,Z.jsx)(I,{className:`flex-none`,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:t(`navigation:more.searchPalette`,{query:a.trim()})}),(0,Z.jsx)(`span`,{className:`text-xs font-normal text-content-muted`,children:t(`navigation:more.searchPaletteHint`)})]})]}),T=`mb-2 text-[13px] font-medium text-content-muted`;return(0,L.useLayoutEffect)(()=>{let e=document.querySelector(`[data-features-index]`),t=$;$=``;let n=0,r=0,i=!t,a=()=>{let o=ce(e,t);o?(o.focus(),i=!0):(n+=1)<20?r=requestAnimationFrame(a):i=!0};return t&&(r=requestAnimationFrame(a)),()=>{cancelAnimationFrame(r),i||($=t);let n=document.activeElement,a=n instanceof HTMLElement&&e?.contains(n)?n.closest(Q):null;a?.dataset.moreTile&&($=a.dataset.moreTile)}},[]),(0,Z.jsxs)(`div`,{"data-features-index":!0,className:`flex h-full min-h-0 w-full flex-col bg-background`,children:[!m&&(0,Z.jsx)(`div`,{"data-window-drag-region":!0,"aria-hidden":`true`,className:`h-[52px] flex-none`}),(0,Z.jsx)(`div`,{"data-features-scroller":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,onKeyDown:ue,children:(0,Z.jsxs)(`div`,{"data-features-column":!0,className:`mx-auto flex w-full max-w-[808px] flex-col px-6 pb-16 max-[650px]:px-4 max-[650px]:pt-4 max-[650px]:pb-8`,children:[(0,Z.jsxs)(`header`,{"data-focus-region":`header`,className:`flex flex-col`,children:[(0,Z.jsx)(`h1`,{id:i,className:A(`text-2xl leading-8 font-semibold tracking-[-.01em] text-content`,m&&`sr-only`),children:h}),(0,Z.jsx)(`p`,{className:A(`mt-1 text-sm text-content-muted`,m&&`hidden`),children:s&&!m?t(`navigation:more.lede`,{shortcut:s}):t(`navigation:more.ledeNoShortcut`)}),(0,Z.jsxs)(`label`,{className:A(`relative mt-5 flex h-9 w-full items-center gap-2 rounded-[var(--r-md)] border border-control bg-panel px-3 text-content-muted focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring max-[650px]:h-11`,m&&`mt-0`),children:[(0,Z.jsx)(E,{className:`size-4 flex-none`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t(`navigation:more.search`)}),(0,Z.jsx)(`input`,{id:k,type:`search`,value:a,placeholder:t(`navigation:more.search`),"aria-keyshortcuts":c||void 0,className:`w-full min-w-0 border-0 bg-transparent text-[length:var(--app-font-size)] text-content caret-focus outline-none max-[650px]:text-[16px] [&::-webkit-search-cancel-button]:hidden`,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&a)e.preventDefault(),e.stopPropagation(),o(``);else if(e.key===`ArrowDown`){let t=e.currentTarget.closest(`[data-features-scroller]`)?.querySelector(Q);t&&(e.preventDefault(),e.stopPropagation(),t.focus())}}}),a?(0,Z.jsx)(`button`,{type:`button`,className:`grid size-6 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:size-11`,"aria-label":t(`navigation:more.clearSearch`),onClick:()=>o(``),children:(0,Z.jsx)(D,{className:`size-3.5`,"aria-hidden":`true`})}):c&&(0,Z.jsx)(M,{className:`flex-none pointer-coarse:hidden`,children:c})]})]}),b.length===0&&S.length===0?(0,Z.jsxs)(`div`,{role:`status`,"data-features-empty":!0,className:`flex flex-col items-center gap-2 py-16 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(`navigation:more.noResults`)}),(0,Z.jsx)(`p`,{className:`max-w-sm text-xs text-content-muted`,children:t(`navigation:more.noResultsHint`,{shortcut:s||`⌘K`})}),(0,Z.jsxs)(`div`,{className:`mt-2 flex w-full max-w-sm flex-col gap-2`,children:[w,(0,Z.jsx)(j,{variant:`secondary`,className:`min-h-11`,onClick:()=>o(``),children:t(`navigation:more.clearSearch`)})]})]}):b.map(n=>{let r=`${i}-${n.id}`;return(0,Z.jsxs)(`section`,{"data-more-group":n.id,"aria-labelledby":r,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:r,className:T,children:n.label}),(0,Z.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 max-[650px]:grid-cols-1`,children:n.tiles.map(t=>(0,Z.jsx)(`li`,{className:`min-w-0`,children:(0,Z.jsx)(de,{tile:t,badge:x.get(t.key),onOpen:e})},t.key))}),n.id===`components`&&!a&&g.isLoading&&(0,Z.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-content-muted`,children:t(`navigation:more.componentsLoading`)}),n.id===`components`&&!a&&!!g.error&&(0,Z.jsxs)(`p`,{role:`alert`,className:`mt-2 flex items-center gap-2 text-xs text-content-muted`,children:[t(`navigation:more.componentsError`),(0,Z.jsx)(j,{variant:`ghost`,size:`xs`,onClick:g.refetch,children:t(`navigation:more.retry`)})]})]},n.id)}),a.trim()&&(b.length>0||S.length>0)&&(0,Z.jsxs)(`section`,{"aria-labelledby":`${i}-search`,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:`${i}-search`,className:T,children:t(`navigation:more.settingsResults`)}),S.length>0&&(0,Z.jsx)(`ul`,{"data-more-settings-results":!0,className:`mb-2 flex flex-col divide-y divide-stroke-soft overflow-hidden rounded-card border border-stroke`,children:S.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full min-w-0 items-center gap-3 px-3.5 py-2 text-left transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:()=>C(e),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:e.title}),e.sectionTitle!==e.title&&(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.sectionTitle})]}),(0,Z.jsx)(y,{className:`size-4 flex-none text-content-muted`,"aria-hidden":`true`})]})},e.entry.id))}),w]})]})})]})}function ue(e){let t=e.target;if(!(t instanceof HTMLElement)||!t.matches(Q)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=[...e.currentTarget.querySelectorAll(Q)],r=n.indexOf(t);if(r<0)return;let i;if(e.key===`ArrowRight`)i=n[r+1];else if(e.key===`ArrowLeft`)i=n[r-1];else if(e.key===`Home`)i=n[0];else if(e.key===`End`)i=n.at(-1);else if(e.key===`ArrowDown`||e.key===`ArrowUp`){let r=t.getBoundingClientRect(),a=e.key===`ArrowDown`,o=r.left+r.width/2,s=n.map(e=>({tile:e,box:e.getBoundingClientRect()})).filter(({box:e})=>a?e.top>=r.bottom-1:e.bottom<=r.top+1);if(s.length>0){let e=a?Math.min(...s.map(({box:e})=>e.top)):Math.max(...s.map(({box:e})=>e.top));i=s.filter(({box:t})=>Math.abs(t.top-e)<2).sort((e,t)=>Math.abs(e.box.left+e.box.width/2-o)-Math.abs(t.box.left+t.box.width/2-o))[0]?.tile}else if(!a){document.getElementById(k)?.focus(),e.preventDefault();return}}else return;e.preventDefault(),i?.focus()}function de({tile:e,badge:t,onOpen:n}){let{t:i}=r(),a=e.icon,o=!!e.disabledReason,s=e.key===R;return(0,Z.jsxs)(`button`,{type:`button`,"data-more-tile":e.key,"aria-disabled":o||void 0,"aria-label":o?i(`navigation:more.disabledTile`,{label:e.label,reason:e.disabledReason}):void 0,className:A(`flex min-h-16 w-full min-w-0 items-center gap-3 rounded-card border px-3.5 py-2.5 text-left transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:min-h-14 max-[650px]:py-2`,s?`border-dashed border-stroke-strong`:`border-stroke`,o?`cursor-not-allowed`:`hover:bg-surface-hover`),onClick:()=>{o||($=e.key,n(e.destination))},children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:A(`grid size-[34px] flex-none place-items-center rounded-[var(--r-md)] max-[650px]:size-8`,s?`text-content-muted`:`bg-surface-subtle text-content-secondary`,o&&`text-content-muted`),children:(0,Z.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75})}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:A(`truncate text-sm font-medium text-content`,(o||s)&&`text-content-secondary`),children:e.label}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.disabledReason||e.description})]}),t&&!o&&(0,Z.jsxs)(`span`,{"data-more-badge":t.tone,className:A(`flex max-w-[45%] flex-none items-center gap-1.5 text-xs whitespace-nowrap tabular-nums`,t.tone===`attn`?`font-medium text-st-attn`:`text-content-muted`),children:[t.tone===`attn`&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),(0,Z.jsx)(`span`,{className:`truncate`,children:t.label})]})]})}export{le as MorePage};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-CIheiCov.js";import{t as i}from"./useQuery-DdcpUQhO.js";import{a,l as o}from"./api-_MWfl2VL.js";import{a as s,n as c,t as l}from"./runtime-capabilities-CHYOF_hE.js";import{t as u}from"./runtime-capabilities-store-CWJvmV83.js";import{m as d}from"./placements-Cw2TcTmd.js";import{t as ee}from"./client-store-xZC2AfqC.js";import{t as f}from"./usePhoneShell-sWQz-gv8.js";import{t as p}from"./createLucideIcon-Cd-3GVxJ.js";import{t as m}from"./app-window-CPNdvYNt.js";import{t as h}from"./blocks-Olsdp5Lp.js";import{t as g}from"./bot-B3TaBp_T.js";import{t as _}from"./brain-qxhnKqYP.js";import{t as v}from"./calendar-clock-VIxTaqqy.js";import{t as y}from"./chevron-right-C3t2Rckj.js";import{t as b}from"./image-BY_c3FYU.js";import{t as x}from"./monitor-smartphone-B1gIjItA.js";import{t as S}from"./plug-BsIeHRwC.js";import{t as C}from"./plus-fQbSqB1n.js";import{t as w}from"./radio-tower-jGQwrFWB.js";import{t as T}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as E}from"./search-D0mqDaf_.js";import{t as te}from"./server-BgNvmqwJ.js";import{t as ne}from"./sparkles-S_eeuqn9.js";import{t as re}from"./workflow-Bg94dy8I.js";import{t as D}from"./x-07u4-129.js";import{t as O}from"./brand-DIEc3fK8.js";import{i as k}from"./more-pages-D_PnxLN0.js";import{t as A}from"./utils-C8uzG5AZ.js";import{t as j}from"./button-CCcCN8tE.js";import{t as M}from"./kbd-CAufZTkl.js";import{g as ie}from"./events-C96FsPEU.js";import{n as N,r as P}from"./config-search-VE6brXfx.js";import{s as F}from"./shortcuts-CVPFuAiJ.js";var I=p(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),L=e(t(),1),R=`add:component`;function z(e,{capabilities:t=l,mobileApp:n=!1,components:r=[]}={}){let i=(e,n,r,i)=>s(t,e)?{key:`page:${e}`,label:n,description:r,icon:i,destination:{type:`page`,id:e}}:null,a=e=>c(t,e,{mobileApp:n}),o=a(`remote-access`),u=a(`desktop-pet`),d=[a(`mobile-server`).supported?{key:`config:mobile-server`,label:e(`config:configPage.mobileServer`),description:e(`navigation:more.mobileServerHint`),icon:x,destination:{type:`config`,id:`mobile-server`}}:o.supported?{key:`config:remote-access`,label:e(`config:configPage.remoteAccess`),description:e(`navigation:more.remoteAccessHint`),icon:x,destination:{type:`config`,id:`remote-access`}}:null,u.supported||u.reason===`desktop-only`?{key:`config:desktop-pet`,label:e(`config:configPage.desktopPet`),description:e(`navigation:more.desktopPetHint`),icon:g,destination:{type:`config`,id:`desktop-pet`},...u.supported?{}:{disabledReason:e(`navigation:more.desktopOnly`)}}:null];return[{id:`sessions`,label:e(`navigation:more.groupSessions`),tiles:[i(`chatHistory`,e(`navigation:navigation.chatHistory`),e(`navigation:more.chatHistoryHint`),T),i(`assets`,e(`navigation:navigation.assets`),e(`navigation:more.assetsHint`),b),i(`memory`,e(`navigation:navigation.memory`),e(`navigation:more.memoryHint`),_)]},{id:`automation`,label:e(`navigation:more.groupAutomation`),tiles:[i(`workflows`,e(`navigation:navigation.workflows`),e(`navigation:more.workflowsHint`),re),i(`schedules`,e(`navigation:navigation.schedules`),e(`navigation:more.schedulesHint`),v),i(`channels`,e(`navigation:navigation.channels`),e(`navigation:more.channelsHint`),w)]},{id:`extensions`,label:e(`navigation:more.groupExtensions`),tiles:[i(`plugins`,e(`navigation:navigation.plugins`),e(`navigation:more.pluginsHint`),S),i(`skills`,e(`navigation:navigation.skills`),e(`navigation:more.skillsHint`),ne),i(`mcp`,e(`navigation:navigation.mcp`),e(`navigation:more.mcpHint`),te),{key:`page:components`,label:e(`navigation:shell.components`),description:e(`navigation:more.componentStudioHint`),icon:h,destination:{type:`page`,id:`components`}}]},{id:`devices`,label:e(`navigation:more.groupDevices`),tiles:d},{id:`components`,label:e(`navigation:more.groupComponents`),tiles:[...r.map(t=>({key:`component:${t.id}`,label:t.name,description:t.description||e(`navigation:more.componentHint`),icon:m,destination:{type:`component`,id:t.id}})),{key:R,label:e(`navigation:more.addComponent`),description:e(`navigation:more.addComponentHint`),icon:C,destination:{type:`page`,id:`components`}}]}].map(e=>({id:e.id,label:e.label,tiles:e.tiles.filter(e=>e!==null)})).filter(e=>e.tiles.length>0)}function B(e,t,n){let r=t.trim().toLocaleLowerCase(n);return r?e.map(e=>({...e,tiles:e.tiles.filter(t=>[t.label,t.description,e.label].some(e=>e.toLocaleLowerCase(n).includes(r)))})).filter(e=>e.tiles.length>0):[...e]}var V=new Set([`connected`,`connecting`,`reconnecting`]);function H(e){let t=e&&typeof e==`object`?e.connections:null;if(!t||typeof t!=`object`||Array.isArray(t))throw o();let n=0;for(let e of Object.values(t)){if(!e||typeof e!=`object`)continue;let{enabled:t,status:r}=e;t!==!1&&(typeof r!=`string`||!V.has(r))&&(n+=1)}return n}function U(e){return a(`/api/channels`,{signal:e,parse:H})}function W(e){let t=e&&typeof e==`object`?e.metrics:null,n=t&&typeof t==`object`?t.onlineServices:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function G(e){return a(`/api/mcp?refresh=0`,{signal:e,parse:W})}function K(e){let t=e&&typeof e==`object`?e.tasks:null;if(!Array.isArray(t))throw o();return t.filter(e=>e&&typeof e==`object`&&e.enabled===!0).length}function q(e){return a(`/api/schedules`,{signal:e,parse:K})}function J(e){let t=e&&typeof e==`object`?e.limits:null,n=t&&typeof t==`object`?t.running:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw o();return Math.floor(n)}function ae(e){return a(`/api/workflows`,{signal:e,parse:J})}var Y=[{key:`page:workflows`,load:ae,tone:`run`,interval:15e3},{key:`page:schedules`,load:q,tone:`neutral`,interval:6e4},{key:`page:channels`,load:U,tone:`attn`,interval:3e4},{key:`page:mcp`,load:G,tone:`neutral`,interval:6e4}];function X(e,t){return i({queryKey:[`more-tile-badge`,e.key],queryFn:({signal:t})=>e.load(t),enabled:t,staleTime:1e4,refetchInterval:t?e.interval:!1,retry:!1}).data}function oe(e,t){let n=[X(Y[0],t.has(Y[0].key)),X(Y[1],t.has(Y[1].key)),X(Y[2],t.has(Y[2].key)),X(Y[3],t.has(Y[3].key))],r=[t=>e(`navigation:more.badgeRunning`,{count:t}),t=>e(`navigation:more.badgeEnabled`,{count:t}),t=>e(`navigation:more.badgeDisconnected`,{count:t}),t=>e(`navigation:more.badgeOnline`,{count:t})],i=new Map;return Y.forEach((e,a)=>{let o=n[a];typeof o==`number`&&o>0&&t.has(e.key)&&i.set(e.key,{label:r[a](o),tone:e.tone})}),i}var Z=n(),se=6,Q=`[data-more-tile]`,$=``;function ce(e,t){return e?.querySelector(`[data-more-tile="${CSS.escape(t)}"]`)??null}function le({onOpen:e}){let{t,language:n}=r(),i=(0,L.useId)(),[a,o]=(0,L.useState)(``),s=F(`commandPalette`),c=F(`focusSearch`),l=u(e=>e.capabilities),p=ee(e=>e.client===`mobile-app`),m=f(),h=t(`navigation:more.title`),g=d(),_=(0,L.useMemo)(()=>g.items.map(({componentId:e,name:t,description:n})=>({id:e,name:t,description:n})),[g.items]),v=(0,L.useMemo)(()=>z(t,{capabilities:l,mobileApp:p,components:_}),[l,_,p,t]),b=(0,L.useMemo)(()=>B(v,a,n),[v,n,a]),x=oe(t,(0,L.useMemo)(()=>new Set(v.flatMap(e=>e.tiles.map(e=>e.key))),[v])),S=(0,L.useMemo)(()=>a.trim()?P(a,n,{capabilities:l,mobileApp:p}).slice(0,se):[],[l,n,p,a]);(0,L.useEffect)(()=>(document.title=`${h} · ${O}`,()=>{document.title=O}),[h]);let C=t=>{if(t.entry.card===`interface-custom-ui`){e({type:`page`,id:`components`});return}N(t.entry.card,t.entry.section,{targetId:t.entry.targetId,targetText:t.title,expandGroup:t.entry.expandGroup}),e({type:`config`,id:t.entry.section})},w=(0,Z.jsxs)(j,{variant:`outline`,className:`h-auto min-h-11 w-full justify-start gap-2.5 py-2 text-left whitespace-normal`,"data-more-palette-search":!0,onClick:()=>ie(a.trim()),children:[m?(0,Z.jsx)(E,{className:`flex-none`,"aria-hidden":`true`}):(0,Z.jsx)(I,{className:`flex-none`,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:t(`navigation:more.searchPalette`,{query:a.trim()})}),(0,Z.jsx)(`span`,{className:`text-xs font-normal text-content-muted`,children:t(`navigation:more.searchPaletteHint`)})]})]}),T=`mb-2 text-[13px] font-medium text-content-muted`;return(0,L.useLayoutEffect)(()=>{let e=document.querySelector(`[data-features-index]`),t=$;$=``;let n=0,r=0,i=!t,a=()=>{let o=ce(e,t);o?(o.focus(),i=!0):(n+=1)<20?r=requestAnimationFrame(a):i=!0};return t&&(r=requestAnimationFrame(a)),()=>{cancelAnimationFrame(r),i||($=t);let n=document.activeElement,a=n instanceof HTMLElement&&e?.contains(n)?n.closest(Q):null;a?.dataset.moreTile&&($=a.dataset.moreTile)}},[]),(0,Z.jsxs)(`div`,{"data-features-index":!0,className:`flex h-full min-h-0 w-full flex-col bg-background`,children:[!m&&(0,Z.jsx)(`div`,{"data-window-drag-region":!0,"aria-hidden":`true`,className:`h-[52px] flex-none`}),(0,Z.jsx)(`div`,{"data-features-scroller":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,onKeyDown:ue,children:(0,Z.jsxs)(`div`,{"data-features-column":!0,className:`mx-auto flex w-full max-w-[808px] flex-col px-6 pb-16 max-[650px]:px-4 max-[650px]:pt-4 max-[650px]:pb-8`,children:[(0,Z.jsxs)(`header`,{"data-focus-region":`header`,className:`flex flex-col`,children:[(0,Z.jsx)(`h1`,{id:i,className:A(`text-2xl leading-8 font-semibold tracking-[-.01em] text-content`,m&&`sr-only`),children:h}),(0,Z.jsx)(`p`,{className:A(`mt-1 text-sm text-content-muted`,m&&`hidden`),children:s&&!m?t(`navigation:more.lede`,{shortcut:s}):t(`navigation:more.ledeNoShortcut`)}),(0,Z.jsxs)(`label`,{className:A(`relative mt-5 flex h-9 w-full items-center gap-2 rounded-[var(--r-md)] border border-control bg-panel px-3 text-content-muted focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring max-[650px]:h-11`,m&&`mt-0`),children:[(0,Z.jsx)(E,{className:`size-4 flex-none`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t(`navigation:more.search`)}),(0,Z.jsx)(`input`,{id:k,type:`search`,value:a,placeholder:t(`navigation:more.search`),"aria-keyshortcuts":c||void 0,className:`w-full min-w-0 border-0 bg-transparent text-[length:var(--app-font-size)] text-content caret-focus outline-none max-[650px]:text-[16px] [&::-webkit-search-cancel-button]:hidden`,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&a)e.preventDefault(),e.stopPropagation(),o(``);else if(e.key===`ArrowDown`){let t=e.currentTarget.closest(`[data-features-scroller]`)?.querySelector(Q);t&&(e.preventDefault(),e.stopPropagation(),t.focus())}}}),a?(0,Z.jsx)(`button`,{type:`button`,className:`grid size-6 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:size-11`,"aria-label":t(`navigation:more.clearSearch`),onClick:()=>o(``),children:(0,Z.jsx)(D,{className:`size-3.5`,"aria-hidden":`true`})}):c&&(0,Z.jsx)(M,{className:`flex-none pointer-coarse:hidden`,children:c})]})]}),b.length===0&&S.length===0?(0,Z.jsxs)(`div`,{role:`status`,"data-features-empty":!0,className:`flex flex-col items-center gap-2 py-16 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(`navigation:more.noResults`)}),(0,Z.jsx)(`p`,{className:`max-w-sm text-xs text-content-muted`,children:t(`navigation:more.noResultsHint`,{shortcut:s||`⌘K`})}),(0,Z.jsxs)(`div`,{className:`mt-2 flex w-full max-w-sm flex-col gap-2`,children:[w,(0,Z.jsx)(j,{variant:`secondary`,className:`min-h-11`,onClick:()=>o(``),children:t(`navigation:more.clearSearch`)})]})]}):b.map(n=>{let r=`${i}-${n.id}`;return(0,Z.jsxs)(`section`,{"data-more-group":n.id,"aria-labelledby":r,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:r,className:T,children:n.label}),(0,Z.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 max-[650px]:grid-cols-1`,children:n.tiles.map(t=>(0,Z.jsx)(`li`,{className:`min-w-0`,children:(0,Z.jsx)(de,{tile:t,badge:x.get(t.key),onOpen:e})},t.key))}),n.id===`components`&&!a&&g.isLoading&&(0,Z.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-content-muted`,children:t(`navigation:more.componentsLoading`)}),n.id===`components`&&!a&&!!g.error&&(0,Z.jsxs)(`p`,{role:`alert`,className:`mt-2 flex items-center gap-2 text-xs text-content-muted`,children:[t(`navigation:more.componentsError`),(0,Z.jsx)(j,{variant:`ghost`,size:`xs`,onClick:g.refetch,children:t(`navigation:more.retry`)})]})]},n.id)}),a.trim()&&(b.length>0||S.length>0)&&(0,Z.jsxs)(`section`,{"aria-labelledby":`${i}-search`,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:`${i}-search`,className:T,children:t(`navigation:more.settingsResults`)}),S.length>0&&(0,Z.jsx)(`ul`,{"data-more-settings-results":!0,className:`mb-2 flex flex-col divide-y divide-stroke-soft overflow-hidden rounded-card border border-stroke`,children:S.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full min-w-0 items-center gap-3 px-3.5 py-2 text-left transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:()=>C(e),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:e.title}),e.sectionTitle!==e.title&&(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.sectionTitle})]}),(0,Z.jsx)(y,{className:`size-4 flex-none text-content-muted`,"aria-hidden":`true`})]})},e.entry.id))}),w]})]})})]})}function ue(e){let t=e.target;if(!(t instanceof HTMLElement)||!t.matches(Q)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=[...e.currentTarget.querySelectorAll(Q)],r=n.indexOf(t);if(r<0)return;let i;if(e.key===`ArrowRight`)i=n[r+1];else if(e.key===`ArrowLeft`)i=n[r-1];else if(e.key===`Home`)i=n[0];else if(e.key===`End`)i=n.at(-1);else if(e.key===`ArrowDown`||e.key===`ArrowUp`){let r=t.getBoundingClientRect(),a=e.key===`ArrowDown`,o=r.left+r.width/2,s=n.map(e=>({tile:e,box:e.getBoundingClientRect()})).filter(({box:e})=>a?e.top>=r.bottom-1:e.bottom<=r.top+1);if(s.length>0){let e=a?Math.min(...s.map(({box:e})=>e.top)):Math.max(...s.map(({box:e})=>e.top));i=s.filter(({box:t})=>Math.abs(t.top-e)<2).sort((e,t)=>Math.abs(e.box.left+e.box.width/2-o)-Math.abs(t.box.left+t.box.width/2-o))[0]?.tile}else if(!a){document.getElementById(k)?.focus(),e.preventDefault();return}}else return;e.preventDefault(),i?.focus()}function de({tile:e,badge:t,onOpen:n}){let{t:i}=r(),a=e.icon,o=!!e.disabledReason,s=e.key===R;return(0,Z.jsxs)(`button`,{type:`button`,"data-more-tile":e.key,"aria-disabled":o||void 0,"aria-label":o?i(`navigation:more.disabledTile`,{label:e.label,reason:e.disabledReason}):void 0,className:A(`flex min-h-16 w-full min-w-0 items-center gap-3 rounded-card border px-3.5 py-2.5 text-left transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:min-h-14 max-[650px]:py-2`,s?`border-dashed border-stroke-strong`:`border-stroke`,o?`cursor-not-allowed`:`hover:bg-surface-hover`),onClick:()=>{o||($=e.key,n(e.destination))},children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:A(`grid size-[34px] flex-none place-items-center rounded-[var(--r-md)] max-[650px]:size-8`,s?`text-content-muted`:`bg-surface-subtle text-content-secondary`,o&&`text-content-muted`),children:(0,Z.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75})}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:A(`truncate text-sm font-medium text-content`,(o||s)&&`text-content-secondary`),children:e.label}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.disabledReason||e.description})]}),t&&!o&&(0,Z.jsxs)(`span`,{"data-more-badge":t.tone,className:A(`flex max-w-[45%] flex-none items-center gap-1.5 text-xs whitespace-nowrap tabular-nums`,t.tone===`attn`?`font-medium text-st-attn`:`text-content-muted`),children:[t.tone===`attn`&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),(0,Z.jsx)(`span`,{className:`truncate`,children:t.label})]})]})}export{le as MorePage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-_vdxObu5.js";import{u as i}from"./api-BW_X0FMZ.js";import{t as a}from"./folder-open-FIShC5Qk.js";import{i as o}from"./workspace-order-store-Ao4OZ13V.js";import{t as s}from"./triangle-alert-CE1q54ci.js";import{n as c,t as l}from"./button-CCcCN8tE.js";import{a as u,i as d,l as f,o as p,s as m,t as h}from"./dialog-DFZX_Dek.js";import{t as g}from"./input-CPw-zkYh.js";import{i as _,n as v,r as y,t as b}from"./input-group-h8z63MzW.js";import{t as x}from"./pick-system-directory-yk6L7wR2.js";import{r as S,t as C}from"./folder-paths-aRRH_MYq.js";import{n as w,t as T}from"./alert-firawb0H.js";import{n as E,t as D}from"./field-DoLEb0np.js";var O=e(t(),1),k=n();function A(e,t){switch(e){case`folder_name_required`:return t(`board:folder.error.nameRequired`);case`folder_name_invalid`:return t(`board:folder.error.nameInvalid`);case`folder_parent_missing`:case`folder_parent_invalid`:return t(`board:folder.error.parentMissing`);case`folder_exists_as_file`:return t(`board:folder.error.existsAsFile`);case`folder_permission_denied`:return t(`board:folder.error.permission`);default:return``}}function j({open:e,initialParent:t,onOpenChange:n,onCreated:j,onCloseAutoFocus:M}){let{t:N}=r(),[P,F]=(0,O.useState)(t),[I,L]=(0,O.useState)(``),[R,z]=(0,O.useState)(!1),[B,V]=(0,O.useState)(!1),[H,U]=(0,O.useState)(!1),[W,G]=(0,O.useState)(``),K=(0,O.useRef)(0),q=(0,O.useRef)(!1),J=(0,O.useRef)(null),Y=R||B;(0,O.useEffect)(()=>{K.current+=1,q.current=!1,e&&(F(t),L(``),z(!1),V(!1),U(!1),G(``))},[t,e]);let X=async()=>{if(q.current)return;q.current=!0;let e=K.current;V(!0),G(``);try{let t=await x(P.trim(),N(`board:folder.browseTitle`));if(e!==K.current)return;t.status===`picked`?F(t.path):t.status===`unavailable`&&(U(!0),J.current?.focus())}catch(t){e===K.current&&G(t instanceof Error?t.message:String(t))}finally{e===K.current&&(q.current=!1,V(!1))}},Z=async e=>{if(e.preventDefault(),q.current||!I.trim())return;q.current=!0;let t=K.current;z(!0),G(``);try{let e=await S(P.trim(),I.trim());if(t!==K.current)return;j(e.path),n(!1)}catch(e){if(t!==K.current)return;let n=A(e instanceof i?e.data?.code:void 0,N);G(n||(e instanceof Error&&e.message?N(`board:folder.error.failedWithReason`,{reason:e.message}):N(`board:folder.error.failed`)))}finally{t===K.current&&(q.current=!1,z(!1))}},Q=I.trim()?C(P,I.trim()):``;return(0,k.jsx)(h,{open:e,onOpenChange:e=>!q.current&&n(e),children:(0,k.jsxs)(d,{showCloseButton:!Y,"aria-describedby":`board-new-folder`,onCloseAutoFocus:M,"data-new-folder-dialog":!0,children:[(0,k.jsxs)(m,{children:[(0,k.jsx)(f,{children:N(`board:folder.title`)}),(0,k.jsx)(u,{id:`board-new-folder`,children:N(`board:folder.description`)})]}),(0,k.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:e=>void Z(e),children:[(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.parent`),(0,k.jsxs)(b,{className:`max-[650px]:h-11`,children:[(0,k.jsx)(_,{ref:J,className:`font-mono text-xs`,value:P,disabled:Y,placeholder:N(`board:folder.parentPlaceholder`),"data-new-folder-parent":!0,onChange:e=>F(e.target.value)}),(0,k.jsx)(v,{align:`inline-end`,children:(0,k.jsxs)(y,{size:`xs`,disabled:Y,"data-new-folder-browse":!0,onClick:()=>void X(),children:[B?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(a,{}),N(`board:folder.browse`)]})})]})]}),H&&(0,k.jsx)(D,{className:`-mt-2`,children:N(`board:folder.browseUnavailable`)}),(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.name`),(0,k.jsx)(g,{autoFocus:!0,className:`max-[650px]:h-11`,value:I,disabled:Y,placeholder:N(`board:folder.namePlaceholder`),autoComplete:`off`,spellCheck:!1,"data-new-folder-name":!0,onChange:e=>{L(e.target.value),W&&G(``)}})]}),Q&&(0,k.jsx)(`p`,{className:`-mt-2 truncate font-mono text-xs text-content-muted`,title:Q,children:N(`board:folder.preview`,{path:Q})}),W&&(0,k.jsxs)(T,{variant:`destructive`,children:[(0,k.jsx)(s,{}),(0,k.jsx)(w,{className:`min-w-0 break-words`,children:W})]}),(0,k.jsxs)(p,{children:[(0,k.jsx)(l,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:Y,onClick:()=>n(!1),children:N(`common:ui.cancel`)}),(0,k.jsxs)(l,{type:`submit`,size:`dialogAction`,disabled:Y||!I.trim(),children:[R?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(o,{}),N(R?`board:folder.creating`:`board:folder.create`)]})]})]})]})})}export{j as NewFolderDialog};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-CIheiCov.js";import{u as i}from"./api-_MWfl2VL.js";import{t as a}from"./folder-open-FIShC5Qk.js";import{i as o}from"./workspace-order-store-GwJH1aiS.js";import{t as s}from"./triangle-alert-CE1q54ci.js";import{n as c,t as l}from"./button-CCcCN8tE.js";import{a as u,i as d,l as f,o as p,s as m,t as h}from"./dialog-BgFAhLng.js";import{t as g}from"./input-CPw-zkYh.js";import{i as _,n as v,r as y,t as b}from"./input-group-h8z63MzW.js";import{t as x}from"./pick-system-directory-UTgPstWX.js";import{r as S,t as C}from"./folder-paths-BguW7FsR.js";import{n as w,t as T}from"./alert-firawb0H.js";import{n as E,t as D}from"./field-DoLEb0np.js";var O=e(t(),1),k=n();function A(e,t){switch(e){case`folder_name_required`:return t(`board:folder.error.nameRequired`);case`folder_name_invalid`:return t(`board:folder.error.nameInvalid`);case`folder_parent_missing`:case`folder_parent_invalid`:return t(`board:folder.error.parentMissing`);case`folder_exists_as_file`:return t(`board:folder.error.existsAsFile`);case`folder_permission_denied`:return t(`board:folder.error.permission`);default:return``}}function j({open:e,initialParent:t,onOpenChange:n,onCreated:j,onCloseAutoFocus:M}){let{t:N}=r(),[P,F]=(0,O.useState)(t),[I,L]=(0,O.useState)(``),[R,z]=(0,O.useState)(!1),[B,V]=(0,O.useState)(!1),[H,U]=(0,O.useState)(!1),[W,G]=(0,O.useState)(``),K=(0,O.useRef)(0),q=(0,O.useRef)(!1),J=(0,O.useRef)(null),Y=R||B;(0,O.useEffect)(()=>{K.current+=1,q.current=!1,e&&(F(t),L(``),z(!1),V(!1),U(!1),G(``))},[t,e]);let X=async()=>{if(q.current)return;q.current=!0;let e=K.current;V(!0),G(``);try{let t=await x(P.trim(),N(`board:folder.browseTitle`));if(e!==K.current)return;t.status===`picked`?F(t.path):t.status===`unavailable`&&(U(!0),J.current?.focus())}catch(t){e===K.current&&G(t instanceof Error?t.message:String(t))}finally{e===K.current&&(q.current=!1,V(!1))}},Z=async e=>{if(e.preventDefault(),q.current||!I.trim())return;q.current=!0;let t=K.current;z(!0),G(``);try{let e=await S(P.trim(),I.trim());if(t!==K.current)return;j(e.path),n(!1)}catch(e){if(t!==K.current)return;let n=A(e instanceof i?e.data?.code:void 0,N);G(n||(e instanceof Error&&e.message?N(`board:folder.error.failedWithReason`,{reason:e.message}):N(`board:folder.error.failed`)))}finally{t===K.current&&(q.current=!1,z(!1))}},Q=I.trim()?C(P,I.trim()):``;return(0,k.jsx)(h,{open:e,onOpenChange:e=>!q.current&&n(e),children:(0,k.jsxs)(d,{showCloseButton:!Y,"aria-describedby":`board-new-folder`,onCloseAutoFocus:M,"data-new-folder-dialog":!0,children:[(0,k.jsxs)(m,{children:[(0,k.jsx)(f,{children:N(`board:folder.title`)}),(0,k.jsx)(u,{id:`board-new-folder`,children:N(`board:folder.description`)})]}),(0,k.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:e=>void Z(e),children:[(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.parent`),(0,k.jsxs)(b,{className:`max-[650px]:h-11`,children:[(0,k.jsx)(_,{ref:J,className:`font-mono text-xs`,value:P,disabled:Y,placeholder:N(`board:folder.parentPlaceholder`),"data-new-folder-parent":!0,onChange:e=>F(e.target.value)}),(0,k.jsx)(v,{align:`inline-end`,children:(0,k.jsxs)(y,{size:`xs`,disabled:Y,"data-new-folder-browse":!0,onClick:()=>void X(),children:[B?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(a,{}),N(`board:folder.browse`)]})})]})]}),H&&(0,k.jsx)(D,{className:`-mt-2`,children:N(`board:folder.browseUnavailable`)}),(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.name`),(0,k.jsx)(g,{autoFocus:!0,className:`max-[650px]:h-11`,value:I,disabled:Y,placeholder:N(`board:folder.namePlaceholder`),autoComplete:`off`,spellCheck:!1,"data-new-folder-name":!0,onChange:e=>{L(e.target.value),W&&G(``)}})]}),Q&&(0,k.jsx)(`p`,{className:`-mt-2 truncate font-mono text-xs text-content-muted`,title:Q,children:N(`board:folder.preview`,{path:Q})}),W&&(0,k.jsxs)(T,{variant:`destructive`,children:[(0,k.jsx)(s,{}),(0,k.jsx)(w,{className:`min-w-0 break-words`,children:W})]}),(0,k.jsxs)(p,{children:[(0,k.jsx)(l,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:Y,onClick:()=>n(!1),children:N(`common:ui.cancel`)}),(0,k.jsxs)(l,{type:`submit`,size:`dialogAction`,disabled:Y||!I.trim(),children:[R?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(o,{}),N(R?`board:folder.creating`:`board:folder.create`)]})]})]})]})})}export{j as NewFolderDialog};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-_vdxObu5.js";import{t as n}from"./chevron-left-BAtyp3_6.js";import{t as r}from"./square-terminal-BVG6cUT1.js";import{r as i}from"./more-pages-D_PnxLN0.js";import{t as a}from"./utils-C8uzG5AZ.js";import{t as o}from"./button-CCcCN8tE.js";import{s}from"./shortcuts-D72gQCwH.js";var c=e();function l({meta:e,page:l,desktopPlatform:u,terminalOpen:d,onToggleTerminal:f,onBackToMore:p,phoneShell:m=!1}){let{t:h}=t(),g=s(`toggleTerminal`),_=!!u,v=i.has(l)||p?h(`navigation:sidebar.features`):``;return(0,c.jsx)(`header`,{"data-focus-region":`header`,"data-window-drag-region":!0,className:a(`@container/page-header relative z-[2] flex flex-none flex-col`,_&&`[-webkit-app-region:drag]`),children:(0,c.jsxs)(`div`,{className:a(`flex min-h-12 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2.5 in-data-[density=compact]:min-h-11 max-[650px]:min-h-0 max-[650px]:flex-wrap max-[650px]:gap-x-2 max-[650px]:gap-y-0 max-[650px]:border-b-0 max-[650px]:px-4 max-[650px]:pt-0 max-[650px]:pb-3`,`pl-[calc(16px+var(--workbench-leading-inset,0px))] max-[650px]:pl-4`,`[[data-custom-titlebar]_&]:pr-[144px]`),children:[(0,c.jsxs)(`div`,{className:a(`mr-auto flex min-w-0 items-center gap-1.5 text-[13px]`,`max-[650px]:h-14 max-[650px]:basis-full max-[650px]:gap-2`,m&&(v&&p?`max-[650px]:h-11`:`max-[650px]:h-0`)),children:[v&&p?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(`button`,{type:`button`,"data-back-to-more":!0,className:`-ml-1.5 flex h-7 shrink-0 items-center gap-0.5 rounded-sm pr-1.5 pl-1 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:-ml-3 max-[650px]:h-11 max-[650px]:min-w-11 max-[650px]:pr-2 max-[650px]:text-sm max-[650px]:text-content-secondary`,"aria-label":h(`navigation:shell.backToFeaturesLabel`),onClick:p,children:[(0,c.jsx)(n,{className:`size-4 max-[650px]:size-5`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:v})]}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[650px]:hidden`,children:`/`})]}):v&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`span`,{className:`shrink-0 text-content-muted max-[900px]:hidden`,children:v}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[900px]:hidden`,children:`/`})]}),(0,c.jsx)(`h1`,{className:a(`max-w-full min-w-[4em] truncate text-[13px] leading-5 font-medium text-content max-[650px]:min-w-0 max-[650px]:text-2xl max-[650px]:leading-8 max-[650px]:font-[650] max-[650px]:tracking-[-.015em]`,m&&`sr-only`),children:e[0]}),e[1]&&!m&&(0,c.jsx)(`p`,{className:`ml-1.5 min-w-0 truncate text-xs text-content-muted max-[900px]:hidden max-[650px]:ml-0 max-[650px]:block max-[650px]:flex-1 max-[650px]:basis-0`,children:e[1]})]}),_&&(0,c.jsx)(`div`,{className:`flex min-w-0 items-center justify-end gap-1.5 [-webkit-app-region:no-drag]`,children:(0,c.jsx)(o,{variant:`ghost`,size:`icon`,className:a(`text-content-muted max-[650px]:hidden`,d&&`bg-surface-hover text-accent-fg`),title:g?`${h(`navigation:pageHeader.toggleTerminal`)} (${g})`:h(`navigation:pageHeader.toggleTerminal`),"aria-label":h(`navigation:pageHeader.toggleTerminal`),"aria-pressed":d,onClick:f,children:(0,c.jsx)(r,{size:16})})})]})})}export{l as PageHeader};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-CIheiCov.js";import{t as n}from"./chevron-left-BAtyp3_6.js";import{t as r}from"./square-terminal-BVG6cUT1.js";import{r as i}from"./more-pages-D_PnxLN0.js";import{t as a}from"./utils-C8uzG5AZ.js";import{t as o}from"./button-CCcCN8tE.js";import{s}from"./shortcuts-CVPFuAiJ.js";var c=e();function l({meta:e,page:l,desktopPlatform:u,terminalOpen:d,onToggleTerminal:f,onBackToMore:p,phoneShell:m=!1}){let{t:h}=t(),g=s(`toggleTerminal`),_=!!u,v=i.has(l)||p?h(`navigation:sidebar.features`):``;return(0,c.jsx)(`header`,{"data-focus-region":`header`,"data-window-drag-region":!0,className:a(`@container/page-header relative z-[2] flex flex-none flex-col`,_&&`[-webkit-app-region:drag]`),children:(0,c.jsxs)(`div`,{className:a(`flex min-h-12 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2.5 in-data-[density=compact]:min-h-11 max-[650px]:min-h-0 max-[650px]:flex-wrap max-[650px]:gap-x-2 max-[650px]:gap-y-0 max-[650px]:border-b-0 max-[650px]:px-4 max-[650px]:pt-0 max-[650px]:pb-3`,`pl-[calc(16px+var(--workbench-leading-inset,0px))] max-[650px]:pl-4`,`[[data-custom-titlebar]_&]:pr-[144px]`),children:[(0,c.jsxs)(`div`,{className:a(`mr-auto flex min-w-0 items-center gap-1.5 text-[13px]`,`max-[650px]:h-14 max-[650px]:basis-full max-[650px]:gap-2`,m&&(v&&p?`max-[650px]:h-11`:`max-[650px]:h-0`)),children:[v&&p?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(`button`,{type:`button`,"data-back-to-more":!0,className:`-ml-1.5 flex h-7 shrink-0 items-center gap-0.5 rounded-sm pr-1.5 pl-1 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:-ml-3 max-[650px]:h-11 max-[650px]:min-w-11 max-[650px]:pr-2 max-[650px]:text-sm max-[650px]:text-content-secondary`,"aria-label":h(`navigation:shell.backToFeaturesLabel`),onClick:p,children:[(0,c.jsx)(n,{className:`size-4 max-[650px]:size-5`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:v})]}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[650px]:hidden`,children:`/`})]}):v&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`span`,{className:`shrink-0 text-content-muted max-[900px]:hidden`,children:v}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[900px]:hidden`,children:`/`})]}),(0,c.jsx)(`h1`,{className:a(`max-w-full min-w-[4em] truncate text-[13px] leading-5 font-medium text-content max-[650px]:min-w-0 max-[650px]:text-2xl max-[650px]:leading-8 max-[650px]:font-[650] max-[650px]:tracking-[-.015em]`,m&&`sr-only`),children:e[0]}),e[1]&&!m&&(0,c.jsx)(`p`,{className:`ml-1.5 min-w-0 truncate text-xs text-content-muted max-[900px]:hidden max-[650px]:ml-0 max-[650px]:block max-[650px]:flex-1 max-[650px]:basis-0`,children:e[1]})]}),_&&(0,c.jsx)(`div`,{className:`flex min-w-0 items-center justify-end gap-1.5 [-webkit-app-region:no-drag]`,children:(0,c.jsx)(o,{variant:`ghost`,size:`icon`,className:a(`text-content-muted max-[650px]:hidden`,d&&`bg-surface-hover text-accent-fg`),title:g?`${h(`navigation:pageHeader.toggleTerminal`)} (${g})`:h(`navigation:pageHeader.toggleTerminal`),"aria-label":h(`navigation:pageHeader.toggleTerminal`),"aria-pressed":d,onClick:f,children:(0,c.jsx)(r,{size:16})})})]})})}export{l as PageHeader};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-_vdxObu5.js";import{n,t as r}from"./list-T5PqlpS2.js";import{t as i}from"./search-D0mqDaf_.js";import{t as a}from"./settings-QX0oWnVK.js";import{t as o}from"./square-pen-hYbjKh6A.js";import{t as s}from"./utils-C8uzG5AZ.js";import{n as c,o as l,r as u,t as d}from"./sheet-BTaIEX4w.js";import{t as f}from"./sidebar-store-CXZ7QrOr.js";var p=e(),m=`flex h-11 w-full min-w-0 items-center gap-3 rounded-[var(--r-md)] px-2.5 text-base text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function h({active:e,onSearch:h,onNewTask:g,onOpenBoard:_,onOpenFeatures:v,onOpenSettings:y,content:b,boardCount:x,update:S}){let{t:C}=t(),w=f(e=>e.drawerOpen),T=f(e=>e.setDrawerOpen),E=e=>()=>{T(!1),e()},D=(t,n,r,i,a)=>(0,p.jsxs)(`button`,{type:`button`,"data-drawer-entry":t,"aria-current":e===t?`page`:void 0,className:s(m,e===t&&`bg-surface-active`),onClick:E(i),children:[(0,p.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:r}),a]});return(0,p.jsx)(d,{open:w,onOpenChange:T,children:(0,p.jsxs)(c,{side:`left`,showCloseButton:!1,"data-phone-drawer":!0,onCloseAutoFocus:e=>{let t=document.querySelector(`[data-phone-menu]`);t&&(e.preventDefault(),t.focus())},"aria-describedby":void 0,className:`w-[min(320px,85vw)] gap-0 border-stroke-soft bg-sidebar p-0 pt-[var(--pisper-safe-area-top)] pb-[var(--pisper-safe-area-bottom)] pl-[var(--pisper-safe-area-left)] data-[side=left]:w-[min(320px,85vw)] data-[side=left]:max-w-none`,children:[(0,p.jsx)(l,{className:`sr-only`,children:C(`navigation:phone.drawer`)}),(0,p.jsx)(u,{className:`sr-only`,children:C(`navigation:phone.drawerHint`)}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-2 px-3 pt-3 pb-2`,children:[(0,p.jsxs)(`button`,{type:`button`,"data-drawer-search":!0,className:`flex h-11 min-w-0 flex-1 items-center gap-2 rounded-[10px] bg-surface-muted px-3 text-left text-base text-content-muted focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:E(h),children:[(0,p.jsx)(i,{className:`size-[18px] flex-none`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`truncate`,children:C(`navigation:sidebar.search`)})]}),(0,p.jsx)(`button`,{type:`button`,"data-drawer-new-task":!0,"aria-label":C(`navigation:shell.newTask`),className:`grid size-11 flex-none place-items-center rounded-[var(--r-md)] text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:E(g),children:(0,p.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,p.jsxs)(`nav`,{"aria-label":C(`navigation:shell.primaryNavigation`),className:`flex-none px-2 pb-2`,children:[D(`board`,r,C(`navigation:sidebar.allAgents`),_,x?(0,p.jsx)(`span`,{className:`flex-none text-sm text-content-muted tabular-nums`,children:x}):void 0),D(`features`,n,C(`navigation:sidebar.features`),v)]}),(0,p.jsx)(`div`,{"data-drawer-sessions":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 pt-1`,children:b}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-1 border-t border-stroke-soft px-2 py-2`,children:[(0,p.jsx)(`div`,{className:`min-w-0 flex-1`,children:D(`settings`,a,C(`navigation:navigation.settings`),y)}),S]})]})})}export{h as PhoneDrawer};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-CIheiCov.js";import{n,t as r}from"./list-T5PqlpS2.js";import{t as i}from"./search-D0mqDaf_.js";import{t as a}from"./settings-QX0oWnVK.js";import{t as o}from"./square-pen-hYbjKh6A.js";import{t as s}from"./utils-C8uzG5AZ.js";import{n as c,o as l,r as u,t as d}from"./sheet-BTaIEX4w.js";import{t as f}from"./sidebar-store-CLA6EfOm.js";var p=e(),m=`flex h-11 w-full min-w-0 items-center gap-3 rounded-[var(--r-md)] px-2.5 text-base text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function h({active:e,onSearch:h,onNewTask:g,onOpenBoard:_,onOpenFeatures:v,onOpenSettings:y,content:b,boardCount:x,update:S}){let{t:C}=t(),w=f(e=>e.drawerOpen),T=f(e=>e.setDrawerOpen),E=e=>()=>{T(!1),e()},D=(t,n,r,i,a)=>(0,p.jsxs)(`button`,{type:`button`,"data-drawer-entry":t,"aria-current":e===t?`page`:void 0,className:s(m,e===t&&`bg-surface-active`),onClick:E(i),children:[(0,p.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:r}),a]});return(0,p.jsx)(d,{open:w,onOpenChange:T,children:(0,p.jsxs)(c,{side:`left`,showCloseButton:!1,"data-phone-drawer":!0,onCloseAutoFocus:e=>{let t=document.querySelector(`[data-phone-menu]`);t&&(e.preventDefault(),t.focus())},"aria-describedby":void 0,className:`w-[min(320px,85vw)] gap-0 border-stroke-soft bg-sidebar p-0 pt-[var(--pisper-safe-area-top)] pb-[var(--pisper-safe-area-bottom)] pl-[var(--pisper-safe-area-left)] data-[side=left]:w-[min(320px,85vw)] data-[side=left]:max-w-none`,children:[(0,p.jsx)(l,{className:`sr-only`,children:C(`navigation:phone.drawer`)}),(0,p.jsx)(u,{className:`sr-only`,children:C(`navigation:phone.drawerHint`)}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-2 px-3 pt-3 pb-2`,children:[(0,p.jsxs)(`button`,{type:`button`,"data-drawer-search":!0,className:`flex h-11 min-w-0 flex-1 items-center gap-2 rounded-[10px] bg-surface-muted px-3 text-left text-base text-content-muted focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:E(h),children:[(0,p.jsx)(i,{className:`size-[18px] flex-none`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`truncate`,children:C(`navigation:sidebar.search`)})]}),(0,p.jsx)(`button`,{type:`button`,"data-drawer-new-task":!0,"aria-label":C(`navigation:shell.newTask`),className:`grid size-11 flex-none place-items-center rounded-[var(--r-md)] text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:E(g),children:(0,p.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,p.jsxs)(`nav`,{"aria-label":C(`navigation:shell.primaryNavigation`),className:`flex-none px-2 pb-2`,children:[D(`board`,r,C(`navigation:sidebar.allAgents`),_,x?(0,p.jsx)(`span`,{className:`flex-none text-sm text-content-muted tabular-nums`,children:x}):void 0),D(`features`,n,C(`navigation:sidebar.features`),v)]}),(0,p.jsx)(`div`,{"data-drawer-sessions":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 pt-1`,children:b}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-1 border-t border-stroke-soft px-2 py-2`,children:[(0,p.jsx)(`div`,{className:`min-w-0 flex-1`,children:D(`settings`,a,C(`navigation:navigation.settings`),y)}),S]})]})})}export{h as PhoneDrawer};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-_vdxObu5.js";import{t as n}from"./createLucideIcon-Cd-3GVxJ.js";import{t as r}from"./utils-C8uzG5AZ.js";import{t as i}from"./sidebar-store-CXZ7QrOr.js";import{t as a}from"./useSidebarModel-CZAfH4Fa.js";import"./public-62LVX7HU.js";var o=n(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),s=e();function c({className:e}){let{t:n}=t(),{model:c}=a(),l=i(e=>e.drawerOpen),u=i(e=>e.setDrawerOpen),d=c.counts.attention;return(0,s.jsxs)(`button`,{type:`button`,"data-phone-menu":!0,"aria-haspopup":`dialog`,"aria-expanded":l,"aria-label":d>0?n(`navigation:phone.menuAttention`,{count:d}):n(`navigation:phone.menu`),className:r(`flex h-11 min-w-11 flex-none items-center justify-center gap-1.5 rounded-full bg-surface-muted px-2.5 text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`,e),onClick:()=>u(!0),children:[(0,s.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`}),d>0&&(0,s.jsxs)(`span`,{"aria-hidden":`true`,"data-phone-attention":d,className:`flex h-5 items-center gap-1 rounded-full bg-warning-soft px-1.5 text-xs leading-none font-semibold text-warning-strong tabular-nums ring-1 ring-st-attn-border ring-inset`,children:[(0,s.jsx)(`span`,{className:`size-1.5 rounded-full bg-st-attn-fill`}),d>99?`99+`:d]})]})}export{c as t};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-CIheiCov.js";import{t as n}from"./createLucideIcon-Cd-3GVxJ.js";import{t as r}from"./utils-C8uzG5AZ.js";import{t as i}from"./sidebar-store-CLA6EfOm.js";import{t as a}from"./useSidebarModel-BuyZjTgh.js";import"./public-DdhGlwHC.js";var o=n(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),s=e();function c({className:e}){let{t:n}=t(),{model:c}=a(),l=i(e=>e.drawerOpen),u=i(e=>e.setDrawerOpen),d=c.counts.attention;return(0,s.jsxs)(`button`,{type:`button`,"data-phone-menu":!0,"aria-haspopup":`dialog`,"aria-expanded":l,"aria-label":d>0?n(`navigation:phone.menuAttention`,{count:d}):n(`navigation:phone.menu`),className:r(`flex h-11 min-w-11 flex-none items-center justify-center gap-1.5 rounded-full bg-surface-muted px-2.5 text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`,e),onClick:()=>u(!0),children:[(0,s.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`}),d>0&&(0,s.jsxs)(`span`,{"aria-hidden":`true`,"data-phone-attention":d,className:`flex h-5 items-center gap-1 rounded-full bg-warning-soft px-1.5 text-xs leading-none font-semibold text-warning-strong tabular-nums ring-1 ring-st-attn-border ring-inset`,children:[(0,s.jsx)(`span`,{className:`size-1.5 rounded-full bg-st-attn-fill`}),d>99?`99+`:d]})]})}export{c as t};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-_vdxObu5.js";import{t as n}from"./PhoneMenuButton-D6vdTZdF.js";import{t as r}from"./search-D0mqDaf_.js";import{t as i}from"./square-pen-hYbjKh6A.js";var a=e(),o=`grid size-11 flex-none place-items-center rounded-full bg-surface-muted text-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`;function s({title:e,onNewTask:s,onSearch:c}){let{t:l}=t();return(0,a.jsxs)(`header`,{"data-phone-topbar":!0,"data-focus-region":`header`,className:`relative grid h-14 flex-none grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center bg-panel px-3`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,a.jsx)(n,{})}),(0,a.jsx)(`p`,{"data-phone-title":!0,"aria-hidden":`true`,className:`max-w-[min(56vw,240px)] truncate text-center text-base leading-6 font-semibold text-content`,children:e}),(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2`,children:[c&&(0,a.jsx)(`button`,{type:`button`,"data-phone-search":!0,"aria-label":l(`navigation:sidebar.search`),className:o,onClick:c,children:(0,a.jsx)(r,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})}),(0,a.jsx)(`button`,{type:`button`,"data-phone-new-task":!0,"aria-label":l(`navigation:shell.newTask`),className:o,onClick:s,children:(0,a.jsx)(i,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]})]})}export{s as PhoneTopBar};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-CIheiCov.js";import{t as n}from"./PhoneMenuButton-1dPMDaRV.js";import{t as r}from"./search-D0mqDaf_.js";import{t as i}from"./square-pen-hYbjKh6A.js";var a=e(),o=`grid size-11 flex-none place-items-center rounded-full bg-surface-muted text-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`;function s({title:e,onNewTask:s,onSearch:c}){let{t:l}=t();return(0,a.jsxs)(`header`,{"data-phone-topbar":!0,"data-focus-region":`header`,className:`relative grid h-14 flex-none grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center bg-panel px-3`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,a.jsx)(n,{})}),(0,a.jsx)(`p`,{"data-phone-title":!0,"aria-hidden":`true`,className:`max-w-[min(56vw,240px)] truncate text-center text-base leading-6 font-semibold text-content`,children:e}),(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2`,children:[c&&(0,a.jsx)(`button`,{type:`button`,"data-phone-search":!0,"aria-label":l(`navigation:sidebar.search`),className:o,onClick:c,children:(0,a.jsx)(r,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})}),(0,a.jsx)(`button`,{type:`button`,"data-phone-new-task":!0,"aria-label":l(`navigation:shell.newTask`),className:o,onClick:s,children:(0,a.jsx)(i,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]})]})}export{s as PhoneTopBar};