codemini-cli 0.6.5 → 0.6.6

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 (32) hide show
  1. package/codemini-web/dist/assets/{AboutDialog-BUp8EzDg.js → AboutDialog-dFkTshay.js} +1 -1
  2. package/codemini-web/dist/assets/{CodeWikiPanel-Fp0VKdzo.js → CodeWikiPanel-Dqup5Sen.js} +1 -1
  3. package/codemini-web/dist/assets/{ConfigDialog-DIpj779O.js → ConfigDialog-DTehAh2r.js} +1 -1
  4. package/codemini-web/dist/assets/{GitDiffDialog-ZLEuX8Qm.js → GitDiffDialog-D4uMixee.js} +1 -1
  5. package/codemini-web/dist/assets/{MemoryDialog-D2YbENVd.js → MemoryDialog-DJqtWamU.js} +1 -1
  6. package/codemini-web/dist/assets/{MessageBubble-BIgpZsLn.js → MessageBubble-BGnFIxcq.js} +1 -1
  7. package/codemini-web/dist/assets/{PatchDiff-CvKNaHsw.js → PatchDiff-CpHAbmv3.js} +1 -1
  8. package/codemini-web/dist/assets/{ProjectSelector-DXIep3lE.js → ProjectSelector-CgJDcTNL.js} +1 -1
  9. package/codemini-web/dist/assets/SkillDialog-D1J46nMC.js +8 -0
  10. package/codemini-web/dist/assets/{SoulDialog-BfIoKETs.js → SoulDialog-DIqK4utD.js} +1 -1
  11. package/codemini-web/dist/assets/chevron-right-BBG4s6Zh.js +1 -0
  12. package/codemini-web/dist/assets/{chunk-BO2N2NFS-DMUdjM9q.js → chunk-BO2N2NFS-fRXUeu1b.js} +4 -4
  13. package/codemini-web/dist/assets/{highlighted-body-OFNGDK62-8ch0jz7Z.js → highlighted-body-OFNGDK62-CKKvx7S1.js} +1 -1
  14. package/codemini-web/dist/assets/{index-DRXwJ-n_.css → index-DF9s7Tuc.css} +1 -1
  15. package/codemini-web/dist/assets/{index-BhMtCC8_.js → index-DyIUhlc8.js} +3 -3
  16. package/codemini-web/dist/assets/{input-CYpdNDlR.js → input-BKNu4DOt.js} +1 -1
  17. package/codemini-web/dist/assets/mermaid-GHXKKRXX-BM8yuNk5.js +1 -0
  18. package/codemini-web/dist/assets/{pencil-BdA2cEeE.js → pencil-C0uznNC_.js} +1 -1
  19. package/codemini-web/dist/assets/{refresh-cw-CJGgUGiS.js → refresh-cw-DUgU5bEu.js} +1 -1
  20. package/codemini-web/dist/assets/{select-BLOccU1M.js → select-J6668k2a.js} +1 -1
  21. package/codemini-web/dist/assets/{trash-2-CQzNOch5.js → trash-2-H0DiWqiE.js} +1 -1
  22. package/codemini-web/dist/index.html +2 -2
  23. package/codemini-web/server.js +90 -73
  24. package/package.json +1 -1
  25. package/src/commands/skill.js +188 -48
  26. package/src/core/agent-loop.js +67 -25
  27. package/src/core/chat-runtime.js +16 -13
  28. package/src/core/shell-profile.js +3 -2
  29. package/src/core/tools.js +42 -27
  30. package/codemini-web/dist/assets/SkillDialog-DjPF-XBx.js +0 -8
  31. package/codemini-web/dist/assets/chevron-right-CfNZHlyU.js +0 -1
  32. package/codemini-web/dist/assets/mermaid-GHXKKRXX-KBEtMEB9.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MessageBubble-BIgpZsLn.js","assets/rolldown-runtime-S-ySWqyJ.js","assets/PatchDiff-CvKNaHsw.js","assets/lib-BXWizt13.js","assets/bundle-mjs-C44PrJ2C.js","assets/chunk-BO2N2NFS-DMUdjM9q.js","assets/chevron-right-CfNZHlyU.js","assets/trash-2-CQzNOch5.js","assets/CodeWikiPanel-Fp0VKdzo.js","assets/refresh-cw-CJGgUGiS.js","assets/ConfigDialog-DIpj779O.js","assets/input-CYpdNDlR.js","assets/select-BLOccU1M.js","assets/ProjectSelector-DXIep3lE.js","assets/SkillDialog-DjPF-XBx.js","assets/pencil-BdA2cEeE.js","assets/MemoryDialog-D2YbENVd.js","assets/SoulDialog-BfIoKETs.js","assets/AboutDialog-BUp8EzDg.js","assets/GitDiffDialog-ZLEuX8Qm.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MessageBubble-BGnFIxcq.js","assets/rolldown-runtime-S-ySWqyJ.js","assets/PatchDiff-CpHAbmv3.js","assets/lib-BXWizt13.js","assets/bundle-mjs-C44PrJ2C.js","assets/chunk-BO2N2NFS-fRXUeu1b.js","assets/chevron-right-BBG4s6Zh.js","assets/trash-2-H0DiWqiE.js","assets/CodeWikiPanel-Dqup5Sen.js","assets/refresh-cw-DUgU5bEu.js","assets/ConfigDialog-DTehAh2r.js","assets/input-BKNu4DOt.js","assets/select-J6668k2a.js","assets/ProjectSelector-CgJDcTNL.js","assets/SkillDialog-D1J46nMC.js","assets/pencil-C0uznNC_.js","assets/MemoryDialog-DJqtWamU.js","assets/SoulDialog-DIqK4utD.js","assets/AboutDialog-dFkTshay.js","assets/GitDiffDialog-D4uMixee.js"])))=>i.map(i=>d[i]);
2
2
  import{r as e,t}from"./rolldown-runtime-S-ySWqyJ.js";import{a as n,i as r,n as i,r as a,t as o}from"./bundle-mjs-C44PrJ2C.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var s=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ne(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ne(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var ee=new MessageChannel,te=ee.port2;ee.port1.onmessage=D,O=function(){te.postMessage(null)}}else O=function(){_(D,0)};function ne(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ne(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),c=t(((e,t)=>{t.exports=s()})),l=t((e=>{var t=c(),i=n(),a=r();function o(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(o(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=a;break}if(c===r){s=!0,r=i,n=a;break}c=c.sibling}if(!s){for(c=a.child;c;){if(c===n){s=!0,n=a,r=i;break}if(c===r){s=!0,r=a,n=i;break}c=c.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),te=Symbol.for(`react.memo_cache_sentinel`),ne=Symbol.iterator;function re(e){return typeof e!=`object`||!e?null:(e=ne&&e[ne]||e[`@@iterator`],typeof e==`function`?e:null)}var ie=Symbol.for(`react.client.reference`);function k(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case ee:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?k(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return k(e(t))}catch{}}return null}var ae=Array.isArray,A=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},se=[],ce=-1;function le(e){return{current:e}}function M(e){0>ce||(e.current=se[ce],se[ce]=null,ce--)}function N(e,t){ce++,se[ce]=e.current,e.current=t}var ue=le(null),de=le(null),fe=le(null),pe=le(null);function me(e,t){switch(N(fe,t),N(de,e),N(ue,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}M(ue),N(ue,e)}function he(){M(ue),M(de),M(fe)}function ge(e){e.memoizedState!==null&&N(pe,e);var t=ue.current,n=Hd(t,e.type);t!==n&&(N(de,e),N(ue,n))}function _e(e){de.current===e&&(M(ue),M(de)),pe.current===e&&(M(pe),Qf._currentValue=oe)}var ve,ye;function be(e){if(ve===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ve=t&&t[1]||``,ye=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+ve+e+ye}var xe=!1;function Se(e,t){if(!e||xe)return``;xe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -56,10 +56,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
56
56
  - less than the value passed to \`max\` (or ${ho} if no \`max\` prop is set)
57
57
  - \`null\` or \`undefined\` if the progress is indeterminate.
58
58
 
59
- Defaulting to \`null\`.`}var Do=vo,Oo=bo,ko=`Separator`,Ao=`horizontal`,jo=[`horizontal`,`vertical`],Mo=d.forwardRef((e,t)=>{let{decorative:n,orientation:r=Ao,...i}=e,a=No(r)?r:Ao,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,h.jsx)(T.div,{"data-orientation":a,...o,...i,ref:t})});Mo.displayName=ko;function No(e){return jo.includes(e)}var Po=Mo,[Fo,Io]=re(`Tooltip`,[va]),Lo=va(),Ro=`TooltipProvider`,zo=700,Bo=`tooltip.open`,[Vo,Ho]=Fo(Ro),Uo=e=>{let{__scopeTooltip:t,delayDuration:n=zo,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=d.useRef(!0),s=d.useRef(!1),c=d.useRef(0);return d.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,h.jsx)(Vo,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:d.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:d.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:d.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Uo.displayName=Ro;var Wo=`Tooltip`,[Go,Ko]=Fo(Wo),qo=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Ho(Wo,e.__scopeTooltip),l=Lo(t),[u,f]=d.useState(null),p=pe(),m=d.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=d.useRef(!1),[y,b]=j({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Bo))):c.onClose(),a?.(e)},caller:Wo}),x=d.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=d.useCallback(()=>{window.clearTimeout(m.current),m.current=0,v.current=!1,b(!0)},[b]),C=d.useCallback(()=>{window.clearTimeout(m.current),m.current=0,b(!1)},[b]),w=d.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{v.current=!0,b(!0),m.current=0},_)},[_,b]);return d.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,h.jsx)(Pa,{...l,children:(0,h.jsx)(Go,{scope:t,contentId:p,open:y,stateAttribute:x,trigger:u,onTriggerChange:f,onTriggerEnter:d.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:d.useCallback(()=>{g?C():(window.clearTimeout(m.current),m.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})};qo.displayName=Wo;var Jo=`TooltipTrigger`,Yo=d.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Ko(Jo,n),a=Ho(Jo,n),o=Lo(n),s=m(t,d.useRef(null),i.onTriggerChange),c=d.useRef(!1),l=d.useRef(!1),u=d.useCallback(()=>c.current=!1,[]);return d.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,h.jsx)(Fa,{asChild:!0,...o,children:(0,h.jsx)(T.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:k(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:k(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:k(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:k(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:k(e.onBlur,i.onClose),onClick:k(e.onClick,i.onClose)})})});Yo.displayName=Jo;var Xo=`TooltipPortal`,[Zo,Qo]=Fo(Xo,{forceMount:void 0}),$o=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Ko(Xo,t);return(0,h.jsx)(Zo,{scope:t,forceMount:n,children:(0,h.jsx)(le,{present:n||a.open,children:(0,h.jsx)(Ke,{asChild:!0,container:i,children:r})})})};$o.displayName=Xo;var es=`TooltipContent`,ts=d.forwardRef((e,t)=>{let n=Qo(es,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Ko(es,e.__scopeTooltip);return(0,h.jsx)(le,{present:r||o.open,children:o.disableHoverableContent?(0,h.jsx)(os,{side:i,...a,ref:t}):(0,h.jsx)(ns,{side:i,...a,ref:t})})}),ns=d.forwardRef((e,t)=>{let n=Ko(es,e.__scopeTooltip),r=Ho(es,e.__scopeTooltip),i=d.useRef(null),a=m(t,i),[o,s]=d.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:f}=r,p=d.useCallback(()=>{s(null),f(!1)},[f]),g=d.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=us(r,ls(r,n.getBoundingClientRect())),a=ds(t.getBoundingClientRect());s(ps([...i,...a])),f(!0)},[f]);return d.useEffect(()=>()=>p(),[p]),d.useEffect(()=>{if(c&&u){let e=e=>g(e,u),t=e=>g(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,g,p]),d.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!fs(n,o);r?p():i&&(p(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,p]),(0,h.jsx)(os,{...e,ref:a})}),[rs,is]=Fo(Wo,{isInside:!1}),as=b(`TooltipContent`),os=d.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Ko(es,n),l=Lo(n),{onClose:u}=c;return d.useEffect(()=>(document.addEventListener(Bo,u),()=>document.removeEventListener(Bo,u)),[u]),d.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,h.jsx)(Se,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,h.jsxs)(Ia,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,h.jsx)(as,{children:r}),(0,h.jsx)(rs,{scope:n,isInside:!0,children:(0,h.jsx)(te,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});ts.displayName=es;var ss=`TooltipArrow`,cs=d.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Lo(n);return is(ss,n).isInside?null:(0,h.jsx)(La,{...i,...r,ref:t})});cs.displayName=ss;function ls(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function us(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ds(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function fs(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ps(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),ms(t)}function ms(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var hs=Uo,gs=qo,_s=Yo,vs=$o,ys=ts,bs=cs,xs=u();function B(...e){return o(i(e))}function Ss({delayDuration:e=0,...t}){return(0,h.jsx)(hs,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Cs({...e}){return(0,h.jsx)(gs,{"data-slot":`tooltip`,...e})}function ws({...e}){return(0,h.jsx)(_s,{"data-slot":`tooltip-trigger`,...e})}function Ts({className:e,sideOffset:t=0,children:n,...r}){return(0,h.jsx)(vs,{children:(0,h.jsxs)(ys,{"data-slot":`tooltip-content`,sideOffset:t,className:B(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md border border-(--border-default) bg-(--bg-secondary) px-3 py-1.5 text-xs text-balance text-(--text-primary) shadow-lg fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,h.jsx)(bs,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-(--bg-secondary) fill-(--bg-secondary)`})]})})}var Es={zh:{brand:`Codemini`,live:`运行中`,idle:`空闲`,sending:`发送中`,thinking:`思考中`,streaming:`回复中`,tooling:`工具执行中`,inputPlaceholder:`输入消息或 / 命令...`,inputDisabled:`等待当前请求完成...`,inputPlanReviewDisabled:`请先在上方审阅计划,批准、修改或否决后再继续输入`,abort:`停止`,approveTitle:`确认操作`,approve:`允许`,deny:`拒绝`,deleteApproval:`确认删除`,runApproval:`确认执行命令`,planApproval:`确认执行计划`,reflectApproval:`确认保存技能`,toolRunning:`运行中`,toolDone:`完成`,toolError:`错误`,toolBlocked:`已阻止`,toolGroupTools:`已运行 {{count}} 个工具`,toolGroupCommands:`已运行 {{count}} 条命令`,toolGroupExpand:`点击展开`,planTitle:`执行计划`,planDone:`完成`,planReviewTitle:`审阅计划`,planReviewSummary:`摘要`,planReviewSteps:`计划步骤`,planApprove:`批准执行`,planReject:`否决`,planEdit:`修改计划`,planEditPlaceholder:`描述你的修改意见...`,planSubmitFeedback:`提交反馈`,planStepCount:`个步骤`,planReviewStatus:`等待审阅`,planWaitingReview:`正在等待计划审阅…`,waitingResponse:`正在等待回复…`,reflectReviewTitle:`审阅技能草稿`,reflectReviewStatus:`等待审阅`,reflectScope:`范围`,reflectConfidence:`置信度`,reflectApprove:`保存技能`,reflectReject:`丢弃`,reflectEdit:`修改草稿`,reflectEditPlaceholder:`描述你希望如何修改这个技能草稿...`,reflectSubmitFeedback:`提交反馈`,reflectReviewFirst:`请先审阅技能草稿,保存、修改或丢弃后再继续输入`,runtimeActivityDreamRunning:`Dream 正在整理记忆`,runtimeActivityDreamDone:`Dream 已完成`,runtimeActivityDreamError:`Dream 失败`,runtimeActivityCompactDone:`上下文已压缩`,runtimeActivityCompactPreview:`上下文压缩预览`,runtimeActivityMicroCompactDone:`微压缩已完成`,runtimeActivityMicroCompactPreview:`微压缩预览`,runtimeActivityInboxCaptured:`已写入 Inbox`,runtimeActivityInboxListed:`Inbox 已查看`,runtimeActivityReflectPending:`Reflect 等待审阅`,runtimeActivityReflectRevised:`Reflect 草稿已更新`,runtimeActivityReflectSaving:`正在保存技能`,runtimeActivityReflectSaved:`技能已保存`,runtimeActivityReflectRevising:`正在修改草稿`,runtimeActivityReflectDiscarding:`正在丢弃草稿`,runtimeActivityReflectDiscarded:`草稿已丢弃`,runtimeActivityReflectNone:`未找到可沉淀技能`,skillRunning:`运行中`,skillDone:`完成`,skillError:`失败`,skillAuto:`自动技能`,contextUsage:`上下文使用`,fileChanges:`文件变更`,thought:`思考过程`,thoughtFor:`思考了 {{duration}}`,thinkingNow:`正在思考中...`,thoughtForNow:`已思考 {{duration}}`,processed:`已处理`,processedFor:`已处理 {{duration}}`,processedDetails:`{{thoughts}} 段思考,{{tools}} 个工具`,usageTokens:`tokens`,usageCache:`缓存`,usageInput:`输入`,usageOutput:`输出`,usageTotal:`总计`,usageCacheHit:`缓存命中`,usageCacheMiss:`缓存未命中`,usageCacheWrite:`缓存写入`,usageReasoning:`推理`,usageRequests:`{{count}} 次请求`,newChat:`新对话`,skills:`Skills`,memory:`记忆`,souls:`Souls`,projects:`项目`,newSessionInProject:`在此项目中新建对话`,openCodeWiki:`打开 CodeWiki`,collapseProject:`折叠项目`,expandProject:`展开项目`,showMoreSessions:`展开显示`,sessionActions:`会话操作`,deleteSession:`删除`,noSessions:`暂无对话`,about:`关于`,lightMode:`浅色`,darkMode:`深色`,autoModeTheme:`跟随系统`,switchTheme:`切换主题`,settings:`设置`,deleteSessionConfirm:`删除会话?`,deleteSessionDescription:`会话「{{session}}」会从历史记录中移除,此操作不可撤销。`,settingsTitle:`设置`,configRequired:`请先在设置中配置接口地址和 API Key`,configRequiredTitle:`需要先配置模型接口`,configRequiredDesc:`当前仍是新安装的默认接口地址。设置 Base URL、API Key 和模型后即可开始使用。`,cancel:`取消`,saveChanges:`保存更改`,gateway:`网关`,baseUrl:`接口地址`,apiKey:`API 密钥`,timeout:`超时 (ms)`,maxRetries:`最大重试`,model:`模型`,modelName:`模型名称`,fastModel:`快速模型`,maxContextTokens:`最大上下文 Tokens`,sdk:`SDK`,provider:`服务商`,execution:`执行`,mode:`模式`,maxSteps:`最大步数`,context:`上下文`,contextMaxTokens:`上下文 Token 预算`,preflightTrigger:`预压缩阈值 (%)`,hardLimit:`硬压缩阈值 (%)`,toolResultMaxChars:`工具结果字符上限`,microcompactEnabled:`微压缩`,microcompactKeepRecent:`微压缩保留数`,shell:`终端`,defaultShell:`默认 Shell`,policy:`策略`,safeMode:`安全模式`,allowedPaths:`目录白名单`,allowedPathsHelp:`可信绝对目录根路径的 JSON 数组。文件工具和 safe mode 的 shell 路径检查除了当前工作区,也允许访问这些目录。`,allowDangerousCommands:`允许危险命令`,ui:`界面`,uiLanguage:`界面语言`,replyLanguage:`回复语言`,backToTop:`回到顶部`,pendingItems:`排队中`,copyCode:`复制`,copyMessage:`复制`,copied:`已复制`,connected:`已连接`,disconnected:`连接断开,正在重连...`,unknownProject:`未知项目`,emptyChat:`空对话`,messages:`条消息`,renderError:`渲染错误`,retry:`重试`,refresh:`刷新`,planReviewFirst:`请先在上方审阅计划,批准、修改或否决后再继续输入`,loading:`加载中`,sending:`发送`,updating:`更新中...`,updatedRestart:`已更新,请重启`,updateAvailable:`新版本可用,点击更新`,openSettings:`打开设置`,current:`当前`,sessions:`会话`,items:`项`,enabled:`已启用`,disabled:`已停用`,disable:`停用`,noMatches:`没有匹配结果`,generationDepthFast:`快速`,generationDepthStandard:`标准`,generationDepthDeep:`深度`,startingAnalysis:`正在启动项目需求分析`,preparingScan:`准备扫描代码、接口和项目结构`,generationFailed:`生成遇到问题`,generatingCodeWiki:`正在生成 CodeWiki`,stepsCompleted:`个步骤完成`,codewikiFailed:`CodeWiki 问答失败`,failedToLoad:`无法加载 CodeWiki 报告`,failedToStart:`无法启动 CodeWiki 生成`,failedToDelete:`无法删除 CodeWiki 报告`,currentProject:`当前项目`,generating:`生成中`,generateNew:`生成新的 CodeWiki`,report:`报告`,refreshReport:`刷新报告`,noReportYet:`还没有 requirements 报告。生成后会出现在这里。`,reportActions:`报告操作`,deleteReport:`删除`,loadingReport:`加载报告`,projectDocs:`基于 project-requirements 的项目文档`,generate:`生成`,noCodeWiki:`还没有 CodeWiki`,generateRequirements:`生成当前项目的 requirements`,reportWillShow:`报告后,这里会展示架构图、接口需求、流程和风险说明。`,reportLoadFailed:`报告加载失败。`,noQuestionsDuringGeneration:`CodeWiki 生成完成前暂不接受提问。`,tempReadOnlyQa:`临时只读问答,不会修改项目,也不会保存到会话历史。`,processingQuestion:`当前问题处理中`,canAskAboutProject:`可以问当前项目`,askAfterGeneration:`生成完成后再基于报告提问。`,exampleQuestions:`例如:主要业务流程是什么?哪些接口风险最高?`,answering:`正在回答...`,sendingQuestion:`发送问题`,deleteReportConfirm:`删除 CodeWiki 报告?`,deleteReportDescription:`报告「{{report}}」会从当前项目历史报告中移除,此操作不可撤销。`,executionMode:`工作模式`,normalExecutionMode:`普通`,normalModeDesc:`直接处理当前请求`,approvalMode:`审阅权限`,reviewMode:`审阅`,reviewModeDesc:`编辑、删除和风险命令需要确认`,autoMode:`自动`,autoModeDesc:`Git 项目自动执行;非 Git 文件变更需审阅`,fullAccessMode:`完全访问`,fullAccessModeDesc:`工具调用不弹审阅确认`,planMode:`计划`,planModeDesc:`仅规划不执行,审阅后再执行`,switchMode:`切换工作模式`,switchApprovalMode:`切换审阅权限`,editApproval:`确认编辑文件?`,writeApproval:`确认写入文件?`,switchModeDisabled:`当前请求完成后可切换模式`,soulSwitch:`灵魂切换`,switchSoul:`切换灵魂`,builtin:`内置`,custom:`自定义`,sendMessageToCodemini:`给 Codemini 发送消息`,sendMessageToCodeminiWithSlash:`给 Codemini 发送消息,输入 / 查看更多功能`,askAnything:`可向 Codemini 询问任何事。输入 / 使用命令或技能`,addContext:`添加上下文`,switchWorkspace:`切换工作区`,name:`名称`,soulContent:`灵魂内容`,newSoul:`新建灵魂`,editSoul:`编辑灵魂`,soulEditorHint:`灵魂只影响回复语气,不应写入执行规则或工具策略。`,soulPlaceholder:`描述这个人格的语气、措辞和表达偏好...`,soulPanelHint:`选择默认人格;新的对话和后续请求会使用当前灵魂语气。`,noActiveSoul:`未选择灵魂`,searchSouls:`搜索灵魂名称...`,create:`创建`,save:`保存`,contentPreview:`- 内容预览`,close:`关闭`,addSoul:`添加灵魂`,noSouls:`暂无灵魂`,noSoulsHint:`创建一个自定义灵魂,用来固定 Codemini 的回复语气。`,activate:`激活`,edit:`编辑`,view:`查看`,delete:`删除`,deleting:`删除中`,globalScope:`全局`,projectScope:`项目`,enable:`启用`,userScope:`用户`,memoryManagement:`记忆管理`,memoryLibrary:`记忆库`,memoryPanelHint:`查看、搜索和删除用户、项目与全局持久记忆。`,memoryLoadFailed:`无法加载记忆`,searchMemories:`搜索记忆内容...`,noMemories:`暂无记忆`,noMemoriesHint:`运行 /memory 或等待自动整理后,长期记忆会显示在这里。`,pinned:`已固定`,deleteFailed:`删除失败`,confirmDeleteMemory:`确定删除记忆 "{{summary}}"?`,addSkill:`添加技能`,installSkill:`安装`,installing:`安装中...`,skillInstallPlaceholder:`GitHub 仓库、URL、目录路径,或 npx skills@latest add owner/repo`,skillScope:`安装范围`,noSkills:`暂无技能`,noSkillsHint:`创建项目技能,把可复用工作流沉淀成 / 命令。`,skillLibrary:`技能库`,skillPanelHint:`技能会作为 / 命令或自动技能注入到 prompt,内置技能始终可用。`,newSkill:`新建技能`,editSkill:`编辑技能`,skillEditorHint:`技能适合沉淀稳定流程、检查清单和项目约定。`,searchSkills:`搜索技能名称...`,skillDescriptionPlaceholder:`这个技能适合什么时候使用...`,skillContent:`SKILL.md 内容`,skillRoutingSettings:`路由设置`,skillMode:`模式`,skillMode_always:`始终`,skillMode_auto_attach:`自动附加`,skillMode_agent_requested:`Agent 请求`,skillMode_manual:`手动`,skillPriority:`优先级`,skillTriggers:`触发器`,description:`描述`,noDescription:`暂无描述`,noPreview:`暂无预览`,filter_all:`全部`,filter_enabled:`启用`,filter_builtin:`内置`,filter_custom:`自定义`,confirmDeleteSkill:`确定删除技能 "{{name}}"?`,confirmDeleteSoul:`确定删除灵魂 "{{name}}"?`,aboutTitle:`关于 Codemini`,aboutEyebrow:`本地 coding agent`,aboutTagline:`一个更克制、更可审计的 coding agent:CLI 的速度,Web UI 的可见性,项目记忆、技能、审批和干净的上下文管理都在一起。`,aboutFeatureRuntime:`同一套运行时`,aboutFeatureRuntimeDesc:`CLI 和 Web UI 共享会话、配置、项目状态、技能和执行模式。`,aboutFeatureApprovals:`过程可审阅`,aboutFeatureApprovalsDesc:`工具调用、计划和高风险动作在执行前都能看清楚。`,aboutFeatureMemory:`上下文更稳`,aboutFeatureMemoryDesc:`压缩摘要、项目索引、记忆 inbox 和 dream consolidation 让长任务可继续。`,aboutFeatureConfig:`接入你的模型`,aboutFeatureConfigDesc:`支持 OpenAI 兼容网关或内部模型服务,不改变工作流。`,projectRepository:`GitHub 项目主页`,installation:`安装`,startWebUI:`启动 Web UI`,startWebUIDesc:`启动后浏览器会自动打开 Web 界面,也可以手动访问终端中显示的地址。`,basicUsage:`基本使用`,chatUsage:`在输入框直接输入问题或指令,按 Enter 发送`,skillUsage:`输入 / 触发技能选择面板`,soulUsage:`点击输入框工具栏的灵魂按钮切换 AI 人格`,normalMode:`普通`,autoModeAbout:`自动`,modeUsage:`需确认工具调用,`,modeUsageAuto:`全自动执行`,workspace:`工作区`,workspaceUsage:`点击输入框的文件夹按钮切换项目目录`,configureModel:`配置模型`,configureModelDesc:`支持 OpenAI 兼容接口,可在设置中配置 API Key、Endpoint 等。`,selectProject:`选择项目`,enterOrBrowse:`输入或浏览项目路径...`,select:`选择`,noSubDirs:`无子目录`,language:`语言`,switchLanguage:`切换语言`,switchThemePalette:`切换主题配色`,themeDefault:`Default`,themeCatppuccin:`Catppuccin`,themeTokyoNight:`Tokyo Night`,themeOne:`One`,themeGithub:`GitHub`,themeVSCode:`VS Code`,generalChat:`普通会话`,projectTask:`项目任务`,generalChatDesc:`无需绑定项目,自由对话`,enterGeneral:`进入普通会话`,askAnythingGeneral:`有什么可以帮你的?`,buildInProject:`要在 {{project}} 中构建什么?`,undoChange:`撤回变更`,undoChangeFailed:`撤回变更失败`,undoChangeConfirm:`确认撤回变更?`,undoChangeDescription:`你确认撤回「{{path}}」的变更吗?此操作会修改工作区文件。`,undoChangesDescription:`你确认撤回「{{path}}」的 {{count}} 个变更吗?此操作会修改工作区文件。`,undoChangeConflict:`无法干净撤回:后续变更和这次变更冲突。请先撤回更新的变更,或手动处理这个文件。`,undoingChange:`撤回中...`,undoChangeReverted:`已撤回`,backupShort:`备份`,backupReusedShort:`已备份`,backupReady:`已记录轻量备份`,backupCreated:`已创建轻量备份`,backupReused:`复用本会话已有备份`,backupSkipped:`未创建文件备份`,gitStaged:`已暂存`,gitModified:`已修改`,gitUntracked:`未跟踪`,gitClean:`无变更`,gitDiffTitle:`Git 差异`,gitDiffNoChanges:`无变更`,gitDiffLoading:`加载差异...`,gitDiffStaged:`已暂存`,gitDiffModified:`已修改`,gitDiffDeleted:`已删除`,gitDiffUntracked:`未跟踪`,gitDiffNoDiffAvailable:`无差异内容`,conversations:`对话`,noConversations:`暂无聊天`,justNow:`刚刚`,minutesAgo:`分钟前`,hoursAgo:`小时前`,daysAgo:`天前`},en:{brand:`Codemini`,live:`LIVE`,idle:`IDLE`,sending:`SENDING`,thinking:`THINKING`,streaming:`STREAMING`,tooling:`TOOLING`,inputPlaceholder:`Type a message or / command...`,inputDisabled:`Waiting for current request to finish...`,inputPlanReviewDisabled:`Review the plan above before continuing`,abort:`Stop`,approveTitle:`Confirm Action`,approve:`Approve`,deny:`Deny`,deleteApproval:`Confirm Delete`,runApproval:`Confirm Run Command`,planApproval:`Confirm Plan`,reflectApproval:`Confirm Save Skill`,toolRunning:`Running`,toolDone:`Done`,toolError:`Error`,toolBlocked:`Blocked`,toolGroupTools:`Ran {{count}} tools`,toolGroupCommands:`Ran {{count}} commands`,toolGroupExpand:`Click to expand`,planTitle:`Execution Plan`,planDone:`Done`,planReviewTitle:`Review Plan`,planReviewSummary:`Summary`,planReviewSteps:`Plan Steps`,planApprove:`Approve`,planReject:`Reject`,planEdit:`Edit Plan`,planEditPlaceholder:`Describe your changes...`,planSubmitFeedback:`Submit Feedback`,planStepCount:`steps`,planReviewStatus:`Awaiting Review`,planWaitingReview:`Waiting for plan review…`,waitingResponse:`Waiting for response…`,reflectReviewTitle:`Review Skill Draft`,reflectReviewStatus:`Awaiting Review`,reflectScope:`Scope`,reflectConfidence:`Confidence`,reflectApprove:`Save Skill`,reflectReject:`Discard`,reflectEdit:`Revise Draft`,reflectEditPlaceholder:`Describe how this skill draft should change...`,reflectSubmitFeedback:`Submit Feedback`,reflectReviewFirst:`Review the skill draft before continuing`,runtimeActivityDreamRunning:`Dream is consolidating memory`,runtimeActivityDreamDone:`Dream complete`,runtimeActivityDreamError:`Dream failed`,runtimeActivityCompactDone:`Context compacted`,runtimeActivityCompactPreview:`Compact preview`,runtimeActivityMicroCompactDone:`Micro-compact complete`,runtimeActivityMicroCompactPreview:`Micro-compact preview`,runtimeActivityInboxCaptured:`Saved to Inbox`,runtimeActivityInboxListed:`Inbox checked`,runtimeActivityReflectPending:`Reflect awaiting review`,runtimeActivityReflectRevised:`Reflect draft updated`,runtimeActivityReflectSaving:`Saving skill`,runtimeActivityReflectSaved:`Skill saved`,runtimeActivityReflectRevising:`Revising draft`,runtimeActivityReflectDiscarding:`Discarding draft`,runtimeActivityReflectDiscarded:`Draft discarded`,runtimeActivityReflectNone:`No reusable skill found`,skillRunning:`Running`,skillDone:`Done`,skillError:`Failed`,skillAuto:`Auto Skill`,contextUsage:`Context`,fileChanges:`File Changes`,thought:`Thought process`,thoughtFor:`Thought for {{duration}}`,thinkingNow:`Thinking...`,thoughtForNow:`Thinking for {{duration}}`,processed:`Processed`,processedFor:`Processed for {{duration}}`,processedDetails:`{{thoughts}} thoughts, {{tools}} tools`,usageTokens:`tokens`,usageCache:`cache`,usageInput:`input`,usageOutput:`output`,usageTotal:`total`,usageCacheHit:`cache hit`,usageCacheMiss:`cache miss`,usageCacheWrite:`cache write`,usageReasoning:`reasoning`,usageRequests:`{{count}} requests`,newChat:`New Chat`,skills:`Skills`,memory:`Memory`,souls:`Souls`,projects:`Projects`,newSessionInProject:`New Chat in Project`,openCodeWiki:`Open CodeWiki`,collapseProject:`Collapse Project`,expandProject:`Expand Project`,showMoreSessions:`Show more`,sessionActions:`Session Actions`,deleteSession:`Delete`,noSessions:`No conversations yet`,about:`About`,lightMode:`Light`,darkMode:`Dark`,autoModeTheme:`System`,switchTheme:`Switch Theme`,settings:`Settings`,deleteSessionConfirm:`Delete Session?`,deleteSessionDescription:`Session "{{session}}" will be removed from history, this action cannot be undone.`,settingsTitle:`Settings`,configRequired:`Configure the API Base URL and API Key in Settings first`,configRequiredTitle:`Model gateway setup required`,configRequiredDesc:`This install is still using the default gateway endpoint. Set the Base URL, API Key, and model before chatting.`,cancel:`Cancel`,saveChanges:`Save Changes`,gateway:`Gateway`,baseUrl:`Base URL`,apiKey:`API Key`,timeout:`Timeout (ms)`,maxRetries:`Max Retries`,model:`Model`,modelName:`Model Name`,fastModel:`Fast Model`,maxContextTokens:`Max Context Tokens`,sdk:`SDK`,provider:`Provider`,execution:`Execution`,mode:`Mode`,maxSteps:`Max Steps`,context:`Context`,contextMaxTokens:`Context Token Budget`,preflightTrigger:`Preflight Trigger (%)`,hardLimit:`Hard Limit (%)`,toolResultMaxChars:`Tool Result Char Limit`,microcompactEnabled:`Micro-Compact`,microcompactKeepRecent:`Micro Keep Recent`,shell:`Shell`,defaultShell:`Default Shell`,policy:`Policy`,safeMode:`Safe Mode`,allowedPaths:`Allowed Paths`,allowedPathsHelp:`JSON array of trusted absolute directory roots. File tools and safe-mode shell path checks may access these paths in addition to the current workspace.`,allowDangerousCommands:`Allow Dangerous Commands`,ui:`UI`,uiLanguage:`UI Language`,replyLanguage:`Reply Language`,backToTop:`Back to top`,pendingItems:`Queued`,copyCode:`Copy`,copyMessage:`Copy`,copied:`Copied`,connected:`Connected`,disconnected:`Disconnected, reconnecting...`,unknownProject:`Unknown Project`,emptyChat:`Empty Chat`,messages:`messages`,renderError:`Render Error`,retry:`Retry`,refresh:`Refresh`,planReviewFirst:`Please review the plan above, approve, modify, or reject before continuing`,loading:`Loading`,sending:`Send`,updating:`Updating...`,updatedRestart:`Updated, please restart`,updateAvailable:`new version available, click to update`,openSettings:`Open Settings`,current:`Current`,sessions:`Sessions`,items:`items`,enabled:`Enabled`,disabled:`Disabled`,disable:`Disable`,noMatches:`No matches`,generationDepthFast:`Fast`,generationDepthStandard:`Standard`,generationDepthDeep:`Deep`,startingAnalysis:`Starting project requirements analysis`,preparingScan:`Preparing to scan code, interfaces, and project structure`,generationFailed:`Generation encountered an issue`,generatingCodeWiki:`Generating CodeWiki`,stepsCompleted:`steps completed`,codewikiFailed:`CodeWiki Q&A failed`,failedToLoad:`Failed to load CodeWiki report`,failedToStart:`Failed to start CodeWiki generation`,failedToDelete:`Failed to delete CodeWiki report`,currentProject:`Current Project`,generating:`Generating`,generateNew:`Generate New CodeWiki`,report:`Report`,refreshReport:`Refresh Report`,noReportYet:`No requirements report yet. It will appear here after generation.`,reportActions:`Report Actions`,deleteReport:`Delete`,loadingReport:`Loading Report`,projectDocs:`Project documentation based on project-requirements`,generate:`Generate`,noCodeWiki:`No CodeWiki yet`,generateRequirements:`Generate requirements for the current project`,reportWillShow:`After generating the report, architecture diagrams, interface requirements, processes, and risk descriptions will be displayed here.`,reportLoadFailed:`Report failed to load.`,noQuestionsDuringGeneration:`Questions not accepted until CodeWiki generation is complete.`,tempReadOnlyQa:`Temporary read-only Q&A, will not modify the project or save to session history.`,processingQuestion:`Processing current question`,canAskAboutProject:`You can ask about the current project`,askAfterGeneration:`Ask questions based on the report after generation is complete.`,exampleQuestions:`For example: What is the main business process? Which interfaces have the highest risks?`,answering:`Answering...`,sendingQuestion:`Send Question`,deleteReportConfirm:`Delete CodeWiki Report?`,deleteReportDescription:`Report "{{report}}" will be removed from current project history reports, this action cannot be undone.`,executionMode:`Work Mode`,normalExecutionMode:`Normal`,normalModeDesc:`Handle the current request directly`,approvalMode:`Approval Mode`,reviewMode:`Review`,reviewModeDesc:`Confirm edits, deletes, and risky commands`,autoMode:`Auto`,autoModeDesc:`Auto-run in Git projects; review non-Git file changes`,fullAccessMode:`Full Access`,fullAccessModeDesc:`Run tool calls without approval prompts`,planMode:`Plan`,planModeDesc:`Plan only, review before execution`,switchMode:`Switch Work Mode`,switchApprovalMode:`Switch Approval Mode`,editApproval:`Confirm file edit?`,writeApproval:`Confirm file write?`,switchModeDisabled:`Can switch modes after current request completes`,soulSwitch:`Soul Switch`,switchSoul:`Switch Soul`,builtin:`Built-in`,custom:`Custom`,sendMessageToCodemini:`Message Codemini`,sendMessageToCodeminiWithSlash:`Message Codemini, type / for more features`,askAnything:`You can ask Codemini anything. Type / to use commands or skills`,addContext:`Add Context`,switchWorkspace:`Switch Workspace`,name:`Name`,soulContent:`Soul Content`,newSoul:`New Soul`,editSoul:`Edit Soul`,soulEditorHint:`Souls affect response tone only; avoid execution rules or tool policy here.`,soulPlaceholder:`Describe tone, phrasing, and personality preferences...`,soulPanelHint:`Choose the default personality. New prompts will use the active soul tone.`,noActiveSoul:`No soul selected`,searchSouls:`Search souls by name...`,create:`Create`,save:`Save`,contentPreview:`- Content Preview`,close:`Close`,addSoul:`Add Soul`,noSouls:`No souls yet`,noSoulsHint:`Create a custom soul to keep Codemini response tone consistent.`,activate:`Activate`,edit:`Edit`,view:`View`,delete:`Delete`,deleting:`Deleting...`,globalScope:`Global`,projectScope:`Project`,enable:`Enable`,userScope:`User`,memoryManagement:`Memory Management`,memoryLibrary:`Memory Library`,memoryPanelHint:`View, search, and delete user, project, and global persistent memories.`,memoryLoadFailed:`Failed to load memories`,searchMemories:`Search memories...`,noMemories:`No memories yet`,noMemoriesHint:`Long-term memories will appear here after /memory or automatic consolidation runs.`,pinned:`Pinned`,deleteFailed:`Delete failed`,confirmDeleteMemory:`Delete memory "{{summary}}"?`,addSkill:`Add Skill`,installSkill:`Install`,installing:`Installing...`,skillInstallPlaceholder:`GitHub repo, URL, folder path, or npx skills@latest add owner/repo`,skillScope:`Install Scope`,noSkills:`No skills yet`,noSkillsHint:`Create a project skill to turn reusable workflows into / commands.`,skillLibrary:`Skill Library`,skillPanelHint:`Skills can be invoked as / commands or injected automatically. Built-in skills are always available.`,newSkill:`New Skill`,editSkill:`Edit Skill`,skillEditorHint:`Skills are best for stable workflows, checklists, and project conventions.`,searchSkills:`Search skills by name...`,skillDescriptionPlaceholder:`When should this skill be used...`,skillContent:`SKILL.md Content`,skillRoutingSettings:`Routing Settings`,skillMode:`Mode`,skillMode_always:`Always`,skillMode_auto_attach:`Auto Attach`,skillMode_agent_requested:`Agent Requested`,skillMode_manual:`Manual`,skillPriority:`Priority`,skillTriggers:`Triggers`,description:`Description`,noDescription:`No description`,noPreview:`No preview`,filter_all:`All`,filter_enabled:`Enabled`,filter_builtin:`Built-in`,filter_custom:`Custom`,confirmDeleteSkill:`Delete skill "{{name}}"?`,confirmDeleteSoul:`Delete soul "{{name}}"?`,aboutTitle:`About Codemini`,aboutEyebrow:`Local coding agent`,aboutTagline:`A compact, auditable coding agent with CLI speed, Web UI visibility, project memory, skills, approvals, and clean context management.`,aboutFeatureRuntime:`One runtime`,aboutFeatureRuntimeDesc:`CLI and Web UI share sessions, config, project state, skills, and execution mode.`,aboutFeatureApprovals:`Reviewable work`,aboutFeatureApprovalsDesc:`Tool calls, plans, and risky actions stay visible before they run.`,aboutFeatureMemory:`Smarter context`,aboutFeatureMemoryDesc:`Compact summaries, project index, memory inbox, and dream consolidation keep long work usable.`,aboutFeatureConfig:`Bring your model`,aboutFeatureConfigDesc:`Use OpenAI-compatible gateways or internal providers without changing the workflow.`,projectRepository:`GitHub repository`,installation:`Installation`,startWebUI:`Start Web UI`,startWebUIDesc:`After starting, the browser will automatically open the Web interface. You can also manually visit the address shown in the terminal.`,basicUsage:`Basic Usage`,chatUsage:`Type questions or instructions in the input box, press Enter to send`,skillUsage:`Type / to open the skill selection panel`,soulUsage:`Click the soul button in the input toolbar to switch AI personality`,normalMode:`Normal`,autoModeAbout:`Auto`,modeUsage:`requires confirming tool calls, `,modeUsageAuto:`executes everything automatically`,workspace:`Workspace`,workspaceUsage:`Click the folder button in the input box to switch project directory`,configureModel:`Configure Model`,configureModelDesc:`Supports OpenAI-compatible interfaces. Configure API Key, Endpoint, etc. in Settings.`,selectProject:`Select Project`,enterOrBrowse:`Enter or browse project path...`,select:`Select`,noSubDirs:`No subdirectories`,language:`Language`,switchLanguage:`Switch Language`,switchThemePalette:`Switch Theme Palette`,themeDefault:`Default`,themeCatppuccin:`Catppuccin`,themeTokyoNight:`Tokyo Night`,themeOne:`One`,themeGithub:`GitHub`,themeVSCode:`VS Code`,generalChat:`General Chat`,projectTask:`Project Task`,generalChatDesc:`Chat freely without binding to a project`,enterGeneral:`Enter General Chat`,askAnythingGeneral:`How can I help you?`,buildInProject:`What do you want to build in {{project}}?`,undoChange:`Undo change`,undoChangeFailed:`Failed to undo change`,undoChangeConfirm:`Undo this change?`,undoChangeDescription:`Undo changes to "{{path}}"? This will modify files in the workspace.`,undoChangesDescription:`Undo {{count}} changes to "{{path}}"? This will modify files in the workspace.`,undoChangeConflict:`Cannot undo cleanly because newer edits conflict with this change. Undo newer changes first, or handle this file manually.`,undoingChange:`Undoing...`,undoChangeReverted:`Reverted`,backupShort:`Backup`,backupReusedShort:`Backed up`,backupReady:`Light backup recorded`,backupCreated:`Light backup created`,backupReused:`Reusing this session backup`,backupSkipped:`File backup not created`,gitStaged:`Staged`,gitModified:`Modified`,gitUntracked:`Untracked`,gitClean:`Clean`,gitDiffTitle:`Git Diff`,gitDiffNoChanges:`No changes`,gitDiffLoading:`Loading diff...`,gitDiffStaged:`Staged`,gitDiffModified:`Modified`,gitDiffDeleted:`Deleted`,gitDiffUntracked:`Untracked`,gitDiffNoDiffAvailable:`No diff available`,conversations:`Conversations`,noConversations:`No conversations yet`,justNow:`just now`,minutesAgo:`m ago`,hoursAgo:`h ago`,daysAgo:`d ago`}},Ds=`zh`,Os=localStorage.getItem(`codemini-ui-language`);Os&&Es[Os]&&(Ds=Os);function ks(e){Es[e]&&(Ds=e,localStorage.setItem(`codemini-ui-language`,e))}function V(e){return Es[Ds][e]||Es.en[e]||e}function As(){return Ds}var js={"Content-Type":`application/json`};async function H(e,t={}){return await fetch(e,t)}async function Ms(){return(await H(`/api/version`)).json()}async function Ns(){return(await H(`/api/update`,{method:`POST`})).json()}async function Ps(){return(await H(`/api/state`)).json()}async function Fs(){return(await H(`/api/startup-events`)).json()}async function Is(){return(await H(`/api/history`)).json()}async function Ls(e=200){let t=new URLSearchParams,n=Number(e);return Number.isFinite(n)&&n>0&&t.set(`limit`,String(Math.round(n))),(await H(t.size?`/api/sessions?${t.toString()}`:`/api/sessions`)).json()}async function Rs(){return(await H(`/api/session/messages`)).json()}async function zs(){return(await H(`/api/session/ui-messages`)).json()}async function Bs(e,t={}){return await H(`/api/submit`,{method:`POST`,headers:js,body:JSON.stringify({line:e,...t.readOnlyCodeWiki?{readOnlyCodeWiki:!0}:{}})})}async function Vs(){await H(`/api/abort`,{method:`POST`})}async function Hs(e){return(await H(`/api/execution-mode`,{method:`POST`,headers:js,body:JSON.stringify({mode:e})})).json()}async function Us(e){return(await H(`/api/approval-mode`,{method:`POST`,headers:js,body:JSON.stringify({mode:e})})).json()}async function Ws(e,t){await H(`/api/approval`,{method:`POST`,headers:js,body:JSON.stringify({id:e,approved:t})})}async function Gs(e){return(await H(`/api/sessions/switch`,{method:`POST`,headers:js,body:JSON.stringify({sessionId:e})})).json()}async function Ks(e){return(await H(`/api/sessions/${encodeURIComponent(e)}`,{method:`DELETE`})).json()}async function qs(){return(await H(`/api/sessions/new`,{method:`POST`})).json()}async function Js(){return(await H(`/api/config`)).json()}async function Ys(){return(await H(`/api/config/status`)).json()}async function Xs(e,t){return(await H(`/api/config/set`,{method:`POST`,headers:js,body:JSON.stringify({key:e,value:t})})).json().catch(()=>({}))}async function Zs(){return(await H(`/api/project`)).json()}async function Qs(){return(await H(`/api/git`)).json()}async function $s(){return(await H(`/api/git-diff`)).json()}async function ec(e){return(await H(`/api/session-changes/${encodeURIComponent(e)}/undo`,{method:`POST`})).json()}async function tc(){return(await H(`/api/session-changes`)).json()}async function nc(e){return(await H(`/api/session-changes/undo`,{method:`POST`,headers:js,body:JSON.stringify({ids:e})})).json()}async function rc(e){return(await H(`/api/git-batch`,{method:`POST`,headers:js,body:JSON.stringify({dirs:e})})).json()}async function ic(e){return(await H(`/api/project/open`,{method:`POST`,headers:js,body:JSON.stringify({path:e})})).json()}async function ac(e){return(await H(`/api/project/browse`,{method:`POST`,headers:js,body:JSON.stringify({dir:e})})).json()}function oc(e,t=[]){let n=Array.isArray(t)?t.map(e=>String(e||``).trim()).filter(Boolean):[];n.length>0&&e.set(`projects`,JSON.stringify(n))}function sc(e,t){let n=String(t||``).trim();return n?`${e}?${new URLSearchParams({projectDir:n}).toString()}`:e}async function cc(e=[]){let t=new URLSearchParams;oc(t,e);let n=t.toString();return(await H(n?`/api/skills?${n}`:`/api/skills`)).json()}async function lc(e,t){return(await H(sc(`/api/skills/${encodeURIComponent(e)}/content`,t))).json()}async function uc({name:e,description:t,content:n,scope:r}){return(await H(`/api/skills/create`,{method:`POST`,headers:js,body:JSON.stringify({name:e,description:t,content:n,scope:r})})).json()}async function dc({source:e,scope:t}){return(await H(`/api/skills/install`,{method:`POST`,headers:js,body:JSON.stringify({source:e,scope:t})})).json()}async function fc(e,t,n){return(await H(`/api/skills/${encodeURIComponent(e)}/content`,{method:`PUT`,headers:js,body:JSON.stringify({content:t,projectDir:n})})).json()}async function pc(e,t,n){return(await H(`/api/skills/${encodeURIComponent(e)}/metadata`,{method:`PUT`,headers:js,body:JSON.stringify({...t||{},projectDir:n})})).json()}async function mc(e,t){return(await H(sc(`/api/skills/${encodeURIComponent(e)}`,t),{method:`DELETE`})).json()}async function hc(e,t,n){return(await H(`/api/skills/${encodeURIComponent(e)}/toggle`,{method:`POST`,headers:js,body:JSON.stringify({enabled:t,projectDir:n})})).json()}async function gc({scope:e=`user`,query:t=``,projectDirs:n=[]}={}){let r=new URLSearchParams({scope:e});return t.trim()&&r.set(`q`,t.trim()),oc(r,n),(await H(`/api/memory?${r.toString()}`)).json()}async function _c(e,t,n){let r=new URLSearchParams({scope:e});return n&&r.set(`projectDir`,n),(await H(`/api/memory/${encodeURIComponent(t)}?${r.toString()}`,{method:`DELETE`})).json()}async function vc(){return(await H(`/api/souls`)).json()}async function yc(e){return(await H(`/api/souls/${encodeURIComponent(e)}/content`)).json()}async function bc({name:e,content:t}){return(await H(`/api/souls/create`,{method:`POST`,headers:js,body:JSON.stringify({name:e,content:t})})).json()}async function xc(e,t){return(await H(`/api/souls/${encodeURIComponent(e)}/content`,{method:`PUT`,headers:js,body:JSON.stringify({content:t})})).json()}async function Sc(e){return(await H(`/api/souls/${encodeURIComponent(e)}`,{method:`DELETE`})).json()}async function Cc(e){return(await H(`/api/souls/activate`,{method:`POST`,headers:js,body:JSON.stringify({name:e})})).json()}function wc(e=``){return e?`?project=${encodeURIComponent(e)}`:``}async function Tc(e=``){return(await H(`/api/codewiki/reports${wc(e)}`)).json()}async function Ec(e=``){return(await H(`/api/codewiki/symbol-graph${wc(e)}`)).json()}async function Dc(e=`standard`,t=``){return(await H(`/api/codewiki/generate${wc(t)}`,{method:`POST`,headers:js,body:JSON.stringify({depth:e})})).json()}async function Oc({question:e,reportFile:t=``,project:n=``,onEvent:r}={}){let i=await H(`/api/codewiki/ask${wc(n)}`,{method:`POST`,headers:js,body:JSON.stringify({question:e,reportFile:t})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.message||`CodeWiki 问答失败`)}if(!i.body)throw Error(`当前浏览器不支持流式响应`);let a=i.body.getReader(),o=new TextDecoder,s=``;for(;;){let{value:e,done:t}=await a.read();if(t)break;s+=o.decode(e,{stream:!0});let n=s.indexOf(`
59
+ Defaulting to \`null\`.`}var Do=vo,Oo=bo,ko=`Separator`,Ao=`horizontal`,jo=[`horizontal`,`vertical`],Mo=d.forwardRef((e,t)=>{let{decorative:n,orientation:r=Ao,...i}=e,a=No(r)?r:Ao,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,h.jsx)(T.div,{"data-orientation":a,...o,...i,ref:t})});Mo.displayName=ko;function No(e){return jo.includes(e)}var Po=Mo,[Fo,Io]=re(`Tooltip`,[va]),Lo=va(),Ro=`TooltipProvider`,zo=700,Bo=`tooltip.open`,[Vo,Ho]=Fo(Ro),Uo=e=>{let{__scopeTooltip:t,delayDuration:n=zo,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=d.useRef(!0),s=d.useRef(!1),c=d.useRef(0);return d.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,h.jsx)(Vo,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:d.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:d.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:d.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Uo.displayName=Ro;var Wo=`Tooltip`,[Go,Ko]=Fo(Wo),qo=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Ho(Wo,e.__scopeTooltip),l=Lo(t),[u,f]=d.useState(null),p=pe(),m=d.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=d.useRef(!1),[y,b]=j({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Bo))):c.onClose(),a?.(e)},caller:Wo}),x=d.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=d.useCallback(()=>{window.clearTimeout(m.current),m.current=0,v.current=!1,b(!0)},[b]),C=d.useCallback(()=>{window.clearTimeout(m.current),m.current=0,b(!1)},[b]),w=d.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{v.current=!0,b(!0),m.current=0},_)},[_,b]);return d.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,h.jsx)(Pa,{...l,children:(0,h.jsx)(Go,{scope:t,contentId:p,open:y,stateAttribute:x,trigger:u,onTriggerChange:f,onTriggerEnter:d.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:d.useCallback(()=>{g?C():(window.clearTimeout(m.current),m.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})};qo.displayName=Wo;var Jo=`TooltipTrigger`,Yo=d.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Ko(Jo,n),a=Ho(Jo,n),o=Lo(n),s=m(t,d.useRef(null),i.onTriggerChange),c=d.useRef(!1),l=d.useRef(!1),u=d.useCallback(()=>c.current=!1,[]);return d.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,h.jsx)(Fa,{asChild:!0,...o,children:(0,h.jsx)(T.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:k(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:k(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:k(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:k(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:k(e.onBlur,i.onClose),onClick:k(e.onClick,i.onClose)})})});Yo.displayName=Jo;var Xo=`TooltipPortal`,[Zo,Qo]=Fo(Xo,{forceMount:void 0}),$o=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Ko(Xo,t);return(0,h.jsx)(Zo,{scope:t,forceMount:n,children:(0,h.jsx)(le,{present:n||a.open,children:(0,h.jsx)(Ke,{asChild:!0,container:i,children:r})})})};$o.displayName=Xo;var es=`TooltipContent`,ts=d.forwardRef((e,t)=>{let n=Qo(es,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Ko(es,e.__scopeTooltip);return(0,h.jsx)(le,{present:r||o.open,children:o.disableHoverableContent?(0,h.jsx)(os,{side:i,...a,ref:t}):(0,h.jsx)(ns,{side:i,...a,ref:t})})}),ns=d.forwardRef((e,t)=>{let n=Ko(es,e.__scopeTooltip),r=Ho(es,e.__scopeTooltip),i=d.useRef(null),a=m(t,i),[o,s]=d.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:f}=r,p=d.useCallback(()=>{s(null),f(!1)},[f]),g=d.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=us(r,ls(r,n.getBoundingClientRect())),a=ds(t.getBoundingClientRect());s(ps([...i,...a])),f(!0)},[f]);return d.useEffect(()=>()=>p(),[p]),d.useEffect(()=>{if(c&&u){let e=e=>g(e,u),t=e=>g(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,g,p]),d.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!fs(n,o);r?p():i&&(p(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,p]),(0,h.jsx)(os,{...e,ref:a})}),[rs,is]=Fo(Wo,{isInside:!1}),as=b(`TooltipContent`),os=d.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Ko(es,n),l=Lo(n),{onClose:u}=c;return d.useEffect(()=>(document.addEventListener(Bo,u),()=>document.removeEventListener(Bo,u)),[u]),d.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,h.jsx)(Se,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,h.jsxs)(Ia,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,h.jsx)(as,{children:r}),(0,h.jsx)(rs,{scope:n,isInside:!0,children:(0,h.jsx)(te,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});ts.displayName=es;var ss=`TooltipArrow`,cs=d.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Lo(n);return is(ss,n).isInside?null:(0,h.jsx)(La,{...i,...r,ref:t})});cs.displayName=ss;function ls(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function us(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ds(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function fs(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ps(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),ms(t)}function ms(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var hs=Uo,gs=qo,_s=Yo,vs=$o,ys=ts,bs=cs,xs=u();function B(...e){return o(i(e))}function Ss({delayDuration:e=0,...t}){return(0,h.jsx)(hs,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Cs({...e}){return(0,h.jsx)(gs,{"data-slot":`tooltip`,...e})}function ws({...e}){return(0,h.jsx)(_s,{"data-slot":`tooltip-trigger`,...e})}function Ts({className:e,sideOffset:t=0,children:n,...r}){return(0,h.jsx)(vs,{children:(0,h.jsxs)(ys,{"data-slot":`tooltip-content`,sideOffset:t,className:B(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md border border-(--border-default) bg-(--bg-secondary) px-3 py-1.5 text-xs text-balance text-(--text-primary) shadow-lg fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,h.jsx)(bs,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-(--bg-secondary) fill-(--bg-secondary)`})]})})}var Es={zh:{brand:`Codemini`,live:`运行中`,idle:`空闲`,sending:`发送中`,thinking:`思考中`,streaming:`回复中`,tooling:`工具执行中`,inputPlaceholder:`输入消息或 / 命令...`,inputDisabled:`等待当前请求完成...`,inputPlanReviewDisabled:`请先在上方审阅计划,批准、修改或否决后再继续输入`,abort:`停止`,approveTitle:`确认操作`,approve:`允许`,deny:`拒绝`,deleteApproval:`确认删除`,runApproval:`确认执行命令`,planApproval:`确认执行计划`,reflectApproval:`确认保存技能`,toolRunning:`运行中`,toolDone:`完成`,toolError:`错误`,toolBlocked:`已阻止`,toolGroupTools:`已运行 {{count}} 个工具`,toolGroupCommands:`已运行 {{count}} 条命令`,toolGroupExpand:`点击展开`,planTitle:`执行计划`,planDone:`完成`,planReviewTitle:`审阅计划`,planReviewSummary:`摘要`,planReviewSteps:`计划步骤`,planApprove:`批准执行`,planReject:`否决`,planEdit:`修改计划`,planEditPlaceholder:`描述你的修改意见...`,planSubmitFeedback:`提交反馈`,planStepCount:`个步骤`,planReviewStatus:`等待审阅`,planWaitingReview:`正在等待计划审阅…`,waitingResponse:`正在等待回复…`,reflectReviewTitle:`审阅技能草稿`,reflectReviewStatus:`等待审阅`,reflectScope:`范围`,reflectConfidence:`置信度`,reflectApprove:`保存技能`,reflectReject:`丢弃`,reflectEdit:`修改草稿`,reflectEditPlaceholder:`描述你希望如何修改这个技能草稿...`,reflectSubmitFeedback:`提交反馈`,reflectReviewFirst:`请先审阅技能草稿,保存、修改或丢弃后再继续输入`,runtimeActivityDreamRunning:`Dream 正在整理记忆`,runtimeActivityDreamDone:`Dream 已完成`,runtimeActivityDreamError:`Dream 失败`,runtimeActivityCompactDone:`上下文已压缩`,runtimeActivityCompactPreview:`上下文压缩预览`,runtimeActivityMicroCompactDone:`微压缩已完成`,runtimeActivityMicroCompactPreview:`微压缩预览`,runtimeActivityInboxCaptured:`已写入 Inbox`,runtimeActivityInboxListed:`Inbox 已查看`,runtimeActivityReflectPending:`Reflect 等待审阅`,runtimeActivityReflectRevised:`Reflect 草稿已更新`,runtimeActivityReflectSaving:`正在保存技能`,runtimeActivityReflectSaved:`技能已保存`,runtimeActivityReflectRevising:`正在修改草稿`,runtimeActivityReflectDiscarding:`正在丢弃草稿`,runtimeActivityReflectDiscarded:`草稿已丢弃`,runtimeActivityReflectNone:`未找到可沉淀技能`,skillRunning:`运行中`,skillDone:`完成`,skillError:`失败`,skillAuto:`自动技能`,contextUsage:`上下文使用`,fileChanges:`文件变更`,thought:`思考过程`,thoughtFor:`思考了 {{duration}}`,thinkingNow:`正在思考中...`,thoughtForNow:`已思考 {{duration}}`,processed:`已处理`,processedFor:`已处理 {{duration}}`,processedDetails:`{{thoughts}} 段思考,{{tools}} 个工具`,usageTokens:`tokens`,usageCache:`缓存`,usageInput:`输入`,usageOutput:`输出`,usageTotal:`总计`,usageCacheHit:`缓存命中`,usageCacheMiss:`缓存未命中`,usageCacheWrite:`缓存写入`,usageReasoning:`推理`,usageRequests:`{{count}} 次请求`,newChat:`新对话`,skills:`Skills`,memory:`记忆`,souls:`Souls`,projects:`项目`,newSessionInProject:`在此项目中新建对话`,openCodeWiki:`打开 CodeWiki`,collapseProject:`折叠项目`,expandProject:`展开项目`,showMoreSessions:`展开显示`,sessionActions:`会话操作`,deleteSession:`删除`,noSessions:`暂无对话`,about:`关于`,lightMode:`浅色`,darkMode:`深色`,autoModeTheme:`跟随系统`,switchTheme:`切换主题`,settings:`设置`,deleteSessionConfirm:`删除会话?`,deleteSessionDescription:`会话「{{session}}」会从历史记录中移除,此操作不可撤销。`,settingsTitle:`设置`,configRequired:`请先在设置中配置接口地址和 API Key`,configRequiredTitle:`需要先配置模型接口`,configRequiredDesc:`当前仍是新安装的默认接口地址。设置 Base URL、API Key 和模型后即可开始使用。`,cancel:`取消`,saveChanges:`保存更改`,gateway:`网关`,baseUrl:`接口地址`,apiKey:`API 密钥`,timeout:`超时 (ms)`,maxRetries:`最大重试`,model:`模型`,modelName:`模型名称`,fastModel:`快速模型`,maxContextTokens:`最大上下文 Tokens`,sdk:`SDK`,provider:`服务商`,execution:`执行`,mode:`模式`,maxSteps:`最大步数`,context:`上下文`,contextMaxTokens:`上下文 Token 预算`,preflightTrigger:`预压缩阈值 (%)`,hardLimit:`硬压缩阈值 (%)`,toolResultMaxChars:`工具结果字符上限`,microcompactEnabled:`微压缩`,microcompactKeepRecent:`微压缩保留数`,shell:`终端`,defaultShell:`默认 Shell`,policy:`策略`,safeMode:`安全模式`,allowedPaths:`目录白名单`,allowedPathsHelp:`可信绝对目录根路径的 JSON 数组。文件工具和 safe mode 的 shell 路径检查除了当前工作区,也允许访问这些目录。`,allowDangerousCommands:`允许危险命令`,ui:`界面`,uiLanguage:`界面语言`,replyLanguage:`回复语言`,backToTop:`回到顶部`,pendingItems:`排队中`,copyCode:`复制`,copyMessage:`复制`,copied:`已复制`,connected:`已连接`,disconnected:`连接断开,正在重连...`,unknownProject:`未知项目`,emptyChat:`空对话`,messages:`条消息`,renderError:`渲染错误`,retry:`重试`,refresh:`刷新`,planReviewFirst:`请先在上方审阅计划,批准、修改或否决后再继续输入`,loading:`加载中`,sending:`发送`,updating:`更新中...`,updatedRestart:`已更新,请重启`,updateAvailable:`新版本可用,点击更新`,openSettings:`打开设置`,current:`当前`,sessions:`会话`,items:`项`,enabled:`已启用`,disabled:`已停用`,disable:`停用`,noMatches:`没有匹配结果`,generationDepthFast:`快速`,generationDepthStandard:`标准`,generationDepthDeep:`深度`,startingAnalysis:`正在启动项目需求分析`,preparingScan:`准备扫描代码、接口和项目结构`,generationFailed:`生成遇到问题`,generatingCodeWiki:`正在生成 CodeWiki`,stepsCompleted:`个步骤完成`,codewikiFailed:`CodeWiki 问答失败`,failedToLoad:`无法加载 CodeWiki 报告`,failedToStart:`无法启动 CodeWiki 生成`,failedToDelete:`无法删除 CodeWiki 报告`,currentProject:`当前项目`,generating:`生成中`,generateNew:`生成新的 CodeWiki`,report:`报告`,refreshReport:`刷新报告`,noReportYet:`还没有 requirements 报告。生成后会出现在这里。`,reportActions:`报告操作`,deleteReport:`删除`,loadingReport:`加载报告`,projectDocs:`基于 project-requirements 的项目文档`,generate:`生成`,noCodeWiki:`还没有 CodeWiki`,generateRequirements:`生成当前项目的 requirements`,reportWillShow:`报告后,这里会展示架构图、接口需求、流程和风险说明。`,reportLoadFailed:`报告加载失败。`,noQuestionsDuringGeneration:`CodeWiki 生成完成前暂不接受提问。`,tempReadOnlyQa:`临时只读问答,不会修改项目,也不会保存到会话历史。`,processingQuestion:`当前问题处理中`,canAskAboutProject:`可以问当前项目`,askAfterGeneration:`生成完成后再基于报告提问。`,exampleQuestions:`例如:主要业务流程是什么?哪些接口风险最高?`,answering:`正在回答...`,sendingQuestion:`发送问题`,deleteReportConfirm:`删除 CodeWiki 报告?`,deleteReportDescription:`报告「{{report}}」会从当前项目历史报告中移除,此操作不可撤销。`,executionMode:`工作模式`,normalExecutionMode:`普通`,normalModeDesc:`直接处理当前请求`,approvalMode:`审阅权限`,reviewMode:`审阅`,reviewModeDesc:`编辑、删除和风险命令需要确认`,autoMode:`自动`,autoModeDesc:`Git 项目自动执行;非 Git 文件变更需审阅`,fullAccessMode:`完全访问`,fullAccessModeDesc:`工具调用不弹审阅确认`,planMode:`计划`,planModeDesc:`仅规划不执行,审阅后再执行`,switchMode:`切换工作模式`,switchApprovalMode:`切换审阅权限`,editApproval:`确认编辑文件?`,writeApproval:`确认写入文件?`,switchModeDisabled:`当前请求完成后可切换模式`,soulSwitch:`灵魂切换`,switchSoul:`切换灵魂`,builtin:`内置`,custom:`自定义`,sendMessageToCodemini:`给 Codemini 发送消息`,sendMessageToCodeminiWithSlash:`给 Codemini 发送消息,输入 / 查看更多功能`,askAnything:`可向 Codemini 询问任何事。输入 / 使用命令或技能`,addContext:`添加上下文`,switchWorkspace:`切换工作区`,name:`名称`,soulContent:`灵魂内容`,newSoul:`新建灵魂`,editSoul:`编辑灵魂`,soulEditorHint:`灵魂只影响回复语气,不应写入执行规则或工具策略。`,soulPlaceholder:`描述这个人格的语气、措辞和表达偏好...`,soulPanelHint:`选择默认人格;新的对话和后续请求会使用当前灵魂语气。`,noActiveSoul:`未选择灵魂`,searchSouls:`搜索灵魂名称...`,create:`创建`,save:`保存`,contentPreview:`- 内容预览`,close:`关闭`,addSoul:`添加灵魂`,noSouls:`暂无灵魂`,noSoulsHint:`创建一个自定义灵魂,用来固定 Codemini 的回复语气。`,activate:`激活`,edit:`编辑`,view:`查看`,delete:`删除`,deleting:`删除中`,globalScope:`全局`,projectScope:`项目`,enable:`启用`,userScope:`用户`,memoryManagement:`记忆管理`,memoryLibrary:`记忆库`,memoryPanelHint:`查看、搜索和删除用户、项目与全局持久记忆。`,memoryLoadFailed:`无法加载记忆`,searchMemories:`搜索记忆内容...`,noMemories:`暂无记忆`,noMemoriesHint:`运行 /memory 或等待自动整理后,长期记忆会显示在这里。`,pinned:`已固定`,deleteFailed:`删除失败`,confirmDeleteMemory:`确定删除记忆 "{{summary}}"?`,addSkill:`添加技能`,installSkill:`安装`,installing:`安装中...`,skillInstallPlaceholder:`GitHub 仓库、URL、目录路径,或 npx skills@latest add owner/repo`,skillScope:`安装范围`,noSkills:`暂无技能`,noSkillsHint:`创建项目技能,把可复用工作流沉淀成 / 命令。`,skillLibrary:`技能库`,skillPanelHint:`技能会作为 / 命令或自动技能注入到 prompt,内置技能始终可用。`,newSkill:`新建技能`,editSkill:`编辑技能`,skillEditorHint:`技能适合沉淀稳定流程、检查清单和项目约定。`,searchSkills:`搜索技能名称...`,skillDescriptionPlaceholder:`这个技能适合什么时候使用...`,skillContent:`SKILL.md 内容`,skillRoutingSettings:`路由设置`,skillMode:`模式`,skillMode_always:`始终`,skillMode_auto_attach:`自动附加`,skillMode_agent_requested:`Agent 请求`,skillMode_manual:`手动`,skillPriority:`优先级`,skillTriggers:`触发器`,description:`描述`,noDescription:`暂无描述`,noPreview:`暂无预览`,filter_all:`全部`,filter_enabled:`启用`,filter_builtin:`内置`,filter_custom:`自定义`,confirmDeleteSkill:`确定删除技能 "{{name}}"?`,confirmDeleteSoul:`确定删除灵魂 "{{name}}"?`,aboutTitle:`关于 Codemini`,aboutEyebrow:`本地 coding agent`,aboutTagline:`一个更克制、更可审计的 coding agent:CLI 的速度,Web UI 的可见性,项目记忆、技能、审批和干净的上下文管理都在一起。`,aboutFeatureRuntime:`同一套运行时`,aboutFeatureRuntimeDesc:`CLI 和 Web UI 共享会话、配置、项目状态、技能和执行模式。`,aboutFeatureApprovals:`过程可审阅`,aboutFeatureApprovalsDesc:`工具调用、计划和高风险动作在执行前都能看清楚。`,aboutFeatureMemory:`上下文更稳`,aboutFeatureMemoryDesc:`压缩摘要、项目索引、记忆 inbox 和 dream consolidation 让长任务可继续。`,aboutFeatureConfig:`接入你的模型`,aboutFeatureConfigDesc:`支持 OpenAI 兼容网关或内部模型服务,不改变工作流。`,projectRepository:`GitHub 项目主页`,installation:`安装`,startWebUI:`启动 Web UI`,startWebUIDesc:`启动后浏览器会自动打开 Web 界面,也可以手动访问终端中显示的地址。`,basicUsage:`基本使用`,chatUsage:`在输入框直接输入问题或指令,按 Enter 发送`,skillUsage:`输入 / 触发技能选择面板`,soulUsage:`点击输入框工具栏的灵魂按钮切换 AI 人格`,normalMode:`普通`,autoModeAbout:`自动`,modeUsage:`需确认工具调用,`,modeUsageAuto:`全自动执行`,workspace:`工作区`,workspaceUsage:`点击输入框的文件夹按钮切换项目目录`,configureModel:`配置模型`,configureModelDesc:`支持 OpenAI 兼容接口,可在设置中配置 API Key、Endpoint 等。`,selectProject:`选择项目`,enterOrBrowse:`输入或浏览项目路径...`,select:`选择`,noSubDirs:`无子目录`,language:`语言`,switchLanguage:`切换语言`,switchThemePalette:`切换主题配色`,themeDefault:`Default`,themeCatppuccin:`Catppuccin`,themeTokyoNight:`Tokyo Night`,themeOne:`One`,themeGithub:`GitHub`,themeVSCode:`VS Code`,generalChat:`普通会话`,projectTask:`项目任务`,generalChatDesc:`无需绑定项目,自由对话`,enterGeneral:`进入普通会话`,askAnythingGeneral:`有什么可以帮你的?`,buildInProject:`要在 {{project}} 中构建什么?`,undoChange:`撤回变更`,undoChangeFailed:`撤回变更失败`,undoChangeConfirm:`确认撤回变更?`,undoChangeDescription:`你确认撤回「{{path}}」的变更吗?此操作会修改工作区文件。`,undoChangesDescription:`你确认撤回「{{path}}」的 {{count}} 个变更吗?此操作会修改工作区文件。`,undoChangeConflict:`无法干净撤回:后续变更和这次变更冲突。请先撤回更新的变更,或手动处理这个文件。`,undoingChange:`撤回中...`,undoChangeReverted:`已撤回`,backupShort:`备份`,backupReusedShort:`已备份`,backupReady:`已记录轻量备份`,backupCreated:`已创建轻量备份`,backupReused:`复用本会话已有备份`,backupSkipped:`未创建文件备份`,gitStaged:`已暂存`,gitModified:`已修改`,gitUntracked:`未跟踪`,gitClean:`无变更`,gitDiffTitle:`Git 差异`,gitDiffNoChanges:`无变更`,gitDiffLoading:`加载差异...`,gitDiffStaged:`已暂存`,gitDiffModified:`已修改`,gitDiffDeleted:`已删除`,gitDiffUntracked:`未跟踪`,gitDiffNoDiffAvailable:`无差异内容`,conversations:`对话`,noConversations:`暂无聊天`,justNow:`刚刚`,minutesAgo:`分钟前`,hoursAgo:`小时前`,daysAgo:`天前`},en:{brand:`Codemini`,live:`LIVE`,idle:`IDLE`,sending:`SENDING`,thinking:`THINKING`,streaming:`STREAMING`,tooling:`TOOLING`,inputPlaceholder:`Type a message or / command...`,inputDisabled:`Waiting for current request to finish...`,inputPlanReviewDisabled:`Review the plan above before continuing`,abort:`Stop`,approveTitle:`Confirm Action`,approve:`Approve`,deny:`Deny`,deleteApproval:`Confirm Delete`,runApproval:`Confirm Run Command`,planApproval:`Confirm Plan`,reflectApproval:`Confirm Save Skill`,toolRunning:`Running`,toolDone:`Done`,toolError:`Error`,toolBlocked:`Blocked`,toolGroupTools:`Ran {{count}} tools`,toolGroupCommands:`Ran {{count}} commands`,toolGroupExpand:`Click to expand`,planTitle:`Execution Plan`,planDone:`Done`,planReviewTitle:`Review Plan`,planReviewSummary:`Summary`,planReviewSteps:`Plan Steps`,planApprove:`Approve`,planReject:`Reject`,planEdit:`Edit Plan`,planEditPlaceholder:`Describe your changes...`,planSubmitFeedback:`Submit Feedback`,planStepCount:`steps`,planReviewStatus:`Awaiting Review`,planWaitingReview:`Waiting for plan review…`,waitingResponse:`Waiting for response…`,reflectReviewTitle:`Review Skill Draft`,reflectReviewStatus:`Awaiting Review`,reflectScope:`Scope`,reflectConfidence:`Confidence`,reflectApprove:`Save Skill`,reflectReject:`Discard`,reflectEdit:`Revise Draft`,reflectEditPlaceholder:`Describe how this skill draft should change...`,reflectSubmitFeedback:`Submit Feedback`,reflectReviewFirst:`Review the skill draft before continuing`,runtimeActivityDreamRunning:`Dream is consolidating memory`,runtimeActivityDreamDone:`Dream complete`,runtimeActivityDreamError:`Dream failed`,runtimeActivityCompactDone:`Context compacted`,runtimeActivityCompactPreview:`Compact preview`,runtimeActivityMicroCompactDone:`Micro-compact complete`,runtimeActivityMicroCompactPreview:`Micro-compact preview`,runtimeActivityInboxCaptured:`Saved to Inbox`,runtimeActivityInboxListed:`Inbox checked`,runtimeActivityReflectPending:`Reflect awaiting review`,runtimeActivityReflectRevised:`Reflect draft updated`,runtimeActivityReflectSaving:`Saving skill`,runtimeActivityReflectSaved:`Skill saved`,runtimeActivityReflectRevising:`Revising draft`,runtimeActivityReflectDiscarding:`Discarding draft`,runtimeActivityReflectDiscarded:`Draft discarded`,runtimeActivityReflectNone:`No reusable skill found`,skillRunning:`Running`,skillDone:`Done`,skillError:`Failed`,skillAuto:`Auto Skill`,contextUsage:`Context`,fileChanges:`File Changes`,thought:`Thought process`,thoughtFor:`Thought for {{duration}}`,thinkingNow:`Thinking...`,thoughtForNow:`Thinking for {{duration}}`,processed:`Processed`,processedFor:`Processed for {{duration}}`,processedDetails:`{{thoughts}} thoughts, {{tools}} tools`,usageTokens:`tokens`,usageCache:`cache`,usageInput:`input`,usageOutput:`output`,usageTotal:`total`,usageCacheHit:`cache hit`,usageCacheMiss:`cache miss`,usageCacheWrite:`cache write`,usageReasoning:`reasoning`,usageRequests:`{{count}} requests`,newChat:`New Chat`,skills:`Skills`,memory:`Memory`,souls:`Souls`,projects:`Projects`,newSessionInProject:`New Chat in Project`,openCodeWiki:`Open CodeWiki`,collapseProject:`Collapse Project`,expandProject:`Expand Project`,showMoreSessions:`Show more`,sessionActions:`Session Actions`,deleteSession:`Delete`,noSessions:`No conversations yet`,about:`About`,lightMode:`Light`,darkMode:`Dark`,autoModeTheme:`System`,switchTheme:`Switch Theme`,settings:`Settings`,deleteSessionConfirm:`Delete Session?`,deleteSessionDescription:`Session "{{session}}" will be removed from history, this action cannot be undone.`,settingsTitle:`Settings`,configRequired:`Configure the API Base URL and API Key in Settings first`,configRequiredTitle:`Model gateway setup required`,configRequiredDesc:`This install is still using the default gateway endpoint. Set the Base URL, API Key, and model before chatting.`,cancel:`Cancel`,saveChanges:`Save Changes`,gateway:`Gateway`,baseUrl:`Base URL`,apiKey:`API Key`,timeout:`Timeout (ms)`,maxRetries:`Max Retries`,model:`Model`,modelName:`Model Name`,fastModel:`Fast Model`,maxContextTokens:`Max Context Tokens`,sdk:`SDK`,provider:`Provider`,execution:`Execution`,mode:`Mode`,maxSteps:`Max Steps`,context:`Context`,contextMaxTokens:`Context Token Budget`,preflightTrigger:`Preflight Trigger (%)`,hardLimit:`Hard Limit (%)`,toolResultMaxChars:`Tool Result Char Limit`,microcompactEnabled:`Micro-Compact`,microcompactKeepRecent:`Micro Keep Recent`,shell:`Shell`,defaultShell:`Default Shell`,policy:`Policy`,safeMode:`Safe Mode`,allowedPaths:`Allowed Paths`,allowedPathsHelp:`JSON array of trusted absolute directory roots. File tools and safe-mode shell path checks may access these paths in addition to the current workspace.`,allowDangerousCommands:`Allow Dangerous Commands`,ui:`UI`,uiLanguage:`UI Language`,replyLanguage:`Reply Language`,backToTop:`Back to top`,pendingItems:`Queued`,copyCode:`Copy`,copyMessage:`Copy`,copied:`Copied`,connected:`Connected`,disconnected:`Disconnected, reconnecting...`,unknownProject:`Unknown Project`,emptyChat:`Empty Chat`,messages:`messages`,renderError:`Render Error`,retry:`Retry`,refresh:`Refresh`,planReviewFirst:`Please review the plan above, approve, modify, or reject before continuing`,loading:`Loading`,sending:`Send`,updating:`Updating...`,updatedRestart:`Updated, please restart`,updateAvailable:`new version available, click to update`,openSettings:`Open Settings`,current:`Current`,sessions:`Sessions`,items:`items`,enabled:`Enabled`,disabled:`Disabled`,disable:`Disable`,noMatches:`No matches`,generationDepthFast:`Fast`,generationDepthStandard:`Standard`,generationDepthDeep:`Deep`,startingAnalysis:`Starting project requirements analysis`,preparingScan:`Preparing to scan code, interfaces, and project structure`,generationFailed:`Generation encountered an issue`,generatingCodeWiki:`Generating CodeWiki`,stepsCompleted:`steps completed`,codewikiFailed:`CodeWiki Q&A failed`,failedToLoad:`Failed to load CodeWiki report`,failedToStart:`Failed to start CodeWiki generation`,failedToDelete:`Failed to delete CodeWiki report`,currentProject:`Current Project`,generating:`Generating`,generateNew:`Generate New CodeWiki`,report:`Report`,refreshReport:`Refresh Report`,noReportYet:`No requirements report yet. It will appear here after generation.`,reportActions:`Report Actions`,deleteReport:`Delete`,loadingReport:`Loading Report`,projectDocs:`Project documentation based on project-requirements`,generate:`Generate`,noCodeWiki:`No CodeWiki yet`,generateRequirements:`Generate requirements for the current project`,reportWillShow:`After generating the report, architecture diagrams, interface requirements, processes, and risk descriptions will be displayed here.`,reportLoadFailed:`Report failed to load.`,noQuestionsDuringGeneration:`Questions not accepted until CodeWiki generation is complete.`,tempReadOnlyQa:`Temporary read-only Q&A, will not modify the project or save to session history.`,processingQuestion:`Processing current question`,canAskAboutProject:`You can ask about the current project`,askAfterGeneration:`Ask questions based on the report after generation is complete.`,exampleQuestions:`For example: What is the main business process? Which interfaces have the highest risks?`,answering:`Answering...`,sendingQuestion:`Send Question`,deleteReportConfirm:`Delete CodeWiki Report?`,deleteReportDescription:`Report "{{report}}" will be removed from current project history reports, this action cannot be undone.`,executionMode:`Work Mode`,normalExecutionMode:`Normal`,normalModeDesc:`Handle the current request directly`,approvalMode:`Approval Mode`,reviewMode:`Review`,reviewModeDesc:`Confirm edits, deletes, and risky commands`,autoMode:`Auto`,autoModeDesc:`Auto-run in Git projects; review non-Git file changes`,fullAccessMode:`Full Access`,fullAccessModeDesc:`Run tool calls without approval prompts`,planMode:`Plan`,planModeDesc:`Plan only, review before execution`,switchMode:`Switch Work Mode`,switchApprovalMode:`Switch Approval Mode`,editApproval:`Confirm file edit?`,writeApproval:`Confirm file write?`,switchModeDisabled:`Can switch modes after current request completes`,soulSwitch:`Soul Switch`,switchSoul:`Switch Soul`,builtin:`Built-in`,custom:`Custom`,sendMessageToCodemini:`Message Codemini`,sendMessageToCodeminiWithSlash:`Message Codemini, type / for more features`,askAnything:`You can ask Codemini anything. Type / to use commands or skills`,addContext:`Add Context`,switchWorkspace:`Switch Workspace`,name:`Name`,soulContent:`Soul Content`,newSoul:`New Soul`,editSoul:`Edit Soul`,soulEditorHint:`Souls affect response tone only; avoid execution rules or tool policy here.`,soulPlaceholder:`Describe tone, phrasing, and personality preferences...`,soulPanelHint:`Choose the default personality. New prompts will use the active soul tone.`,noActiveSoul:`No soul selected`,searchSouls:`Search souls by name...`,create:`Create`,save:`Save`,contentPreview:`- Content Preview`,close:`Close`,addSoul:`Add Soul`,noSouls:`No souls yet`,noSoulsHint:`Create a custom soul to keep Codemini response tone consistent.`,activate:`Activate`,edit:`Edit`,view:`View`,delete:`Delete`,deleting:`Deleting...`,globalScope:`Global`,projectScope:`Project`,enable:`Enable`,userScope:`User`,memoryManagement:`Memory Management`,memoryLibrary:`Memory Library`,memoryPanelHint:`View, search, and delete user, project, and global persistent memories.`,memoryLoadFailed:`Failed to load memories`,searchMemories:`Search memories...`,noMemories:`No memories yet`,noMemoriesHint:`Long-term memories will appear here after /memory or automatic consolidation runs.`,pinned:`Pinned`,deleteFailed:`Delete failed`,confirmDeleteMemory:`Delete memory "{{summary}}"?`,addSkill:`Add Skill`,installSkill:`Install`,installing:`Installing...`,skillInstallPlaceholder:`GitHub repo, URL, folder path, or npx skills@latest add owner/repo`,skillScope:`Install Scope`,noSkills:`No skills yet`,noSkillsHint:`Create a project skill to turn reusable workflows into / commands.`,skillLibrary:`Skill Library`,skillPanelHint:`Skills can be invoked as / commands or injected automatically. Built-in skills are always available.`,newSkill:`New Skill`,editSkill:`Edit Skill`,skillEditorHint:`Skills are best for stable workflows, checklists, and project conventions.`,searchSkills:`Search skills by name...`,skillDescriptionPlaceholder:`When should this skill be used...`,skillContent:`SKILL.md Content`,skillRoutingSettings:`Routing Settings`,skillMode:`Mode`,skillMode_always:`Always`,skillMode_auto_attach:`Auto Attach`,skillMode_agent_requested:`Agent Requested`,skillMode_manual:`Manual`,skillPriority:`Priority`,skillTriggers:`Triggers`,description:`Description`,noDescription:`No description`,noPreview:`No preview`,filter_all:`All`,filter_enabled:`Enabled`,filter_builtin:`Built-in`,filter_custom:`Custom`,confirmDeleteSkill:`Delete skill "{{name}}"?`,confirmDeleteSoul:`Delete soul "{{name}}"?`,aboutTitle:`About Codemini`,aboutEyebrow:`Local coding agent`,aboutTagline:`A compact, auditable coding agent with CLI speed, Web UI visibility, project memory, skills, approvals, and clean context management.`,aboutFeatureRuntime:`One runtime`,aboutFeatureRuntimeDesc:`CLI and Web UI share sessions, config, project state, skills, and execution mode.`,aboutFeatureApprovals:`Reviewable work`,aboutFeatureApprovalsDesc:`Tool calls, plans, and risky actions stay visible before they run.`,aboutFeatureMemory:`Smarter context`,aboutFeatureMemoryDesc:`Compact summaries, project index, memory inbox, and dream consolidation keep long work usable.`,aboutFeatureConfig:`Bring your model`,aboutFeatureConfigDesc:`Use OpenAI-compatible gateways or internal providers without changing the workflow.`,projectRepository:`GitHub repository`,installation:`Installation`,startWebUI:`Start Web UI`,startWebUIDesc:`After starting, the browser will automatically open the Web interface. You can also manually visit the address shown in the terminal.`,basicUsage:`Basic Usage`,chatUsage:`Type questions or instructions in the input box, press Enter to send`,skillUsage:`Type / to open the skill selection panel`,soulUsage:`Click the soul button in the input toolbar to switch AI personality`,normalMode:`Normal`,autoModeAbout:`Auto`,modeUsage:`requires confirming tool calls, `,modeUsageAuto:`executes everything automatically`,workspace:`Workspace`,workspaceUsage:`Click the folder button in the input box to switch project directory`,configureModel:`Configure Model`,configureModelDesc:`Supports OpenAI-compatible interfaces. Configure API Key, Endpoint, etc. in Settings.`,selectProject:`Select Project`,enterOrBrowse:`Enter or browse project path...`,select:`Select`,noSubDirs:`No subdirectories`,language:`Language`,switchLanguage:`Switch Language`,switchThemePalette:`Switch Theme Palette`,themeDefault:`Default`,themeCatppuccin:`Catppuccin`,themeTokyoNight:`Tokyo Night`,themeOne:`One`,themeGithub:`GitHub`,themeVSCode:`VS Code`,generalChat:`General Chat`,projectTask:`Project Task`,generalChatDesc:`Chat freely without binding to a project`,enterGeneral:`Enter General Chat`,askAnythingGeneral:`How can I help you?`,buildInProject:`What do you want to build in {{project}}?`,undoChange:`Undo change`,undoChangeFailed:`Failed to undo change`,undoChangeConfirm:`Undo this change?`,undoChangeDescription:`Undo changes to "{{path}}"? This will modify files in the workspace.`,undoChangesDescription:`Undo {{count}} changes to "{{path}}"? This will modify files in the workspace.`,undoChangeConflict:`Cannot undo cleanly because newer edits conflict with this change. Undo newer changes first, or handle this file manually.`,undoingChange:`Undoing...`,undoChangeReverted:`Reverted`,backupShort:`Backup`,backupReusedShort:`Backed up`,backupReady:`Light backup recorded`,backupCreated:`Light backup created`,backupReused:`Reusing this session backup`,backupSkipped:`File backup not created`,gitStaged:`Staged`,gitModified:`Modified`,gitUntracked:`Untracked`,gitClean:`Clean`,gitDiffTitle:`Git Diff`,gitDiffNoChanges:`No changes`,gitDiffLoading:`Loading diff...`,gitDiffStaged:`Staged`,gitDiffModified:`Modified`,gitDiffDeleted:`Deleted`,gitDiffUntracked:`Untracked`,gitDiffNoDiffAvailable:`No diff available`,conversations:`Conversations`,noConversations:`No conversations yet`,justNow:`just now`,minutesAgo:`m ago`,hoursAgo:`h ago`,daysAgo:`d ago`}},Ds=`zh`,Os=localStorage.getItem(`codemini-ui-language`);Os&&Es[Os]&&(Ds=Os);function ks(e){Es[e]&&(Ds=e,localStorage.setItem(`codemini-ui-language`,e))}function V(e){return Es[Ds][e]||Es.en[e]||e}function As(){return Ds}var js={"Content-Type":`application/json`};async function H(e,t={}){return await fetch(e,t)}async function Ms(){return(await H(`/api/version`)).json()}async function Ns(){return(await H(`/api/update`,{method:`POST`})).json()}async function Ps(){return(await H(`/api/state`)).json()}async function Fs(){return(await H(`/api/startup-events`)).json()}async function Is(){return(await H(`/api/history`)).json()}async function Ls(e=200){let t=new URLSearchParams,n=Number(e);return Number.isFinite(n)&&n>0&&t.set(`limit`,String(Math.round(n))),(await H(t.size?`/api/sessions?${t.toString()}`:`/api/sessions`)).json()}async function Rs(){return(await H(`/api/session/messages`)).json()}async function zs(){return(await H(`/api/session/ui-messages`)).json()}async function Bs(e,t={}){return await H(`/api/submit`,{method:`POST`,headers:js,body:JSON.stringify({line:e,...t.readOnlyCodeWiki?{readOnlyCodeWiki:!0}:{}})})}async function Vs(){await H(`/api/abort`,{method:`POST`})}async function Hs(e){return(await H(`/api/execution-mode`,{method:`POST`,headers:js,body:JSON.stringify({mode:e})})).json()}async function Us(e){return(await H(`/api/approval-mode`,{method:`POST`,headers:js,body:JSON.stringify({mode:e})})).json()}async function Ws(e,t){await H(`/api/approval`,{method:`POST`,headers:js,body:JSON.stringify({id:e,approved:t})})}async function Gs(e){return(await H(`/api/sessions/switch`,{method:`POST`,headers:js,body:JSON.stringify({sessionId:e})})).json()}async function Ks(e){return(await H(`/api/sessions/${encodeURIComponent(e)}`,{method:`DELETE`})).json()}async function qs(){return(await H(`/api/sessions/new`,{method:`POST`})).json()}async function Js(){return(await H(`/api/config`)).json()}async function Ys(){return(await H(`/api/config/status`)).json()}async function Xs(e,t){return(await H(`/api/config/set`,{method:`POST`,headers:js,body:JSON.stringify({key:e,value:t})})).json().catch(()=>({}))}async function Zs(){return(await H(`/api/project`)).json()}async function Qs(){return(await H(`/api/git`)).json()}async function $s(){return(await H(`/api/git-diff`)).json()}async function ec(e){return(await H(`/api/session-changes/${encodeURIComponent(e)}/undo`,{method:`POST`})).json()}async function tc(){return(await H(`/api/session-changes`)).json()}async function nc(e){return(await H(`/api/session-changes/undo`,{method:`POST`,headers:js,body:JSON.stringify({ids:e})})).json()}async function rc(e){return(await H(`/api/git-batch`,{method:`POST`,headers:js,body:JSON.stringify({dirs:e})})).json()}async function ic(e){return(await H(`/api/project/open`,{method:`POST`,headers:js,body:JSON.stringify({path:e})})).json()}async function ac(e){return(await H(`/api/project/browse`,{method:`POST`,headers:js,body:JSON.stringify({dir:e})})).json()}function oc(e,t=[]){let n=Array.isArray(t)?t.map(e=>String(e||``).trim()).filter(Boolean):[];n.length>0&&e.set(`projects`,JSON.stringify(n))}function sc(e,t){let n=String(t||``).trim();return n?`${e}?${new URLSearchParams({projectDir:n}).toString()}`:e}async function cc(e=[]){let t=new URLSearchParams;oc(t,e);let n=t.toString();return(await H(n?`/api/skills?${n}`:`/api/skills`)).json()}async function lc(e,t){return(await H(sc(`/api/skills/${encodeURIComponent(e)}/content`,t))).json()}async function uc({name:e,description:t,content:n,scope:r,projectDir:i}){return(await H(`/api/skills/create`,{method:`POST`,headers:js,body:JSON.stringify({name:e,description:t,content:n,scope:r,projectDir:i})})).json()}async function dc({source:e,scope:t,projectDir:n}){return(await H(`/api/skills/install`,{method:`POST`,headers:js,body:JSON.stringify({source:e,scope:t,projectDir:n})})).json()}async function fc(e,t,n){return(await H(`/api/skills/${encodeURIComponent(e)}/content`,{method:`PUT`,headers:js,body:JSON.stringify({content:t,projectDir:n})})).json()}async function pc(e,t,n){return(await H(`/api/skills/${encodeURIComponent(e)}/metadata`,{method:`PUT`,headers:js,body:JSON.stringify({...t||{},projectDir:n})})).json()}async function mc(e,t){return(await H(sc(`/api/skills/${encodeURIComponent(e)}`,t),{method:`DELETE`})).json()}async function hc(e,t,n){return(await H(`/api/skills/${encodeURIComponent(e)}/toggle`,{method:`POST`,headers:js,body:JSON.stringify({enabled:t,projectDir:n})})).json()}async function gc({scope:e=`user`,query:t=``,projectDirs:n=[]}={}){let r=new URLSearchParams({scope:e});return t.trim()&&r.set(`q`,t.trim()),oc(r,n),(await H(`/api/memory?${r.toString()}`)).json()}async function _c(e,t,n){let r=new URLSearchParams({scope:e});return n&&r.set(`projectDir`,n),(await H(`/api/memory/${encodeURIComponent(t)}?${r.toString()}`,{method:`DELETE`})).json()}async function vc(){return(await H(`/api/souls`)).json()}async function yc(e){return(await H(`/api/souls/${encodeURIComponent(e)}/content`)).json()}async function bc({name:e,content:t}){return(await H(`/api/souls/create`,{method:`POST`,headers:js,body:JSON.stringify({name:e,content:t})})).json()}async function xc(e,t){return(await H(`/api/souls/${encodeURIComponent(e)}/content`,{method:`PUT`,headers:js,body:JSON.stringify({content:t})})).json()}async function Sc(e){return(await H(`/api/souls/${encodeURIComponent(e)}`,{method:`DELETE`})).json()}async function Cc(e){return(await H(`/api/souls/activate`,{method:`POST`,headers:js,body:JSON.stringify({name:e})})).json()}function wc(e=``){return e?`?project=${encodeURIComponent(e)}`:``}async function Tc(e=``){return(await H(`/api/codewiki/reports${wc(e)}`)).json()}async function Ec(e=``){return(await H(`/api/codewiki/symbol-graph${wc(e)}`)).json()}async function Dc(e=`standard`,t=``){return(await H(`/api/codewiki/generate${wc(t)}`,{method:`POST`,headers:js,body:JSON.stringify({depth:e})})).json()}async function Oc({question:e,reportFile:t=``,project:n=``,onEvent:r}={}){let i=await H(`/api/codewiki/ask${wc(n)}`,{method:`POST`,headers:js,body:JSON.stringify({question:e,reportFile:t})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.message||`CodeWiki 问答失败`)}if(!i.body)throw Error(`当前浏览器不支持流式响应`);let a=i.body.getReader(),o=new TextDecoder,s=``;for(;;){let{value:e,done:t}=await a.read();if(t)break;s+=o.decode(e,{stream:!0});let n=s.indexOf(`
60
60
  `);for(;n!==-1;){let e=s.slice(0,n).trim();s=s.slice(n+1),e&&r?.(JSON.parse(e)),n=s.indexOf(`
61
61
  `)}}s+=o.decode();let c=s.trim();c&&r?.(JSON.parse(c))}async function kc(e,t=``){return(await H(`/api/codewiki/report/${encodeURIComponent(e)}${wc(t)}`,{method:`DELETE`})).json()}var Ac=(0,d.createContext)(null);function jc(e){let t=String(e?.name||``).toLowerCase(),n=String(e?.summary||``).toLowerCase();return t.includes(`project_index`)||t.includes(`initializeprojectindex`)||n.includes(`project_index(`)||n.includes(`initialized `)&&n.includes(`/.codemini`)}function Mc(){let e=window.location.pathname.replace(/\/+$/,``)||`/`,t=new URLSearchParams(window.location.search),n=e.match(/^\/chat\/([^/]+)$/);return n?{view:`chat`,sessionId:decodeURIComponent(n[1])}:e===`/codewiki`?{view:`codewiki`,projectPath:t.get(`project`)||``}:{view:`chat`}}function Nc(e,t,n={}){if(e===`codewiki`){let e=String(n.projectPath||``).trim();return e?`/codewiki?project=${encodeURIComponent(e)}`:`/codewiki`}return t?`/chat/${encodeURIComponent(t)}`:`/`}function Pc(e,t,{replace:n=!1,projectPath:r=``}={}){let i=Nc(e,t,{projectPath:r});if(`${window.location.pathname}${window.location.search}`===i)return;let a={view:e,sessionId:t||null,projectPath:r||null};n?window.history.replaceState(a,``,i):window.history.pushState(a,``,i)}var Fc={stage:`idle`,busy:!1,currentView:`chat`,runtimeState:null,live:!1,stageLabel:``,messages:[],activeMsgId:null,pendingToolChanges:[],planSteps:[],pendingPlanApproval:null,pendingReflectApproval:null,runtimeActivities:[],approvalRequest:null,config:null,configStatus:null,configOpen:!1,projectOpen:!1,skillsOpen:!1,memoryOpen:!1,soulsOpen:!1,aboutOpen:!1,gitDiffOpen:!1,sessions:[],projectCwd:null,isGeneral:!1,history:[],skills:[],gitInfo:null,gitBatch:{},codewikiProjectPath:``,codewikiGeneration:{status:`idle`,updatedAt:null,error:``},versionInfo:null,updateStatus:null,initialLoading:!0,sessionsLoading:!1,messagesLoading:!1};function Ic(e){let t=String(e||``),n=t.match(/^\[Executing skill: \/([^\]\s]+)\]\n\n/);if(!n)return t;let r=`/${n[1]}`,i=t.match(/\nCurrent question:\n([\s\S]+)$/);return i?.[1]?.trim()?`${r} ${i[1].trim()}`:r}function Lc(e,t,n){return e.map(e=>{if(e.type!==`tools`)return e;let r=e.cards.findIndex(e=>e.id===t);if(r===-1)return e;let i=[...e.cards];return i[r]=n(i[r]),{...e,cards:i}})}function Rc(e,t){if(e.length===0)return[{type:`tools`,cards:[t]}];let n=e[e.length-1];return n.type===`tools`?[...e.slice(0,-1),{...n,cards:[...n.cards,t]}]:[...e,{type:`tools`,cards:[t]}]}function U(e){return e.length===0?[{type:`text`,text:``,isStreaming:!1}]:e[e.length-1].type===`text`?e:[...e,{type:`text`,text:``,isStreaming:!1}]}function zc(e,t){let n=U(e),r=n[n.length-1];return[...n.slice(0,-1),{...r,text:(r.text||``)+t,isStreaming:!0}]}function Bc(e,t,n=!0){let r=String(t||``);if(!r)return e||[];let i=Array.isArray(e)?e:[],a=new Date().toISOString(),o=Date.parse(a),s=i[i.length-1];if(s?.type===`thinking`){let e=s.startedAt||a;return[...i.slice(0,-1),{...s,text:`${s.text||``}${r}`,isStreaming:n,startedAt:e,endedAt:n?null:s.endedAt||a,durationMs:Math.max(Number(s.durationMs||0),o-Date.parse(e))}]}return[...i,{type:`thinking`,text:r,isStreaming:n,startedAt:a,endedAt:n?null:a,durationMs:n?0:null}]}function Vc(e,t){let n=Number(e?.durationMs),r=Date.parse(e?.startedAt||``),i=Date.parse(e?.endedAt||t||``),a=Number.isFinite(r)&&Number.isFinite(i)?Math.max(0,i-r):null;return Number.isFinite(n)&&a!=null?Math.max(n,a):Number.isFinite(n)?Math.max(0,n):a}function Hc(e){let t=new Date().toISOString();return(Array.isArray(e)?e:[]).map(e=>e.type===`thinking`?{...e,isStreaming:!1,endedAt:e.endedAt||t,durationMs:Vc(e,t)}:e)}function Uc(e){if(!e||typeof e!=`object`)return null;let t={};for(let n of[`inputTokens`,`outputTokens`,`totalTokens`,`cachedInputTokens`,`cacheMissInputTokens`,`cacheWriteInputTokens`,`reasoningOutputTokens`,`requests`]){let r=Number(e?.[n]);Number.isFinite(r)&&(t[n]=Math.max(0,Math.round(r)))}return Object.keys(t).length?t:null}function Wc(e,t){let n=Uc(e),r=Uc(t);if(!n)return r;if(!r)return n;let i={};for(let e of[`inputTokens`,`outputTokens`,`totalTokens`,`cachedInputTokens`,`cacheMissInputTokens`,`cacheWriteInputTokens`,`reasoningOutputTokens`,`requests`])i[e]=Math.max(0,Math.round(Number(n[e]||0)+Number(r[e]||0)));return i}function Gc(e){return Array.isArray(e)?e.map(e=>!e||typeof e!=`object`?``:e.type===`thinking`?e.thinking||e.text||``:e.type===`reasoning`||e.type===`reasoning_content`?e.text||e.reasoning_content||``:e.type===`redacted_thinking`?`[redacted thinking]`:``).filter(Boolean).join(`
62
62
 
63
63
  `):``}function Kc(e){return String(e?.reasoningContent||e?.reasoning_content||``).trim()||Gc(e?.reasoningDetails||e?.reasoning_details).trim()}function qc(e){return String(e||``).replace(/(?:^|\n)\[plan\]\s+Step\s+\d+\/\d+\s+->[^\n]*\n?/g,``)}function Jc(e){return e?.path?JSON.stringify({path:String(e.path||``),action:String(e.action||``),linesAdded:Number(e.linesAdded||0),linesRemoved:Number(e.linesRemoved||0),changedLine:Number(e.changedLine||0),diffPreview:String(e.diffPreview||``),changeSetId:String(e.changeSetId||``)}):``}function Yc(e=[],t=[]){let n=Array.isArray(e)?[...e]:[],r=new Set(n.map(Jc).filter(Boolean));for(let e of Array.isArray(t)?t:[t]){let t=Jc(e);!t||r.has(t)||(r.add(t),n.push(e))}return n}function Xc(e=[]){let t=new Map;for(let n of Array.isArray(e)?e:[]){let e=String(n?.id||``).trim();e&&t.set(e,{revertedAt:n.revertedAt||null})}return t}function Zc(e,t){if(!e||typeof e!=`object`)return e;let n=String(e.changeSetId||``).trim();if(!n)return e;let r=t.get(n);return r?.revertedAt?{...e,revertedAt:r.revertedAt}:e}function Qc(e,t){return!Array.isArray(e)||!e.length?e:e.map(e=>Zc(e,t))}function $c(e,t=[]){let n=Xc(t);return n.size?(Array.isArray(e)?e:[]).map(e=>({...e,fileChanges:Qc(e.fileChanges,n),segments:Array.isArray(e.segments)?e.segments.map(e=>e?.type!==`tools`||!Array.isArray(e.cards)?e:{...e,cards:e.cards.map(e=>({...e,fileChange:Zc(e.fileChange,n),fileChanges:Qc(e.fileChanges,n)}))}):e.segments})):e}function el(e,t=[],n=new Date().toISOString()){let r=new Set((Array.isArray(t)?t:[t]).map(e=>String(e||``).trim()).filter(Boolean));if(!r.size)return e;let i=e=>!e||typeof e!=`object`?e:r.has(String(e.changeSetId||``).trim())?{...e,revertedAt:n}:e;return(Array.isArray(e)?e:[]).map(e=>({...e,fileChanges:Array.isArray(e.fileChanges)?e.fileChanges.map(i):e.fileChanges,segments:Array.isArray(e.segments)?e.segments.map(e=>e?.type!==`tools`||!Array.isArray(e.cards)?e:{...e,cards:e.cards.map(e=>({...e,fileChange:i(e.fileChange),fileChanges:Array.isArray(e.fileChanges)?e.fileChanges.map(i):e.fileChanges}))}):e.segments}))}function tl(e,t){let n=new Set(Array.isArray(t)?t:[t]);return e.filter(e=>{if(n.has(e.transientKey))return!1;let t=String(e.text||``);return!(n.has(`plan-waiting-review`)&&(t.includes(`等待计划审阅`)||t.includes(`Waiting for plan review`))||n.has(`waiting-response`)&&(t.includes(`等待回复`)||t.includes(`Waiting for response`)))})}function nl(e){let t=String(e||``);return t.includes(`Auto plan finished`)||t.includes(`Plan created and waiting for approval`)||t.includes(`Pending plan approval`)||t.includes(`Plan File:`)&&t.includes(`/yes`)}function rl(e){let t=String(e||``);return t.includes(`Reflect skill draft pending.`)||t.includes(`Reflect skill draft revised.`)||t.includes(`Reflect skill written and loaded:`)||t.includes(`Reflect skill draft discarded.`)}function il(e){let t=String(e||``).trim();if(t.startsWith(`Reflect skill written and loaded:`)){let e=t.match(/\/[A-Za-z0-9_-]+/)?.[0]||``;return{key:`reflect`,status:`done`,emoji:`✨`,label:V(`runtimeActivityReflectSaved`),detail:e}}return t.startsWith(`Reflect skill draft revised.`)?{key:`reflect`,status:`running`,emoji:`📝`,label:V(`runtimeActivityReflectRevised`)}:t.startsWith(`Reflect skill draft pending.`)?{key:`reflect`,status:`running`,emoji:`🪞`,label:V(`runtimeActivityReflectPending`)}:t.startsWith(`Reflect skill draft discarded.`)?{key:`reflect`,status:`done`,emoji:`🗑️`,label:V(`runtimeActivityReflectDiscarded`)}:t.startsWith(`Reflect found no reusable skill candidate.`)?{key:`reflect`,status:`done`,emoji:`🪞`,label:V(`runtimeActivityReflectNone`)}:t.startsWith(`Dream failed:`)?{key:`dream`,status:`error`,emoji:`⚠️`,label:V(`runtimeActivityDreamError`),detail:t.slice(13).trim()}:t.startsWith(`Dream done`)?{key:`dream`,status:`done`,emoji:`🌙`,label:V(`runtimeActivityDreamDone`)}:t.startsWith(`Micro-compact`)?{key:`compact`,status:`done`,emoji:`🪄`,label:t.includes(` preview`)?V(`runtimeActivityMicroCompactPreview`):V(`runtimeActivityMicroCompactDone`),detail:t.split(`
64
64
  `)[0]}:t.startsWith(`Compact `)||t===`Context restored to full view`?{key:`compact`,status:`done`,emoji:`🧳`,label:t.includes(` preview`)?V(`runtimeActivityCompactPreview`):V(`runtimeActivityCompactDone`),detail:t.split(`
65
- `)[0]}:t.startsWith(`Captured to inbox:`)?{key:`inbox`,status:`done`,emoji:`📥`,label:V(`runtimeActivityInboxCaptured`)}:t.startsWith(`Inbox (`)||t===`Inbox is empty.`?{key:`inbox`,status:`done`,emoji:`📬`,label:V(`runtimeActivityInboxListed`)}:null}function al(e){let t=new Map;for(let n of e||[]){if(n?.role!==`assistant`)continue;let e=il(n.content);if(!e)continue;let r=e.key||`runtime`;t.set(r,{id:`runtime-${r}`,key:r,status:e.status||`done`,emoji:e.emoji||`•`,label:e.label||``,detail:e.detail||``,timestamp:n.at||new Date().toISOString()})}return[...t.values()].sort((e,t)=>String(t.timestamp).localeCompare(String(e.timestamp))).slice(0,3)}function ol(e){let t=String(e||``).trim().toLowerCase();return[`yes`,`y`,`/yes`,`/plan approve`,`approve`,`approved`,`no`,`n`,`/no`,`/reject`].includes(t)||t.startsWith(`/edit `)}function sl(e){let t=String(e||``).trim().toLowerCase();return[`/yes`,`/plan approve`,`/no`,`/reject`].includes(t)||t.startsWith(`/edit `)}function cl(e){return{id:`plan-step-${e.step}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,role:e.role||`general`,isComplete:!1,text:``,segments:[],skillBadges:[],fileChanges:[],timestamp:new Date().toISOString(),planStep:{step:e.step,total:e.total,role:e.role||`general`,title:e.title||``,status:`running`,summary:``}}}function W(e){let t=String(e||``),n=[...t.matchAll(/^\[(DONE|FAILED|RUNNING)\]\s+([A-Za-z0-9_-]+):\s*(.*)$/gm)];return!n.length||n[0].index>t.slice(0,n[0].index).trim().length?null:n.map((e,r)=>{let i=n[r+1],a=e.index+e[0].length,o=i?i.index:t.length,s=String(e[1]||``).toLowerCase();return{step:r+1,total:n.length,status:s===`failed`?`failed`:s===`done`?`done`:`running`,role:String(e[2]||`general`).toLowerCase(),title:String(e[3]||``).trim(),body:t.slice(a,o).trim()}})}function ll(e,t){let n=e.role===`summarizer`;return{id:`plan-history-${Date.now()}-${t}-${e.step}`,role:e.role||`general`,segments:n&&e.body?[{type:`text`,text:e.body,isStreaming:!1}]:[],skillBadges:[],fileChanges:[],planStep:{step:e.step,total:e.total,role:e.role||`general`,title:e.title||``,status:e.status||`done`,summary:``}}}function ul(e,t){let n=Array.isArray(e.segments)?e.segments:[];return{id:`plan-transcript-${Date.now()}-${t}-${e.step||0}`,role:e.role||`general`,segments:n,skillBadges:[],fileChanges:Array.isArray(e.fileChanges)?e.fileChanges:[],usage:Uc(e.usage),planStep:{step:e.step,total:e.total,role:e.role||`general`,title:e.title||``,status:e.status||`done`,summary:e.summary||``}}}function dl(e,t=0){return{index:Number(e?.index||e?.step||t+1),title:e?.title||``,role:e?.role||`general`,status:e?.status||`pending`}}function fl(e,t){let n=Array.isArray(e)?e:[];if(t.phase===`steps`)return(Array.isArray(t.steps)?t.steps:[]).map(dl);let r=Number(t.step||0);if(!r)return n;let i=t.status||(t.phase===`step_done`?`done`:`running`),a=!1,o=n.map((e,n)=>{let o=dl(e,n);return Number(o.index)===r?(a=!0,{...o,title:t.title||o.title,role:t.role||o.role,status:i,summary:t.summary||o.summary||``}):o});return a||o.push({index:r,title:t.title||``,role:t.role||`general`,status:i,summary:t.summary||``}),o.sort((e,t)=>Number(e.index||0)-Number(t.index||0))}function pl({children:e}){let[t,n]=(0,d.useState)(Fc),r=(0,d.useRef)(t);r.current=t;let i=(0,d.useRef)(null),a=(0,d.useRef)([]),o=(0,d.useRef)(!1),s=(0,d.useRef)(new Map),c=(0,d.useRef)(new Map),l=(0,d.useRef)(null),u=(0,d.useRef)(null),f=(0,d.useCallback)(e=>{n(t=>({...t,...e}))},[]),p=(0,d.useCallback)(e=>{let t=e.id||`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,r=[];e.text&&r.push({type:`text`,text:e.text,isStreaming:e.isStreaming||!1});let i={...e,id:t,segments:r,skillBadges:[],fileChanges:[]};return n(e=>({...e,messages:[...e.messages,i]})),t},[]),m=(0,d.useCallback)((e,t=6500)=>{clearTimeout(c.current.get(e));let r=setTimeout(()=>{c.current.delete(e),n(t=>({...t,runtimeActivities:t.runtimeActivities.filter(t=>t.id!==e)}))},t);c.current.set(e,r)},[]),g=(0,d.useCallback)(e=>{let t=e.key||e.id||`runtime`,r=`runtime-${t}`,i=Number(e.clearAfterMs),a={id:r,key:t,status:e.status||`done`,emoji:e.emoji||`•`,label:e.label||``,detail:e.detail||``,sticky:e.sticky===!0||t===`reflect`,timestamp:new Date().toISOString()};clearTimeout(c.current.get(r)),c.current.delete(r),n(e=>({...e,runtimeActivities:[a,...e.runtimeActivities.filter(e=>e.id!==r)].slice(0,4)})),a.status!==`running`&&!a.sticky?m(r,Number.isFinite(i)?i:6500):a.status===`running`&&Number.isFinite(i)&&m(r,i)},[m]),_=(0,d.useCallback)(e=>{i.current=e,f({activeMsgId:e})},[f]),v=(0,d.useCallback)(async()=>{try{let e=await Ps(),t=e.isGeneral?`__codemini_general__`:e.cwd?.split(/[/\\]/).pop()||e.cwd||`...`,r=!!e.busy;return n(n=>({...n,runtimeState:e,projectCwd:t,isGeneral:!!e.isGeneral,pendingPlanApproval:e?.pendingPlanApproval||null,pendingReflectApproval:e?.pendingReflectSkill||null,busy:r,live:r||n.live,stage:r?`thinking`:n.stage,stageLabel:r?V(`waitingResponse`):n.stageLabel,messages:e?.pendingPlanApproval?n.messages:tl(n.messages,`plan-waiting-review`)})),e}catch{return null}},[f]),y=(0,d.useCallback)(async({openIfRequired:e=!1}={})=>{try{let t=await Ys();return f({configStatus:t,configOpen:e&&t?.setupRequired?!0:r.current.configOpen}),t}catch{return null}},[f]),b=(0,d.useCallback)(async()=>{try{f({gitInfo:await Qs()})}catch{}},[f]),x=(0,d.useCallback)(async e=>{let t=[...new Set((e||[]).map(e=>e.projectDir).filter(Boolean))];if(t.length)try{f({gitBatch:await rc(t)})}catch{}},[f]),S=(0,d.useCallback)(async()=>{try{let e=await Is();f({history:Array.isArray(e)?e:[]})}catch{}},[f]),C=(0,d.useCallback)(async()=>{f({sessionsLoading:!0});try{let e=await Ls(200),t=Array.isArray(e)?e:[];f({sessions:t}),x(t)}catch{}finally{f({sessionsLoading:!1})}},[f,x]),w=(0,d.useCallback)(async e=>{if(!e)return null;try{let t=await Ps();if(t?.cwd===e)return t;let n=await ic(e);return n?.error?null:n}catch{return null}},[]),T=(0,d.useCallback)(async()=>{try{let e=await cc();f({skills:Array.isArray(e)?e:[]})}catch{}},[f]),E=(0,d.useCallback)(async(e=null)=>{f({messagesLoading:!0});try{let t=e||await Rs(),n=Array.isArray(t)?t:t.messages||[],r=t?.compact||null,i=al(n);if(!n.length){let n=Array.isArray(t?.uiMessages)?t.uiMessages:e?[]:await zs();Array.isArray(n)&&n.length?f({messages:$c(n,e?[]:(await tc().catch(()=>({})))?.changes||[])}):f({messages:[],runtimeActivities:[]});return}let a=[],o=null,s=r?.boundaryIndex,c=s==null;for(let e=0;e<n.length;e++){let t=n[e];if(!c&&e>=s&&(a.push({id:`msg-compact-divider-${Date.now()}`,role:`divider`,dividerType:`compact`,text:`以上内容已压缩 (${r.mode||``})`,timestamp:r.timestamp||new Date().toISOString()}),c=!0),t.role===`user`){if(sl(t.content))continue;o=null;let e=Ic(t.content||``);a.push({id:`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}-u${a.length}`,role:`you`,segments:[{type:`text`,text:e,isStreaming:!1}],skillBadges:[],fileChanges:[]})}else if(t.role===`assistant`){if(il(t.content)&&rl(t.content)){o=null;continue}if(Array.isArray(t.planTranscript)&&t.planTranscript.length){o=null;for(let e of t.planTranscript)a.push(ul(e,a.length));continue}let e=W(t.content);if(e?.length){o=null;let t=[...e].reverse().find(e=>e.role===`summarizer`)||e[e.length-1];a.push(ll({...t,step:1,total:1,role:t.role||`summarizer`},a.length));continue}o||(o={id:`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}-a${a.length}`,role:`general`,segments:[],skillBadges:[],fileChanges:[]},a.push(o)),Array.isArray(t.fileChanges)&&t.fileChanges.length&&(o.fileChanges=[...o.fileChanges||[],...t.fileChanges]),o.usage=Wc(o.usage,t.usage);let n=Kc(t);if(n&&o.segments.push({type:`thinking`,text:n,isStreaming:!1,startedAt:t.reasoningStartedAt||t.at||null,endedAt:t.reasoningEndedAt||t.at||null,durationMs:Number.isFinite(Number(t.reasoningDurationMs))?Number(t.reasoningDurationMs):null}),t.content&&o.segments.push({type:`text`,text:t.content,isStreaming:!1}),t.toolCalls&&t.toolCalls.length){let e=t.toolCalls.map(e=>({id:e.id,name:e.function?.name||e.name||`tool`,arguments:e.function?.arguments||e.arguments||{},status:e.status||`done`,durationMs:e.durationMs,summary:e.summary||``,result:``,...e.resultMeta?{resultMeta:e.resultMeta}:{},...e.fileChange?{fileChange:e.fileChange}:{},...Array.isArray(e.fileChanges)&&e.fileChanges.length?{fileChanges:e.fileChanges}:{}}));o.segments.push({type:`tools`,cards:e})}}else if(t.role===`tool`&&o){let e=t.toolCallId||t.tool_call_id;if(!e)continue;for(let n of o.segments){if(n.type!==`tools`)continue;let r=n.cards.find(t=>t.id===e);if(!r)continue;t.toolSummary&&(r.summary=t.toolSummary),t.toolDurationMs!=null&&(r.durationMs=t.toolDurationMs),t.toolStatus===`error`&&(r.status=`error`),t.toolStatus===`blocked`&&(r.status=`blocked`),t.toolResultMeta&&(r.resultMeta=t.toolResultMeta),t.content&&(r.result=t.content);let i=t.toolFileChange?.path?t.toolFileChange:null;i?.path&&(r.fileChange=i),Array.isArray(t.toolFileChanges)&&t.toolFileChanges.length?(r.fileChanges=t.toolFileChanges,o.fileChanges=Yc(o.fileChanges,t.toolFileChanges)):i?.path&&(o.fileChanges=Yc(o.fileChanges,[i]));break}}}f({messages:$c(a,e?[]:(await tc().catch(()=>({})))?.changes||[]),runtimeActivities:i})}catch{}finally{f({messagesLoading:!1})}},[f]),D=(0,d.useCallback)(e=>{if(!e?.type||jc(e))return;let t=r.current,c=i.current;switch(e.type){case`connected`:break;case`assistant:start`:{if(t.currentView!==`chat`&&t.currentView!==`codewiki`&&f({currentView:`chat`}),n(e=>({...e,messages:tl(e.messages,`waiting-response`)})),o.current){f({stage:`thinking`,busy:!0,live:!0,stageLabel:V(`thinking`)});break}let e=c;e?n(t=>({...t,messages:t.messages.map(t=>t.id===e?{...t,isComplete:!1}:t)})):(e=p({role:`general`,timestamp:new Date().toISOString(),text:``,isStreaming:!1,isComplete:!1}),_(e)),f({stage:`thinking`,busy:!0,live:!0,stageLabel:V(`thinking`)});break}case`assistant:delta`:{let t=qc(e.text);c&&t&&n(e=>({...e,messages:e.messages.map(e=>e.id===c?{...e,segments:zc(Hc(e.segments),t)}:e)})),f({stage:`streaming`,live:!0,stageLabel:V(`streaming`)});break}case`assistant:reasoning_delta`:c&&e.text&&n(t=>({...t,messages:t.messages.map(t=>t.id===c?{...t,segments:Bc(t.segments,e.text,!0)}:t)})),f({stage:`thinking`,live:!0,stageLabel:V(`thinking`)});break;case`assistant:tool_call_delta`:break;case`assistant:response`:c&&n(t=>({...t,messages:t.messages.map(t=>{if(t.id!==c)return t;let n=Kc(e.assistantMessage),r=n&&!(Array.isArray(t.segments)?t.segments:[]).some(e=>e.type===`thinking`&&String(e.text||``).trim())?{...t,segments:Bc(t.segments,n,!1)}:t;if(e.text){let t=qc(e.text),n=U(r.segments),i=n.length-1;return{...r,usage:Wc(r.usage,e.usage||e.assistantMessage?.usage),segments:Hc(n).map((e,n)=>n===i&&e.type===`text`?{...e,text:t,isStreaming:!1}:e)}}return{...r,usage:Wc(r.usage,e.usage||e.assistantMessage?.usage),segments:Hc(r.segments).map(e=>e.type===`text`?{...e,isStreaming:!1}:e)}})}));break;case`tool:start`:if(f({stage:`tooling`,live:!0,stageLabel:V(`tooling`)}),c){let t={id:e.id,name:e.name,arguments:e.arguments,status:`running`,durationMs:null,summary:``,result:``};n(e=>({...e,messages:e.messages.map(e=>e.id===c?{...e,segments:Rc(Hc(e.segments),t)}:e)}))}break;case`tool:end`:c&&n(t=>({...t,messages:t.messages.map(t=>{if(t.id!==c)return t;let n=Array.isArray(e.fileChanges)&&e.fileChanges.length?e.fileChanges:e.fileChange?[e.fileChange]:[];return n.length&&(a.current=[...a.current,...n]),{...t,fileChanges:n.length?Yc(t.fileChanges,n):t.fileChanges,segments:Lc(t.segments,e.id,t=>{let r={...t,status:`done`,durationMs:e.durationMs};return e.summary&&(r.summary=e.summary),e.resultMeta&&(r.resultMeta=e.resultMeta),e.fileChange&&(r.fileChange=e.fileChange),n.length&&(r.fileChanges=n),r})}})}));break;case`tool:result`:c&&n(t=>({...t,messages:t.messages.map(t=>t.id===c?{...t,segments:Lc(t.segments,e.id,t=>({...t,result:e.content||``}))}:t)}));break;case`tool:error`:c&&n(t=>({...t,messages:t.messages.map(t=>t.id===c?{...t,segments:Lc(t.segments,e.id,t=>({...t,status:`error`,durationMs:e.durationMs,summary:e.summary||t.summary}))}:t)}));break;case`tool:blocked`:c&&n(t=>({...t,messages:t.messages.map(t=>t.id===c?{...t,segments:Lc(t.segments,e.id,e=>({...e,status:`blocked`,summary:V(`toolBlocked`)}))}:t)}));break;case`system_tool:start`:p({role:`system`,text:`${e.name||`System`}: ${e.summary||``}`,timestamp:new Date().toISOString()});break;case`plan:steps`:{let t=(e.steps||[]).map((e,t)=>({index:e.index??t,title:e.title,role:e.role,status:`pending`}));o.current=!0,s.current=new Map,_(null),f({planSteps:t,pendingPlanApproval:null});break}case`plan:progress`:{let{step:t,status:r}=e;n(e=>({...e,planSteps:e.planSteps.map((e,n)=>n===t-1?{...e,status:r}:e)}));break}case`plan:step_start`:{o.current=!0,r.current.pendingPlanApproval&&f({pendingPlanApproval:null});let t=String(e.step),i=s.current.get(t);if(i)n(e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,isComplete:!1,planStep:{...e.planStep||{},status:`running`}}:e)}));else{let r=cl(e);i=r.id,s.current.set(t,i),n(e=>({...e,messages:[...tl(e.messages,`waiting-response`),r]}))}_(i),f({stage:`tooling`,busy:!0,live:!0,stageLabel:`${e.role||`agent`}: ${e.title||``}`.trim()});break}case`plan:step_done`:{let t=s.current.get(String(e.step));t&&n(n=>({...n,messages:n.messages.map(n=>n.id===t?{...n,segments:Hc(n.segments).map(e=>e.type===`text`?{...e,isStreaming:!1}:e),isComplete:!0,planStep:{...n.planStep||{},status:e.status||`done`,summary:e.summary||``}}:n)}));break}case`plan:pending_approval`:n(t=>({...t,messages:[...tl(t.messages,[`plan-waiting-review`,`waiting-response`]).filter(e=>!nl(e.text)),{id:`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,role:`system`,text:V(`planWaitingReview`),segments:[{type:`text`,text:V(`planWaitingReview`),isStreaming:!1}],skillBadges:[],fileChanges:[],transientKey:`plan-waiting-review`,timestamp:new Date().toISOString()}],pendingPlanApproval:{goal:e.goal,summary:e.summary,filePath:e.filePath,steps:e.steps||[]}}));break;case`plan:approval_cleared`:n(e=>({...e,pendingPlanApproval:null,messages:tl(e.messages,`plan-waiting-review`)}));break;case`reflect:pending_approval`:g({key:`reflect`,status:`running`,emoji:r.current.pendingReflectApproval?`📝`:`🪞`,label:r.current.pendingReflectApproval?V(`runtimeActivityReflectRevised`):V(`runtimeActivityReflectPending`),detail:e.draft?.name?`/${e.draft.name}`:``}),f({pendingReflectApproval:e.draft||null});break;case`reflect:approval_cleared`:f({pendingReflectApproval:null});break;case`skill:start`:c&&n(t=>({...t,messages:t.messages.map(t=>t.id===c?{...t,skillBadges:[...t.skillBadges,{name:e.name,status:`running`}]}:t)}));break;case`skill:end`:c&&n(t=>({...t,messages:t.messages.map(t=>t.id===c?{...t,skillBadges:t.skillBadges.map(t=>t.name===e.name?{...t,status:`done`}:t)}:t)}));break;case`skill:error`:c&&n(t=>({...t,messages:t.messages.map(t=>t.id===c?{...t,skillBadges:t.skillBadges.map(t=>t.name===e.name?{...t,status:`error`}:t)}:t)}));break;case`skill:auto`:if(c){let t=(e.names||[]).join(`, `);n(e=>({...e,messages:e.messages.map(e=>e.id===c?{...e,skillBadges:[...e.skillBadges,{name:t,status:`auto`}]}:e)}))}break;case`compact:auto`:g({key:`compact`,status:`done`,emoji:`🧳`,label:V(`runtimeActivityCompactDone`),detail:`${e.mode||`auto`} ${e.threshold?`${e.threshold}%`:``}`.trim()}),p({role:`divider`,dividerType:`compact`,text:`以上内容已压缩 (${e.mode||``}, ${e.threshold||``}%)`,timestamp:new Date().toISOString()});break;case`dream:auto`:{let e=r.current.runtimeActivities.find(e=>e.key===`dream`);if(e&&e.status!==`running`&&Date.now()-Date.parse(e.timestamp||``)<1e4)break}g({key:`dream`,status:`running`,emoji:`💤`,label:V(`runtimeActivityDreamRunning`),clearAfterMs:1800*1e3}),p({role:`system`,text:`Dream triggered...`,timestamp:new Date().toISOString()});break;case`dream:complete`:g({key:`dream`,status:e.report?.ok===!1?`error`:`done`,emoji:e.report?.ok===!1?`⚠️`:`🌙`,label:e.report?.ok===!1?V(`runtimeActivityDreamError`):V(`runtimeActivityDreamDone`),detail:e.report?.error||``,clearAfterMs:2500}),p({role:`system`,text:`Dream complete`,timestamp:new Date().toISOString()});break;case`approval:request`:f({approvalRequest:e});break;case`change:undone`:{let t=e.result||{},r=Array.isArray(t.changeSetIds)&&t.changeSetIds.length?t.changeSetIds:t.changeSetId?[t.changeSetId]:[];r.length&&n(e=>({...e,messages:el(e.messages,r)}));break}case`submit:done`:{let t=e.result||{};if(c&&a.current.length&&(n(e=>({...e,messages:e.messages.map(e=>e.id===c?{...e,fileChanges:Yc(e.fileChanges,a.current)}:e)})),a.current=[]),c&&n(e=>({...e,messages:e.messages.map(e=>e.id===c?{...e,isComplete:!0,segments:Hc(e.segments).map(e=>e.type===`text`?{...e,isStreaming:!1}:e)}:e)})),t.type===`system`&&t.text){let e=il(t.text);e&&g(e),!r.current.pendingPlanApproval&&!r.current.pendingReflectApproval&&!nl(t.text)&&!rl(t.text)&&p({role:`system`,text:t.text,timestamp:new Date().toISOString()})}t.type===`error`&&t.text&&p({role:`error`,text:`Failed: ${t.text}`,timestamp:new Date().toISOString()}),_(null),o.current=!1,s.current=new Map,n(e=>({...e,stage:`idle`,busy:!1,live:!1,stageLabel:``,messages:tl(e.messages,r.current.pendingPlanApproval?`waiting-response`:[`waiting-response`,`plan-waiting-review`])})),S(),C();let i=r.current.runtimeState;i?.sessionId&&r.current.currentView===`chat`&&Pc(`chat`,i.sessionId,{replace:!0});break}case`mode:changed`:{let t=e;f({runtimeState:{...r.current.runtimeState,mode:t.mode,...t}});break}case`approval-mode:changed`:{let t=e;f({runtimeState:{...r.current.runtimeState,approvalMode:t.approvalMode,...t}});break}case`runtime:state`:{let t=e.state||{};f({runtimeState:{...r.current.runtimeState,...t},pendingPlanApproval:t?.pendingPlanApproval||null,pendingReflectApproval:t?.pendingReflectSkill||null,busy:!!t.busy,live:!!t.busy,stage:t.busy?r.current.stage:`idle`,stageLabel:t.busy?r.current.stageLabel:``});break}case`codewiki:generate_progress`:{let t=e.title||e.summary||e.name||r.current.stageLabel||V(`generatingCodeWiki`);n(n=>({...n,stage:`tooling`,live:!0,busy:!0,stageLabel:t,planSteps:fl(n.planSteps,e),codewikiGeneration:{status:`running`,updatedAt:e.timestamp||new Date().toISOString(),error:``}}));break}case`codewiki:generate_done`:n(e=>({...e,stage:`idle`,live:!1,busy:!1,stageLabel:``,planSteps:[],codewikiGeneration:{status:`done`,updatedAt:new Date().toISOString(),error:``}})),C();break;case`codewiki:generate_error`:n(t=>({...t,stage:`idle`,live:!1,busy:!1,stageLabel:e.message||``,planSteps:[],codewikiGeneration:{status:`error`,updatedAt:new Date().toISOString(),error:e.message||``}}));break;case`runtime:switched`:n(e=>({...e,messages:[],planSteps:[],pendingPlanApproval:null,pendingReflectApproval:null,runtimeActivities:[],codewikiGeneration:{status:`idle`,updatedAt:null,error:``}})),i.current=null,a.current=[],v(),b(),S(),E(),C(),r.current.currentView!==`codewiki`&&Pc(`chat`,e.sessionId);break;case`session:title`:e.sessionId&&e.title&&n(t=>({...t,sessions:t.sessions.map(t=>t.id===e.sessionId?{...t,title:e.title}:t)}));break}},[p,f,g,S,C,v,E]),O=(0,d.useCallback)(()=>{l.current&&l.current.close();let e=new EventSource(`/api/events`);e.onmessage=e=>{try{D(JSON.parse(e.data))}catch(e){console.error(`SSE:`,e)}},e.onerror=()=>{e.close(),clearTimeout(u.current),u.current=setTimeout(O,3e3)},l.current=e},[D]);(0,d.useEffect)(()=>{(async()=>{let e=Mc(),t=y({openIfRequired:!0}),n=Fs().catch(()=>[]);if(f({currentView:e.view,codewikiProjectPath:e.view===`codewiki`?e.projectPath||``:r.current.codewikiProjectPath}),e.sessionId)try{(await Ps()).sessionId!==e.sessionId&&await Gs(e.sessionId)}catch{}else e.view===`codewiki`&&e.projectPath&&await w(e.projectPath);await t;try{let e=await n;for(let t of e)if(!(!t||jc(t))&&(t.type===`system_tool`||t.type===`tool`)){let e=t.summary||``;(e||t.name)&&p({role:`system`,text:e?`${t.name}: ${e}`:t.name,timestamp:new Date().toISOString(),startupTodos:t.arguments?.todos})}}catch{}let i=await v();if(e.view===`chat`&&i?.sessionId)Pc(`chat`,i.sessionId,{replace:!0});else if(e.view===`codewiki`){let t=e.projectPath||i?.cwd||``;f({currentView:`codewiki`,codewikiProjectPath:t}),t&&Pc(`codewiki`,null,{replace:!0,projectPath:t})}await Promise.all([E(),S(),C(),T(),b(),Ms().then(e=>f({versionInfo:e})).catch(()=>{})]),f({initialLoading:!1}),O()})();let e=async()=>{let e=Mc();if(f({currentView:e.view,codewikiProjectPath:e.view===`codewiki`?e.projectPath||``:r.current.codewikiProjectPath}),e.sessionId)try{(await Ps()).sessionId!==e.sessionId&&(f({messagesLoading:!0}),n(e=>({...e,messages:[]})),await Gs(e.sessionId),await v(),await E(),C(),b())}catch{f({messagesLoading:!1})}else if(e.view===`codewiki`){e.projectPath&&await w(e.projectPath);let t=await v();f({currentView:`codewiki`,codewikiProjectPath:e.projectPath||t?.cwd||``}),C(),b()}};return window.addEventListener(`popstate`,e),()=>{l.current&&l.current.close(),clearTimeout(u.current);for(let e of c.current.values())clearTimeout(e);c.current.clear(),window.removeEventListener(`popstate`,e)}},[p,O,y,b,S,E,C,T,v,w,f]);let ee=(0,d.useCallback)(e=>{localStorage.setItem(`codemini-theme`,e);let t=window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`),n=e===`auto`?t&&t.matches?`dark`:`light`:e;document.documentElement.dataset.theme=n},[]),te=(0,d.useMemo)(()=>({submit:async(e,t={})=>{if(!e.trim())return;r.current.currentView!==`chat`&&!t.stayInView&&f({currentView:`chat`});let i=!!r.current.pendingPlanApproval&&ol(e);i&&(o.current=!0),i||p({role:`you`,text:e,timestamp:new Date().toISOString()});let a=i?null:p({role:`system`,text:V(`waitingResponse`),timestamp:new Date().toISOString(),transientKey:`waiting-response`});f({busy:!0,live:!0,stage:`thinking`,stageLabel:V(`waitingResponse`)});try{let n=await(await Bs(e,{readOnlyCodeWiki:t.readOnlyCodeWiki===!0})).json().catch(()=>({}));if(n?.code===`CONFIG_REQUIRED`)throw f({configOpen:!0,configStatus:n.configStatus||r.current.configStatus}),Error(V(`configRequired`));if(n?.error)throw Error(n.message||`Request failed`)}catch(e){i&&(o.current=!1),a&&n(e=>({...e,messages:e.messages.filter(e=>e.id!==a)})),p({role:`error`,text:`Failed: ${e.message}`,timestamp:new Date().toISOString()}),f({busy:!1,live:!1})}},abort:async()=>{try{await Vs()}catch{}},approve:async(e,t)=>{f({approvalRequest:null});try{await Ws(e,t)}catch{}},approvePlan:async(e,t)=>{if(r.current.pendingPlanApproval){o.current=e===`approve`,e===`reject`&&f({pendingPlanApproval:null}),f({busy:!0,live:!0,stage:`thinking`,stageLabel:V(`waitingResponse`)});try{let n=e===`approve`?`/yes`:e===`reject`?`/reject`:t?.trim()?`/edit ${t.trim()}`:``;if(!n){f({busy:!1,live:!1,stage:`idle`,stageLabel:``});return}let r=await(await Bs(n)).json().catch(()=>({}));if(r?.error)throw Error(r.message||`Request failed`)}catch(e){o.current=!1,p({role:`error`,text:`Failed: ${e.message}`,timestamp:new Date().toISOString()}),f({busy:!1,live:!1,stage:`idle`,stageLabel:``})}}},approveReflect:async(e,t)=>{let n=r.current.pendingReflectApproval;if(n){g({key:`reflect`,status:`running`,emoji:e===`approve`?`💾`:e===`reject`?`🗑️`:`📝`,label:V(e===`approve`?`runtimeActivityReflectSaving`:e===`reject`?`runtimeActivityReflectDiscarding`:`runtimeActivityReflectRevising`),detail:n.name?`/${n.name}`:``}),e===`reject`&&f({pendingReflectApproval:null}),f({busy:!0,live:!0,stage:`thinking`,stageLabel:V(`waitingResponse`)});try{let n=e===`approve`?`/yes`:e===`reject`?`/no`:t?.trim()?`/edit ${t.trim()}`:``;if(!n){f({busy:!1,live:!1,stage:`idle`,stageLabel:``});return}let r=await(await Bs(n)).json().catch(()=>({}));if(r?.error)throw Error(r.message||`Request failed`)}catch(e){p({role:`error`,text:`Failed: ${e.message}`,timestamp:new Date().toISOString()}),f({busy:!1,live:!1,stage:`idle`,stageLabel:``})}}},switchSession:async e=>{let t=r.current.runtimeState?.sessionId;if(!(!e||e===t)){f({currentView:`chat`,messagesLoading:!0}),n(e=>({...e,messages:[]}));try{let t=await Gs(e);t.ok?(Pc(`chat`,e),t.state?f({runtimeState:t.state,projectCwd:t.state.cwd,isGeneral:!!t.state.isGeneral}):await v(),await E(t.sessionData),C(),b()):f({messagesLoading:!1})}catch{f({messagesLoading:!1})}}},deleteSession:async e=>{try{let t=e===r.current.runtimeState?.sessionId,i=await Ks(e);return i?.error?i:(n(t=>({...t,sessions:t.sessions.filter(t=>t.id!==e)})),t&&(f({currentView:`chat`,messagesLoading:!0}),i.sessionId&&Pc(`chat`,i.sessionId,{replace:!0}),i.state?f({runtimeState:i.state,projectCwd:i.state.cwd,isGeneral:!!i.state.isGeneral}):await v(),n(e=>({...e,messages:[]})),await E(i.sessionData),b()),C(),i)}catch(e){return{error:!0,message:e.message}}},newSession:async()=>{f({currentView:`chat`,messagesLoading:!0}),n(e=>({...e,messages:[]}));try{let e=await qs();e.ok?(e.sessionId&&Pc(`chat`,e.sessionId),await v(),C(),f({messagesLoading:!1})):f({messagesLoading:!1})}catch{f({messagesLoading:!1})}},openProject:async(e,t={})=>{let i=t.view||`chat`,a=i===`codewiki`?e:r.current.codewikiProjectPath;f({currentView:i,projectOpen:!1,messagesLoading:i===`chat`,codewikiProjectPath:a}),i===`chat`&&n(e=>({...e,messages:[]}));try{let t=await ic(e);if(t.ok){let n=i===`codewiki`?t.cwd||e:r.current.codewikiProjectPath;f({currentView:i,projectOpen:!1,codewikiProjectPath:n}),i===`codewiki`?Pc(`codewiki`,null,{projectPath:n}):t.sessionId&&Pc(`chat`,t.sessionId),await v(),C(),b(),i===`chat`&&f({messagesLoading:!1})}else i===`chat`&&f({messagesLoading:!1})}catch{i===`chat`&&f({messagesLoading:!1})}},switchView:(e,t={})=>{let n=e===`codewiki`?t.projectPath||r.current.codewikiProjectPath||r.current.runtimeState?.cwd||``:r.current.codewikiProjectPath;if(f({currentView:e,codewikiProjectPath:n}),e===`codewiki`&&Pc(e,null,{projectPath:n}),e===`chat`){let e=r.current.runtimeState;Pc(`chat`,e?.sessionId)}},toggleTheme:()=>{ee({light:`dark`,dark:`auto`,auto:`light`}[localStorage.getItem(`codemini-theme`)||`auto`]||`auto`)},setTheme:ee,setConfigOpen:e=>f({configOpen:e}),refreshConfigStatus:()=>y(),setProjectOpen:e=>f({projectOpen:e}),setSkillsOpen:e=>f({skillsOpen:e}),setMemoryOpen:e=>f({memoryOpen:e}),setSoulsOpen:e=>f({soulsOpen:e}),setAboutOpen:e=>f({aboutOpen:e}),setGitDiffOpen:e=>f({gitDiffOpen:e}),checkVersion:async()=>{try{f({versionInfo:await Ms()})}catch{}},runUpdate:async()=>{f({updateStatus:`updating`});try{(await Ns()).ok?f({updateStatus:`done`}):f({updateStatus:`error`})}catch{f({updateStatus:`error`})}}}),[p,ee,y,b,S,E,C,v,f,g]),ne=(0,d.useMemo)(()=>({state:t,actions:te}),[t,te]);return(0,h.jsx)(Ac.Provider,{value:ne,children:e})}function ml(){let e=(0,d.useContext)(Ac);if(!e)throw Error(`useApp must be used within AppProvider`);return e}var hl=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),gl=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),_l=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),vl=e=>{let t=_l(e);return t.charAt(0).toUpperCase()+t.slice(1)},yl={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},bl=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},xl=(0,d.createContext)({}),Sl=()=>(0,d.useContext)(xl),Cl=(0,d.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=Sl()??{},h=r??f?Number(n??u)*24/Number(t??l):n??u;return(0,d.createElement)(`svg`,{ref:c,...yl,width:t??l??yl.width,height:t??l??yl.height,stroke:e??p,strokeWidth:h,className:hl(`lucide`,m,i),...!a&&!bl(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,d.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),G=(e,t)=>{let n=(0,d.forwardRef)(({className:n,...r},i)=>(0,d.createElement)(Cl,{ref:i,iconNode:t,className:hl(`lucide-${gl(vl(e))}`,`lucide-${e}`,n),...r}));return n.displayName=vl(e),n},wl=G(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),Tl=G(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),El=G(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Dl=G(`book-open-text`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M16 12h2`,key:`7q9ll5`}],[`path`,{d:`M16 8h2`,key:`msurwy`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}],[`path`,{d:`M6 12h2`,key:`32wvfc`}],[`path`,{d:`M6 8h2`,key:`30oboj`}]]),Ol=G(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),kl=G(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Al=G(`chart-no-axes-combined`,[[`path`,{d:`M12 16v5`,key:`zza2cw`}],[`path`,{d:`M16 14v7`,key:`1g90b9`}],[`path`,{d:`M20 10v11`,key:`1iqoj0`}],[`path`,{d:`m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15`,key:`1fw8x9`}],[`path`,{d:`M4 18v3`,key:`1yp0dc`}],[`path`,{d:`M8 14v7`,key:`n3cwzv`}]]),jl=G(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Ml=G(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Nl=G(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Pl=G(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Fl=G(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Il=G(`drama`,[[`path`,{d:`M10 11h.01`,key:`d2at3l`}],[`path`,{d:`M14 6h.01`,key:`k028ub`}],[`path`,{d:`M18 6h.01`,key:`1v4wsw`}],[`path`,{d:`M6.5 13.1h.01`,key:`1748ia`}],[`path`,{d:`M22 5c0 9-4 12-6 12s-6-3-6-12c0-2 2-3 6-3s6 1 6 3`,key:`172yzv`}],[`path`,{d:`M17.4 9.9c-.8.8-2 .8-2.8 0`,key:`1obv0w`}],[`path`,{d:`M10.1 7.1C9 7.2 7.7 7.7 6 8.6c-3.5 2-4.7 3.9-3.7 5.6 4.5 7.8 9.5 8.4 11.2 7.4.9-.5 1.9-2.1 1.9-4.7`,key:`rqjl8i`}],[`path`,{d:`M9.1 16.5c.3-1.1 1.4-1.7 2.4-1.4`,key:`1mr6wy`}]]),Ll=G(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Rl=G(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),K=G(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),q=G(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),J=G(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Y=G(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),X=G(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),zl=G(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Bl=G(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),Vl=G(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Hl=G(`lock-open`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]]),Ul=G(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),Wl=G(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Gl=G(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Kl=G(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),ql=G(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Jl=G(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Yl=G(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Xl=G(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Zl=G(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Ql=G(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),$l=G(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),eu=G(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),tu=G(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),nu=G(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),ru=G(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),iu=G(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function au({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,h.jsx)(Po,{"data-slot":`separator`,decorative:n,orientation:t,className:B(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}function ou({...e}){return(0,h.jsx)(uo,{"data-slot":`popover`,...e})}function su({...e}){return(0,h.jsx)(fo,{"data-slot":`popover-trigger`,...e})}function cu({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,h.jsx)(po,{children:(0,h.jsx)(mo,{"data-slot":`popover-content`,align:t,sideOffset:n,className:B(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...r})})}var lu=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,uu=i,du=(e,t)=>n=>{if(t?.variants==null)return uu(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=lu(t)||lu(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return uu(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},fu=du(`inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none cursor-pointer disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground shadow-xs hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90`,outline:`border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 px-3.5 py-1.5 text-[13px] has-[>svg]:px-2.5`,xs:`h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1.5 rounded-md px-3 text-[13px] has-[>svg]:px-2`,lg:`h-10 rounded-md px-6 has-[>svg]:px-4`,icon:`size-8`,"icon-xs":`size-6 rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function pu({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,h.jsx)(r?_:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:B(fu({variant:t,size:n,className:e})),...i})}function mu({...e}){return(0,h.jsx)(Yn,{"data-slot":`dialog`,...e})}function hu({...e}){return(0,h.jsx)(Xn,{"data-slot":`dialog-portal`,...e})}function gu({className:e,...t}){return(0,h.jsx)(Zn,{"data-slot":`dialog-overlay`,className:B(`fixed inset-0 z-50 bg-black/40 backdrop-blur-[2px] data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function _u({className:e,children:t,...n}){return(0,h.jsxs)(hu,{"data-slot":`dialog-portal`,children:[(0,h.jsx)(gu,{}),(0,h.jsx)(Qn,{"data-slot":`dialog-content`,className:B(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border border-(--border-default) bg-(--bg-primary) text-(--text-primary) p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...n,children:t})]})}function vu({className:e,showCloseButton:t=!0,children:n,...r}){return(0,h.jsxs)(`div`,{"data-slot":`dialog-header`,className:B(`flex flex-row items-center justify-between gap-2 text-center sm:text-left`,e),...r,children:[(0,h.jsx)(`div`,{className:`flex-1 min-w-0`,children:n}),t&&(0,h.jsxs)(tr,{"data-slot":`dialog-close`,className:`shrink-0 rounded-xs opacity-70 text-(--text-muted) transition-opacity hover:opacity-100 hover:text-(--text-primary) focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,h.jsx)(iu,{}),(0,h.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})}function yu({className:e,showCloseButton:t=!1,children:n,...r}){return(0,h.jsxs)(`div`,{"data-slot":`dialog-footer`,className:B(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,h.jsx)(tr,{asChild:!0,children:(0,h.jsx)(pu,{variant:`outline`,children:`Close`})})]})}function bu({className:e,...t}){return(0,h.jsx)($n,{"data-slot":`dialog-title`,className:B(`text-base font-semibold text-(--text-primary)`,e),...t})}function xu({className:e,...t}){return(0,h.jsx)(er,{"data-slot":`dialog-description`,className:B(`text-sm text-(--text-secondary)`,e),...t})}function Su({open:e,title:t,description:n,confirmLabel:r,cancelLabel:i,loadingLabel:a,loading:o=!1,onOpenChange:s,onConfirm:c}){return(0,h.jsx)(mu,{open:e,onOpenChange:e=>!o&&s?.(e),children:(0,h.jsxs)(_u,{className:`sm:max-w-[380px]`,children:[(0,h.jsxs)(vu,{showCloseButton:!o,children:[(0,h.jsx)(bu,{children:t}),(0,h.jsx)(xu,{className:`leading-6`,children:n})]}),(0,h.jsxs)(yu,{children:[(0,h.jsx)(pu,{type:`button`,variant:`outline`,disabled:o,onClick:()=>s?.(!1),children:i||V(`cancel`)}),(0,h.jsx)(pu,{type:`button`,variant:`destructive`,disabled:o,onClick:c,children:o?a||V(`deleting`):r||V(`delete`)})]})]})})}function Cu({className:e}){return(0,h.jsxs)(`span`,{role:`status`,className:B(`loading-dots text-(--text-muted)`,e),children:[(0,h.jsx)(`span`,{}),(0,h.jsx)(`span`,{}),(0,h.jsx)(`span`,{})]})}var wu=`__codemini_general__`,Tu=5,Eu=10;function Du(e){return e?.projectDir||`unknown`}function Ou(e,t){return t?V(`generalChat`):!e||e===`unknown`?V(`unknownProject`):String(e).split(/[/\\]/).filter(Boolean).pop()||e}function ku({size:e=14,className:t,...n}){return(0,h.jsx)(`svg`,{viewBox:`0 0 24 24`,width:e,height:e,fill:`currentColor`,"aria-hidden":`true`,className:t,...n,children:(0,h.jsx)(`path`,{d:`M12 .5C5.65.5.5 5.65.5 12c0 5.09 3.29 9.4 7.86 10.93.58.1.79-.25.79-.56v-2.18c-3.2.69-3.87-1.36-3.87-1.36-.52-1.33-1.28-1.68-1.28-1.68-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.76 2.7 1.25 3.36.96.1-.75.4-1.25.73-1.54-2.55-.29-5.23-1.27-5.23-5.67 0-1.25.45-2.27 1.18-3.07-.12-.29-.51-1.46.11-3.03 0 0 .97-.31 3.16 1.17A10.98 10.98 0 0 1 12 6.07c.98 0 1.96.13 2.88.39 2.19-1.48 3.15-1.17 3.15-1.17.63 1.57.24 2.74.12 3.03.74.8 1.18 1.82 1.18 3.07 0 4.41-2.69 5.38-5.25 5.66.42.36.78 1.06.78 2.14v3.18c0 .31.21.67.8.56A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z`})})}function Au(e){return e?.title||e?.preview||(e?.messageCount>0?`${e.messageCount} ${V(`messages`)}`:V(`emptyChat`))}function ju(e){let t=Date.parse(e||``);if(!Number.isFinite(t))return``;let n=Date.now()-t;if(n<6e4)return V(`justNow`);let r=Math.floor(n/6e4);if(r<60)return`${r}${V(`minutesAgo`)}`;let i=Math.floor(r/60);if(i<24)return`${i}${V(`hoursAgo`)}`;let a=Math.floor(i/24);return a<30?`${a}${V(`daysAgo`)}`:new Date(t).toLocaleDateString(void 0,{month:`numeric`,day:`numeric`})}var Mu=[{id:`default`,labelKey:`themeDefault`,swatches:[`#0a0a0a`,`#f5f5f5`,`#60a5fa`]},{id:`catppuccin`,labelKey:`themeCatppuccin`,swatches:[`#1e1e2e`,`#cba6f7`,`#89b4fa`]},{id:`tokyonight`,labelKey:`themeTokyoNight`,swatches:[`#1a1b26`,`#7aa2f7`,`#bb9af7`]},{id:`one`,labelKey:`themeOne`,swatches:[`#282c34`,`#61afef`,`#c678dd`]},{id:`github`,labelKey:`themeGithub`,swatches:[`#ffffff`,`#0969da`,`#24292f`]},{id:`vscode`,labelKey:`themeVSCode`,swatches:[`#1e1e1e`,`#007acc`,`#d4d4d4`]}];function Nu({sessions:e,sessionsLoading:t,currentSessionId:n,onNewSession:r,onSwitchSession:i,onToggleTheme:a,onSetTheme:o,onOpenSettings:s,onOpenSkills:c,onOpenMemory:l,onOpenSouls:u,onOpenAbout:f,gitBatch:p,versionInfo:m,onUpdate:g,updateStatus:_,currentView:v,onSwitchView:y,onOpenProject:b,onDeleteSession:x}){let[S,C]=(0,d.useState)(new Set),[w,T]=(0,d.useState)({}),[E,D]=(0,d.useState)(Eu),[O,ee]=(0,d.useState)(null),[te,ne]=(0,d.useState)(!1),[re,ie]=(0,d.useState)(()=>typeof document>`u`?`default`:document.documentElement.dataset.palette||`default`),[k,ae]=(0,d.useState)(()=>typeof document>`u`?`light`:document.documentElement.dataset.theme||`light`),[A,j]=(0,d.useState)(()=>typeof window>`u`?`auto`:localStorage.getItem(`codemini-theme`)||`auto`);(0,d.useEffect)(()=>{let e=window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>{ae(document.documentElement.dataset.theme||`light`),j(localStorage.getItem(`codemini-theme`)||`auto`)},n=new MutationObserver(t);return n.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),e&&e.addEventListener(`change`,t),()=>{n.disconnect(),e&&e.removeEventListener(`change`,t)}},[]);let oe=k===`dark`,{allSessions:se,currentSession:ce,activeIsGeneral:le,activeProjectKey:M,generalSessions:N,projectSessionsOnly:ue,projectGroups:de,projectGroupEntries:fe}=(0,d.useMemo)(()=>{let t=Array.isArray(e)?e:[],r=t.find(e=>e.id===n),i=[],a=[],o=new Map;for(let e of t){if(e.isGeneral){i.push(e);continue}a.push(e);let t=Du(e);o.has(t)||o.set(t,[]),o.get(t).push(e)}return{allSessions:t,currentSession:r,activeIsGeneral:!!r?.isGeneral,activeProjectKey:r?Du(r):null,generalSessions:i,projectSessionsOnly:a,projectGroups:o,projectGroupEntries:Array.from(o.entries())}},[e,n]),pe=e=>{C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},me=(e,t)=>{T(n=>{let r=n[e]||Tu;return{...n,[e]:Math.min(r+Tu,t)}})},he=()=>{D(e=>Math.min(e+Eu,N.length))},ge=e=>{let t=Mu.some(t=>t.id===e)?e:`default`;document.documentElement.dataset.palette=t,localStorage.setItem(`codemini-theme-palette`,t),window.dispatchEvent(new CustomEvent(`codemini-theme-palette-change`,{detail:{palette:t}})),ie(t)},_e=async(e,t)=>{if(e.stopPropagation(),t&&t!==`unknown`&&t!==M&&b){await b(t,{view:`codewiki`});return}y?.(`codewiki`,{projectPath:t})},ve=async(e,t)=>{if(e.stopPropagation(),!(!t||t===`unknown`)){if(t===M){await r?.();return}await b?.(t,{view:`chat`})}},ye=async()=>{if(le){await r?.();return}await b?.(wu,{view:`chat`})};return(0,h.jsxs)(`aside`,{className:`w-[260px] shrink-0 flex flex-col bg-(--bg-secondary)`,children:[(0,h.jsxs)(`div`,{className:`shrink-0 px-2.5 pt-3 flex flex-col gap-0.5`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex h-10 items-center gap-2.5 px-2`,children:[(0,h.jsx)(`img`,{src:`/logos/codemini_logo.png`,alt:``,className:`size-6 shrink-0 rounded-md`,draggable:!1}),(0,h.jsx)(`div`,{className:`min-w-0 truncate text-[23px] font-semibold leading-6 text-(--text-primary)`,children:V(`brand`)})]}),(0,h.jsxs)(`button`,{className:`w-full border-0 bg-transparent flex items-center gap-2.5 h-[32px] px-2 rounded-lg cursor-pointer text-left text-[13px] hover:bg-(--bg-hover) text-(--text-primary)`,onClick:r,children:[(0,h.jsx)(Xl,{size:15,strokeWidth:2,className:`text-(--text-secondary) shrink-0`}),(0,h.jsx)(`span`,{className:`truncate`,children:V(`newChat`)})]}),(0,h.jsxs)(`button`,{className:`w-full border-0 bg-transparent flex items-center gap-2.5 h-[32px] px-2 rounded-lg cursor-pointer text-left text-[13px] hover:bg-(--bg-hover) text-(--text-primary)`,onClick:c,children:[(0,h.jsx)(Y,{size:15,strokeWidth:2,className:`text-(--text-secondary) shrink-0`}),(0,h.jsx)(`span`,{className:`truncate`,children:V(`skills`)})]}),(0,h.jsxs)(`button`,{className:`w-full border-0 bg-transparent flex items-center gap-2.5 h-[32px] px-2 rounded-lg cursor-pointer text-left text-[13px] hover:bg-(--bg-hover) text-(--text-primary)`,onClick:u,children:[(0,h.jsx)(Il,{size:15,strokeWidth:2,className:`text-(--text-secondary) shrink-0`}),(0,h.jsx)(`span`,{className:`truncate`,children:V(`souls`)})]}),(0,h.jsxs)(`button`,{className:`w-full border-0 bg-transparent flex items-center gap-2.5 h-[32px] px-2 rounded-lg cursor-pointer text-left text-[13px] hover:bg-(--bg-hover) text-(--text-primary)`,onClick:l,children:[(0,h.jsx)(Ol,{size:15,strokeWidth:2,className:`text-(--text-secondary) shrink-0`}),(0,h.jsx)(`span`,{className:`truncate`,children:V(`memory`)})]}),(0,h.jsx)(au,{className:`my-2 bg-transparent`})]}),(0,h.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto scroll-smooth`,children:[(0,h.jsx)(`div`,{className:`flex items-center gap-2 px-4 pb-2.5`,children:(0,h.jsx)(`span`,{className:`min-w-0 flex-1 text-[12px] font-medium text-(--text-muted)`,children:V(`projects`)})}),(0,h.jsxs)(`nav`,{className:`flex flex-col px-2.5 pb-1 gap-0.5`,children:[fe.map(([e,t])=>{let r=S.has(e)||de.size===1,a=w[e]||Tu,o=t.slice(0,a),s=p?.[e],c=e===M,l=e!==`unknown`;return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{className:B(`w-full border-0 bg-transparent flex items-center gap-1 h-[28px] px-1.5 rounded-md text-left text-[12px] font-medium tracking-[0.2px] hover:bg-(--bg-hover)`,c?`text-(--text-primary)`:`text-(--text-muted) hover:text-(--text-secondary)`),title:e===`unknown`?``:e,children:[(0,h.jsxs)(`button`,{className:`min-w-0 flex-1 border-0 bg-transparent flex items-center gap-2 text-left text-inherit cursor-pointer`,onClick:()=>pe(e),children:[(0,h.jsx)(Rl,{size:13,className:`shrink-0`}),(0,h.jsx)(`span`,{className:`truncate flex-1`,children:Ou(e)})]}),l&&(0,h.jsx)(`button`,{type:`button`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-(--text-muted) cursor-pointer hover:bg-(--bg-active) hover:text-(--text-primary)`,title:V(`newSessionInProject`),"aria-label":`${V(`newSessionInProject`)} ${Ou(e)}`,onClick:t=>ve(t,e),children:(0,h.jsx)(Xl,{size:13,strokeWidth:2.1})}),l&&(0,h.jsx)(`button`,{type:`button`,className:B(`inline-flex size-6 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-(--text-muted) cursor-pointer hover:bg-(--bg-active) hover:text-(--text-primary)`,v===`codewiki`&&c&&`bg-(--bg-active) text-(--text-primary)`),title:V(`openCodeWiki`),"aria-label":`${V(`openCodeWiki`)} ${Ou(e)}`,onClick:t=>_e(t,e),children:(0,h.jsx)(Dl,{size:13,strokeWidth:1.9})}),s?.isGit&&(0,h.jsx)(ku,{size:11,className:`shrink-0 text-(--text-muted)`}),(0,h.jsx)(`span`,{className:`text-[11px] px-2`,children:t.length}),(0,h.jsx)(`button`,{type:`button`,className:`border-0 bg-transparent inline-flex size-5 shrink-0 items-center justify-center rounded-md text-inherit cursor-pointer hover:bg-(--bg-active)`,onClick:()=>pe(e),"aria-label":V(r?`collapseProject`:`expandProject`),children:(0,h.jsx)(Ml,{size:13,className:B(`transition-transform`,!r&&`-rotate-90`)})})]}),r&&(0,h.jsxs)(`div`,{className:`flex flex-col gap-1.5 py-1 pl-2`,children:[o.map(e=>(0,h.jsxs)(`div`,{onClick:()=>{e.id===n?v!==`chat`&&y?.(`chat`):i(e.id)},className:B(`group w-full border-0 bg-transparent flex items-center gap-2 h-[30px] px-2 rounded-md cursor-pointer text-left text-[13px] truncate`,e.id===n?`bg-(--bg-active) text-(--text-primary)`:`text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),children:[(0,h.jsx)(`span`,{className:`truncate flex-1`,title:Au(e),children:Au(e)}),e.updatedAt&&(0,h.jsx)(`span`,{className:`text-[11px] text-(--text-muted) shrink-0 tabular-nums`,children:ju(e.updatedAt)}),(0,h.jsxs)(ou,{children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsx)(`button`,{type:`button`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-md text-(--text-muted) opacity-0 hover:bg-(--bg-active) hover:text-(--text-primary) group-hover:opacity-100 focus:opacity-100`,onClick:e=>e.stopPropagation(),"aria-label":V(`sessionActions`),children:(0,h.jsx)(Ll,{size:14})})}),(0,h.jsx)(cu,{align:`end`,className:`w-36 border-(--border-default) bg-(--bg-primary) p-1 text-(--text-primary)`,onClick:e=>e.stopPropagation(),children:(0,h.jsx)(`button`,{type:`button`,className:`w-full rounded-md px-2.5 py-2 text-left text-[13px] text-(--accent-red) hover:bg-(--accent-red-bg)`,onClick:()=>ee(e),children:V(`deleteSession`)})})]})]},e.id)),a<t.length&&(0,h.jsx)(`button`,{type:`button`,className:`h-[26px] rounded-md border-0 bg-transparent px-2 text-left text-[12px] font-medium text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary)`,onClick:()=>me(e,t.length),children:V(`showMoreSessions`)})]})]},e)}),t&&se.length===0&&(0,h.jsx)(`div`,{className:`px-3 py-4 text-center`,children:(0,h.jsx)(Cu,{className:`justify-center`})}),!t&&ue.length===0&&N.length===0&&(0,h.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-(--text-muted) text-center`,children:V(`noSessions`)})]}),(0,h.jsxs)(`section`,{className:`px-2.5 pb-2`,children:[(0,h.jsx)(au,{className:`my-2 bg-transparent`}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-1.5 pb-1.5`,children:[(0,h.jsx)(`span`,{className:`min-w-0 flex-1 text-[12px] font-medium text-(--text-muted)`,children:V(`conversations`)}),(0,h.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-(--text-muted) cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary)`,title:V(`newChat`),"aria-label":V(`newChat`),onClick:ye,children:(0,h.jsx)(Xl,{size:14,strokeWidth:1.9})})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[t&&N.length===0&&(0,h.jsx)(`div`,{className:`flex h-[34px] items-center justify-center px-3 text-(--text-muted)`,children:(0,h.jsx)(Cu,{})}),N.slice(0,E).map(e=>(0,h.jsxs)(`div`,{onClick:()=>{e.id===n?v!==`chat`&&y?.(`chat`):i(e.id)},className:B(`group flex h-[34px] w-full cursor-pointer items-center gap-2 rounded-lg border-0 px-2 text-left text-[13px]`,e.id===n&&v===`chat`?`bg-(--bg-active) text-(--text-primary)`:`text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),children:[(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,title:Au(e),children:Au(e)}),e.updatedAt&&(0,h.jsx)(`span`,{className:`shrink-0 text-[11px] tabular-nums text-(--text-muted)`,children:ju(e.updatedAt)}),(0,h.jsxs)(ou,{children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsx)(`button`,{type:`button`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-md text-(--text-muted) opacity-0 hover:bg-(--bg-active) hover:text-(--text-primary) group-hover:opacity-100 focus:opacity-100`,onClick:e=>e.stopPropagation(),"aria-label":V(`sessionActions`),children:(0,h.jsx)(Ll,{size:14})})}),(0,h.jsx)(cu,{align:`end`,className:`w-36 border-(--border-default) bg-(--bg-primary) p-1 text-(--text-primary)`,onClick:e=>e.stopPropagation(),children:(0,h.jsx)(`button`,{type:`button`,className:`w-full rounded-md px-2.5 py-2 text-left text-[13px] text-(--accent-red) hover:bg-(--accent-red-bg)`,onClick:()=>ee(e),children:V(`deleteSession`)})})]})]},e.id)),E<N.length&&(0,h.jsx)(`button`,{type:`button`,className:`h-[28px] rounded-md border-0 bg-transparent px-2 text-left text-[12px] font-medium text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary)`,onClick:he,children:V(`showMoreSessions`)}),!t&&N.length===0&&(0,h.jsx)(`button`,{type:`button`,onClick:ye,className:`h-[34px] rounded-lg border-0 bg-transparent px-2 text-left text-[13px] text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary)`,children:V(`noConversations`)})]})]})]}),(0,h.jsxs)(`div`,{className:`mt-auto px-2.5 py-2 flex flex-col gap-0`,children:[(0,h.jsx)(au,{className:`my-2 bg-transparent`}),m?.latest&&m.latest!==m.current&&(0,h.jsx)(`button`,{className:`w-full border-0 bg-(--bg-tertiary) rounded-md px-2.5 py-1.5 cursor-pointer text-[11px] text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary) flex items-center justify-center gap-1.5`,onClick:_===`updating`?void 0:g,disabled:_===`updating`,children:_===`updating`?(0,h.jsx)(h.Fragment,{children:V(`updating`)}):_===`done`?(0,h.jsx)(h.Fragment,{children:V(`updatedRestart`)}):(0,h.jsx)(h.Fragment,{children:V(`updateAvailable`)})}),(0,h.jsxs)(`div`,{className:`flex items-center justify-center gap-1`,children:[(0,h.jsx)(`button`,{className:`border-0 bg-transparent inline-flex items-center justify-center size-8 rounded-lg cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary) text-(--text-secondary)`,onClick:f,title:V(`about`),"aria-label":V(`about`),children:(0,h.jsx)(zl,{size:15,strokeWidth:1.8})}),(0,h.jsx)(`a`,{href:`https://github.com/havingautism/Codemini-CLI`,target:`_blank`,rel:`noreferrer`,className:`border-0 bg-transparent inline-flex items-center justify-center size-8 rounded-lg cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary) text-(--text-secondary)`,title:V(`projectRepository`),"aria-label":V(`projectRepository`),children:(0,h.jsx)(ku,{size:15})}),(0,h.jsxs)(ou,{children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsx)(`button`,{className:`border-0 bg-transparent inline-flex items-center justify-center size-8 rounded-lg cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary) text-(--text-secondary)`,title:V(`switchThemePalette`),"aria-label":V(`switchThemePalette`),children:(0,h.jsx)(Jl,{size:15,strokeWidth:1.8})})}),(0,h.jsx)(cu,{align:`center`,side:`top`,className:`w-44 border-(--border-default) bg-(--bg-primary) p-1 text-(--text-primary)`,children:Mu.map(e=>(0,h.jsxs)(`button`,{type:`button`,className:B(`w-full rounded-md px-2.5 py-2 text-left text-[13px] flex items-center gap-2 hover:bg-(--bg-hover)`,re===e.id&&`text-(--text-primary) font-medium`),onClick:()=>ge(e.id),children:[(0,h.jsx)(`span`,{className:`flex shrink-0 -space-x-1`,children:e.swatches.map(e=>(0,h.jsx)(`span`,{className:`size-3 rounded-full border border-(--border-default)`,style:{backgroundColor:e}},e))}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:V(e.labelKey)}),re===e.id&&(0,h.jsx)(jl,{size:13})]},e.id))})]}),(0,h.jsxs)(ou,{children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsx)(`button`,{className:`border-0 bg-transparent inline-flex items-center justify-center size-8 rounded-lg cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary) text-(--text-secondary)`,title:V(`switchLanguage`),"aria-label":V(`switchLanguage`),children:(0,h.jsx)(J,{size:15,strokeWidth:1.8})})}),(0,h.jsx)(cu,{align:`center`,side:`top`,className:`w-30 border-(--border-default) bg-(--bg-primary) p-1 text-(--text-primary)`,children:[`zh`,`en`].map(e=>(0,h.jsxs)(`button`,{type:`button`,className:B(`w-full rounded-md px-2.5 py-1.5 text-left text-[13px] flex items-center justify-between hover:bg-(--bg-hover)`,As()===e&&`text-(--text-primary) font-medium`),onClick:()=>{As()!==e&&(ks(e),window.location.reload())},children:[(0,h.jsx)(`span`,{children:e===`zh`?`中文`:`English`}),As()===e&&(0,h.jsx)(jl,{size:13})]},e))})]}),(0,h.jsxs)(ou,{children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsx)(`button`,{className:`border-0 bg-transparent inline-flex items-center justify-center size-8 rounded-lg cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary) text-(--text-secondary)`,title:V(`switchTheme`),"aria-label":V(`switchTheme`),children:oe?(0,h.jsx)(ql,{size:15,strokeWidth:1.8}):(0,h.jsx)(nu,{size:15,strokeWidth:1.8})})}),(0,h.jsx)(cu,{align:`center`,side:`top`,className:`w-30 border-(--border-default) bg-(--bg-primary) p-1 text-(--text-primary)`,children:[{mode:`light`,icon:nu,label:V(`lightMode`)},{mode:`dark`,icon:ql,label:V(`darkMode`)},{mode:`auto`,icon:Kl,label:V(`autoModeTheme`)}].map(({mode:e,icon:t,label:n})=>(0,h.jsxs)(`button`,{type:`button`,className:B(`w-full rounded-md px-2.5 py-1.5 text-left text-[13px] flex items-center justify-between hover:bg-(--bg-hover)`,A===e&&`text-(--text-primary) font-medium`),onClick:()=>o(e),children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,h.jsx)(t,{size:13,strokeWidth:1.8}),(0,h.jsx)(`span`,{children:n})]}),A===e&&(0,h.jsx)(jl,{size:13})]},e))})]}),(0,h.jsx)(`button`,{className:`border-0 bg-transparent inline-flex items-center justify-center size-8 rounded-lg cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary) text-(--text-secondary)`,onClick:s,title:V(`settings`),"aria-label":V(`settings`),children:(0,h.jsx)($l,{size:15,strokeWidth:1.8})})]})]}),(0,h.jsx)(Su,{open:!!O,title:V(`deleteSessionConfirm`),description:O?V(`deleteSessionDescription`).replace(`{{session}}`,O.title||O.preview||O.id||``):``,loading:te,onOpenChange:e=>!e&&ee(null),onConfirm:async()=>{if(!O)return;ne(!0);let e=await x?.(O.id);ne(!1),e?.error||ee(null)}})]})}var Pu=`modulepreload`,Fu=function(e){return`/`+e},Iu={},Lu=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Fu(t,n),t in Iu)return;Iu[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Pu,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Ru=(0,d.lazy)(()=>Lu(()=>import(`./MessageBubble-BIgpZsLn.js`).then(e=>({default:e.MessageBubble})),__vite__mapDeps([0,1,2,3,4,5,6,7])));function zu(e,t=36){let n=String(e||``).replace(/\n/g,` `).trim();return n.length>t?n.slice(0,t)+`...`:n}function Bu(){return(0,h.jsxs)(`div`,{className:`codemini-home-visual codemini-press`,"aria-hidden":`true`,children:[(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`roll`}),(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`roll`}),(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`roll`}),(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`roll`})]})}function Vu({userMessages:e,activeNavIndex:t,scrollToMessage:n}){let[r,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(-1),s=(0,d.useRef)(null),c=(0,d.useCallback)(()=>{clearTimeout(s.current),i(!0)},[]),l=(0,d.useCallback)(()=>{s.current=setTimeout(()=>{i(!1),o(-1)},150)},[]);return(0,d.useEffect)(()=>()=>clearTimeout(s.current),[]),e.length<=1?null:(0,h.jsxs)(`div`,{className:`fixed right-5 top-1/2 -translate-y-1/2 pointer-events-auto z-30 flex items-center gap-1`,onMouseEnter:c,onMouseLeave:l,children:[r&&(0,h.jsx)(`div`,{className:`flex flex-col gap-px rounded-lg bg-(--bg-primary) border border-(--border-default) p-1.5 max-w-[180px] max-h-[60vh] overflow-y-auto shadow-lg`,children:e.map((e,r)=>(0,h.jsx)(`button`,{onClick:()=>n(e.id),onMouseEnter:()=>o(r),onMouseLeave:()=>o(-1),className:B(`text-left text-[11px] leading-tight px-2 py-1 rounded-md truncate transition-colors cursor-pointer max-w-full`,r===t?`text-primary`:`text-(--text-muted)`,a===r&&`bg-primary/10 text-primary`),children:e.text||`...`},e.id))}),(0,h.jsx)(`div`,{className:`flex flex-col items-end gap-6 py-1`,children:e.map((e,r)=>(0,h.jsx)(`button`,{onClick:()=>n(e.id),className:B(`h-0.5 rounded-sm transition-all duration-150 cursor-pointer`,r===t?`w-5 bg-primary`:a===r?`w-4 bg-primary/50`:`w-3 bg-(--text-muted)`)},e.id))})]})}function Hu({messages:e,projectCwd:t,skills:n=[],gitInfo:r,messagesLoading:i,isGeneral:a=!1}){let o=(0,d.useRef)(null),[s,c]=(0,d.useState)(!0),[l,u]=(0,d.useState)(!1),[f,p]=(0,d.useState)(-1),m=(0,d.useMemo)(()=>e.filter(e=>e.role===`you`).map(e=>({id:e.id,text:zu(e.text||e.segments?.filter(e=>e.type===`text`).map(e=>e.text).join(``)||``)})),[e]),g=(0,d.useCallback)(e=>{let t=o.current?.querySelector(`[data-message-id="${e}"]`);t&&t.scrollIntoView({behavior:`smooth`,block:`center`})},[]);return(0,d.useEffect)(()=>{let e=o.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<80;c(t),u(!t&&e.scrollTop>100);let n=e.querySelectorAll(`[data-message-id][class*="justify-end"]`);if(n.length===0){p(-1);return}let r=e.scrollTop+e.clientHeight*.4,i=-1;n.forEach((e,t)=>{e.offsetTop<=r&&(i=t)}),p(i)};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,d.useEffect)(()=>{s&&o.current&&requestAnimationFrame(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)})},[e,s]),(0,h.jsxs)(`div`,{className:`flex-1 relative overflow-hidden`,children:[i&&e.length===0&&(0,h.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:(0,h.jsx)(Cu,{})}),!i&&e.length===0&&(0,h.jsx)(`div`,{className:`absolute left-1/2 top-[38%] -translate-x-1/2 -translate-y-1/2 w-[min(760px,calc(100%-48px))] text-center pointer-events-none`,children:a?(0,h.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,h.jsx)(`div`,{className:`mb-7 w-[min(560px,100%)]`,children:(0,h.jsx)(Bu,{})}),(0,h.jsx)(`h1`,{className:`text-[clamp(24px,2.4vw,36px)] font-medium leading-tight tracking-normal`,children:V(`askAnythingGeneral`)})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`h1`,{className:`text-[clamp(24px,2.4vw,36px)] font-medium leading-tight tracking-normal`,children:V(`buildInProject`).replace(`{{project}}`,t||`qurio-coder`)}),r?.isGit&&(0,h.jsxs)(`div`,{className:`mt-4 flex items-center justify-center gap-3 text-[13px] text-(--text-muted)`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,h.jsx)(K,{size:13}),(0,h.jsx)(`span`,{children:r.branch})]}),r.dirty?(0,h.jsxs)(h.Fragment,{children:[r.staged>0&&(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-green-600 dark:text-green-400`,children:[(0,h.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-current`}),V(`gitStaged`),` `,r.staged]}),r.modified>0&&(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-amber-600 dark:text-amber-400`,children:[(0,h.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-current`}),V(`gitModified`),` `,r.modified]}),r.untracked>0&&(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-current`}),V(`gitUntracked`),` `,r.untracked]})]}):(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-emerald-500`}),V(`gitClean`)]})]})]})}),(0,h.jsx)(`div`,{ref:o,className:`h-full overflow-y-auto py-[44px_0_28px] scroll-smooth`,style:{scrollbarWidth:`thin`},children:(0,h.jsx)(`div`,{className:`relative`,children:(0,h.jsx)(`div`,{className:`w-[min(960px,calc(100%-96px))] mx-auto`,children:(0,h.jsx)(d.Suspense,{fallback:null,children:e.map(e=>(0,h.jsx)(Ru,{message:e,skills:n},e.id))})})})}),(0,h.jsx)(Vu,{userMessages:m,activeNavIndex:f,scrollToMessage:g}),(0,h.jsx)(`div`,{className:`absolute right-7 bottom-0 flex flex-col gap-2 z-20`,children:l&&(0,h.jsx)(`button`,{className:`w-9 h-9 rounded-full bg-(--bg-primary) dark:bg-(--bg-secondary) border border-(--border-default) cursor-pointer flex items-center justify-center text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary) animate-in fade-in-0 zoom-in-95`,onClick:()=>{c(!0),o.current?.scrollTo({top:o.current.scrollHeight,behavior:`smooth`})},children:(0,h.jsx)(Tl,{size:16})})})]})}var Uu=new Set([`superpowers-lite`]);function Wu(){return[{value:`normal`,label:V(`normalExecutionMode`),desc:V(`normalModeDesc`),icon:Ul},{value:`plan`,label:V(`planMode`),desc:V(`planModeDesc`),icon:Bl}]}function Z(){return[{value:`review`,label:V(`reviewMode`),desc:V(`reviewModeDesc`),icon:eu},{value:`auto`,label:V(`autoMode`),desc:V(`autoModeDesc`),icon:tu},{value:`full_access`,label:V(`fullAccessMode`),desc:V(`fullAccessModeDesc`),icon:Hl}]}var Gu=[{name:`dream`,insert:`/dream `,icon:ql,description:`Run memory consolidation now. Auto dream still runs in the background when needed.`},{name:`compact`,insert:`/compact `,icon:wl,description:`Compress the current conversation context while keeping the useful working summary.`},{name:`memory`,insert:`/memory `,icon:Fl,description:`Inspect or manage remembered project and user context.`},{name:`capture`,insert:`/capture `,icon:kl,description:`Capture an explicit note into the memory inbox for later consolidation.`},{name:`inbox`,insert:`/inbox `,icon:X,description:`Review pending memory inbox entries.`},{name:`reflect`,insert:`/reflect `,icon:tu,description:`Draft or update a reusable skill from the current workflow.`},{name:`retry`,insert:`/retry `,icon:Ql,description:`Retry the last assistant turn.`}],Ku=new Set(Gu.map(e=>e.name)),qu=`border border-transparent bg-(--bg-primary)/35 text-(--text-secondary) h-8 rounded-full inline-flex items-center justify-center gap-1.5 shrink-0 cursor-pointer text-[13px] whitespace-nowrap transition-colors hover:border-(--border-strong) hover:bg-(--bg-hover) hover:text-(--text-primary)`;function Ju({current:e,disabled:t=!1}){let[n,r]=(0,d.useState)(!1),[i,a]=(0,d.useState)(!1),o=Wu(),s=o.find(t=>t.value===e)||o[0],c=s.icon,l=async n=>{if(!(n===e||i||t)){a(!0);try{let e=await Hs(n);if(e?.error)throw Error(e.message||`Failed to switch mode`)}catch{}finally{a(!1)}r(!1)}};return(0,h.jsxs)(ou,{open:n,onOpenChange:e=>!t&&r(e),children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsxs)(`button`,{type:`button`,className:B(qu,`px-3 hover:border-(--accent-blue)/55 hover:bg-(--accent-blue-bg) hover:text-(--accent-blue)`,(i||t)&&`opacity-50 pointer-events-none`),disabled:t,title:V(t?`switchModeDisabled`:`switchMode`),children:[(0,h.jsx)(c,{size:13}),(0,h.jsx)(`span`,{className:`truncate`,children:s.label}),(0,h.jsx)(Ml,{size:11})]})}),(0,h.jsxs)(cu,{side:`top`,align:`start`,sideOffset:6,className:`w-70 p-1 rounded-lg bg-(--bg-primary) border border-(--border-default) shadow-lg`,children:[(0,h.jsx)(`div`,{className:`text-[11px] text-(--text-muted) px-2 py-1.5 font-medium`,children:V(`executionMode`)}),(0,h.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:o.map(n=>{let r=n.icon;return(0,h.jsxs)(`button`,{disabled:t||i,className:B(`w-full border-0 rounded-md px-2 py-1.5 text-left text-[12px] cursor-pointer flex items-center gap-2`,(t||i)&&`opacity-50 cursor-not-allowed`,e===n.value?`bg-(--bg-active) text-(--text-primary) font-medium`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),onClick:()=>l(n.value),children:[(0,h.jsx)(r,{size:13,className:`shrink-0 text-(--text-muted)`}),(0,h.jsx)(`span`,{className:`shrink-0`,children:n.label}),(0,h.jsx)(`span`,{className:`text-[10px] text-(--text-muted) min-w-0 text-right leading-4`,children:n.desc})]},n.value)})})]})]})}function Yu({current:e,disabled:t=!1}){let[n,r]=(0,d.useState)(!1),[i,a]=(0,d.useState)(!1),o=Z(),s=o.find(t=>t.value===e)||o[0],c=s.icon,l=async n=>{if(!(n===e||i||t)){a(!0);try{let e=await Us(n);if(e?.error)throw Error(e.message||`Failed to switch approval mode`)}catch{}finally{a(!1)}r(!1)}};return(0,h.jsxs)(ou,{open:n,onOpenChange:e=>!t&&r(e),children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsxs)(`button`,{type:`button`,className:B(qu,`px-3 hover:border-(--accent-green)/55 hover:bg-(--accent-green-bg) hover:text-(--accent-green)`,(i||t)&&`opacity-50 pointer-events-none`),disabled:t,title:V(t?`switchModeDisabled`:`switchApprovalMode`),children:[(0,h.jsx)(c,{size:13}),(0,h.jsx)(`span`,{className:`truncate`,children:s.label}),(0,h.jsx)(Ml,{size:11})]})}),(0,h.jsxs)(cu,{side:`top`,align:`start`,sideOffset:6,className:`w-76 p-1 rounded-lg bg-(--bg-primary) border border-(--border-default) shadow-lg`,children:[(0,h.jsx)(`div`,{className:`text-[11px] text-(--text-muted) px-2 py-1.5 font-medium`,children:V(`approvalMode`)}),(0,h.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:o.map(n=>{let r=n.icon;return(0,h.jsxs)(`button`,{disabled:t||i,className:B(`w-full border-0 rounded-md px-2 py-1.5 text-left text-[12px] cursor-pointer flex items-center gap-2`,(t||i)&&`opacity-50 cursor-not-allowed`,e===n.value?`bg-(--bg-active) text-(--text-primary) font-medium`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),onClick:()=>l(n.value),children:[(0,h.jsx)(r,{size:14,className:`shrink-0 mt-0.5`}),(0,h.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(`span`,{className:`block`,children:n.label}),(0,h.jsx)(`span`,{className:`block text-(--text-muted) text-[11px] font-normal leading-snug`,children:n.desc})]})]},n.value)})})]})]})}function Xu(){let[e,t]=(0,d.useState)([]),[n,r]=(0,d.useState)(``),[i,a]=(0,d.useState)(!1),o=(0,d.useCallback)(async()=>{try{let e=await vc(),n=Array.isArray(e)?e:[];t(n);let i=n.find(e=>e.active);r(i?i.name:``)}catch{}},[]);(0,d.useEffect)(()=>{o()},[o]);let s=async e=>{await Cc(e),r(e),a(!1),o()};return(0,h.jsxs)(ou,{open:i,onOpenChange:a,children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsxs)(`button`,{type:`button`,className:B(qu,`px-3`),title:V(`soulSwitch`),children:[(0,h.jsx)(Il,{size:13}),(0,h.jsx)(`span`,{className:`truncate max-w-[60px]`,children:n||`default`}),(0,h.jsx)(Ml,{size:11})]})}),(0,h.jsxs)(cu,{side:`top`,align:`start`,sideOffset:6,className:`w-52 p-1 rounded-lg bg-(--bg-primary) border border-(--border-default) shadow-lg`,children:[(0,h.jsx)(`div`,{className:`text-[11px] text-(--text-muted) px-2 py-1.5 font-medium`,children:V(`switchSoul`)}),(0,h.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.map(e=>(0,h.jsxs)(`button`,{className:B(`w-full border-0 rounded-md px-2 py-1.5 text-left text-[12px] cursor-pointer flex items-center gap-2`,e.active?`bg-(--bg-active) text-(--text-primary) font-medium`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),onClick:()=>s(e.name),children:[(0,h.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,h.jsx)(`span`,{className:`text-[10px] text-(--text-muted) shrink-0`,children:e.scope===`builtin`?V(`builtin`):V(`custom`)})]},`${e.scope}-${e.name}`))})]})]})}function Zu({query:e,onSelect:t,visible:n}){let[r,i]=(0,d.useState)([]),[a,o]=(0,d.useState)(null);(0,d.useEffect)(()=>{n&&cc().then(e=>{i(Array.isArray(e)?e.filter(e=>e.enabled!==!1&&!Uu.has(e.name)&&!Ku.has(e.name)):[])}).catch(()=>{})},[n]);let s=e.trim().toLowerCase(),c=(0,d.useMemo)(()=>Gu.filter(e=>!s||e.name.includes(s)||e.description.toLowerCase().includes(s)).map(e=>({...e,kind:`action`,key:`action-${e.name}`})),[s]),l=(0,d.useMemo)(()=>r.filter(e=>!s||e.name.toLowerCase().includes(s)||(e.description||``).toLowerCase().includes(s)).map(e=>({name:e.name,insert:`/${e.name} `,icon:Y,description:e.description||`Manual skill`,kind:`skill`,key:`skill-${e.name}`})),[r,s]);if(!n)return null;let u=c.length>0||l.length>0,f=(e,n)=>n.length?(0,h.jsxs)(`div`,{className:`py-1`,children:[(0,h.jsx)(`div`,{className:`px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.45px] text-(--text-muted)`,children:e}),(0,h.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:n.map(e=>{let n=e.icon,r=a===e.key;return(0,h.jsxs)(`button`,{className:B(`w-full border-0 rounded-md px-2.5 py-2 text-left cursor-pointer grid grid-cols-[22px_minmax(96px,180px)_minmax(0,1fr)_auto] items-start gap-2 text-[12px] transition-colors`,r?`bg-(--bg-hover) text-(--text-primary)`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),onClick:()=>t(e.insert),onMouseEnter:()=>o(e.key),onMouseLeave:()=>o(null),children:[(0,h.jsx)(`span`,{className:B(`mt-0.5 inline-flex size-5 items-center justify-center rounded-md transition-colors`,e.kind===`action`?`bg-(--accent-cyan-bg) text-(--accent-cyan)`:`bg-(--accent-purple-bg) text-(--accent-purple)`,!r&&`opacity-80`),children:(0,h.jsx)(n,{size:12})}),(0,h.jsxs)(`span`,{className:`truncate font-medium leading-5 font-mono`,children:[`/`,e.name]}),(0,h.jsx)(`span`,{className:`text-(--text-muted) text-[11px] leading-5 overflow-hidden`,style:{display:`-webkit-box`,WebkitLineClamp:2,WebkitBoxOrient:`vertical`},children:e.description}),(0,h.jsx)(`span`,{className:B(`mt-0.5 rounded-full border px-1.5 py-0.5 text-[10px] uppercase leading-none`,e.kind===`action`?`border-(--accent-cyan)/25 text-(--accent-cyan)`:`border-(--accent-purple)/25 text-(--accent-purple)`),children:e.kind})]},e.key)})})]}):null;return(0,h.jsxs)(`div`,{className:`absolute bottom-full left-0 right-0 mb-1.5 max-h-[360px] overflow-y-auto rounded-xl border border-(--border-default) bg-(--bg-primary) shadow-lg z-50 animate-in fade-in-0 zoom-in-95 slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,style:{scrollbarWidth:`thin`},children:[!u&&(0,h.jsx)(`div`,{className:`px-2.5 py-5 text-[12px] text-(--text-muted) text-center`,children:`No matching commands`}),f(`Actions`,c),c.length>0&&l.length>0&&(0,h.jsx)(au,{className:` my-1 bg-(--border-default)`}),f(`Skills`,l)]})}function Qu({onSubmit:e,onAbort:t,busy:n,disabled:r=!1,disabledReason:i=``,runtimeState:a,history:o,onOpenProject:s,projectCwd:c}){let[l,u]=(0,d.useState)(``),[f,p]=(0,d.useState)([]),[m,g]=(0,d.useState)(-1),[_,v]=(0,d.useState)(``),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(``),C=(0,d.useRef)(null),w=a||{},T=w.mode||`normal`,E=w.approvalMode||`review`,D=n||r,O=c===`__codemini_general__`;(0,d.useEffect)(()=>{o&&o.length&&f.length===0&&p([...o].reverse())},[o]),(0,d.useEffect)(()=>{D&&b(!1)},[D]);let ee=(0,d.useCallback)(()=>{let t=l.trim();!t||D||(e(t),u(``),b(!1),g(-1),C.current&&(C.current.style.height=`auto`))},[l,D,e]),te=(0,d.useCallback)(e=>{if(e.key===`Enter`&&!e.shiftKey){if(y){e.preventDefault();return}e.preventDefault(),ee();return}if(y&&e.key===`Escape`){e.preventDefault(),b(!1);return}if(e.key===`ArrowUp`&&f.length>0&&!y){e.preventDefault(),m===-1&&v(l);let t=Math.min(m+1,f.length-1);g(t),u(f[t]);return}if(e.key===`ArrowDown`&&m!==-1&&!y){e.preventDefault();let t=m-1;g(t),u(t<0?_:f[t]);return}e.key===`Tab`&&e.preventDefault()},[l,f,m,_,ee,y]),ne=(0,d.useCallback)(e=>{let t=e.target.value;u(t),e.target.style.height=`auto`,e.target.style.height=Math.min(e.target.scrollHeight,160)+`px`,t===`/`?(b(!0),S(``)):t.startsWith(`/`)&&!t.includes(` `)?(b(!0),S(t.slice(1))):b(!1)},[]);return(0,h.jsxs)(`div`,{className:`w-full relative`,children:[(0,h.jsx)(Zu,{query:x,onSelect:(0,d.useCallback)(e=>{u(e),b(!1),C.current?.focus()},[]),visible:y}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-4 border border-border rounded-[28px] px-3 py-2 transition-colors bg-(--bg-primary) shadow-(--shadow-lg) dark:bg-(--bg-secondary) dark:shadow-[0_14px_44px_color-mix(in_srgb,var(--background)_70%,transparent)]`,children:[(0,h.jsx)(`div`,{className:`flex min-h-[58px]`,children:(0,h.jsx)(`textarea`,{ref:C,value:l,onChange:ne,onKeyDown:te,placeholder:n?V(`inputDisabled`):r?i||V(`inputDisabled`):V(`sendMessageToCodeminiWithSlash`),disabled:D,rows:1,className:`flex-1 resize-none border-0 outline-none bg-transparent text-(--text-primary) min-h-[34px] max-h-[160px] p-1 leading-[1.55] text-[16px] placeholder:text-(--text-muted) disabled:opacity-50 disabled:cursor-not-allowed`,style:{height:`auto`}})}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 min-h-9 flex-wrap`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,h.jsxs)(`button`,{type:`button`,className:B(qu,`px-3`),title:V(`switchWorkspace`),onClick:s,children:[O?(0,h.jsx)(Wl,{size:13,className:`shrink-0`}):(0,h.jsx)(Rl,{size:13,className:`shrink-0`}),(0,h.jsx)(`span`,{className:`truncate max-w-[80px]`,children:O?V(`generalChat`):c||`...`}),(0,h.jsx)(Ml,{size:11})]}),(0,h.jsx)(Ju,{current:T,disabled:D}),(0,h.jsx)(Yu,{current:E,disabled:D}),(0,h.jsx)(Xu,{})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[(0,h.jsx)(`button`,{type:`button`,className:`border-0 bg-transparent text-(--text-secondary) min-w-9 h-9 rounded-full inline-flex items-center justify-center shrink-0 cursor-pointer transition-colors hover:bg-(--bg-hover) hover:text-(--text-primary)`,title:V(`addContext`),children:(0,h.jsx)(Yl,{size:18})}),n?(0,h.jsx)(`button`,{type:`button`,className:`border-0 text-(--accent-red) min-w-9 h-9 rounded-full inline-flex items-center justify-center shrink-0 cursor-pointer bg-(--accent-red-bg) transition-opacity hover:opacity-80`,onClick:t,title:V(`abort`),children:(0,h.jsx)(Gl,{size:14})}):(0,h.jsx)(`button`,{type:`button`,className:B(`border-0 min-w-10 w-10 h-10 rounded-full inline-flex items-center justify-center shrink-0 cursor-pointer transition-all`,l.trim()&&!D?`bg-(--accent-blue) text-white hover:bg-(--accent-hover)`:`bg-(--text-muted)/25 text-(--text-muted) cursor-not-allowed`),onClick:ee,disabled:!l.trim()||D,title:V(`sending`),children:(0,h.jsx)(El,{size:16})})]})]})]})]})}var $u={thinking:`bg-(--accent-blue)`,streaming:`bg-(--accent-green)`,tooling:`bg-(--accent-orange)`,live:`bg-(--accent-cyan)`},ed=[{pattern:/\bdeepseek\b/i,logo:`/logos/deepseek-color.svg`},{pattern:/\bopenai\b/i,logo:`/logos/openai.svg`},{pattern:/\bgpt\b/i,logo:`/logos/openai.svg`},{pattern:/\bo[134]\b/i,logo:`/logos/openai.svg`},{pattern:/\bgemini\b/i,logo:`/logos/gemini-color.svg`},{pattern:/\bqwen\b/i,logo:`/logos/qwen-color.svg`},{pattern:/\bchatglm\b/i,logo:`/logos/chatglm-color.svg`},{pattern:/\bglm-/i,logo:`/logos/glm-color.svg`},{pattern:/\bkimi\b/i,logo:`/logos/kimi-color.svg`},{pattern:/\bminimax\b/i,logo:`/logos/minimax-color.svg`},{pattern:/\bmoonshot\b/i,logo:`/logos/moonshot.svg`},{pattern:/\bnvidia\b/i,logo:`/logos/nvidia-color.svg`},{pattern:/\bzhipu\b/i,logo:`/logos/zhipu-color.svg`},{pattern:/\bclaude\b/i,logo:`/logos/claude-color.svg`}],td={"openai-compatible":`/logos/openai.svg`,anthropic:`/logos/claude-color.svg`};function nd(e){if(!e)return null;for(let{pattern:t,logo:n}of ed)if(t.test(e))return n;return null}function rd({src:e,size:t=13}){return e?(0,h.jsx)(`img`,{src:e,alt:``,width:t,height:t,className:`shrink-0 rounded-sm object-contain`}):null}function id({runtimeState:e,live:t,stageLabel:n}){let r=e||{},i=r.mode||`normal`,a=r.approvalMode||`review`,o=r.currentContextTokens||0,s=r.maxContextTokens||0,c=s?Math.round(o/s*100):0,l=c<40?`bg-(--accent-green)`:c<75?`bg-(--accent-orange)`:`bg-(--accent-red)`,u=Object.keys($u).find(e=>(n||``).includes(e))||`live`,d=nd(r.model),f=td[r.sdkProvider],p=i===`plan`?Bl:Ol,m=a===`full_access`?Hl:a===`auto`?tu:eu,g=V(a===`full_access`?`fullAccessMode`:a===`auto`?`autoMode`:`reviewMode`);return(0,h.jsxs)(`div`,{className:`flex items-center gap-3 flex-1 min-w-0 text-[12px] text-(--text-muted) overflow-hidden`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,h.jsx)(p,{size:13,className:`shrink-0 opacity-70`}),(0,h.jsx)(`span`,{children:V(i===`plan`?`planMode`:`normalExecutionMode`)})]}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,h.jsx)(m,{size:13,className:`shrink-0 opacity-70`}),(0,h.jsx)(`span`,{children:g})]}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[d?(0,h.jsx)(rd,{src:d}):(0,h.jsx)(Ol,{size:13,className:`shrink-0 opacity-70`}),(0,h.jsx)(`span`,{children:r.model?.toUpperCase()||`-`})]}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[f?(0,h.jsx)(rd,{src:f}):(0,h.jsx)(Zl,{size:13,className:`shrink-0 opacity-70`}),(0,h.jsx)(`span`,{children:r.sdkProvider?.toUpperCase()||`-`})]}),s>0&&(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,h.jsx)(Al,{size:13,className:`shrink-0 opacity-70`}),(0,h.jsx)(`span`,{children:`CTX`}),(0,h.jsx)(`span`,{className:`w-12 h-1 bg-(--muted) rounded-full overflow-hidden`,children:(0,h.jsx)(`span`,{className:B(`block h-full rounded-full transition-all`,l),style:{width:`${c}%`}})}),(0,h.jsxs)(`span`,{children:[c,`%`]})]}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 ml-auto whitespace-nowrap`,children:[(0,h.jsx)(`span`,{className:B(`w-1.5 h-1.5 rounded-full shrink-0`,t?$u[u]:`bg-(--text-muted)`,t&&`animate-pulse`)}),(0,h.jsx)(`span`,{children:t?n:V(`idle`)})]})]})}function ad(e,t){return e===`delete`?`delete`:e===`run`?`run`:e===`edit`?`edit`:e===`write`?`write`:t?.planApproval?`plan`:t?.reflectApproval?`reflect`:`generic`}function od(e){if(!e)return{};try{let t=typeof e==`string`?JSON.parse(e):e;return{...t,_raw:JSON.stringify(t,null,2)}}catch{return{_raw:String(e)}}}function sd({label:e,value:t}){return(0,h.jsxs)(`div`,{className:`flex gap-3 py-1.5 min-w-0`,children:[(0,h.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-muted) w-20 shrink-0`,children:e}),(0,h.jsx)(`span`,{className:`text-[13px] font-mono min-w-0 break-words text-(--text-primary)`,children:String(t)})]})}function cd({label:e,value:t}){return t==null||t===``?null:(0,h.jsxs)(`div`,{className:`py-1.5 min-w-0`,children:[(0,h.jsx)(`div`,{className:`mb-1 text-[13px] font-medium text-(--text-muted)`,children:e}),(0,h.jsx)(`pre`,{className:`max-h-40 overflow-auto rounded-md border border-(--border-default) bg-(--bg-secondary) px-2.5 py-2 text-[12px] leading-5 text-(--text-primary) whitespace-pre-wrap break-words`,children:String(t)})]})}function ld({variant:e,args:t,details:n}){let r=od(t);if(e===`delete`)return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(sd,{label:`File`,value:r.path||r.name||`-`}),(0,h.jsx)(sd,{label:`Type`,value:r.type||`file`})]});if(e===`run`)return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(sd,{label:`Command`,value:r.command||`-`}),n?.risk&&(0,h.jsx)(sd,{label:`Risk`,value:n.risk}),n?.description&&(0,h.jsx)(sd,{label:`Info`,value:n.description})]});if(e===`edit`){let e=r.edit&&typeof r.edit==`object`?r.edit:{},t=r.kind||e.kind||r.mode||`edit`;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(sd,{label:`Tool`,value:`edit`}),(0,h.jsx)(sd,{label:`File`,value:r.file||r.path||`-`}),(0,h.jsx)(sd,{label:`Action`,value:t}),(0,h.jsx)(cd,{label:`Old`,value:r.old_text||r.old_string||e.old_text||e.old_string}),(0,h.jsx)(cd,{label:`New`,value:r.new_text||r.new_string||e.new_text||e.new_string||e.new_content||r.content})]})}return e===`write`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(sd,{label:`Tool`,value:`write`}),(0,h.jsx)(sd,{label:`File`,value:r.file||r.path||`-`}),(0,h.jsx)(cd,{label:`Content`,value:r.content||r.text||r.body})]}):e===`plan`?(0,h.jsxs)(h.Fragment,{children:[n?.title&&(0,h.jsx)(`p`,{className:`text-sm mb-2`,children:n.title}),n?.steps&&(0,h.jsx)(`ol`,{className:`list-decimal list-inside space-y-1`,children:n.steps.map((e,t)=>(0,h.jsxs)(`li`,{className:`text-sm`,children:[e.role||``,`: `,e.title||``]},t))})]}):e===`reflect`?(0,h.jsxs)(h.Fragment,{children:[n?.scope&&(0,h.jsx)(sd,{label:`Scope`,value:n.scope}),n?.skillName&&(0,h.jsx)(sd,{label:`Skill`,value:n.skillName}),n?.targetPath&&(0,h.jsx)(sd,{label:`Path`,value:n.targetPath})]}):(0,h.jsx)(cd,{label:`Arguments`,value:r._raw||`-`})}function ud({request:e,open:t,onDecision:n}){if(!e)return null;let{id:r,toolName:i,displayName:a,arguments:o,details:s}=e,c=ad(i,s);return(0,h.jsx)(mu,{open:t,onOpenChange:e=>{e||n(r,!1)},children:(0,h.jsxs)(_u,{className:`sm:max-w-xl max-h-[82vh] grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden`,children:[(0,h.jsx)(vu,{children:(0,h.jsx)(bu,{children:{delete:V(`deleteApproval`),run:V(`runApproval`),edit:V(`editApproval`),write:V(`writeApproval`),plan:V(`planApproval`),reflect:V(`reflectApproval`),generic:V(`approveTitle`)}[c]||V(`approveTitle`)})}),(0,h.jsx)(`div`,{className:`min-h-0 overflow-y-auto py-1 pr-1`,children:(0,h.jsx)(ld,{variant:c,args:o,details:s})}),(0,h.jsxs)(yu,{className:`gap-2`,children:[(0,h.jsx)(pu,{variant:`outline`,onClick:()=>n(r,!1),children:V(`deny`)}),(0,h.jsx)(pu,{onClick:()=>n(r,!0),children:V(`approve`)})]})]})})}var dd=du(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function fd({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,h.jsx)(n?_:`span`,{"data-slot":`badge`,"data-variant":t,className:B(dd({variant:t}),e),...r})}function pd({className:e,...t}){return(0,h.jsx)(`textarea`,{"data-slot":`textarea`,className:B(`flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40`,e),...t})}function md({className:e,value:t,...n}){return(0,h.jsx)(Do,{"data-slot":`progress`,className:B(`relative h-2 w-full overflow-hidden rounded-full bg-primary/20`,e),...n,children:(0,h.jsx)(Oo,{"data-slot":`progress-indicator`,className:`h-full w-full flex-1 bg-primary transition-all`,style:{transform:`translateX(-${100-(t||0)}%)`}})})}var hd={planner:`bg-(--accent-purple-bg) text-(--accent-purple)`,coder:`bg-(--accent-green-bg) text-(--accent-green)`,reviewer:`bg-(--accent-orange-bg) text-(--accent-orange)`,tester:`bg-(--accent-blue-bg) text-(--accent-blue)`,advisor:`bg-(--accent-blue-bg) text-(--accent-blue)`,summarizer:`bg-(--accent-cyan-bg) text-(--accent-cyan)`};function gd({steps:e}){if(!e?.length)return null;let t=e.filter(e=>e.status===`done`).length,n=t===e.length,r=Math.round(t/e.length*100);return(0,h.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg p-3 my-2 max-w-3xl mx-auto bg-(--bg-secondary)`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,h.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-primary)`,children:V(`planTitle`)}),(0,h.jsx)(fd,{className:B(`text-[11px]`,n?`bg-(--accent-green-bg) text-(--accent-green)`:`bg-(--accent-blue-bg) text-(--accent-blue)`),children:n?V(`planDone`):`${t}/${e.length}`})]}),(0,h.jsx)(md,{value:r,className:`h-1.5 mb-3`}),(0,h.jsx)(`div`,{className:`space-y-1.5`,children:e.map((e,t)=>(0,h.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,h.jsx)(`span`,{className:B(`w-5 h-5 rounded-full flex items-center justify-center text-[11px] font-medium shrink-0`,e.status===`done`&&`bg-(--accent-green-bg) text-(--accent-green)`,e.status===`failed`&&`bg-(--accent-red-bg) text-(--accent-red)`,e.status===`running`&&`bg-(--accent-blue-bg) text-(--accent-blue)`,e.status===`pending`&&`bg-(--muted) text-(--muted-foreground)`),children:e.status===`done`?`✓`:e.status===`failed`?`✗`:e.status===`running`?`▶`:t+1}),(0,h.jsx)(fd,{variant:`outline`,className:B(`text-[11px] px-1.5 py-0`,hd[e.role]||`bg-(--muted) text-(--muted-foreground)`),children:e.role?.toUpperCase()}),(0,h.jsx)(`span`,{className:`truncate text-(--text-secondary)`,children:e.title})]},t))})]})}function _d({plan:e,onAction:t,disabled:n=!1}){let[r,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(``);if(!e)return null;let s=Array.isArray(e.steps)?e.steps:[];return(0,h.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg p-3 max-w-3xl mx-auto bg-(--bg-secondary) space-y-2.5`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,h.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-primary)`,children:V(`planReviewTitle`)}),(0,h.jsx)(fd,{className:`text-[11px] bg-(--accent-orange-bg) text-(--accent-orange)`,children:V(`planReviewStatus`)})]}),(0,h.jsx)(`p`,{className:`text-[13px] text-(--text-secondary) leading-relaxed`,children:e.goal}),e.summary&&(0,h.jsx)(`p`,{className:`text-[12px] text-(--text-muted) leading-relaxed`,children:e.summary}),(0,h.jsx)(`div`,{className:`space-y-1.5`,children:s.map((e,t)=>(0,h.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,h.jsx)(`span`,{className:`w-5 h-5 rounded-full bg-(--muted) text-(--muted-foreground) flex items-center justify-center text-[11px] font-medium shrink-0`,children:t+1}),(0,h.jsx)(fd,{variant:`outline`,className:B(`text-[11px] px-1.5 py-0 shrink-0`,hd[e.role||``]||`bg-(--muted) text-(--muted-foreground)`),children:String(e.role||`step`).toUpperCase()}),(0,h.jsx)(`span`,{className:`truncate text-(--text-secondary)`,children:e.title})]},t))}),r&&(0,h.jsx)(pd,{value:a,onChange:e=>o(e.target.value),placeholder:V(`planEditPlaceholder`),className:`min-h-[64px] text-[13px]`,autoFocus:!0}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,h.jsx)(pu,{variant:`destructive`,size:`xs`,disabled:n,onClick:()=>t(`reject`),children:V(`planReject`)}),(0,h.jsx)(pu,{variant:`outline`,size:`xs`,disabled:n||r&&!a.trim(),onClick:()=>{r?(a.trim()&&t(`edit`,a),a.trim()&&(i(!1),o(``))):i(!0)},children:V(r?`planSubmitFeedback`:`planEdit`)}),(0,h.jsx)(pu,{size:`xs`,disabled:n,onClick:()=>t(`approve`),children:V(`planApprove`)})]})]})}function vd(e){let t=Number(e);return Number.isFinite(t)?t.toFixed(2):`0.75`}function yd({draft:e,onAction:t,disabled:n=!1}){let[r,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(``);if(!e)return null;let s=()=>{let e=a.trim();e&&(t(`edit`,e),i(!1),o(``))};return(0,h.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg p-3 max-w-3xl mx-auto bg-(--bg-secondary) space-y-3 shadow-sm`,children:[(0,h.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,h.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-primary)`,children:V(`reflectReviewTitle`)}),(0,h.jsx)(fd,{className:`text-[11px] bg-(--accent-purple-bg) text-accent-purple`,children:V(`reflectReviewStatus`)})]}),(0,h.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[12px] text-(--text-muted)`,children:[(0,h.jsxs)(`span`,{children:[V(`reflectScope`),`: `,e.scope||`project`]}),(0,h.jsxs)(`span`,{children:[V(`reflectConfidence`),`: `,vd(e.confidence)]})]})]})}),(0,h.jsxs)(`div`,{className:`space-y-1`,children:[(0,h.jsxs)(`div`,{className:`text-[14px] font-medium text-(--text-primary) break-words`,children:[`/`,e.name||`reflected-skill`]}),e.description&&(0,h.jsx)(`p`,{className:`text-[13px] leading-relaxed text-(--text-secondary)`,children:e.description}),e.targetPath&&(0,h.jsx)(`p`,{className:`text-[12px] font-mono break-all text-(--text-muted)`,children:e.targetPath})]}),e.content&&(0,h.jsx)(`pre`,{className:`max-h-56 overflow-auto rounded-md border border-(--border-default) bg-(--bg-primary) p-3 text-[12px] leading-relaxed text-(--text-secondary) whitespace-pre-wrap`,children:e.content}),r&&(0,h.jsx)(pd,{value:a,onChange:e=>o(e.target.value),placeholder:V(`reflectEditPlaceholder`),className:`min-h-[68px] text-[13px]`,autoFocus:!0}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,h.jsx)(pu,{variant:`destructive`,size:`xs`,disabled:n,onClick:()=>t(`reject`),children:V(`reflectReject`)}),(0,h.jsx)(pu,{variant:`outline`,size:`xs`,disabled:n||r&&!a.trim(),onClick:()=>r?s():i(!0),children:V(r?`reflectSubmitFeedback`:`reflectEdit`)}),(0,h.jsx)(pu,{size:`xs`,disabled:n,onClick:()=>t(`approve`),children:V(`reflectApprove`)})]})]})}var Q={running:{icon:Vl,className:`border-(--accent-cyan)/30 bg-(--accent-cyan-bg) text-(--accent-cyan)`,iconClassName:`animate-spin`},done:{icon:Nl,className:`border-(--accent-green)/30 bg-(--accent-green-bg) text-(--accent-green)`,iconClassName:``},error:{icon:Pl,className:`border-(--accent-red)/30 bg-(--accent-red-bg) text-(--accent-red)`,iconClassName:``}};function bd({activities:e=[]}){let t=e.slice(0,3);return t.length?(0,h.jsx)(`div`,{className:`mb-2 flex flex-wrap items-center justify-center gap-2`,children:t.map(e=>{let t=Q[e.status]||Q.done,n=t.icon;return(0,h.jsxs)(`div`,{className:B(`inline-flex max-w-full items-center gap-1.5 rounded-full border px-2.5 py-1 text-[12px] leading-none shadow-sm`,t.className),children:[(0,h.jsx)(`span`,{className:`shrink-0`,"aria-hidden":`true`,children:e.emoji}),(0,h.jsx)(n,{size:13,className:B(`shrink-0`,t.iconClassName)}),(0,h.jsx)(`span`,{className:`truncate text-(--text-primary)`,children:e.label}),e.detail&&(0,h.jsx)(`span`,{className:`max-w-[180px] truncate text-(--text-muted)`,children:e.detail})]},e.id)})}):null}var xd=(0,d.lazy)(()=>Lu(()=>import(`./CodeWikiPanel-Fp0VKdzo.js`).then(e=>({default:e.CodeWikiPanel})),__vite__mapDeps([8,1,0,2,3,4,5,6,7,9]))),Sd=(0,d.lazy)(()=>Lu(()=>import(`./ConfigDialog-DIpj779O.js`).then(e=>({default:e.ConfigDialog})),__vite__mapDeps([10,1,11,4,12]))),Cd=(0,d.lazy)(()=>Lu(()=>import(`./ProjectSelector-DXIep3lE.js`).then(e=>({default:e.ProjectSelector})),__vite__mapDeps([13,1,11,4,12]))),wd=(0,d.lazy)(()=>Lu(()=>import(`./SkillDialog-DjPF-XBx.js`).then(e=>({default:e.SkillDialog})),__vite__mapDeps([14,1,11,4,12,6,15,7]))),Td=(0,d.lazy)(()=>Lu(()=>import(`./MemoryDialog-D2YbENVd.js`).then(e=>({default:e.MemoryDialog})),__vite__mapDeps([16,1,11,4,6,9,7]))),Ed=(0,d.lazy)(()=>Lu(()=>import(`./SoulDialog-BfIoKETs.js`).then(e=>({default:e.SoulDialog})),__vite__mapDeps([17,1,11,4,15,7]))),Dd=(0,d.lazy)(()=>Lu(()=>import(`./AboutDialog-BUp8EzDg.js`).then(e=>({default:e.AboutDialog})),__vite__mapDeps([18,4,1]))),Od=(0,d.lazy)(()=>Lu(()=>import(`./GitDiffDialog-ZLEuX8Qm.js`).then(e=>({default:e.GitDiffDialog})),__vite__mapDeps([19,1,2,3,4]))),kd=(0,d.memo)(Nu),Ad=(0,d.memo)(Qu),jd=(0,d.memo)(id);function Md(e=[],t=``,n=``){let r=new Set;for(let t of e||[]){let e=String(t?.projectDir||``).trim();!e||e===`unknown`||r.add(e)}for(let e of[t,n]){let t=String(e||``).trim();t&&t!==`unknown`&&r.add(t)}return Array.from(r)}function $({size:e=14,className:t,...n}){return(0,h.jsx)(`svg`,{viewBox:`0 0 24 24`,width:e,height:e,fill:`currentColor`,"aria-hidden":`true`,className:t,...n,children:(0,h.jsx)(`path`,{d:`M12 .5C5.65.5.5 5.65.5 12c0 5.09 3.29 9.4 7.86 10.93.58.1.79-.25.79-.56v-2.18c-3.2.69-3.87-1.36-3.87-1.36-.52-1.33-1.28-1.68-1.28-1.68-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.76 2.7 1.25 3.36.96.1-.75.4-1.25.73-1.54-2.55-.29-5.23-1.27-5.23-5.67 0-1.25.45-2.27 1.18-3.07-.12-.29-.51-1.46.11-3.03 0 0 .97-.31 3.16 1.17A10.98 10.98 0 0 1 12 6.07c.98 0 1.96.13 2.88.39 2.19-1.48 3.15-1.17 3.15-1.17.63 1.57.24 2.74.12 3.03.74.8 1.18 1.82 1.18 3.07 0 4.41-2.69 5.38-5.25 5.66.42.36.78 1.06.78 2.14v3.18c0 .31.21.67.8.56A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z`})})}var Nd=class extends d.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,h.jsxs)(`div`,{style:{padding:32,color:`#d84f4f`,fontFamily:`monospace`,fontSize:13},children:[(0,h.jsx)(`p`,{style:{fontWeight:600,marginBottom:8},children:V(`renderError`)}),(0,h.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`,opacity:.8},children:this.state.error?.message||String(this.state.error)}),(0,h.jsx)(`button`,{onClick:()=>this.setState({error:null}),style:{marginTop:12,padding:`6px 16px`,borderRadius:6,border:`1px solid #d84f4f`,background:`transparent`,color:`#d84f4f`,cursor:`pointer`},children:V(`retry`)})]}):this.props.children}};function Pd(){let{state:e,actions:t}=ml(),n=(e.runtimeState||{}).sessionId,r=(0,d.useCallback)(()=>t.setConfigOpen(!0),[t]),i=(0,d.useCallback)(()=>t.setSkillsOpen(!0),[t]),a=(0,d.useCallback)(()=>t.setMemoryOpen(!0),[t]),o=(0,d.useCallback)(()=>t.setSoulsOpen(!0),[t]),s=(0,d.useCallback)(()=>t.setAboutOpen(!0),[t]),c=(0,d.useCallback)(()=>t.setProjectOpen(!0),[t]),l=(0,d.useMemo)(()=>Md(e.sessions,``,e.runtimeState?.cwd),[e.sessions,e.runtimeState?.cwd]);return(0,h.jsxs)(`div`,{className:`flex h-screen bg-(--bg-primary) text-(--text-primary)`,children:[(0,h.jsx)(kd,{sessions:e.sessions,sessionsLoading:e.sessionsLoading,currentSessionId:n,onNewSession:t.newSession,onSwitchSession:t.switchSession,onToggleTheme:t.toggleTheme,onSetTheme:t.setTheme,onOpenSettings:r,onOpenSkills:i,onOpenMemory:a,onOpenSouls:o,onOpenAbout:s,gitBatch:e.gitBatch,versionInfo:e.versionInfo,onUpdate:t.runUpdate,updateStatus:e.updateStatus,currentView:e.currentView,onSwitchView:t.switchView,onOpenProject:t.openProject,onDeleteSession:t.deleteSession}),(0,h.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 bg-(--bg-secondary)`,children:e.currentView===`codewiki`?(0,h.jsx)(d.Suspense,{fallback:null,children:(0,h.jsx)(xd,{projectCwd:e.codewikiProjectPath?.split(/[/\\]/).pop()||e.projectCwd,projectKey:e.codewikiProjectPath||e.runtimeState?.cwd||e.projectCwd||``,busy:e.busy,planSteps:e.planSteps,stageLabel:e.stageLabel,generationStatus:e.codewikiGeneration})}):(0,h.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 bg-(--bg-primary) rounded-[18px] shadow-[inset_0_0_0_1px_var(--panel-edge)] relative overflow-hidden my-1 mx-1`,children:[(0,h.jsx)(`div`,{className:`flex items-center justify-between h-[52px] px-5 shrink-0`,children:(0,h.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,h.jsx)(`span`,{className:`font-medium text-[14px] text-(--text-primary) truncate`,children:e.isGeneral?V(`generalChat`):e.projectCwd||`qurio-coder`}),e.gitInfo?.isGit&&(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12px] text-(--text-muted) shrink-0`,children:[(0,h.jsx)($,{size:13}),(0,h.jsx)(`span`,{children:e.gitInfo.branch})]}),e.gitInfo?.isGit&&e.gitInfo?.dirty&&(0,h.jsx)(`button`,{onClick:()=>t.setGitDiffOpen(!0),className:`inline-flex items-center gap-1 text-[12px] text-(--text-muted) shrink-0 border-0 bg-transparent cursor-pointer hover:text-(--text-primary) p-0`,children:(0,h.jsx)(q,{size:13})})]})}),e.planSteps?.length>0&&!e.pendingPlanApproval&&(0,h.jsx)(`div`,{className:`px-4`,children:(0,h.jsx)(gd,{steps:e.planSteps})}),(0,h.jsx)(Hu,{messages:e.messages,projectCwd:e.projectCwd,skills:e.skills,gitInfo:e.gitInfo,messagesLoading:e.messagesLoading,isGeneral:e.isGeneral}),(0,h.jsxs)(`div`,{className:`w-[min(980px,calc(100%-64px))] mx-auto mb-4 shrink-0 z-30 bg-transparent relative`,children:[(0,h.jsx)(bd,{activities:e.runtimeActivities}),e.pendingPlanApproval&&(0,h.jsx)(`div`,{className:`mb-3`,children:(0,h.jsx)(_d,{plan:e.pendingPlanApproval,onAction:t.approvePlan,disabled:e.busy})}),e.pendingReflectApproval&&(0,h.jsx)(`div`,{className:`mb-3`,children:(0,h.jsx)(yd,{draft:e.pendingReflectApproval,onAction:t.approveReflect,disabled:e.busy})}),(0,h.jsx)(Ad,{onSubmit:t.submit,onAbort:t.abort,busy:e.busy,disabled:!!e.pendingPlanApproval||!!e.pendingReflectApproval,disabledReason:e.pendingReflectApproval?V(`reflectReviewFirst`):V(`planReviewFirst`),runtimeState:e.runtimeState,history:e.history,onOpenProject:c,projectCwd:e.projectCwd}),(0,h.jsxs)(`div`,{className:`flex items-center gap-3 pt-2 px-3 min-h-[28px] overflow-hidden`,children:[e.versionInfo?.current&&(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-(--text-muted) shrink-0`,children:[(0,h.jsx)(`span`,{className:`inline-flex h-3 w-3.5 items-center justify-center rounded-[3px] bg-black text-white dark:bg-white dark:text-black`,children:(0,h.jsx)(ru,{size:12,strokeWidth:2.5})}),`Codemini CLI@`,e.versionInfo.current]}),(0,h.jsx)(jd,{runtimeState:e.runtimeState,live:e.live,stageLabel:e.stageLabel})]})]})]})}),(0,h.jsx)(ud,{request:e.approvalRequest,open:!!e.approvalRequest,onDecision:t.approve}),(0,h.jsxs)(d.Suspense,{fallback:null,children:[e.configOpen&&(0,h.jsx)(Sd,{open:e.configOpen,onOpenChange:t.setConfigOpen,status:e.configStatus,onSaved:t.refreshConfigStatus}),e.skillsOpen&&(0,h.jsx)(wd,{open:e.skillsOpen,onOpenChange:t.setSkillsOpen,projectDirs:l}),e.memoryOpen&&(0,h.jsx)(Td,{open:e.memoryOpen,onOpenChange:t.setMemoryOpen,projectDirs:l}),e.soulsOpen&&(0,h.jsx)(Ed,{open:e.soulsOpen,onOpenChange:t.setSoulsOpen}),e.aboutOpen&&(0,h.jsx)(Dd,{open:e.aboutOpen,onOpenChange:t.setAboutOpen,version:e.versionInfo?.current}),e.gitDiffOpen&&(0,h.jsx)(Od,{open:e.gitDiffOpen,onOpenChange:t.setGitDiffOpen}),e.projectOpen&&(0,h.jsx)(Cd,{open:e.projectOpen,onOpenChange:t.setProjectOpen,onOpenProject:t.openProject})]})]})}function Fd(){return(0,h.jsx)(Nd,{children:(0,h.jsx)(Ss,{children:(0,h.jsx)(pl,{children:(0,h.jsx)(Pd,{})})})})}(0,xs.createRoot)(document.getElementById(`root`)).render((0,h.jsx)(Fd,{}));export{Dc as $,jl as A,k as At,mc as B,J as C,Ne as Ct,Pl as D,le as Dt,Il as E,pe as Et,Cc as F,m as Ft,$s as G,Tc as H,ac as I,lc as J,gc as K,uc as L,Dl as M,D as Mt,wl as N,T as Nt,Nl as O,j as Ot,G as P,g as Pt,_c as Q,bc as R,Vl as S,Ke as St,Ll as T,me as Tt,Ec as U,Sc as V,Js as W,yc as X,cc as Y,vc as Z,ru as _,Pa as _t,Cu as a,nc as at,Xl as b,an as bt,_u as c,xc as ct,bu as d,Ts as dt,dc as et,pu as f,ws as ft,au as g,Ia as gt,su as h,La as ht,Lu as i,ec as it,Ol as j,re as jt,Ml as k,ae as kt,yu as l,V as lt,cu as m,Fa as mt,pd as n,Oc as nt,Su as o,fc as ot,ou as p,B as pt,Zs as q,fd as r,hc as rt,mu as s,pc as st,md as t,Xs as tt,vu as u,Cs as ut,tu as v,va as vt,Rl as w,Se as wt,ql as x,Je as xt,Ql as y,mn as yt,kc as z};
65
+ `)[0]}:t.startsWith(`Captured to inbox:`)?{key:`inbox`,status:`done`,emoji:`📥`,label:V(`runtimeActivityInboxCaptured`)}:t.startsWith(`Inbox (`)||t===`Inbox is empty.`?{key:`inbox`,status:`done`,emoji:`📬`,label:V(`runtimeActivityInboxListed`)}:null}function al(e){let t=new Map;for(let n of e||[]){if(n?.role!==`assistant`)continue;let e=il(n.content);if(!e)continue;let r=e.key||`runtime`;t.set(r,{id:`runtime-${r}`,key:r,status:e.status||`done`,emoji:e.emoji||`•`,label:e.label||``,detail:e.detail||``,timestamp:n.at||new Date().toISOString()})}return[...t.values()].sort((e,t)=>String(t.timestamp).localeCompare(String(e.timestamp))).slice(0,3)}function ol(e){let t=String(e||``).trim().toLowerCase();return[`yes`,`y`,`/yes`,`/plan approve`,`approve`,`approved`,`no`,`n`,`/no`,`/reject`].includes(t)||t.startsWith(`/edit `)}function sl(e){let t=String(e||``).trim().toLowerCase();return[`/yes`,`/plan approve`,`/no`,`/reject`].includes(t)||t.startsWith(`/edit `)}function cl(e){return{id:`plan-step-${e.step}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,role:e.role||`general`,isComplete:!1,text:``,segments:[],skillBadges:[],fileChanges:[],timestamp:new Date().toISOString(),planStep:{step:e.step,total:e.total,role:e.role||`general`,title:e.title||``,status:`running`,summary:``}}}function W(e){let t=String(e||``),n=[...t.matchAll(/^\[(DONE|FAILED|RUNNING)\]\s+([A-Za-z0-9_-]+):\s*(.*)$/gm)];return!n.length||n[0].index>t.slice(0,n[0].index).trim().length?null:n.map((e,r)=>{let i=n[r+1],a=e.index+e[0].length,o=i?i.index:t.length,s=String(e[1]||``).toLowerCase();return{step:r+1,total:n.length,status:s===`failed`?`failed`:s===`done`?`done`:`running`,role:String(e[2]||`general`).toLowerCase(),title:String(e[3]||``).trim(),body:t.slice(a,o).trim()}})}function ll(e,t){let n=e.role===`summarizer`;return{id:`plan-history-${Date.now()}-${t}-${e.step}`,role:e.role||`general`,segments:n&&e.body?[{type:`text`,text:e.body,isStreaming:!1}]:[],skillBadges:[],fileChanges:[],planStep:{step:e.step,total:e.total,role:e.role||`general`,title:e.title||``,status:e.status||`done`,summary:``}}}function ul(e,t){let n=Array.isArray(e.segments)?e.segments:[];return{id:`plan-transcript-${Date.now()}-${t}-${e.step||0}`,role:e.role||`general`,segments:n,skillBadges:[],fileChanges:Array.isArray(e.fileChanges)?e.fileChanges:[],usage:Uc(e.usage),planStep:{step:e.step,total:e.total,role:e.role||`general`,title:e.title||``,status:e.status||`done`,summary:e.summary||``}}}function dl(e,t=0){return{index:Number(e?.index||e?.step||t+1),title:e?.title||``,role:e?.role||`general`,status:e?.status||`pending`}}function fl(e,t){let n=Array.isArray(e)?e:[];if(t.phase===`steps`)return(Array.isArray(t.steps)?t.steps:[]).map(dl);let r=Number(t.step||0);if(!r)return n;let i=t.status||(t.phase===`step_done`?`done`:`running`),a=!1,o=n.map((e,n)=>{let o=dl(e,n);return Number(o.index)===r?(a=!0,{...o,title:t.title||o.title,role:t.role||o.role,status:i,summary:t.summary||o.summary||``}):o});return a||o.push({index:r,title:t.title||``,role:t.role||`general`,status:i,summary:t.summary||``}),o.sort((e,t)=>Number(e.index||0)-Number(t.index||0))}function pl({children:e}){let[t,n]=(0,d.useState)(Fc),r=(0,d.useRef)(t);r.current=t;let i=(0,d.useRef)(null),a=(0,d.useRef)([]),o=(0,d.useRef)(!1),s=(0,d.useRef)(new Map),c=(0,d.useRef)(new Map),l=(0,d.useRef)(null),u=(0,d.useRef)(null),f=(0,d.useCallback)(e=>{n(t=>({...t,...e}))},[]),p=(0,d.useCallback)(e=>{let t=e.id||`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,r=[];e.text&&r.push({type:`text`,text:e.text,isStreaming:e.isStreaming||!1});let i={...e,id:t,segments:r,skillBadges:[],fileChanges:[]};return n(e=>({...e,messages:[...e.messages,i]})),t},[]),m=(0,d.useCallback)((e,t=6500)=>{clearTimeout(c.current.get(e));let r=setTimeout(()=>{c.current.delete(e),n(t=>({...t,runtimeActivities:t.runtimeActivities.filter(t=>t.id!==e)}))},t);c.current.set(e,r)},[]),g=(0,d.useCallback)(e=>{let t=e.key||e.id||`runtime`,r=`runtime-${t}`,i=Number(e.clearAfterMs),a={id:r,key:t,status:e.status||`done`,emoji:e.emoji||`•`,label:e.label||``,detail:e.detail||``,sticky:e.sticky===!0||t===`reflect`,timestamp:new Date().toISOString()};clearTimeout(c.current.get(r)),c.current.delete(r),n(e=>({...e,runtimeActivities:[a,...e.runtimeActivities.filter(e=>e.id!==r)].slice(0,4)})),a.status!==`running`&&!a.sticky?m(r,Number.isFinite(i)?i:6500):a.status===`running`&&Number.isFinite(i)&&m(r,i)},[m]),_=(0,d.useCallback)(e=>{i.current=e,f({activeMsgId:e})},[f]),v=(0,d.useCallback)(async()=>{try{let e=await Ps(),t=e.isGeneral?`__codemini_general__`:e.cwd?.split(/[/\\]/).pop()||e.cwd||`...`,r=!!e.busy;return n(n=>({...n,runtimeState:e,projectCwd:t,isGeneral:!!e.isGeneral,pendingPlanApproval:e?.pendingPlanApproval||null,pendingReflectApproval:e?.pendingReflectSkill||null,busy:r,live:r||n.live,stage:r?`thinking`:n.stage,stageLabel:r?V(`waitingResponse`):n.stageLabel,messages:e?.pendingPlanApproval?n.messages:tl(n.messages,`plan-waiting-review`)})),e}catch{return null}},[f]),y=(0,d.useCallback)(async({openIfRequired:e=!1}={})=>{try{let t=await Ys();return f({configStatus:t,configOpen:e&&t?.setupRequired?!0:r.current.configOpen}),t}catch{return null}},[f]),b=(0,d.useCallback)(async()=>{try{f({gitInfo:await Qs()})}catch{}},[f]),x=(0,d.useCallback)(async e=>{let t=[...new Set((e||[]).map(e=>e.projectDir).filter(Boolean))];if(t.length)try{f({gitBatch:await rc(t)})}catch{}},[f]),S=(0,d.useCallback)(async()=>{try{let e=await Is();f({history:Array.isArray(e)?e:[]})}catch{}},[f]),C=(0,d.useCallback)(async()=>{f({sessionsLoading:!0});try{let e=await Ls(200),t=Array.isArray(e)?e:[];f({sessions:t}),x(t)}catch{}finally{f({sessionsLoading:!1})}},[f,x]),w=(0,d.useCallback)(async e=>{if(!e)return null;try{let t=await Ps();if(t?.cwd===e)return t;let n=await ic(e);return n?.error?null:n}catch{return null}},[]),T=(0,d.useCallback)(async()=>{try{let e=await cc();f({skills:Array.isArray(e)?e:[]})}catch{}},[f]),E=(0,d.useCallback)(async(e=null)=>{f({messagesLoading:!0});try{let t=e||await Rs(),n=Array.isArray(t)?t:t.messages||[],r=t?.compact||null,i=al(n);if(!n.length){let n=Array.isArray(t?.uiMessages)?t.uiMessages:e?[]:await zs();Array.isArray(n)&&n.length?f({messages:$c(n,e?[]:(await tc().catch(()=>({})))?.changes||[])}):f({messages:[],runtimeActivities:[]});return}let a=[],o=null,s=r?.boundaryIndex,c=s==null;for(let e=0;e<n.length;e++){let t=n[e];if(!c&&e>=s&&(a.push({id:`msg-compact-divider-${Date.now()}`,role:`divider`,dividerType:`compact`,text:`以上内容已压缩 (${r.mode||``})`,timestamp:r.timestamp||new Date().toISOString()}),c=!0),t.role===`user`){if(sl(t.content))continue;o=null;let e=Ic(t.content||``);a.push({id:`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}-u${a.length}`,role:`you`,segments:[{type:`text`,text:e,isStreaming:!1}],skillBadges:[],fileChanges:[]})}else if(t.role===`assistant`){if(il(t.content)&&rl(t.content)){o=null;continue}if(Array.isArray(t.planTranscript)&&t.planTranscript.length){o=null;for(let e of t.planTranscript)a.push(ul(e,a.length));continue}let e=W(t.content);if(e?.length){o=null;let t=[...e].reverse().find(e=>e.role===`summarizer`)||e[e.length-1];a.push(ll({...t,step:1,total:1,role:t.role||`summarizer`},a.length));continue}o||(o={id:`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}-a${a.length}`,role:`general`,segments:[],skillBadges:[],fileChanges:[]},a.push(o)),Array.isArray(t.fileChanges)&&t.fileChanges.length&&(o.fileChanges=[...o.fileChanges||[],...t.fileChanges]),o.usage=Wc(o.usage,t.usage);let n=Kc(t);if(n&&o.segments.push({type:`thinking`,text:n,isStreaming:!1,startedAt:t.reasoningStartedAt||t.at||null,endedAt:t.reasoningEndedAt||t.at||null,durationMs:Number.isFinite(Number(t.reasoningDurationMs))?Number(t.reasoningDurationMs):null}),t.content&&o.segments.push({type:`text`,text:t.content,isStreaming:!1}),t.toolCalls&&t.toolCalls.length){let e=t.toolCalls.map(e=>({id:e.id,name:e.function?.name||e.name||`tool`,arguments:e.function?.arguments||e.arguments||{},status:e.status||`done`,durationMs:e.durationMs,summary:e.summary||``,result:``,...e.resultMeta?{resultMeta:e.resultMeta}:{},...e.fileChange?{fileChange:e.fileChange}:{},...Array.isArray(e.fileChanges)&&e.fileChanges.length?{fileChanges:e.fileChanges}:{}}));o.segments.push({type:`tools`,cards:e})}}else if(t.role===`tool`&&o){let e=t.toolCallId||t.tool_call_id;if(!e)continue;for(let n of o.segments){if(n.type!==`tools`)continue;let r=n.cards.find(t=>t.id===e);if(!r)continue;t.toolSummary&&(r.summary=t.toolSummary),t.toolDurationMs!=null&&(r.durationMs=t.toolDurationMs),t.toolStatus===`error`&&(r.status=`error`),t.toolStatus===`blocked`&&(r.status=`blocked`),t.toolResultMeta&&(r.resultMeta=t.toolResultMeta),t.content&&(r.result=t.content);let i=t.toolFileChange?.path?t.toolFileChange:null;i?.path&&(r.fileChange=i),Array.isArray(t.toolFileChanges)&&t.toolFileChanges.length?(r.fileChanges=t.toolFileChanges,o.fileChanges=Yc(o.fileChanges,t.toolFileChanges)):i?.path&&(o.fileChanges=Yc(o.fileChanges,[i]));break}}}f({messages:$c(a,e?[]:(await tc().catch(()=>({})))?.changes||[]),runtimeActivities:i})}catch{}finally{f({messagesLoading:!1})}},[f]),D=(0,d.useCallback)(e=>{if(!e?.type||jc(e))return;let t=r.current,c=i.current;switch(e.type){case`connected`:break;case`assistant:start`:{if(t.currentView!==`chat`&&t.currentView!==`codewiki`&&f({currentView:`chat`}),n(e=>({...e,messages:tl(e.messages,`waiting-response`)})),o.current){f({stage:`thinking`,busy:!0,live:!0,stageLabel:V(`thinking`)});break}let e=c;e?n(t=>({...t,messages:t.messages.map(t=>t.id===e?{...t,isComplete:!1}:t)})):(e=p({role:`general`,timestamp:new Date().toISOString(),text:``,isStreaming:!1,isComplete:!1}),_(e)),f({stage:`thinking`,busy:!0,live:!0,stageLabel:V(`thinking`)});break}case`assistant:delta`:{let t=qc(e.text);c&&t&&n(e=>({...e,messages:e.messages.map(e=>e.id===c?{...e,segments:zc(Hc(e.segments),t)}:e)})),f({stage:`streaming`,live:!0,stageLabel:V(`streaming`)});break}case`assistant:reasoning_delta`:c&&e.text&&n(t=>({...t,messages:t.messages.map(t=>t.id===c?{...t,segments:Bc(t.segments,e.text,!0)}:t)})),f({stage:`thinking`,live:!0,stageLabel:V(`thinking`)});break;case`assistant:tool_call_delta`:break;case`assistant:response`:c&&n(t=>({...t,messages:t.messages.map(t=>{if(t.id!==c)return t;let n=Kc(e.assistantMessage),r=n&&!(Array.isArray(t.segments)?t.segments:[]).some(e=>e.type===`thinking`&&String(e.text||``).trim())?{...t,segments:Bc(t.segments,n,!1)}:t;if(e.text){let t=qc(e.text),n=U(r.segments),i=n.length-1;return{...r,usage:Wc(r.usage,e.usage||e.assistantMessage?.usage),segments:Hc(n).map((e,n)=>n===i&&e.type===`text`?{...e,text:t,isStreaming:!1}:e)}}return{...r,usage:Wc(r.usage,e.usage||e.assistantMessage?.usage),segments:Hc(r.segments).map(e=>e.type===`text`?{...e,isStreaming:!1}:e)}})}));break;case`tool:start`:if(f({stage:`tooling`,live:!0,stageLabel:V(`tooling`)}),c){let t={id:e.id,name:e.name,arguments:e.arguments,status:`running`,durationMs:null,summary:``,result:``};n(e=>({...e,messages:e.messages.map(e=>e.id===c?{...e,segments:Rc(Hc(e.segments),t)}:e)}))}break;case`tool:end`:c&&n(t=>({...t,messages:t.messages.map(t=>{if(t.id!==c)return t;let n=Array.isArray(e.fileChanges)&&e.fileChanges.length?e.fileChanges:e.fileChange?[e.fileChange]:[];return n.length&&(a.current=[...a.current,...n]),{...t,fileChanges:n.length?Yc(t.fileChanges,n):t.fileChanges,segments:Lc(t.segments,e.id,t=>{let r={...t,status:`done`,durationMs:e.durationMs};return e.summary&&(r.summary=e.summary),e.resultMeta&&(r.resultMeta=e.resultMeta),e.fileChange&&(r.fileChange=e.fileChange),n.length&&(r.fileChanges=n),r})}})}));break;case`tool:result`:c&&n(t=>({...t,messages:t.messages.map(t=>t.id===c?{...t,segments:Lc(t.segments,e.id,t=>({...t,result:e.content||``}))}:t)}));break;case`tool:error`:c&&n(t=>({...t,messages:t.messages.map(t=>t.id===c?{...t,segments:Lc(t.segments,e.id,t=>({...t,status:`error`,durationMs:e.durationMs,summary:e.summary||t.summary}))}:t)}));break;case`tool:blocked`:c&&n(t=>({...t,messages:t.messages.map(t=>t.id===c?{...t,segments:Lc(t.segments,e.id,e=>({...e,status:`blocked`,summary:V(`toolBlocked`)}))}:t)}));break;case`system_tool:start`:p({role:`system`,text:`${e.name||`System`}: ${e.summary||``}`,timestamp:new Date().toISOString()});break;case`plan:steps`:{let t=(e.steps||[]).map((e,t)=>({index:e.index??t,title:e.title,role:e.role,status:`pending`}));o.current=!0,s.current=new Map,_(null),f({planSteps:t,pendingPlanApproval:null});break}case`plan:progress`:{let{step:t,status:r}=e;n(e=>({...e,planSteps:e.planSteps.map((e,n)=>n===t-1?{...e,status:r}:e)}));break}case`plan:step_start`:{o.current=!0,r.current.pendingPlanApproval&&f({pendingPlanApproval:null});let t=String(e.step),i=s.current.get(t);if(i)n(e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,isComplete:!1,planStep:{...e.planStep||{},status:`running`}}:e)}));else{let r=cl(e);i=r.id,s.current.set(t,i),n(e=>({...e,messages:[...tl(e.messages,`waiting-response`),r]}))}_(i),f({stage:`tooling`,busy:!0,live:!0,stageLabel:`${e.role||`agent`}: ${e.title||``}`.trim()});break}case`plan:step_done`:{let t=s.current.get(String(e.step));t&&n(n=>({...n,messages:n.messages.map(n=>n.id===t?{...n,segments:Hc(n.segments).map(e=>e.type===`text`?{...e,isStreaming:!1}:e),isComplete:!0,planStep:{...n.planStep||{},status:e.status||`done`,summary:e.summary||``}}:n)}));break}case`plan:pending_approval`:n(t=>({...t,messages:[...tl(t.messages,[`plan-waiting-review`,`waiting-response`]).filter(e=>!nl(e.text)),{id:`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,role:`system`,text:V(`planWaitingReview`),segments:[{type:`text`,text:V(`planWaitingReview`),isStreaming:!1}],skillBadges:[],fileChanges:[],transientKey:`plan-waiting-review`,timestamp:new Date().toISOString()}],pendingPlanApproval:{goal:e.goal,summary:e.summary,filePath:e.filePath,steps:e.steps||[]}}));break;case`plan:approval_cleared`:n(e=>({...e,pendingPlanApproval:null,messages:tl(e.messages,`plan-waiting-review`)}));break;case`reflect:pending_approval`:g({key:`reflect`,status:`running`,emoji:r.current.pendingReflectApproval?`📝`:`🪞`,label:r.current.pendingReflectApproval?V(`runtimeActivityReflectRevised`):V(`runtimeActivityReflectPending`),detail:e.draft?.name?`/${e.draft.name}`:``}),f({pendingReflectApproval:e.draft||null});break;case`reflect:approval_cleared`:f({pendingReflectApproval:null});break;case`skill:start`:c&&n(t=>({...t,messages:t.messages.map(t=>t.id===c?{...t,skillBadges:[...t.skillBadges,{name:e.name,status:`running`}]}:t)}));break;case`skill:end`:c&&n(t=>({...t,messages:t.messages.map(t=>t.id===c?{...t,skillBadges:t.skillBadges.map(t=>t.name===e.name?{...t,status:`done`}:t)}:t)}));break;case`skill:error`:c&&n(t=>({...t,messages:t.messages.map(t=>t.id===c?{...t,skillBadges:t.skillBadges.map(t=>t.name===e.name?{...t,status:`error`}:t)}:t)}));break;case`skill:auto`:if(c){let t=(e.names||[]).join(`, `);n(e=>({...e,messages:e.messages.map(e=>e.id===c?{...e,skillBadges:[...e.skillBadges,{name:t,status:`auto`}]}:e)}))}break;case`compact:auto`:g({key:`compact`,status:`done`,emoji:`🧳`,label:V(`runtimeActivityCompactDone`),detail:`${e.mode||`auto`} ${e.threshold?`${e.threshold}%`:``}`.trim()}),p({role:`divider`,dividerType:`compact`,text:`以上内容已压缩 (${e.mode||``}, ${e.threshold||``}%)`,timestamp:new Date().toISOString()});break;case`dream:auto`:{let e=r.current.runtimeActivities.find(e=>e.key===`dream`);if(e&&e.status!==`running`&&Date.now()-Date.parse(e.timestamp||``)<1e4)break}g({key:`dream`,status:`running`,emoji:`💤`,label:V(`runtimeActivityDreamRunning`),clearAfterMs:1800*1e3}),p({role:`system`,text:`Dream triggered...`,timestamp:new Date().toISOString()});break;case`dream:complete`:g({key:`dream`,status:e.report?.ok===!1?`error`:`done`,emoji:e.report?.ok===!1?`⚠️`:`🌙`,label:e.report?.ok===!1?V(`runtimeActivityDreamError`):V(`runtimeActivityDreamDone`),detail:e.report?.error||``,clearAfterMs:2500}),p({role:`system`,text:`Dream complete`,timestamp:new Date().toISOString()});break;case`approval:request`:f({approvalRequest:e});break;case`change:undone`:{let t=e.result||{},r=Array.isArray(t.changeSetIds)&&t.changeSetIds.length?t.changeSetIds:t.changeSetId?[t.changeSetId]:[];r.length&&n(e=>({...e,messages:el(e.messages,r)}));break}case`submit:done`:{let t=e.result||{};if(c&&a.current.length&&(n(e=>({...e,messages:e.messages.map(e=>e.id===c?{...e,fileChanges:Yc(e.fileChanges,a.current)}:e)})),a.current=[]),c&&n(e=>({...e,messages:e.messages.map(e=>e.id===c?{...e,isComplete:!0,segments:Hc(e.segments).map(e=>e.type===`text`?{...e,isStreaming:!1}:e)}:e)})),t.type===`system`&&t.text){let e=il(t.text);e&&g(e),!r.current.pendingPlanApproval&&!r.current.pendingReflectApproval&&!nl(t.text)&&!rl(t.text)&&p({role:`system`,text:t.text,timestamp:new Date().toISOString()})}t.type===`error`&&t.text&&p({role:`error`,text:`Failed: ${t.text}`,timestamp:new Date().toISOString()}),_(null),o.current=!1,s.current=new Map,n(e=>({...e,stage:`idle`,busy:!1,live:!1,stageLabel:``,messages:tl(e.messages,r.current.pendingPlanApproval?`waiting-response`:[`waiting-response`,`plan-waiting-review`])})),S(),C();let i=r.current.runtimeState;i?.sessionId&&r.current.currentView===`chat`&&Pc(`chat`,i.sessionId,{replace:!0});break}case`mode:changed`:{let t=e;f({runtimeState:{...r.current.runtimeState,mode:t.mode,...t}});break}case`approval-mode:changed`:{let t=e;f({runtimeState:{...r.current.runtimeState,approvalMode:t.approvalMode,...t}});break}case`runtime:state`:{let t=e.state||{};f({runtimeState:{...r.current.runtimeState,...t},pendingPlanApproval:t?.pendingPlanApproval||null,pendingReflectApproval:t?.pendingReflectSkill||null,busy:!!t.busy,live:!!t.busy,stage:t.busy?r.current.stage:`idle`,stageLabel:t.busy?r.current.stageLabel:``});break}case`codewiki:generate_progress`:{let t=e.title||e.summary||e.name||r.current.stageLabel||V(`generatingCodeWiki`);n(n=>({...n,stage:`tooling`,live:!0,busy:!0,stageLabel:t,planSteps:fl(n.planSteps,e),codewikiGeneration:{status:`running`,updatedAt:e.timestamp||new Date().toISOString(),error:``}}));break}case`codewiki:generate_done`:n(e=>({...e,stage:`idle`,live:!1,busy:!1,stageLabel:``,planSteps:[],codewikiGeneration:{status:`done`,updatedAt:new Date().toISOString(),error:``}})),C();break;case`codewiki:generate_error`:n(t=>({...t,stage:`idle`,live:!1,busy:!1,stageLabel:e.message||``,planSteps:[],codewikiGeneration:{status:`error`,updatedAt:new Date().toISOString(),error:e.message||``}}));break;case`runtime:switched`:n(e=>({...e,messages:[],planSteps:[],pendingPlanApproval:null,pendingReflectApproval:null,runtimeActivities:[],codewikiGeneration:{status:`idle`,updatedAt:null,error:``}})),i.current=null,a.current=[],v(),b(),S(),E(),C(),r.current.currentView!==`codewiki`&&Pc(`chat`,e.sessionId);break;case`session:title`:e.sessionId&&e.title&&n(t=>({...t,sessions:t.sessions.map(t=>t.id===e.sessionId?{...t,title:e.title}:t)}));break}},[p,f,g,S,C,v,E]),O=(0,d.useCallback)(()=>{l.current&&l.current.close();let e=new EventSource(`/api/events`);e.onmessage=e=>{try{D(JSON.parse(e.data))}catch(e){console.error(`SSE:`,e)}},e.onerror=()=>{e.close(),clearTimeout(u.current),u.current=setTimeout(O,3e3)},l.current=e},[D]);(0,d.useEffect)(()=>{(async()=>{let e=Mc(),t=y({openIfRequired:!0}),n=Fs().catch(()=>[]);if(f({currentView:e.view,codewikiProjectPath:e.view===`codewiki`?e.projectPath||``:r.current.codewikiProjectPath}),e.sessionId)try{(await Ps()).sessionId!==e.sessionId&&await Gs(e.sessionId)}catch{}else e.view===`codewiki`&&e.projectPath&&await w(e.projectPath);await t;try{let e=await n;for(let t of e)if(!(!t||jc(t))&&(t.type===`system_tool`||t.type===`tool`)){let e=t.summary||``;(e||t.name)&&p({role:`system`,text:e?`${t.name}: ${e}`:t.name,timestamp:new Date().toISOString(),startupTodos:t.arguments?.todos})}}catch{}let i=await v();if(e.view===`chat`&&i?.sessionId)Pc(`chat`,i.sessionId,{replace:!0});else if(e.view===`codewiki`){let t=e.projectPath||i?.cwd||``;f({currentView:`codewiki`,codewikiProjectPath:t}),t&&Pc(`codewiki`,null,{replace:!0,projectPath:t})}await Promise.all([E(),S(),C(),T(),b(),Ms().then(e=>f({versionInfo:e})).catch(()=>{})]),f({initialLoading:!1}),O()})();let e=async()=>{let e=Mc();if(f({currentView:e.view,codewikiProjectPath:e.view===`codewiki`?e.projectPath||``:r.current.codewikiProjectPath}),e.sessionId)try{(await Ps()).sessionId!==e.sessionId&&(f({messagesLoading:!0}),n(e=>({...e,messages:[]})),await Gs(e.sessionId),await v(),await E(),C(),b())}catch{f({messagesLoading:!1})}else if(e.view===`codewiki`){e.projectPath&&await w(e.projectPath);let t=await v();f({currentView:`codewiki`,codewikiProjectPath:e.projectPath||t?.cwd||``}),C(),b()}};return window.addEventListener(`popstate`,e),()=>{l.current&&l.current.close(),clearTimeout(u.current);for(let e of c.current.values())clearTimeout(e);c.current.clear(),window.removeEventListener(`popstate`,e)}},[p,O,y,b,S,E,C,T,v,w,f]);let ee=(0,d.useCallback)(e=>{localStorage.setItem(`codemini-theme`,e);let t=window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`),n=e===`auto`?t&&t.matches?`dark`:`light`:e;document.documentElement.dataset.theme=n},[]),te=(0,d.useMemo)(()=>({submit:async(e,t={})=>{if(!e.trim())return;r.current.currentView!==`chat`&&!t.stayInView&&f({currentView:`chat`});let i=!!r.current.pendingPlanApproval&&ol(e);i&&(o.current=!0),i||p({role:`you`,text:e,timestamp:new Date().toISOString()});let a=i?null:p({role:`system`,text:V(`waitingResponse`),timestamp:new Date().toISOString(),transientKey:`waiting-response`});f({busy:!0,live:!0,stage:`thinking`,stageLabel:V(`waitingResponse`)});try{let n=await(await Bs(e,{readOnlyCodeWiki:t.readOnlyCodeWiki===!0})).json().catch(()=>({}));if(n?.code===`CONFIG_REQUIRED`)throw f({configOpen:!0,configStatus:n.configStatus||r.current.configStatus}),Error(V(`configRequired`));if(n?.error)throw Error(n.message||`Request failed`)}catch(e){i&&(o.current=!1),a&&n(e=>({...e,messages:e.messages.filter(e=>e.id!==a)})),p({role:`error`,text:`Failed: ${e.message}`,timestamp:new Date().toISOString()}),f({busy:!1,live:!1})}},abort:async()=>{try{await Vs()}catch{}},approve:async(e,t)=>{f({approvalRequest:null});try{await Ws(e,t)}catch{}},approvePlan:async(e,t)=>{if(r.current.pendingPlanApproval){o.current=e===`approve`,e===`reject`&&f({pendingPlanApproval:null}),f({busy:!0,live:!0,stage:`thinking`,stageLabel:V(`waitingResponse`)});try{let n=e===`approve`?`/yes`:e===`reject`?`/reject`:t?.trim()?`/edit ${t.trim()}`:``;if(!n){f({busy:!1,live:!1,stage:`idle`,stageLabel:``});return}let r=await(await Bs(n)).json().catch(()=>({}));if(r?.error)throw Error(r.message||`Request failed`)}catch(e){o.current=!1,p({role:`error`,text:`Failed: ${e.message}`,timestamp:new Date().toISOString()}),f({busy:!1,live:!1,stage:`idle`,stageLabel:``})}}},approveReflect:async(e,t)=>{let n=r.current.pendingReflectApproval;if(n){g({key:`reflect`,status:`running`,emoji:e===`approve`?`💾`:e===`reject`?`🗑️`:`📝`,label:V(e===`approve`?`runtimeActivityReflectSaving`:e===`reject`?`runtimeActivityReflectDiscarding`:`runtimeActivityReflectRevising`),detail:n.name?`/${n.name}`:``}),e===`reject`&&f({pendingReflectApproval:null}),f({busy:!0,live:!0,stage:`thinking`,stageLabel:V(`waitingResponse`)});try{let n=e===`approve`?`/yes`:e===`reject`?`/no`:t?.trim()?`/edit ${t.trim()}`:``;if(!n){f({busy:!1,live:!1,stage:`idle`,stageLabel:``});return}let r=await(await Bs(n)).json().catch(()=>({}));if(r?.error)throw Error(r.message||`Request failed`)}catch(e){p({role:`error`,text:`Failed: ${e.message}`,timestamp:new Date().toISOString()}),f({busy:!1,live:!1,stage:`idle`,stageLabel:``})}}},switchSession:async e=>{let t=r.current.runtimeState?.sessionId;if(!(!e||e===t)){f({currentView:`chat`,messagesLoading:!0}),n(e=>({...e,messages:[]}));try{let t=await Gs(e);t.ok?(Pc(`chat`,e),t.state?f({runtimeState:t.state,projectCwd:t.state.cwd,isGeneral:!!t.state.isGeneral}):await v(),await E(t.sessionData),C(),b()):f({messagesLoading:!1})}catch{f({messagesLoading:!1})}}},deleteSession:async e=>{try{let t=e===r.current.runtimeState?.sessionId,i=await Ks(e);return i?.error?i:(n(t=>({...t,sessions:t.sessions.filter(t=>t.id!==e)})),t&&(f({currentView:`chat`,messagesLoading:!0}),i.sessionId&&Pc(`chat`,i.sessionId,{replace:!0}),i.state?f({runtimeState:i.state,projectCwd:i.state.cwd,isGeneral:!!i.state.isGeneral}):await v(),n(e=>({...e,messages:[]})),await E(i.sessionData),b()),C(),i)}catch(e){return{error:!0,message:e.message}}},newSession:async()=>{f({currentView:`chat`,messagesLoading:!0}),n(e=>({...e,messages:[]}));try{let e=await qs();e.ok?(e.sessionId&&Pc(`chat`,e.sessionId),await v(),C(),f({messagesLoading:!1})):f({messagesLoading:!1})}catch{f({messagesLoading:!1})}},openProject:async(e,t={})=>{let i=t.view||`chat`,a=i===`codewiki`?e:r.current.codewikiProjectPath;f({currentView:i,projectOpen:!1,messagesLoading:i===`chat`,codewikiProjectPath:a}),i===`chat`&&n(e=>({...e,messages:[]}));try{let t=await ic(e);if(t.ok){let n=i===`codewiki`?t.cwd||e:r.current.codewikiProjectPath;f({currentView:i,projectOpen:!1,codewikiProjectPath:n}),i===`codewiki`?Pc(`codewiki`,null,{projectPath:n}):t.sessionId&&Pc(`chat`,t.sessionId),await v(),C(),b(),i===`chat`&&f({messagesLoading:!1})}else i===`chat`&&f({messagesLoading:!1})}catch{i===`chat`&&f({messagesLoading:!1})}},switchView:(e,t={})=>{let n=e===`codewiki`?t.projectPath||r.current.codewikiProjectPath||r.current.runtimeState?.cwd||``:r.current.codewikiProjectPath;if(f({currentView:e,codewikiProjectPath:n}),e===`codewiki`&&Pc(e,null,{projectPath:n}),e===`chat`){let e=r.current.runtimeState;Pc(`chat`,e?.sessionId)}},toggleTheme:()=>{ee({light:`dark`,dark:`auto`,auto:`light`}[localStorage.getItem(`codemini-theme`)||`auto`]||`auto`)},setTheme:ee,setConfigOpen:e=>f({configOpen:e}),refreshConfigStatus:()=>y(),setProjectOpen:e=>f({projectOpen:e}),setSkillsOpen:e=>f({skillsOpen:e}),setMemoryOpen:e=>f({memoryOpen:e}),setSoulsOpen:e=>f({soulsOpen:e}),setAboutOpen:e=>f({aboutOpen:e}),setGitDiffOpen:e=>f({gitDiffOpen:e}),checkVersion:async()=>{try{f({versionInfo:await Ms()})}catch{}},runUpdate:async()=>{f({updateStatus:`updating`});try{(await Ns()).ok?f({updateStatus:`done`}):f({updateStatus:`error`})}catch{f({updateStatus:`error`})}}}),[p,ee,y,b,S,E,C,v,f,g]),ne=(0,d.useMemo)(()=>({state:t,actions:te}),[t,te]);return(0,h.jsx)(Ac.Provider,{value:ne,children:e})}function ml(){let e=(0,d.useContext)(Ac);if(!e)throw Error(`useApp must be used within AppProvider`);return e}var hl=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),gl=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),_l=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),vl=e=>{let t=_l(e);return t.charAt(0).toUpperCase()+t.slice(1)},yl={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},bl=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},xl=(0,d.createContext)({}),Sl=()=>(0,d.useContext)(xl),Cl=(0,d.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=Sl()??{},h=r??f?Number(n??u)*24/Number(t??l):n??u;return(0,d.createElement)(`svg`,{ref:c,...yl,width:t??l??yl.width,height:t??l??yl.height,stroke:e??p,strokeWidth:h,className:hl(`lucide`,m,i),...!a&&!bl(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,d.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),G=(e,t)=>{let n=(0,d.forwardRef)(({className:n,...r},i)=>(0,d.createElement)(Cl,{ref:i,iconNode:t,className:hl(`lucide-${gl(vl(e))}`,`lucide-${e}`,n),...r}));return n.displayName=vl(e),n},wl=G(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),Tl=G(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),El=G(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Dl=G(`book-open-text`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M16 12h2`,key:`7q9ll5`}],[`path`,{d:`M16 8h2`,key:`msurwy`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}],[`path`,{d:`M6 12h2`,key:`32wvfc`}],[`path`,{d:`M6 8h2`,key:`30oboj`}]]),Ol=G(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),kl=G(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Al=G(`chart-no-axes-combined`,[[`path`,{d:`M12 16v5`,key:`zza2cw`}],[`path`,{d:`M16 14v7`,key:`1g90b9`}],[`path`,{d:`M20 10v11`,key:`1iqoj0`}],[`path`,{d:`m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15`,key:`1fw8x9`}],[`path`,{d:`M4 18v3`,key:`1yp0dc`}],[`path`,{d:`M8 14v7`,key:`n3cwzv`}]]),jl=G(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Ml=G(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Nl=G(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Pl=G(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Fl=G(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Il=G(`drama`,[[`path`,{d:`M10 11h.01`,key:`d2at3l`}],[`path`,{d:`M14 6h.01`,key:`k028ub`}],[`path`,{d:`M18 6h.01`,key:`1v4wsw`}],[`path`,{d:`M6.5 13.1h.01`,key:`1748ia`}],[`path`,{d:`M22 5c0 9-4 12-6 12s-6-3-6-12c0-2 2-3 6-3s6 1 6 3`,key:`172yzv`}],[`path`,{d:`M17.4 9.9c-.8.8-2 .8-2.8 0`,key:`1obv0w`}],[`path`,{d:`M10.1 7.1C9 7.2 7.7 7.7 6 8.6c-3.5 2-4.7 3.9-3.7 5.6 4.5 7.8 9.5 8.4 11.2 7.4.9-.5 1.9-2.1 1.9-4.7`,key:`rqjl8i`}],[`path`,{d:`M9.1 16.5c.3-1.1 1.4-1.7 2.4-1.4`,key:`1mr6wy`}]]),Ll=G(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Rl=G(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),K=G(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),q=G(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),J=G(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Y=G(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),X=G(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),zl=G(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Bl=G(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),Vl=G(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Hl=G(`lock-open`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]]),Ul=G(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),Wl=G(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Gl=G(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Kl=G(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),ql=G(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Jl=G(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Yl=G(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Xl=G(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Zl=G(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Ql=G(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),$l=G(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),eu=G(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),tu=G(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),nu=G(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),ru=G(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),iu=G(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function au({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,h.jsx)(Po,{"data-slot":`separator`,decorative:n,orientation:t,className:B(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}function ou({...e}){return(0,h.jsx)(uo,{"data-slot":`popover`,...e})}function su({...e}){return(0,h.jsx)(fo,{"data-slot":`popover-trigger`,...e})}function cu({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,h.jsx)(po,{children:(0,h.jsx)(mo,{"data-slot":`popover-content`,align:t,sideOffset:n,className:B(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...r})})}var lu=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,uu=i,du=(e,t)=>n=>{if(t?.variants==null)return uu(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=lu(t)||lu(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return uu(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},fu=du(`inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none cursor-pointer disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground shadow-xs hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90`,outline:`border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 px-3.5 py-1.5 text-[13px] has-[>svg]:px-2.5`,xs:`h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1.5 rounded-md px-3 text-[13px] has-[>svg]:px-2`,lg:`h-10 rounded-md px-6 has-[>svg]:px-4`,icon:`size-8`,"icon-xs":`size-6 rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function pu({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,h.jsx)(r?_:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:B(fu({variant:t,size:n,className:e})),...i})}function mu({...e}){return(0,h.jsx)(Yn,{"data-slot":`dialog`,...e})}function hu({...e}){return(0,h.jsx)(Xn,{"data-slot":`dialog-portal`,...e})}function gu({className:e,...t}){return(0,h.jsx)(Zn,{"data-slot":`dialog-overlay`,className:B(`fixed inset-0 z-50 bg-black/40 backdrop-blur-[2px] data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function _u({className:e,children:t,...n}){return(0,h.jsxs)(hu,{"data-slot":`dialog-portal`,children:[(0,h.jsx)(gu,{}),(0,h.jsx)(Qn,{"data-slot":`dialog-content`,className:B(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border border-(--border-default) bg-(--bg-primary) text-(--text-primary) p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...n,children:t})]})}function vu({className:e,showCloseButton:t=!0,children:n,...r}){return(0,h.jsxs)(`div`,{"data-slot":`dialog-header`,className:B(`flex flex-row items-center justify-between gap-2 text-center sm:text-left`,e),...r,children:[(0,h.jsx)(`div`,{className:`flex-1 min-w-0`,children:n}),t&&(0,h.jsxs)(tr,{"data-slot":`dialog-close`,className:`shrink-0 rounded-xs opacity-70 text-(--text-muted) transition-opacity hover:opacity-100 hover:text-(--text-primary) focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,h.jsx)(iu,{}),(0,h.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})}function yu({className:e,showCloseButton:t=!1,children:n,...r}){return(0,h.jsxs)(`div`,{"data-slot":`dialog-footer`,className:B(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,h.jsx)(tr,{asChild:!0,children:(0,h.jsx)(pu,{variant:`outline`,children:`Close`})})]})}function bu({className:e,...t}){return(0,h.jsx)($n,{"data-slot":`dialog-title`,className:B(`text-base font-semibold text-(--text-primary)`,e),...t})}function xu({className:e,...t}){return(0,h.jsx)(er,{"data-slot":`dialog-description`,className:B(`text-sm text-(--text-secondary)`,e),...t})}function Su({open:e,title:t,description:n,confirmLabel:r,cancelLabel:i,loadingLabel:a,loading:o=!1,onOpenChange:s,onConfirm:c}){return(0,h.jsx)(mu,{open:e,onOpenChange:e=>!o&&s?.(e),children:(0,h.jsxs)(_u,{className:`sm:max-w-[380px]`,children:[(0,h.jsxs)(vu,{showCloseButton:!o,children:[(0,h.jsx)(bu,{children:t}),(0,h.jsx)(xu,{className:`leading-6`,children:n})]}),(0,h.jsxs)(yu,{children:[(0,h.jsx)(pu,{type:`button`,variant:`outline`,disabled:o,onClick:()=>s?.(!1),children:i||V(`cancel`)}),(0,h.jsx)(pu,{type:`button`,variant:`destructive`,disabled:o,onClick:c,children:o?a||V(`deleting`):r||V(`delete`)})]})]})})}function Cu({className:e}){return(0,h.jsxs)(`span`,{role:`status`,className:B(`loading-dots text-(--text-muted)`,e),children:[(0,h.jsx)(`span`,{}),(0,h.jsx)(`span`,{}),(0,h.jsx)(`span`,{})]})}var wu=`__codemini_general__`,Tu=5,Eu=10;function Du(e){return e?.projectDir||`unknown`}function Ou(e,t){return t?V(`generalChat`):!e||e===`unknown`?V(`unknownProject`):String(e).split(/[/\\]/).filter(Boolean).pop()||e}function ku({size:e=14,className:t,...n}){return(0,h.jsx)(`svg`,{viewBox:`0 0 24 24`,width:e,height:e,fill:`currentColor`,"aria-hidden":`true`,className:t,...n,children:(0,h.jsx)(`path`,{d:`M12 .5C5.65.5.5 5.65.5 12c0 5.09 3.29 9.4 7.86 10.93.58.1.79-.25.79-.56v-2.18c-3.2.69-3.87-1.36-3.87-1.36-.52-1.33-1.28-1.68-1.28-1.68-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.76 2.7 1.25 3.36.96.1-.75.4-1.25.73-1.54-2.55-.29-5.23-1.27-5.23-5.67 0-1.25.45-2.27 1.18-3.07-.12-.29-.51-1.46.11-3.03 0 0 .97-.31 3.16 1.17A10.98 10.98 0 0 1 12 6.07c.98 0 1.96.13 2.88.39 2.19-1.48 3.15-1.17 3.15-1.17.63 1.57.24 2.74.12 3.03.74.8 1.18 1.82 1.18 3.07 0 4.41-2.69 5.38-5.25 5.66.42.36.78 1.06.78 2.14v3.18c0 .31.21.67.8.56A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z`})})}function Au(e){return e?.title||e?.preview||(e?.messageCount>0?`${e.messageCount} ${V(`messages`)}`:V(`emptyChat`))}function ju(e){let t=Date.parse(e||``);if(!Number.isFinite(t))return``;let n=Date.now()-t;if(n<6e4)return V(`justNow`);let r=Math.floor(n/6e4);if(r<60)return`${r}${V(`minutesAgo`)}`;let i=Math.floor(r/60);if(i<24)return`${i}${V(`hoursAgo`)}`;let a=Math.floor(i/24);return a<30?`${a}${V(`daysAgo`)}`:new Date(t).toLocaleDateString(void 0,{month:`numeric`,day:`numeric`})}var Mu=[{id:`default`,labelKey:`themeDefault`,swatches:[`#0a0a0a`,`#f5f5f5`,`#60a5fa`]},{id:`catppuccin`,labelKey:`themeCatppuccin`,swatches:[`#1e1e2e`,`#cba6f7`,`#89b4fa`]},{id:`tokyonight`,labelKey:`themeTokyoNight`,swatches:[`#1a1b26`,`#7aa2f7`,`#bb9af7`]},{id:`one`,labelKey:`themeOne`,swatches:[`#282c34`,`#61afef`,`#c678dd`]},{id:`github`,labelKey:`themeGithub`,swatches:[`#ffffff`,`#0969da`,`#24292f`]},{id:`vscode`,labelKey:`themeVSCode`,swatches:[`#1e1e1e`,`#007acc`,`#d4d4d4`]}];function Nu({sessions:e,sessionsLoading:t,currentSessionId:n,onNewSession:r,onSwitchSession:i,onToggleTheme:a,onSetTheme:o,onOpenSettings:s,onOpenSkills:c,onOpenMemory:l,onOpenSouls:u,onOpenAbout:f,gitBatch:p,versionInfo:m,onUpdate:g,updateStatus:_,currentView:v,onSwitchView:y,onOpenProject:b,onDeleteSession:x}){let[S,C]=(0,d.useState)(new Set),[w,T]=(0,d.useState)({}),[E,D]=(0,d.useState)(Eu),[O,ee]=(0,d.useState)(null),[te,ne]=(0,d.useState)(!1),[re,ie]=(0,d.useState)(()=>typeof document>`u`?`default`:document.documentElement.dataset.palette||`default`),[k,ae]=(0,d.useState)(()=>typeof document>`u`?`light`:document.documentElement.dataset.theme||`light`),[A,j]=(0,d.useState)(()=>typeof window>`u`?`auto`:localStorage.getItem(`codemini-theme`)||`auto`);(0,d.useEffect)(()=>{let e=window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>{ae(document.documentElement.dataset.theme||`light`),j(localStorage.getItem(`codemini-theme`)||`auto`)},n=new MutationObserver(t);return n.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]}),e&&e.addEventListener(`change`,t),()=>{n.disconnect(),e&&e.removeEventListener(`change`,t)}},[]);let oe=k===`dark`,{allSessions:se,currentSession:ce,activeIsGeneral:le,activeProjectKey:M,generalSessions:N,projectSessionsOnly:ue,projectGroups:de,projectGroupEntries:fe}=(0,d.useMemo)(()=>{let t=Array.isArray(e)?e:[],r=t.find(e=>e.id===n),i=[],a=[],o=new Map;for(let e of t){if(e.isGeneral){i.push(e);continue}a.push(e);let t=Du(e);o.has(t)||o.set(t,[]),o.get(t).push(e)}return{allSessions:t,currentSession:r,activeIsGeneral:!!r?.isGeneral,activeProjectKey:r?Du(r):null,generalSessions:i,projectSessionsOnly:a,projectGroups:o,projectGroupEntries:Array.from(o.entries())}},[e,n]),pe=e=>{C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},me=(e,t)=>{T(n=>{let r=n[e]||Tu;return{...n,[e]:Math.min(r+Tu,t)}})},he=()=>{D(e=>Math.min(e+Eu,N.length))},ge=e=>{let t=Mu.some(t=>t.id===e)?e:`default`;document.documentElement.dataset.palette=t,localStorage.setItem(`codemini-theme-palette`,t),window.dispatchEvent(new CustomEvent(`codemini-theme-palette-change`,{detail:{palette:t}})),ie(t)},_e=async(e,t)=>{if(e.stopPropagation(),t&&t!==`unknown`&&t!==M&&b){await b(t,{view:`codewiki`});return}y?.(`codewiki`,{projectPath:t})},ve=async(e,t)=>{if(e.stopPropagation(),!(!t||t===`unknown`)){if(t===M){await r?.();return}await b?.(t,{view:`chat`})}},ye=async()=>{if(le){await r?.();return}await b?.(wu,{view:`chat`})};return(0,h.jsxs)(`aside`,{className:`w-[260px] shrink-0 flex flex-col bg-(--bg-secondary)`,children:[(0,h.jsxs)(`div`,{className:`shrink-0 px-2.5 pt-3 flex flex-col gap-0.5`,children:[(0,h.jsxs)(`div`,{className:`mb-2 flex h-10 items-center gap-2.5 px-2`,children:[(0,h.jsx)(`img`,{src:`/logos/codemini_logo.png`,alt:``,className:`size-6 shrink-0 rounded-md`,draggable:!1}),(0,h.jsx)(`div`,{className:`min-w-0 truncate text-[23px] font-semibold leading-6 text-(--text-primary)`,children:V(`brand`)})]}),(0,h.jsxs)(`button`,{className:`w-full border-0 bg-transparent flex items-center gap-2.5 h-[32px] px-2 rounded-lg cursor-pointer text-left text-[13px] hover:bg-(--bg-hover) text-(--text-primary)`,onClick:r,children:[(0,h.jsx)(Xl,{size:15,strokeWidth:2,className:`text-(--text-secondary) shrink-0`}),(0,h.jsx)(`span`,{className:`truncate`,children:V(`newChat`)})]}),(0,h.jsxs)(`button`,{className:`w-full border-0 bg-transparent flex items-center gap-2.5 h-[32px] px-2 rounded-lg cursor-pointer text-left text-[13px] hover:bg-(--bg-hover) text-(--text-primary)`,onClick:c,children:[(0,h.jsx)(Y,{size:15,strokeWidth:2,className:`text-(--text-secondary) shrink-0`}),(0,h.jsx)(`span`,{className:`truncate`,children:V(`skills`)})]}),(0,h.jsxs)(`button`,{className:`w-full border-0 bg-transparent flex items-center gap-2.5 h-[32px] px-2 rounded-lg cursor-pointer text-left text-[13px] hover:bg-(--bg-hover) text-(--text-primary)`,onClick:u,children:[(0,h.jsx)(Il,{size:15,strokeWidth:2,className:`text-(--text-secondary) shrink-0`}),(0,h.jsx)(`span`,{className:`truncate`,children:V(`souls`)})]}),(0,h.jsxs)(`button`,{className:`w-full border-0 bg-transparent flex items-center gap-2.5 h-[32px] px-2 rounded-lg cursor-pointer text-left text-[13px] hover:bg-(--bg-hover) text-(--text-primary)`,onClick:l,children:[(0,h.jsx)(Ol,{size:15,strokeWidth:2,className:`text-(--text-secondary) shrink-0`}),(0,h.jsx)(`span`,{className:`truncate`,children:V(`memory`)})]}),(0,h.jsx)(au,{className:`my-2 bg-transparent`})]}),(0,h.jsxs)(`div`,{className:`flex-1 min-h-0 overflow-y-auto scroll-smooth`,children:[(0,h.jsx)(`div`,{className:`flex items-center gap-2 px-4 pb-2.5`,children:(0,h.jsx)(`span`,{className:`min-w-0 flex-1 text-[12px] font-medium text-(--text-muted)`,children:V(`projects`)})}),(0,h.jsxs)(`nav`,{className:`flex flex-col px-2.5 pb-1 gap-0.5`,children:[fe.map(([e,t])=>{let r=S.has(e)||de.size===1,a=w[e]||Tu,o=t.slice(0,a),s=p?.[e],c=e===M,l=e!==`unknown`;return(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{className:B(`w-full border-0 bg-transparent flex items-center gap-1 h-[28px] px-1.5 rounded-md text-left text-[12px] font-medium tracking-[0.2px] hover:bg-(--bg-hover)`,c?`text-(--text-primary)`:`text-(--text-muted) hover:text-(--text-secondary)`),title:e===`unknown`?``:e,children:[(0,h.jsxs)(`button`,{className:`min-w-0 flex-1 border-0 bg-transparent flex items-center gap-2 text-left text-inherit cursor-pointer`,onClick:()=>pe(e),children:[(0,h.jsx)(Rl,{size:13,className:`shrink-0`}),(0,h.jsx)(`span`,{className:`truncate flex-1`,children:Ou(e)})]}),l&&(0,h.jsx)(`button`,{type:`button`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-(--text-muted) cursor-pointer hover:bg-(--bg-active) hover:text-(--text-primary)`,title:V(`newSessionInProject`),"aria-label":`${V(`newSessionInProject`)} ${Ou(e)}`,onClick:t=>ve(t,e),children:(0,h.jsx)(Xl,{size:13,strokeWidth:2.1})}),l&&(0,h.jsx)(`button`,{type:`button`,className:B(`inline-flex size-6 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-(--text-muted) cursor-pointer hover:bg-(--bg-active) hover:text-(--text-primary)`,v===`codewiki`&&c&&`bg-(--bg-active) text-(--text-primary)`),title:V(`openCodeWiki`),"aria-label":`${V(`openCodeWiki`)} ${Ou(e)}`,onClick:t=>_e(t,e),children:(0,h.jsx)(Dl,{size:13,strokeWidth:1.9})}),s?.isGit&&(0,h.jsx)(ku,{size:11,className:`shrink-0 text-(--text-muted)`}),(0,h.jsx)(`span`,{className:`text-[11px] px-2`,children:t.length}),(0,h.jsx)(`button`,{type:`button`,className:`border-0 bg-transparent inline-flex size-5 shrink-0 items-center justify-center rounded-md text-inherit cursor-pointer hover:bg-(--bg-active)`,onClick:()=>pe(e),"aria-label":V(r?`collapseProject`:`expandProject`),children:(0,h.jsx)(Ml,{size:13,className:B(`transition-transform`,!r&&`-rotate-90`)})})]}),r&&(0,h.jsxs)(`div`,{className:`flex flex-col gap-1.5 py-1 pl-2`,children:[o.map(e=>(0,h.jsxs)(`div`,{onClick:()=>{e.id===n?v!==`chat`&&y?.(`chat`):i(e.id)},className:B(`group w-full border-0 bg-transparent flex items-center gap-2 h-[30px] px-2 rounded-md cursor-pointer text-left text-[13px] truncate`,e.id===n?`bg-(--bg-active) text-(--text-primary)`:`text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),children:[(0,h.jsx)(`span`,{className:`truncate flex-1`,title:Au(e),children:Au(e)}),e.updatedAt&&(0,h.jsx)(`span`,{className:`text-[11px] text-(--text-muted) shrink-0 tabular-nums`,children:ju(e.updatedAt)}),(0,h.jsxs)(ou,{children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsx)(`button`,{type:`button`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-md text-(--text-muted) opacity-0 hover:bg-(--bg-active) hover:text-(--text-primary) group-hover:opacity-100 focus:opacity-100`,onClick:e=>e.stopPropagation(),"aria-label":V(`sessionActions`),children:(0,h.jsx)(Ll,{size:14})})}),(0,h.jsx)(cu,{align:`end`,className:`w-36 border-(--border-default) bg-(--bg-primary) p-1 text-(--text-primary)`,onClick:e=>e.stopPropagation(),children:(0,h.jsx)(`button`,{type:`button`,className:`w-full rounded-md px-2.5 py-2 text-left text-[13px] text-(--accent-red) hover:bg-(--accent-red-bg)`,onClick:()=>ee(e),children:V(`deleteSession`)})})]})]},e.id)),a<t.length&&(0,h.jsx)(`button`,{type:`button`,className:`h-[26px] rounded-md border-0 bg-transparent px-2 text-left text-[12px] font-medium text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary)`,onClick:()=>me(e,t.length),children:V(`showMoreSessions`)})]})]},e)}),t&&se.length===0&&(0,h.jsx)(`div`,{className:`px-3 py-4 text-center`,children:(0,h.jsx)(Cu,{className:`justify-center`})}),!t&&ue.length===0&&N.length===0&&(0,h.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-(--text-muted) text-center`,children:V(`noSessions`)})]}),(0,h.jsxs)(`section`,{className:`px-2.5 pb-2`,children:[(0,h.jsx)(au,{className:`my-2 bg-transparent`}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 px-1.5 pb-1.5`,children:[(0,h.jsx)(`span`,{className:`min-w-0 flex-1 text-[12px] font-medium text-(--text-muted)`,children:V(`conversations`)}),(0,h.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-(--text-muted) cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary)`,title:V(`newChat`),"aria-label":V(`newChat`),onClick:ye,children:(0,h.jsx)(Xl,{size:14,strokeWidth:1.9})})]}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[t&&N.length===0&&(0,h.jsx)(`div`,{className:`flex h-[34px] items-center justify-center px-3 text-(--text-muted)`,children:(0,h.jsx)(Cu,{})}),N.slice(0,E).map(e=>(0,h.jsxs)(`div`,{onClick:()=>{e.id===n?v!==`chat`&&y?.(`chat`):i(e.id)},className:B(`group flex h-[34px] w-full cursor-pointer items-center gap-2 rounded-lg border-0 px-2 text-left text-[13px]`,e.id===n&&v===`chat`?`bg-(--bg-active) text-(--text-primary)`:`text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),children:[(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,title:Au(e),children:Au(e)}),e.updatedAt&&(0,h.jsx)(`span`,{className:`shrink-0 text-[11px] tabular-nums text-(--text-muted)`,children:ju(e.updatedAt)}),(0,h.jsxs)(ou,{children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsx)(`button`,{type:`button`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-md text-(--text-muted) opacity-0 hover:bg-(--bg-active) hover:text-(--text-primary) group-hover:opacity-100 focus:opacity-100`,onClick:e=>e.stopPropagation(),"aria-label":V(`sessionActions`),children:(0,h.jsx)(Ll,{size:14})})}),(0,h.jsx)(cu,{align:`end`,className:`w-36 border-(--border-default) bg-(--bg-primary) p-1 text-(--text-primary)`,onClick:e=>e.stopPropagation(),children:(0,h.jsx)(`button`,{type:`button`,className:`w-full rounded-md px-2.5 py-2 text-left text-[13px] text-(--accent-red) hover:bg-(--accent-red-bg)`,onClick:()=>ee(e),children:V(`deleteSession`)})})]})]},e.id)),E<N.length&&(0,h.jsx)(`button`,{type:`button`,className:`h-[28px] rounded-md border-0 bg-transparent px-2 text-left text-[12px] font-medium text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary)`,onClick:he,children:V(`showMoreSessions`)}),!t&&N.length===0&&(0,h.jsx)(`button`,{type:`button`,onClick:ye,className:`h-[34px] rounded-lg border-0 bg-transparent px-2 text-left text-[13px] text-(--text-muted) hover:bg-(--bg-hover) hover:text-(--text-primary)`,children:V(`noConversations`)})]})]})]}),(0,h.jsxs)(`div`,{className:`mt-auto px-2.5 py-2 flex flex-col gap-0`,children:[(0,h.jsx)(au,{className:`my-2 bg-transparent`}),m?.latest&&m.latest!==m.current&&(0,h.jsx)(`button`,{className:`w-full border-0 bg-(--bg-tertiary) rounded-md px-2.5 py-1.5 cursor-pointer text-[11px] text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary) flex items-center justify-center gap-1.5`,onClick:_===`updating`?void 0:g,disabled:_===`updating`,children:_===`updating`?(0,h.jsx)(h.Fragment,{children:V(`updating`)}):_===`done`?(0,h.jsx)(h.Fragment,{children:V(`updatedRestart`)}):(0,h.jsx)(h.Fragment,{children:V(`updateAvailable`)})}),(0,h.jsxs)(`div`,{className:`flex items-center justify-center gap-1`,children:[(0,h.jsx)(`button`,{className:`border-0 bg-transparent inline-flex items-center justify-center size-8 rounded-lg cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary) text-(--text-secondary)`,onClick:f,title:V(`about`),"aria-label":V(`about`),children:(0,h.jsx)(zl,{size:15,strokeWidth:1.8})}),(0,h.jsx)(`a`,{href:`https://github.com/havingautism/Codemini-CLI`,target:`_blank`,rel:`noreferrer`,className:`border-0 bg-transparent inline-flex items-center justify-center size-8 rounded-lg cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary) text-(--text-secondary)`,title:V(`projectRepository`),"aria-label":V(`projectRepository`),children:(0,h.jsx)(ku,{size:15})}),(0,h.jsxs)(ou,{children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsx)(`button`,{className:`border-0 bg-transparent inline-flex items-center justify-center size-8 rounded-lg cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary) text-(--text-secondary)`,title:V(`switchThemePalette`),"aria-label":V(`switchThemePalette`),children:(0,h.jsx)(Jl,{size:15,strokeWidth:1.8})})}),(0,h.jsx)(cu,{align:`center`,side:`top`,className:`w-44 border-(--border-default) bg-(--bg-primary) p-1 text-(--text-primary)`,children:Mu.map(e=>(0,h.jsxs)(`button`,{type:`button`,className:B(`w-full rounded-md px-2.5 py-2 text-left text-[13px] flex items-center gap-2 hover:bg-(--bg-hover)`,re===e.id&&`text-(--text-primary) font-medium`),onClick:()=>ge(e.id),children:[(0,h.jsx)(`span`,{className:`flex shrink-0 -space-x-1`,children:e.swatches.map(e=>(0,h.jsx)(`span`,{className:`size-3 rounded-full border border-(--border-default)`,style:{backgroundColor:e}},e))}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:V(e.labelKey)}),re===e.id&&(0,h.jsx)(jl,{size:13})]},e.id))})]}),(0,h.jsxs)(ou,{children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsx)(`button`,{className:`border-0 bg-transparent inline-flex items-center justify-center size-8 rounded-lg cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary) text-(--text-secondary)`,title:V(`switchLanguage`),"aria-label":V(`switchLanguage`),children:(0,h.jsx)(J,{size:15,strokeWidth:1.8})})}),(0,h.jsx)(cu,{align:`center`,side:`top`,className:`w-30 border-(--border-default) bg-(--bg-primary) p-1 text-(--text-primary)`,children:[`zh`,`en`].map(e=>(0,h.jsxs)(`button`,{type:`button`,className:B(`w-full rounded-md px-2.5 py-1.5 text-left text-[13px] flex items-center justify-between hover:bg-(--bg-hover)`,As()===e&&`text-(--text-primary) font-medium`),onClick:()=>{As()!==e&&(ks(e),window.location.reload())},children:[(0,h.jsx)(`span`,{children:e===`zh`?`中文`:`English`}),As()===e&&(0,h.jsx)(jl,{size:13})]},e))})]}),(0,h.jsxs)(ou,{children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsx)(`button`,{className:`border-0 bg-transparent inline-flex items-center justify-center size-8 rounded-lg cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary) text-(--text-secondary)`,title:V(`switchTheme`),"aria-label":V(`switchTheme`),children:oe?(0,h.jsx)(ql,{size:15,strokeWidth:1.8}):(0,h.jsx)(nu,{size:15,strokeWidth:1.8})})}),(0,h.jsx)(cu,{align:`center`,side:`top`,className:`w-30 border-(--border-default) bg-(--bg-primary) p-1 text-(--text-primary)`,children:[{mode:`light`,icon:nu,label:V(`lightMode`)},{mode:`dark`,icon:ql,label:V(`darkMode`)},{mode:`auto`,icon:Kl,label:V(`autoModeTheme`)}].map(({mode:e,icon:t,label:n})=>(0,h.jsxs)(`button`,{type:`button`,className:B(`w-full rounded-md px-2.5 py-1.5 text-left text-[13px] flex items-center justify-between hover:bg-(--bg-hover)`,A===e&&`text-(--text-primary) font-medium`),onClick:()=>o(e),children:[(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,h.jsx)(t,{size:13,strokeWidth:1.8}),(0,h.jsx)(`span`,{children:n})]}),A===e&&(0,h.jsx)(jl,{size:13})]},e))})]}),(0,h.jsx)(`button`,{className:`border-0 bg-transparent inline-flex items-center justify-center size-8 rounded-lg cursor-pointer hover:bg-(--bg-hover) hover:text-(--text-primary) text-(--text-secondary)`,onClick:s,title:V(`settings`),"aria-label":V(`settings`),children:(0,h.jsx)($l,{size:15,strokeWidth:1.8})})]})]}),(0,h.jsx)(Su,{open:!!O,title:V(`deleteSessionConfirm`),description:O?V(`deleteSessionDescription`).replace(`{{session}}`,O.title||O.preview||O.id||``):``,loading:te,onOpenChange:e=>!e&&ee(null),onConfirm:async()=>{if(!O)return;ne(!0);let e=await x?.(O.id);ne(!1),e?.error||ee(null)}})]})}var Pu=`modulepreload`,Fu=function(e){return`/`+e},Iu={},Lu=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Fu(t,n),t in Iu)return;Iu[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Pu,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Ru=(0,d.lazy)(()=>Lu(()=>import(`./MessageBubble-BGnFIxcq.js`).then(e=>({default:e.MessageBubble})),__vite__mapDeps([0,1,2,3,4,5,6,7])));function zu(e,t=36){let n=String(e||``).replace(/\n/g,` `).trim();return n.length>t?n.slice(0,t)+`...`:n}function Bu(){return(0,h.jsxs)(`div`,{className:`codemini-home-visual codemini-press`,"aria-hidden":`true`,children:[(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`roll`}),(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`roll`}),(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`roll`}),(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`sheet`}),(0,h.jsx)(`div`,{className:`roll`})]})}function Vu({userMessages:e,activeNavIndex:t,scrollToMessage:n}){let[r,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(-1),s=(0,d.useRef)(null),c=(0,d.useCallback)(()=>{clearTimeout(s.current),i(!0)},[]),l=(0,d.useCallback)(()=>{s.current=setTimeout(()=>{i(!1),o(-1)},150)},[]);return(0,d.useEffect)(()=>()=>clearTimeout(s.current),[]),e.length<=1?null:(0,h.jsxs)(`div`,{className:`fixed right-5 top-1/2 -translate-y-1/2 pointer-events-auto z-30 flex items-center gap-1`,onMouseEnter:c,onMouseLeave:l,children:[r&&(0,h.jsx)(`div`,{className:`flex flex-col gap-px rounded-lg bg-(--bg-primary) border border-(--border-default) p-1.5 max-w-[180px] max-h-[60vh] overflow-y-auto shadow-lg`,children:e.map((e,r)=>(0,h.jsx)(`button`,{onClick:()=>n(e.id),onMouseEnter:()=>o(r),onMouseLeave:()=>o(-1),className:B(`text-left text-[11px] leading-tight px-2 py-1 rounded-md truncate transition-colors cursor-pointer max-w-full`,r===t?`text-primary`:`text-(--text-muted)`,a===r&&`bg-primary/10 text-primary`),children:e.text||`...`},e.id))}),(0,h.jsx)(`div`,{className:`flex flex-col items-end gap-6 py-1`,children:e.map((e,r)=>(0,h.jsx)(`button`,{onClick:()=>n(e.id),className:B(`h-0.5 rounded-sm transition-all duration-150 cursor-pointer`,r===t?`w-5 bg-primary`:a===r?`w-4 bg-primary/50`:`w-3 bg-(--text-muted)`)},e.id))})]})}function Hu({messages:e,projectCwd:t,skills:n=[],gitInfo:r,messagesLoading:i,isGeneral:a=!1}){let o=(0,d.useRef)(null),[s,c]=(0,d.useState)(!0),[l,u]=(0,d.useState)(!1),[f,p]=(0,d.useState)(-1),m=(0,d.useMemo)(()=>e.filter(e=>e.role===`you`).map(e=>({id:e.id,text:zu(e.text||e.segments?.filter(e=>e.type===`text`).map(e=>e.text).join(``)||``)})),[e]),g=(0,d.useCallback)(e=>{let t=o.current?.querySelector(`[data-message-id="${e}"]`);t&&t.scrollIntoView({behavior:`smooth`,block:`center`})},[]);return(0,d.useEffect)(()=>{let e=o.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<80;c(t),u(!t&&e.scrollTop>100);let n=e.querySelectorAll(`[data-message-id][class*="justify-end"]`);if(n.length===0){p(-1);return}let r=e.scrollTop+e.clientHeight*.4,i=-1;n.forEach((e,t)=>{e.offsetTop<=r&&(i=t)}),p(i)};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,d.useEffect)(()=>{s&&o.current&&requestAnimationFrame(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)})},[e,s]),(0,h.jsxs)(`div`,{className:`flex-1 relative overflow-hidden`,children:[i&&e.length===0&&(0,h.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center pointer-events-none`,children:(0,h.jsx)(Cu,{})}),!i&&e.length===0&&(0,h.jsx)(`div`,{className:`absolute left-1/2 top-[38%] -translate-x-1/2 -translate-y-1/2 w-[min(760px,calc(100%-48px))] text-center pointer-events-none`,children:a?(0,h.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,h.jsx)(`div`,{className:`mb-7 w-[min(560px,100%)]`,children:(0,h.jsx)(Bu,{})}),(0,h.jsx)(`h1`,{className:`text-[clamp(24px,2.4vw,36px)] font-medium leading-tight tracking-normal`,children:V(`askAnythingGeneral`)})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`h1`,{className:`text-[clamp(24px,2.4vw,36px)] font-medium leading-tight tracking-normal`,children:V(`buildInProject`).replace(`{{project}}`,t||`qurio-coder`)}),r?.isGit&&(0,h.jsxs)(`div`,{className:`mt-4 flex items-center justify-center gap-3 text-[13px] text-(--text-muted)`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,h.jsx)(K,{size:13}),(0,h.jsx)(`span`,{children:r.branch})]}),r.dirty?(0,h.jsxs)(h.Fragment,{children:[r.staged>0&&(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-green-600 dark:text-green-400`,children:[(0,h.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-current`}),V(`gitStaged`),` `,r.staged]}),r.modified>0&&(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-amber-600 dark:text-amber-400`,children:[(0,h.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-current`}),V(`gitModified`),` `,r.modified]}),r.untracked>0&&(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-current`}),V(`gitUntracked`),` `,r.untracked]})]}):(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,h.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-emerald-500`}),V(`gitClean`)]})]})]})}),(0,h.jsx)(`div`,{ref:o,className:`h-full overflow-y-auto py-[44px_0_28px] scroll-smooth`,style:{scrollbarWidth:`thin`},children:(0,h.jsx)(`div`,{className:`relative`,children:(0,h.jsx)(`div`,{className:`w-[min(960px,calc(100%-96px))] mx-auto`,children:(0,h.jsx)(d.Suspense,{fallback:null,children:e.map(e=>(0,h.jsx)(Ru,{message:e,skills:n},e.id))})})})}),(0,h.jsx)(Vu,{userMessages:m,activeNavIndex:f,scrollToMessage:g}),(0,h.jsx)(`div`,{className:`absolute right-7 bottom-0 flex flex-col gap-2 z-20`,children:l&&(0,h.jsx)(`button`,{className:`w-9 h-9 rounded-full bg-(--bg-primary) dark:bg-(--bg-secondary) border border-(--border-default) cursor-pointer flex items-center justify-center text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary) animate-in fade-in-0 zoom-in-95`,onClick:()=>{c(!0),o.current?.scrollTo({top:o.current.scrollHeight,behavior:`smooth`})},children:(0,h.jsx)(Tl,{size:16})})})]})}var Uu=new Set([`superpowers-lite`]);function Wu(){return[{value:`normal`,label:V(`normalExecutionMode`),desc:V(`normalModeDesc`),icon:Ul},{value:`plan`,label:V(`planMode`),desc:V(`planModeDesc`),icon:Bl}]}function Z(){return[{value:`review`,label:V(`reviewMode`),desc:V(`reviewModeDesc`),icon:eu},{value:`auto`,label:V(`autoMode`),desc:V(`autoModeDesc`),icon:tu},{value:`full_access`,label:V(`fullAccessMode`),desc:V(`fullAccessModeDesc`),icon:Hl}]}var Gu=[{name:`dream`,insert:`/dream `,icon:ql,description:`Run memory consolidation now. Auto dream still runs in the background when needed.`},{name:`compact`,insert:`/compact `,icon:wl,description:`Compress the current conversation context while keeping the useful working summary.`},{name:`memory`,insert:`/memory `,icon:Fl,description:`Inspect or manage remembered project and user context.`},{name:`capture`,insert:`/capture `,icon:kl,description:`Capture an explicit note into the memory inbox for later consolidation.`},{name:`inbox`,insert:`/inbox `,icon:X,description:`Review pending memory inbox entries.`},{name:`reflect`,insert:`/reflect `,icon:tu,description:`Draft or update a reusable skill from the current workflow.`},{name:`retry`,insert:`/retry `,icon:Ql,description:`Retry the last assistant turn.`}],Ku=new Set(Gu.map(e=>e.name)),qu=`border border-transparent bg-(--bg-primary)/35 text-(--text-secondary) h-8 rounded-full inline-flex items-center justify-center gap-1.5 shrink-0 cursor-pointer text-[13px] whitespace-nowrap transition-colors hover:border-(--border-strong) hover:bg-(--bg-hover) hover:text-(--text-primary)`;function Ju({current:e,disabled:t=!1}){let[n,r]=(0,d.useState)(!1),[i,a]=(0,d.useState)(!1),o=Wu(),s=o.find(t=>t.value===e)||o[0],c=s.icon,l=async n=>{if(!(n===e||i||t)){a(!0);try{let e=await Hs(n);if(e?.error)throw Error(e.message||`Failed to switch mode`)}catch{}finally{a(!1)}r(!1)}};return(0,h.jsxs)(ou,{open:n,onOpenChange:e=>!t&&r(e),children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsxs)(`button`,{type:`button`,className:B(qu,`px-3 hover:border-(--accent-blue)/55 hover:bg-(--accent-blue-bg) hover:text-(--accent-blue)`,(i||t)&&`opacity-50 pointer-events-none`),disabled:t,title:V(t?`switchModeDisabled`:`switchMode`),children:[(0,h.jsx)(c,{size:13}),(0,h.jsx)(`span`,{className:`truncate`,children:s.label}),(0,h.jsx)(Ml,{size:11})]})}),(0,h.jsxs)(cu,{side:`top`,align:`start`,sideOffset:6,className:`w-70 p-1 rounded-lg bg-(--bg-primary) border border-(--border-default) shadow-lg`,children:[(0,h.jsx)(`div`,{className:`text-[11px] text-(--text-muted) px-2 py-1.5 font-medium`,children:V(`executionMode`)}),(0,h.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:o.map(n=>{let r=n.icon;return(0,h.jsxs)(`button`,{disabled:t||i,className:B(`w-full border-0 rounded-md px-2 py-1.5 text-left text-[12px] cursor-pointer flex items-center gap-2`,(t||i)&&`opacity-50 cursor-not-allowed`,e===n.value?`bg-(--bg-active) text-(--text-primary) font-medium`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),onClick:()=>l(n.value),children:[(0,h.jsx)(r,{size:13,className:`shrink-0 text-(--text-muted)`}),(0,h.jsx)(`span`,{className:`shrink-0`,children:n.label}),(0,h.jsx)(`span`,{className:`text-[10px] text-(--text-muted) min-w-0 text-right leading-4`,children:n.desc})]},n.value)})})]})]})}function Yu({current:e,disabled:t=!1}){let[n,r]=(0,d.useState)(!1),[i,a]=(0,d.useState)(!1),o=Z(),s=o.find(t=>t.value===e)||o[0],c=s.icon,l=async n=>{if(!(n===e||i||t)){a(!0);try{let e=await Us(n);if(e?.error)throw Error(e.message||`Failed to switch approval mode`)}catch{}finally{a(!1)}r(!1)}};return(0,h.jsxs)(ou,{open:n,onOpenChange:e=>!t&&r(e),children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsxs)(`button`,{type:`button`,className:B(qu,`px-3 hover:border-(--accent-green)/55 hover:bg-(--accent-green-bg) hover:text-(--accent-green)`,(i||t)&&`opacity-50 pointer-events-none`),disabled:t,title:V(t?`switchModeDisabled`:`switchApprovalMode`),children:[(0,h.jsx)(c,{size:13}),(0,h.jsx)(`span`,{className:`truncate`,children:s.label}),(0,h.jsx)(Ml,{size:11})]})}),(0,h.jsxs)(cu,{side:`top`,align:`start`,sideOffset:6,className:`w-76 p-1 rounded-lg bg-(--bg-primary) border border-(--border-default) shadow-lg`,children:[(0,h.jsx)(`div`,{className:`text-[11px] text-(--text-muted) px-2 py-1.5 font-medium`,children:V(`approvalMode`)}),(0,h.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:o.map(n=>{let r=n.icon;return(0,h.jsxs)(`button`,{disabled:t||i,className:B(`w-full border-0 rounded-md px-2 py-1.5 text-left text-[12px] cursor-pointer flex items-center gap-2`,(t||i)&&`opacity-50 cursor-not-allowed`,e===n.value?`bg-(--bg-active) text-(--text-primary) font-medium`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),onClick:()=>l(n.value),children:[(0,h.jsx)(r,{size:14,className:`shrink-0 mt-0.5`}),(0,h.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,h.jsx)(`span`,{className:`block`,children:n.label}),(0,h.jsx)(`span`,{className:`block text-(--text-muted) text-[11px] font-normal leading-snug`,children:n.desc})]})]},n.value)})})]})]})}function Xu(){let[e,t]=(0,d.useState)([]),[n,r]=(0,d.useState)(``),[i,a]=(0,d.useState)(!1),o=(0,d.useCallback)(async()=>{try{let e=await vc(),n=Array.isArray(e)?e:[];t(n);let i=n.find(e=>e.active);r(i?i.name:``)}catch{}},[]);(0,d.useEffect)(()=>{o()},[o]);let s=async e=>{await Cc(e),r(e),a(!1),o()};return(0,h.jsxs)(ou,{open:i,onOpenChange:a,children:[(0,h.jsx)(su,{asChild:!0,children:(0,h.jsxs)(`button`,{type:`button`,className:B(qu,`px-3`),title:V(`soulSwitch`),children:[(0,h.jsx)(Il,{size:13}),(0,h.jsx)(`span`,{className:`truncate max-w-[60px]`,children:n||`default`}),(0,h.jsx)(Ml,{size:11})]})}),(0,h.jsxs)(cu,{side:`top`,align:`start`,sideOffset:6,className:`w-52 p-1 rounded-lg bg-(--bg-primary) border border-(--border-default) shadow-lg`,children:[(0,h.jsx)(`div`,{className:`text-[11px] text-(--text-muted) px-2 py-1.5 font-medium`,children:V(`switchSoul`)}),(0,h.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.map(e=>(0,h.jsxs)(`button`,{className:B(`w-full border-0 rounded-md px-2 py-1.5 text-left text-[12px] cursor-pointer flex items-center gap-2`,e.active?`bg-(--bg-active) text-(--text-primary) font-medium`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),onClick:()=>s(e.name),children:[(0,h.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,h.jsx)(`span`,{className:`text-[10px] text-(--text-muted) shrink-0`,children:e.scope===`builtin`?V(`builtin`):V(`custom`)})]},`${e.scope}-${e.name}`))})]})]})}function Zu({query:e,onSelect:t,visible:n}){let[r,i]=(0,d.useState)([]),[a,o]=(0,d.useState)(null);(0,d.useEffect)(()=>{n&&cc().then(e=>{i(Array.isArray(e)?e.filter(e=>e.enabled!==!1&&!Uu.has(e.name)&&!Ku.has(e.name)):[])}).catch(()=>{})},[n]);let s=e.trim().toLowerCase(),c=(0,d.useMemo)(()=>Gu.filter(e=>!s||e.name.includes(s)||e.description.toLowerCase().includes(s)).map(e=>({...e,kind:`action`,key:`action-${e.name}`})),[s]),l=(0,d.useMemo)(()=>r.filter(e=>!s||e.name.toLowerCase().includes(s)||(e.description||``).toLowerCase().includes(s)).map(e=>({name:e.name,insert:`/${e.name} `,icon:Y,description:e.description||`Manual skill`,kind:`skill`,key:`skill-${e.name}`})),[r,s]);if(!n)return null;let u=c.length>0||l.length>0,f=(e,n)=>n.length?(0,h.jsxs)(`div`,{className:`py-1`,children:[(0,h.jsx)(`div`,{className:`px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.45px] text-(--text-muted)`,children:e}),(0,h.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:n.map(e=>{let n=e.icon,r=a===e.key;return(0,h.jsxs)(`button`,{className:B(`w-full border-0 rounded-md px-2.5 py-2 text-left cursor-pointer grid grid-cols-[22px_minmax(96px,180px)_minmax(0,1fr)_auto] items-start gap-2 text-[12px] transition-colors`,r?`bg-(--bg-hover) text-(--text-primary)`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover) hover:text-(--text-primary)`),onClick:()=>t(e.insert),onMouseEnter:()=>o(e.key),onMouseLeave:()=>o(null),children:[(0,h.jsx)(`span`,{className:B(`mt-0.5 inline-flex size-5 items-center justify-center rounded-md transition-colors`,e.kind===`action`?`bg-(--accent-cyan-bg) text-(--accent-cyan)`:`bg-(--accent-purple-bg) text-(--accent-purple)`,!r&&`opacity-80`),children:(0,h.jsx)(n,{size:12})}),(0,h.jsxs)(`span`,{className:`truncate font-medium leading-5 font-mono`,children:[`/`,e.name]}),(0,h.jsx)(`span`,{className:`text-(--text-muted) text-[11px] leading-5 overflow-hidden`,style:{display:`-webkit-box`,WebkitLineClamp:2,WebkitBoxOrient:`vertical`},children:e.description}),(0,h.jsx)(`span`,{className:B(`mt-0.5 rounded-full border px-1.5 py-0.5 text-[10px] uppercase leading-none`,e.kind===`action`?`border-(--accent-cyan)/25 text-(--accent-cyan)`:`border-(--accent-purple)/25 text-(--accent-purple)`),children:e.kind})]},e.key)})})]}):null;return(0,h.jsxs)(`div`,{className:`absolute bottom-full left-0 right-0 mb-1.5 max-h-[360px] overflow-y-auto rounded-xl border border-(--border-default) bg-(--bg-primary) shadow-lg z-50 animate-in fade-in-0 zoom-in-95 slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,style:{scrollbarWidth:`thin`},children:[!u&&(0,h.jsx)(`div`,{className:`px-2.5 py-5 text-[12px] text-(--text-muted) text-center`,children:`No matching commands`}),f(`Actions`,c),c.length>0&&l.length>0&&(0,h.jsx)(au,{className:` my-1 bg-(--border-default)`}),f(`Skills`,l)]})}function Qu({onSubmit:e,onAbort:t,busy:n,disabled:r=!1,disabledReason:i=``,runtimeState:a,history:o,onOpenProject:s,projectCwd:c}){let[l,u]=(0,d.useState)(``),[f,p]=(0,d.useState)([]),[m,g]=(0,d.useState)(-1),[_,v]=(0,d.useState)(``),[y,b]=(0,d.useState)(!1),[x,S]=(0,d.useState)(``),C=(0,d.useRef)(null),w=a||{},T=w.mode||`normal`,E=w.approvalMode||`review`,D=n||r,O=c===`__codemini_general__`;(0,d.useEffect)(()=>{o&&o.length&&f.length===0&&p([...o].reverse())},[o]),(0,d.useEffect)(()=>{D&&b(!1)},[D]);let ee=(0,d.useCallback)(()=>{let t=l.trim();!t||D||(e(t),u(``),b(!1),g(-1),C.current&&(C.current.style.height=`auto`))},[l,D,e]),te=(0,d.useCallback)(e=>{if(e.key===`Enter`&&!e.shiftKey){if(y){e.preventDefault();return}e.preventDefault(),ee();return}if(y&&e.key===`Escape`){e.preventDefault(),b(!1);return}if(e.key===`ArrowUp`&&f.length>0&&!y){e.preventDefault(),m===-1&&v(l);let t=Math.min(m+1,f.length-1);g(t),u(f[t]);return}if(e.key===`ArrowDown`&&m!==-1&&!y){e.preventDefault();let t=m-1;g(t),u(t<0?_:f[t]);return}e.key===`Tab`&&e.preventDefault()},[l,f,m,_,ee,y]),ne=(0,d.useCallback)(e=>{let t=e.target.value;u(t),e.target.style.height=`auto`,e.target.style.height=Math.min(e.target.scrollHeight,160)+`px`,t===`/`?(b(!0),S(``)):t.startsWith(`/`)&&!t.includes(` `)?(b(!0),S(t.slice(1))):b(!1)},[]);return(0,h.jsxs)(`div`,{className:`w-full relative`,children:[(0,h.jsx)(Zu,{query:x,onSelect:(0,d.useCallback)(e=>{u(e),b(!1),C.current?.focus()},[]),visible:y}),(0,h.jsxs)(`div`,{className:`flex flex-col gap-4 border border-border rounded-[28px] px-3 py-2 transition-colors bg-(--bg-primary) shadow-(--shadow-lg) dark:bg-(--bg-secondary) dark:shadow-[0_14px_44px_color-mix(in_srgb,var(--background)_70%,transparent)]`,children:[(0,h.jsx)(`div`,{className:`flex min-h-[58px]`,children:(0,h.jsx)(`textarea`,{ref:C,value:l,onChange:ne,onKeyDown:te,placeholder:n?V(`inputDisabled`):r?i||V(`inputDisabled`):V(`sendMessageToCodeminiWithSlash`),disabled:D,rows:1,className:`flex-1 resize-none border-0 outline-none bg-transparent text-(--text-primary) min-h-[34px] max-h-[160px] p-1 leading-[1.55] text-[16px] placeholder:text-(--text-muted) disabled:opacity-50 disabled:cursor-not-allowed`,style:{height:`auto`}})}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 min-h-9 flex-wrap`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,h.jsxs)(`button`,{type:`button`,className:B(qu,`px-3`),title:V(`switchWorkspace`),onClick:s,children:[O?(0,h.jsx)(Wl,{size:13,className:`shrink-0`}):(0,h.jsx)(Rl,{size:13,className:`shrink-0`}),(0,h.jsx)(`span`,{className:`truncate max-w-[80px]`,children:O?V(`generalChat`):c||`...`}),(0,h.jsx)(Ml,{size:11})]}),(0,h.jsx)(Ju,{current:T,disabled:D}),(0,h.jsx)(Yu,{current:E,disabled:D}),(0,h.jsx)(Xu,{})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[(0,h.jsx)(`button`,{type:`button`,className:`border-0 bg-transparent text-(--text-secondary) min-w-9 h-9 rounded-full inline-flex items-center justify-center shrink-0 cursor-pointer transition-colors hover:bg-(--bg-hover) hover:text-(--text-primary)`,title:V(`addContext`),children:(0,h.jsx)(Yl,{size:18})}),n?(0,h.jsx)(`button`,{type:`button`,className:`border-0 text-(--accent-red) min-w-9 h-9 rounded-full inline-flex items-center justify-center shrink-0 cursor-pointer bg-(--accent-red-bg) transition-opacity hover:opacity-80`,onClick:t,title:V(`abort`),children:(0,h.jsx)(Gl,{size:14})}):(0,h.jsx)(`button`,{type:`button`,className:B(`border-0 min-w-10 w-10 h-10 rounded-full inline-flex items-center justify-center shrink-0 cursor-pointer transition-all`,l.trim()&&!D?`bg-(--accent-blue) text-white hover:bg-(--accent-hover)`:`bg-(--text-muted)/25 text-(--text-muted) cursor-not-allowed`),onClick:ee,disabled:!l.trim()||D,title:V(`sending`),children:(0,h.jsx)(El,{size:16})})]})]})]})]})}var $u={thinking:`bg-(--accent-blue)`,streaming:`bg-(--accent-green)`,tooling:`bg-(--accent-orange)`,live:`bg-(--accent-cyan)`},ed=[{pattern:/\bdeepseek\b/i,logo:`/logos/deepseek-color.svg`},{pattern:/\bopenai\b/i,logo:`/logos/openai.svg`},{pattern:/\bgpt\b/i,logo:`/logos/openai.svg`},{pattern:/\bo[134]\b/i,logo:`/logos/openai.svg`},{pattern:/\bgemini\b/i,logo:`/logos/gemini-color.svg`},{pattern:/\bqwen\b/i,logo:`/logos/qwen-color.svg`},{pattern:/\bchatglm\b/i,logo:`/logos/chatglm-color.svg`},{pattern:/\bglm-/i,logo:`/logos/glm-color.svg`},{pattern:/\bkimi\b/i,logo:`/logos/kimi-color.svg`},{pattern:/\bminimax\b/i,logo:`/logos/minimax-color.svg`},{pattern:/\bmoonshot\b/i,logo:`/logos/moonshot.svg`},{pattern:/\bnvidia\b/i,logo:`/logos/nvidia-color.svg`},{pattern:/\bzhipu\b/i,logo:`/logos/zhipu-color.svg`},{pattern:/\bclaude\b/i,logo:`/logos/claude-color.svg`}],td={"openai-compatible":`/logos/openai.svg`,anthropic:`/logos/claude-color.svg`};function nd(e){if(!e)return null;for(let{pattern:t,logo:n}of ed)if(t.test(e))return n;return null}function rd({src:e,size:t=13}){return e?(0,h.jsx)(`img`,{src:e,alt:``,width:t,height:t,className:`shrink-0 rounded-sm object-contain`}):null}function id({runtimeState:e,live:t,stageLabel:n}){let r=e||{},i=r.mode||`normal`,a=r.approvalMode||`review`,o=r.currentContextTokens||0,s=r.maxContextTokens||0,c=s?Math.round(o/s*100):0,l=c<40?`bg-(--accent-green)`:c<75?`bg-(--accent-orange)`:`bg-(--accent-red)`,u=Object.keys($u).find(e=>(n||``).includes(e))||`live`,d=nd(r.model),f=td[r.sdkProvider],p=i===`plan`?Bl:Ol,m=a===`full_access`?Hl:a===`auto`?tu:eu,g=V(a===`full_access`?`fullAccessMode`:a===`auto`?`autoMode`:`reviewMode`);return(0,h.jsxs)(`div`,{className:`flex items-center gap-3 flex-1 min-w-0 text-[12px] text-(--text-muted) overflow-hidden`,children:[(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,h.jsx)(p,{size:13,className:`shrink-0 opacity-70`}),(0,h.jsx)(`span`,{children:V(i===`plan`?`planMode`:`normalExecutionMode`)})]}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,h.jsx)(m,{size:13,className:`shrink-0 opacity-70`}),(0,h.jsx)(`span`,{children:g})]}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[d?(0,h.jsx)(rd,{src:d}):(0,h.jsx)(Ol,{size:13,className:`shrink-0 opacity-70`}),(0,h.jsx)(`span`,{children:r.model?.toUpperCase()||`-`})]}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[f?(0,h.jsx)(rd,{src:f}):(0,h.jsx)(Zl,{size:13,className:`shrink-0 opacity-70`}),(0,h.jsx)(`span`,{children:r.sdkProvider?.toUpperCase()||`-`})]}),s>0&&(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 whitespace-nowrap`,children:[(0,h.jsx)(Al,{size:13,className:`shrink-0 opacity-70`}),(0,h.jsx)(`span`,{children:`CTX`}),(0,h.jsx)(`span`,{className:`w-12 h-1 bg-(--muted) rounded-full overflow-hidden`,children:(0,h.jsx)(`span`,{className:B(`block h-full rounded-full transition-all`,l),style:{width:`${c}%`}})}),(0,h.jsxs)(`span`,{children:[c,`%`]})]}),(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 ml-auto whitespace-nowrap`,children:[(0,h.jsx)(`span`,{className:B(`w-1.5 h-1.5 rounded-full shrink-0`,t?$u[u]:`bg-(--text-muted)`,t&&`animate-pulse`)}),(0,h.jsx)(`span`,{children:t?n:V(`idle`)})]})]})}function ad(e,t){return e===`delete`?`delete`:e===`run`?`run`:e===`edit`?`edit`:e===`write`?`write`:t?.planApproval?`plan`:t?.reflectApproval?`reflect`:`generic`}function od(e){if(!e)return{};try{let t=typeof e==`string`?JSON.parse(e):e;return{...t,_raw:JSON.stringify(t,null,2)}}catch{return{_raw:String(e)}}}function sd({label:e,value:t}){return(0,h.jsxs)(`div`,{className:`flex gap-3 py-1.5 min-w-0`,children:[(0,h.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-muted) w-20 shrink-0`,children:e}),(0,h.jsx)(`span`,{className:`text-[13px] font-mono min-w-0 break-words text-(--text-primary)`,children:String(t)})]})}function cd({label:e,value:t}){return t==null||t===``?null:(0,h.jsxs)(`div`,{className:`py-1.5 min-w-0`,children:[(0,h.jsx)(`div`,{className:`mb-1 text-[13px] font-medium text-(--text-muted)`,children:e}),(0,h.jsx)(`pre`,{className:`max-h-40 overflow-auto rounded-md border border-(--border-default) bg-(--bg-secondary) px-2.5 py-2 text-[12px] leading-5 text-(--text-primary) whitespace-pre-wrap break-words`,children:String(t)})]})}function ld({variant:e,args:t,details:n}){let r=od(t);if(e===`delete`)return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(sd,{label:`File`,value:r.path||r.name||`-`}),(0,h.jsx)(sd,{label:`Type`,value:r.type||`file`})]});if(e===`run`)return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(sd,{label:`Command`,value:r.command||`-`}),n?.risk&&(0,h.jsx)(sd,{label:`Risk`,value:n.risk}),n?.evaluation?.recommendation&&(0,h.jsx)(sd,{label:`Recommend`,value:n.evaluation.recommendation}),n?.policyBlock?.reason&&(0,h.jsx)(sd,{label:`Policy`,value:n.policyBlock.reason}),(n?.description||n?.evaluation?.description)&&(0,h.jsx)(sd,{label:`Info`,value:n.description||n.evaluation.description}),n?.evaluation?.sideEffects&&(0,h.jsx)(sd,{label:`Effects`,value:n.evaluation.sideEffects})]});if(e===`edit`){let e=r.edit&&typeof r.edit==`object`?r.edit:{},t=r.kind||e.kind||r.mode||`edit`;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(sd,{label:`Tool`,value:`edit`}),(0,h.jsx)(sd,{label:`File`,value:r.file||r.path||`-`}),(0,h.jsx)(sd,{label:`Action`,value:t}),(0,h.jsx)(cd,{label:`Old`,value:r.old_text||r.old_string||e.old_text||e.old_string}),(0,h.jsx)(cd,{label:`New`,value:r.new_text||r.new_string||e.new_text||e.new_string||e.new_content||r.content})]})}return e===`write`?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(sd,{label:`Tool`,value:`write`}),(0,h.jsx)(sd,{label:`File`,value:r.file||r.path||`-`}),(0,h.jsx)(cd,{label:`Content`,value:r.content||r.text||r.body})]}):e===`plan`?(0,h.jsxs)(h.Fragment,{children:[n?.title&&(0,h.jsx)(`p`,{className:`text-sm mb-2`,children:n.title}),n?.steps&&(0,h.jsx)(`ol`,{className:`list-decimal list-inside space-y-1`,children:n.steps.map((e,t)=>(0,h.jsxs)(`li`,{className:`text-sm`,children:[e.role||``,`: `,e.title||``]},t))})]}):e===`reflect`?(0,h.jsxs)(h.Fragment,{children:[n?.scope&&(0,h.jsx)(sd,{label:`Scope`,value:n.scope}),n?.skillName&&(0,h.jsx)(sd,{label:`Skill`,value:n.skillName}),n?.targetPath&&(0,h.jsx)(sd,{label:`Path`,value:n.targetPath})]}):(0,h.jsx)(cd,{label:`Arguments`,value:r._raw||`-`})}function ud({request:e,open:t,onDecision:n}){if(!e)return null;let{id:r,toolName:i,displayName:a,arguments:o,details:s}=e,c=ad(i,s);return(0,h.jsx)(mu,{open:t,onOpenChange:e=>{e||n(r,!1)},children:(0,h.jsxs)(_u,{className:`sm:max-w-xl max-h-[82vh] grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden`,children:[(0,h.jsx)(vu,{children:(0,h.jsx)(bu,{children:{delete:V(`deleteApproval`),run:V(`runApproval`),edit:V(`editApproval`),write:V(`writeApproval`),plan:V(`planApproval`),reflect:V(`reflectApproval`),generic:V(`approveTitle`)}[c]||V(`approveTitle`)})}),(0,h.jsx)(`div`,{className:`min-h-0 overflow-y-auto py-1 pr-1`,children:(0,h.jsx)(ld,{variant:c,args:o,details:s})}),(0,h.jsxs)(yu,{className:`gap-2`,children:[(0,h.jsx)(pu,{variant:`outline`,onClick:()=>n(r,!1),children:V(`deny`)}),(0,h.jsx)(pu,{onClick:()=>n(r,!0),children:V(`approve`)})]})]})})}var dd=du(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function fd({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,h.jsx)(n?_:`span`,{"data-slot":`badge`,"data-variant":t,className:B(dd({variant:t}),e),...r})}function pd({className:e,...t}){return(0,h.jsx)(`textarea`,{"data-slot":`textarea`,className:B(`flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40`,e),...t})}function md({className:e,value:t,...n}){return(0,h.jsx)(Do,{"data-slot":`progress`,className:B(`relative h-2 w-full overflow-hidden rounded-full bg-primary/20`,e),...n,children:(0,h.jsx)(Oo,{"data-slot":`progress-indicator`,className:`h-full w-full flex-1 bg-primary transition-all`,style:{transform:`translateX(-${100-(t||0)}%)`}})})}var hd={planner:`bg-(--accent-purple-bg) text-(--accent-purple)`,coder:`bg-(--accent-green-bg) text-(--accent-green)`,reviewer:`bg-(--accent-orange-bg) text-(--accent-orange)`,tester:`bg-(--accent-blue-bg) text-(--accent-blue)`,advisor:`bg-(--accent-blue-bg) text-(--accent-blue)`,summarizer:`bg-(--accent-cyan-bg) text-(--accent-cyan)`};function gd({steps:e}){if(!e?.length)return null;let t=e.filter(e=>e.status===`done`).length,n=t===e.length,r=Math.round(t/e.length*100);return(0,h.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg p-3 my-2 max-w-3xl mx-auto bg-(--bg-secondary)`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,h.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-primary)`,children:V(`planTitle`)}),(0,h.jsx)(fd,{className:B(`text-[11px]`,n?`bg-(--accent-green-bg) text-(--accent-green)`:`bg-(--accent-blue-bg) text-(--accent-blue)`),children:n?V(`planDone`):`${t}/${e.length}`})]}),(0,h.jsx)(md,{value:r,className:`h-1.5 mb-3`}),(0,h.jsx)(`div`,{className:`space-y-1.5`,children:e.map((e,t)=>(0,h.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,h.jsx)(`span`,{className:B(`w-5 h-5 rounded-full flex items-center justify-center text-[11px] font-medium shrink-0`,e.status===`done`&&`bg-(--accent-green-bg) text-(--accent-green)`,e.status===`failed`&&`bg-(--accent-red-bg) text-(--accent-red)`,e.status===`running`&&`bg-(--accent-blue-bg) text-(--accent-blue)`,e.status===`pending`&&`bg-(--muted) text-(--muted-foreground)`),children:e.status===`done`?`✓`:e.status===`failed`?`✗`:e.status===`running`?`▶`:t+1}),(0,h.jsx)(fd,{variant:`outline`,className:B(`text-[11px] px-1.5 py-0`,hd[e.role]||`bg-(--muted) text-(--muted-foreground)`),children:e.role?.toUpperCase()}),(0,h.jsx)(`span`,{className:`truncate text-(--text-secondary)`,children:e.title})]},t))})]})}function _d({plan:e,onAction:t,disabled:n=!1}){let[r,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(``);if(!e)return null;let s=Array.isArray(e.steps)?e.steps:[];return(0,h.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg p-3 max-w-3xl mx-auto bg-(--bg-secondary) space-y-2.5`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,h.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-primary)`,children:V(`planReviewTitle`)}),(0,h.jsx)(fd,{className:`text-[11px] bg-(--accent-orange-bg) text-(--accent-orange)`,children:V(`planReviewStatus`)})]}),(0,h.jsx)(`p`,{className:`text-[13px] text-(--text-secondary) leading-relaxed`,children:e.goal}),e.summary&&(0,h.jsx)(`p`,{className:`text-[12px] text-(--text-muted) leading-relaxed`,children:e.summary}),(0,h.jsx)(`div`,{className:`space-y-1.5`,children:s.map((e,t)=>(0,h.jsxs)(`div`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,h.jsx)(`span`,{className:`w-5 h-5 rounded-full bg-(--muted) text-(--muted-foreground) flex items-center justify-center text-[11px] font-medium shrink-0`,children:t+1}),(0,h.jsx)(fd,{variant:`outline`,className:B(`text-[11px] px-1.5 py-0 shrink-0`,hd[e.role||``]||`bg-(--muted) text-(--muted-foreground)`),children:String(e.role||`step`).toUpperCase()}),(0,h.jsx)(`span`,{className:`truncate text-(--text-secondary)`,children:e.title})]},t))}),r&&(0,h.jsx)(pd,{value:a,onChange:e=>o(e.target.value),placeholder:V(`planEditPlaceholder`),className:`min-h-[64px] text-[13px]`,autoFocus:!0}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,h.jsx)(pu,{variant:`destructive`,size:`xs`,disabled:n,onClick:()=>t(`reject`),children:V(`planReject`)}),(0,h.jsx)(pu,{variant:`outline`,size:`xs`,disabled:n||r&&!a.trim(),onClick:()=>{r?(a.trim()&&t(`edit`,a),a.trim()&&(i(!1),o(``))):i(!0)},children:V(r?`planSubmitFeedback`:`planEdit`)}),(0,h.jsx)(pu,{size:`xs`,disabled:n,onClick:()=>t(`approve`),children:V(`planApprove`)})]})]})}function vd(e){let t=Number(e);return Number.isFinite(t)?t.toFixed(2):`0.75`}function yd({draft:e,onAction:t,disabled:n=!1}){let[r,i]=(0,d.useState)(!1),[a,o]=(0,d.useState)(``);if(!e)return null;let s=()=>{let e=a.trim();e&&(t(`edit`,e),i(!1),o(``))};return(0,h.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg p-3 max-w-3xl mx-auto bg-(--bg-secondary) space-y-3 shadow-sm`,children:[(0,h.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,h.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-primary)`,children:V(`reflectReviewTitle`)}),(0,h.jsx)(fd,{className:`text-[11px] bg-(--accent-purple-bg) text-accent-purple`,children:V(`reflectReviewStatus`)})]}),(0,h.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[12px] text-(--text-muted)`,children:[(0,h.jsxs)(`span`,{children:[V(`reflectScope`),`: `,e.scope||`project`]}),(0,h.jsxs)(`span`,{children:[V(`reflectConfidence`),`: `,vd(e.confidence)]})]})]})}),(0,h.jsxs)(`div`,{className:`space-y-1`,children:[(0,h.jsxs)(`div`,{className:`text-[14px] font-medium text-(--text-primary) break-words`,children:[`/`,e.name||`reflected-skill`]}),e.description&&(0,h.jsx)(`p`,{className:`text-[13px] leading-relaxed text-(--text-secondary)`,children:e.description}),e.targetPath&&(0,h.jsx)(`p`,{className:`text-[12px] font-mono break-all text-(--text-muted)`,children:e.targetPath})]}),e.content&&(0,h.jsx)(`pre`,{className:`max-h-56 overflow-auto rounded-md border border-(--border-default) bg-(--bg-primary) p-3 text-[12px] leading-relaxed text-(--text-secondary) whitespace-pre-wrap`,children:e.content}),r&&(0,h.jsx)(pd,{value:a,onChange:e=>o(e.target.value),placeholder:V(`reflectEditPlaceholder`),className:`min-h-[68px] text-[13px]`,autoFocus:!0}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,h.jsx)(pu,{variant:`destructive`,size:`xs`,disabled:n,onClick:()=>t(`reject`),children:V(`reflectReject`)}),(0,h.jsx)(pu,{variant:`outline`,size:`xs`,disabled:n||r&&!a.trim(),onClick:()=>r?s():i(!0),children:V(r?`reflectSubmitFeedback`:`reflectEdit`)}),(0,h.jsx)(pu,{size:`xs`,disabled:n,onClick:()=>t(`approve`),children:V(`reflectApprove`)})]})]})}var Q={running:{icon:Vl,className:`border-(--accent-cyan)/30 bg-(--accent-cyan-bg) text-(--accent-cyan)`,iconClassName:`animate-spin`},done:{icon:Nl,className:`border-(--accent-green)/30 bg-(--accent-green-bg) text-(--accent-green)`,iconClassName:``},error:{icon:Pl,className:`border-(--accent-red)/30 bg-(--accent-red-bg) text-(--accent-red)`,iconClassName:``}};function bd({activities:e=[]}){let t=e.slice(0,3);return t.length?(0,h.jsx)(`div`,{className:`mb-2 flex flex-wrap items-center justify-center gap-2`,children:t.map(e=>{let t=Q[e.status]||Q.done,n=t.icon;return(0,h.jsxs)(`div`,{className:B(`inline-flex max-w-full items-center gap-1.5 rounded-full border px-2.5 py-1 text-[12px] leading-none shadow-sm`,t.className),children:[(0,h.jsx)(`span`,{className:`shrink-0`,"aria-hidden":`true`,children:e.emoji}),(0,h.jsx)(n,{size:13,className:B(`shrink-0`,t.iconClassName)}),(0,h.jsx)(`span`,{className:`truncate text-(--text-primary)`,children:e.label}),e.detail&&(0,h.jsx)(`span`,{className:`max-w-[180px] truncate text-(--text-muted)`,children:e.detail})]},e.id)})}):null}var xd=(0,d.lazy)(()=>Lu(()=>import(`./CodeWikiPanel-Dqup5Sen.js`).then(e=>({default:e.CodeWikiPanel})),__vite__mapDeps([8,1,0,2,3,4,5,6,7,9]))),Sd=(0,d.lazy)(()=>Lu(()=>import(`./ConfigDialog-DTehAh2r.js`).then(e=>({default:e.ConfigDialog})),__vite__mapDeps([10,1,11,4,12]))),Cd=(0,d.lazy)(()=>Lu(()=>import(`./ProjectSelector-CgJDcTNL.js`).then(e=>({default:e.ProjectSelector})),__vite__mapDeps([13,1,11,4,12]))),wd=(0,d.lazy)(()=>Lu(()=>import(`./SkillDialog-D1J46nMC.js`).then(e=>({default:e.SkillDialog})),__vite__mapDeps([14,1,11,4,12,6,15,7]))),Td=(0,d.lazy)(()=>Lu(()=>import(`./MemoryDialog-DJqtWamU.js`).then(e=>({default:e.MemoryDialog})),__vite__mapDeps([16,1,11,4,6,9,7]))),Ed=(0,d.lazy)(()=>Lu(()=>import(`./SoulDialog-DIqK4utD.js`).then(e=>({default:e.SoulDialog})),__vite__mapDeps([17,1,11,4,15,7]))),Dd=(0,d.lazy)(()=>Lu(()=>import(`./AboutDialog-dFkTshay.js`).then(e=>({default:e.AboutDialog})),__vite__mapDeps([18,4,1]))),Od=(0,d.lazy)(()=>Lu(()=>import(`./GitDiffDialog-D4uMixee.js`).then(e=>({default:e.GitDiffDialog})),__vite__mapDeps([19,1,2,3,4]))),kd=(0,d.memo)(Nu),Ad=(0,d.memo)(Qu),jd=(0,d.memo)(id);function Md(e,t=!1){if(t)return V(`generalChat`);let n=String(e||``).trim();return!n||n===`unknown`?V(`unknownProject`):n.split(/[/\\]/).filter(Boolean).pop()||n}function $(e=[],t=``,n=``,r=!1){let i=new Map,a=(e,t=!1)=>{let n=String(e||``).trim();!n||n===`unknown`||i.has(n)||i.set(n,{dir:n,label:Md(n,t),isGeneral:!!t})};for(let t of e||[])a(t?.projectDir,t?.isGeneral);return a(t,!1),a(n,r),Array.from(i.values())}function Nd({size:e=14,className:t,...n}){return(0,h.jsx)(`svg`,{viewBox:`0 0 24 24`,width:e,height:e,fill:`currentColor`,"aria-hidden":`true`,className:t,...n,children:(0,h.jsx)(`path`,{d:`M12 .5C5.65.5.5 5.65.5 12c0 5.09 3.29 9.4 7.86 10.93.58.1.79-.25.79-.56v-2.18c-3.2.69-3.87-1.36-3.87-1.36-.52-1.33-1.28-1.68-1.28-1.68-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.76 2.7 1.25 3.36.96.1-.75.4-1.25.73-1.54-2.55-.29-5.23-1.27-5.23-5.67 0-1.25.45-2.27 1.18-3.07-.12-.29-.51-1.46.11-3.03 0 0 .97-.31 3.16 1.17A10.98 10.98 0 0 1 12 6.07c.98 0 1.96.13 2.88.39 2.19-1.48 3.15-1.17 3.15-1.17.63 1.57.24 2.74.12 3.03.74.8 1.18 1.82 1.18 3.07 0 4.41-2.69 5.38-5.25 5.66.42.36.78 1.06.78 2.14v3.18c0 .31.21.67.8.56A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z`})})}var Pd=class extends d.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}render(){return this.state.error?(0,h.jsxs)(`div`,{style:{padding:32,color:`#d84f4f`,fontFamily:`monospace`,fontSize:13},children:[(0,h.jsx)(`p`,{style:{fontWeight:600,marginBottom:8},children:V(`renderError`)}),(0,h.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`,opacity:.8},children:this.state.error?.message||String(this.state.error)}),(0,h.jsx)(`button`,{onClick:()=>this.setState({error:null}),style:{marginTop:12,padding:`6px 16px`,borderRadius:6,border:`1px solid #d84f4f`,background:`transparent`,color:`#d84f4f`,cursor:`pointer`},children:V(`retry`)})]}):this.props.children}};function Fd(){let{state:e,actions:t}=ml(),n=(e.runtimeState||{}).sessionId,r=(0,d.useCallback)(()=>t.setConfigOpen(!0),[t]),i=(0,d.useCallback)(()=>t.setSkillsOpen(!0),[t]),a=(0,d.useCallback)(()=>t.setMemoryOpen(!0),[t]),o=(0,d.useCallback)(()=>t.setSoulsOpen(!0),[t]),s=(0,d.useCallback)(()=>t.setAboutOpen(!0),[t]),c=(0,d.useCallback)(()=>t.setProjectOpen(!0),[t]),l=(0,d.useMemo)(()=>$(e.sessions,``,e.runtimeState?.cwd,e.isGeneral),[e.sessions,e.runtimeState?.cwd,e.isGeneral]),u=(0,d.useMemo)(()=>l.map(e=>e.dir),[l]);return(0,h.jsxs)(`div`,{className:`flex h-screen bg-(--bg-primary) text-(--text-primary)`,children:[(0,h.jsx)(kd,{sessions:e.sessions,sessionsLoading:e.sessionsLoading,currentSessionId:n,onNewSession:t.newSession,onSwitchSession:t.switchSession,onToggleTheme:t.toggleTheme,onSetTheme:t.setTheme,onOpenSettings:r,onOpenSkills:i,onOpenMemory:a,onOpenSouls:o,onOpenAbout:s,gitBatch:e.gitBatch,versionInfo:e.versionInfo,onUpdate:t.runUpdate,updateStatus:e.updateStatus,currentView:e.currentView,onSwitchView:t.switchView,onOpenProject:t.openProject,onDeleteSession:t.deleteSession}),(0,h.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 bg-(--bg-secondary)`,children:e.currentView===`codewiki`?(0,h.jsx)(d.Suspense,{fallback:null,children:(0,h.jsx)(xd,{projectCwd:e.codewikiProjectPath?.split(/[/\\]/).pop()||e.projectCwd,projectKey:e.codewikiProjectPath||e.runtimeState?.cwd||e.projectCwd||``,busy:e.busy,planSteps:e.planSteps,stageLabel:e.stageLabel,generationStatus:e.codewikiGeneration})}):(0,h.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 bg-(--bg-primary) rounded-[18px] shadow-[inset_0_0_0_1px_var(--panel-edge)] relative overflow-hidden my-1 mx-1`,children:[(0,h.jsx)(`div`,{className:`flex items-center justify-between h-[52px] px-5 shrink-0`,children:(0,h.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,h.jsx)(`span`,{className:`font-medium text-[14px] text-(--text-primary) truncate`,children:e.isGeneral?V(`generalChat`):e.projectCwd||`qurio-coder`}),e.gitInfo?.isGit&&(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12px] text-(--text-muted) shrink-0`,children:[(0,h.jsx)(Nd,{size:13}),(0,h.jsx)(`span`,{children:e.gitInfo.branch})]}),e.gitInfo?.isGit&&e.gitInfo?.dirty&&(0,h.jsx)(`button`,{onClick:()=>t.setGitDiffOpen(!0),className:`inline-flex items-center gap-1 text-[12px] text-(--text-muted) shrink-0 border-0 bg-transparent cursor-pointer hover:text-(--text-primary) p-0`,children:(0,h.jsx)(q,{size:13})})]})}),e.planSteps?.length>0&&!e.pendingPlanApproval&&(0,h.jsx)(`div`,{className:`px-4`,children:(0,h.jsx)(gd,{steps:e.planSteps})}),(0,h.jsx)(Hu,{messages:e.messages,projectCwd:e.projectCwd,skills:e.skills,gitInfo:e.gitInfo,messagesLoading:e.messagesLoading,isGeneral:e.isGeneral}),(0,h.jsxs)(`div`,{className:`w-[min(980px,calc(100%-64px))] mx-auto mb-4 shrink-0 z-30 bg-transparent relative`,children:[(0,h.jsx)(bd,{activities:e.runtimeActivities}),e.pendingPlanApproval&&(0,h.jsx)(`div`,{className:`mb-3`,children:(0,h.jsx)(_d,{plan:e.pendingPlanApproval,onAction:t.approvePlan,disabled:e.busy})}),e.pendingReflectApproval&&(0,h.jsx)(`div`,{className:`mb-3`,children:(0,h.jsx)(yd,{draft:e.pendingReflectApproval,onAction:t.approveReflect,disabled:e.busy})}),(0,h.jsx)(Ad,{onSubmit:t.submit,onAbort:t.abort,busy:e.busy,disabled:!!e.pendingPlanApproval||!!e.pendingReflectApproval,disabledReason:e.pendingReflectApproval?V(`reflectReviewFirst`):V(`planReviewFirst`),runtimeState:e.runtimeState,history:e.history,onOpenProject:c,projectCwd:e.projectCwd}),(0,h.jsxs)(`div`,{className:`flex items-center gap-3 pt-2 px-3 min-h-[28px] overflow-hidden`,children:[e.versionInfo?.current&&(0,h.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-(--text-muted) shrink-0`,children:[(0,h.jsx)(`span`,{className:`inline-flex h-3 w-3.5 items-center justify-center rounded-[3px] bg-black text-white dark:bg-white dark:text-black`,children:(0,h.jsx)(ru,{size:12,strokeWidth:2.5})}),`Codemini CLI@`,e.versionInfo.current]}),(0,h.jsx)(jd,{runtimeState:e.runtimeState,live:e.live,stageLabel:e.stageLabel})]})]})]})}),(0,h.jsx)(ud,{request:e.approvalRequest,open:!!e.approvalRequest,onDecision:t.approve}),(0,h.jsxs)(d.Suspense,{fallback:null,children:[e.configOpen&&(0,h.jsx)(Sd,{open:e.configOpen,onOpenChange:t.setConfigOpen,status:e.configStatus,onSaved:t.refreshConfigStatus}),e.skillsOpen&&(0,h.jsx)(wd,{open:e.skillsOpen,onOpenChange:t.setSkillsOpen,projectDirs:u,projectTargets:l}),e.memoryOpen&&(0,h.jsx)(Td,{open:e.memoryOpen,onOpenChange:t.setMemoryOpen,projectDirs:u}),e.soulsOpen&&(0,h.jsx)(Ed,{open:e.soulsOpen,onOpenChange:t.setSoulsOpen}),e.aboutOpen&&(0,h.jsx)(Dd,{open:e.aboutOpen,onOpenChange:t.setAboutOpen,version:e.versionInfo?.current}),e.gitDiffOpen&&(0,h.jsx)(Od,{open:e.gitDiffOpen,onOpenChange:t.setGitDiffOpen}),e.projectOpen&&(0,h.jsx)(Cd,{open:e.projectOpen,onOpenChange:t.setProjectOpen,onOpenProject:t.openProject})]})]})}function Id(){return(0,h.jsx)(Pd,{children:(0,h.jsx)(Ss,{children:(0,h.jsx)(pl,{children:(0,h.jsx)(Fd,{})})})})}(0,xs.createRoot)(document.getElementById(`root`)).render((0,h.jsx)(Id,{}));export{Dc as $,jl as A,k as At,mc as B,J as C,Ne as Ct,Pl as D,le as Dt,Il as E,pe as Et,Cc as F,m as Ft,$s as G,Tc as H,ac as I,lc as J,gc as K,uc as L,Dl as M,D as Mt,wl as N,T as Nt,Nl as O,j as Ot,G as P,g as Pt,_c as Q,bc as R,Vl as S,Ke as St,Ll as T,me as Tt,Ec as U,Sc as V,Js as W,yc as X,cc as Y,vc as Z,ru as _,Pa as _t,Cu as a,nc as at,Xl as b,an as bt,_u as c,xc as ct,bu as d,Ts as dt,dc as et,pu as f,ws as ft,au as g,Ia as gt,su as h,La as ht,Lu as i,ec as it,Ol as j,re as jt,Ml as k,ae as kt,yu as l,V as lt,cu as m,Fa as mt,pd as n,Oc as nt,Su as o,fc as ot,ou as p,B as pt,Zs as q,fd as r,hc as rt,mu as s,pc as st,md as t,Xs as tt,vu as u,Cs as ut,tu as v,va as vt,Rl as w,Se as wt,ql as x,Je as xt,Ql as y,mn as yt,kc as z};