blade-code 0.10.12 → 0.10.13

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 (45) hide show
  1. package/dist/blade.js +2 -2
  2. package/dist/{chunk-cscm57tr.js → chunk-097zrzyy.js} +1 -1
  3. package/dist/{chunk-2wkt2w3f.js → chunk-0q7pvmvz.js} +1 -1
  4. package/dist/{chunk-2mmbqha8.js → chunk-45wpygt9.js} +1 -1
  5. package/dist/{chunk-vwwf7p7x.js → chunk-4em4jxj5.js} +1 -1
  6. package/dist/{chunk-86shv4yp.js → chunk-5vgjhqk9.js} +1 -1
  7. package/dist/{chunk-pz21tcah.js → chunk-5wnxafpf.js} +1 -1
  8. package/dist/{chunk-tadbcnwr.js → chunk-74wm5qnw.js} +1 -1
  9. package/dist/{chunk-zd3qxc5p.js → chunk-7s99zkve.js} +1 -1
  10. package/dist/{chunk-p5zstj8j.js → chunk-820ek28g.js} +1 -1
  11. package/dist/{chunk-4faz5tkt.js → chunk-8p5a371t.js} +1 -1
  12. package/dist/{chunk-vszmbnjh.js → chunk-8yypkbew.js} +1 -1
  13. package/dist/{chunk-e65vyfj7.js → chunk-97fyx4hr.js} +1 -1
  14. package/dist/{chunk-pmvfkre2.js → chunk-9ac3eajy.js} +1 -1
  15. package/dist/{chunk-vpz57h5x.js → chunk-a3mwn9zj.js} +1 -1
  16. package/dist/{chunk-86w8fd67.js → chunk-ab4sp3m4.js} +2 -2
  17. package/dist/{chunk-9e8fyt60.js → chunk-c477j84k.js} +1 -1
  18. package/dist/{chunk-jh4571hm.js → chunk-c9m16hqc.js} +1 -1
  19. package/dist/{chunk-evn886hs.js → chunk-cx0tdprs.js} +1 -1
  20. package/dist/{chunk-eqr25kxv.js → chunk-cy6emyt9.js} +1 -1
  21. package/dist/{chunk-vdgskayb.js → chunk-hf3dwmfa.js} +1 -1
  22. package/dist/{chunk-k7caqeew.js → chunk-j4rfyz81.js} +1 -1
  23. package/dist/{chunk-670th5hb.js → chunk-j8fkhkan.js} +1 -1
  24. package/dist/{chunk-63rg3mhn.js → chunk-k653znk8.js} +1 -1
  25. package/dist/{chunk-y2j96b3t.js → chunk-ke4n1nv5.js} +1 -1
  26. package/dist/{chunk-e2s6czgg.js → chunk-kfgv64hg.js} +1 -1
  27. package/dist/chunk-m6sg36pw.js +1 -0
  28. package/dist/{chunk-04wd6zez.js → chunk-nsxkd8bq.js} +1 -1
  29. package/dist/{chunk-pqgw6t9b.js → chunk-nysyp11q.js} +3 -3
  30. package/dist/{chunk-21zwc98r.js → chunk-p42cz164.js} +1 -1
  31. package/dist/{chunk-hb8krnp5.js → chunk-pmz455nq.js} +1 -1
  32. package/dist/{chunk-95zwz4q8.js → chunk-x9t4ryyf.js} +1 -1
  33. package/dist/{chunk-z24sj1r8.js → chunk-xjyctv33.js} +1 -1
  34. package/dist/{chunk-vaxcmm72.js → chunk-zgg0y0sy.js} +1 -1
  35. package/dist/web/assets/{ChatView-DG6MMrFK.js → ChatView-ucu62nNl.js} +6 -6
  36. package/dist/web/assets/{CodeBlockHighlighter-Cf3DBUGk.js → CodeBlockHighlighter-GS19h8wb.js} +1 -1
  37. package/dist/web/assets/{FilePreview-LvuYnyjv.js → FilePreview-BIjFuDdg.js} +1 -1
  38. package/dist/web/assets/{MarkdownRenderer-CkSbe36j.js → MarkdownRenderer-D-NrQgb1.js} +3 -3
  39. package/dist/web/assets/{SettingsModal-DBsb7E9J.js → SettingsModal-BNz9vyER.js} +1 -1
  40. package/dist/web/assets/{TaskSwitcher-Z0KWY8g9.js → TaskSwitcher-HnRA3Mj8.js} +1 -1
  41. package/dist/web/assets/{TerminalPanel-DVWTlxtd.js → TerminalPanel-Df2CK9n_.js} +1 -1
  42. package/dist/web/assets/{index-DWtXGF3o.js → index-DWTihvUI.js} +3 -3
  43. package/dist/web/index.html +1 -1
  44. package/package.json +1 -1
  45. package/dist/chunk-14rzj7js.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SettingsModal-DBsb7E9J.js","assets/vendor-react-DG5dkZ_t.js","assets/vendor-radix-DXRuAJHH.js","assets/vendor-icons-ICv1v-tf.js","assets/TaskSwitcher-Z0KWY8g9.js","assets/FilePreview-LvuYnyjv.js","assets/TerminalPanel-DVWTlxtd.js","assets/vendor-xterm-DuYZoU4T.js","assets/vendor-xterm-9CEnUXvW.css","assets/ChatView-DG6MMrFK.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SettingsModal-BNz9vyER.js","assets/vendor-react-DG5dkZ_t.js","assets/vendor-radix-DXRuAJHH.js","assets/vendor-icons-ICv1v-tf.js","assets/TaskSwitcher-HnRA3Mj8.js","assets/FilePreview-BIjFuDdg.js","assets/TerminalPanel-Df2CK9n_.js","assets/vendor-xterm-DuYZoU4T.js","assets/vendor-xterm-9CEnUXvW.css","assets/ChatView-ucu62nNl.js"])))=>i.map(i=>d[i]);
2
2
  var Yy=Object.defineProperty;var Xy=(e,t,n)=>t in e?Yy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ja=(e,t,n)=>Xy(e,typeof t!="symbol"?t+"":t,n);import{r as w,j as c,c as oo,d as Zy}from"./vendor-react-DG5dkZ_t.js";import{S as eS,O as Af,P as tS,C as Ef,a as nS,T as Pf,D as Nf,R as rS,b as Of,V as sS,c as oS,d as $f,e as iS,f as aS,g as Rf,h as cS,i as lS}from"./vendor-radix-DXRuAJHH.js";import{X as co,H as Su,L as lt,F as dS,R as Qi,A as Mf,a as lo,D as Ff,b as uS,c as Oi,d as fS,e as uo,G as el,T as Df,C as _f,f as As,S as tl,M as mS,g as pS,P as gS,h as Lf,i as nl,j as Uf,k as rl,l as hS,m as bS,n as kS,o as Bf,p as xS,q as yS,r as Hf,s as wu,t as SS,u as wS,v as qf,w as vS,I as IS,x as vu,y as Ss,B as CS,z as jS,E as TS,W as Iu,J as AS,K as ES,N as PS,O as NS,Q as OS,U as Cu,V as ju}from"./vendor-icons-ICv1v-tf.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();const $S="modulepreload",RS=function(e){return"/"+e},Tu={},Io=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));s=Promise.allSettled(n.map(l=>{if(l=RS(l),l in Tu)return;Tu[l]=!0;const d=l.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${m}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":$S,d||(p.as="script"),p.crossOrigin="",p.href=l,a&&p.setAttribute("nonce",a),document.head.appendChild(p),d)return new Promise((g,x)=>{p.addEventListener("load",g),p.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return s.then(i=>{for(const a of i||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};function zf(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=zf(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Kf(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=zf(e))&&(r&&(r+=" "),r+=t);return r}const Au=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Eu=Kf,MS=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Eu(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(d=>{const m=n==null?void 0:n[d],p=o==null?void 0:o[d];if(m===null)return null;const g=Au(m)||Au(p);return s[d][g]}),a=n&&Object.entries(n).reduce((d,m)=>{let[p,g]=m;return g===void 0||(d[p]=g),d},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,m)=>{let{class:p,className:g,...x}=m;return Object.entries(x).every(b=>{let[y,j]=b;return Array.isArray(j)?j.includes({...o,...a}[y]):{...o,...a}[y]===j})?[...d,p,g]:d},[]);return Eu(e,i,l,n==null?void 0:n.class,n==null?void 0:n.className)},sl="-",FS=e=>{const t=_S(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(sl);return a[0]===""&&a.length!==1&&a.shift(),Gf(a,t)||DS(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},Gf=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?Gf(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(sl);return(i=t.validators.find(({validator:a})=>a(o)))==null?void 0:i.classGroupId},Pu=/^\[(.+)\]$/,DS=e=>{if(Pu.test(e)){const t=Pu.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},_S=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return US(Object.entries(e.classGroups),n).forEach(([o,i])=>{gc(i,r,o,t)}),r},gc=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:Nu(t,s);o.classGroupId=n;return}if(typeof s=="function"){if(LS(s)){gc(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([o,i])=>{gc(i,Nu(t,o),n,r)})})},Nu=(e,t)=>{let n=e;return t.split(sl).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},LS=e=>e.isThemeGetter,US=(e,t)=>t?e.map(([n,r])=>{const s=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,a])=>[t+i,a])):o);return[n,s]}):e,BS=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(o,i)=>{n.set(o,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let i=n.get(o);if(i!==void 0)return i;if((i=r.get(o))!==void 0)return s(o,i),i},set(o,i){n.has(o)?n.set(o,i):s(o,i)}}},Vf="!",HS=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],o=t.length,i=a=>{const l=[];let d=0,m=0,p;for(let j=0;j<a.length;j++){let k=a[j];if(d===0){if(k===s&&(r||a.slice(j,j+o)===t)){l.push(a.slice(m,j)),m=j+o;continue}if(k==="/"){p=j;continue}}k==="["?d++:k==="]"&&d--}const g=l.length===0?a:a.substring(m),x=g.startsWith(Vf),b=x?g.substring(1):g,y=p&&p>m?p-m:void 0;return{modifiers:l,hasImportantModifier:x,baseClassName:b,maybePostfixModifierPosition:y}};return n?a=>n({className:a,parseClassName:i}):i},qS=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},zS=e=>({cache:BS(e.cacheSize),parseClassName:HS(e),...FS(e)}),KS=/\s+/,GS=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(KS);let a="";for(let l=i.length-1;l>=0;l-=1){const d=i[l],{modifiers:m,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:x}=n(d);let b=!!x,y=r(b?g.substring(0,x):g);if(!y){if(!b){a=d+(a.length>0?" "+a:a);continue}if(y=r(g),!y){a=d+(a.length>0?" "+a:a);continue}b=!1}const j=qS(m).join(":"),k=p?j+Vf:j,A=k+y;if(o.includes(A))continue;o.push(A);const N=s(y,b);for(let $=0;$<N.length;++$){const Q=N[$];o.push(k+Q)}a=d+(a.length>0?" "+a:a)}return a};function VS(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Wf(t))&&(r&&(r+=" "),r+=n);return r}const Wf=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Wf(e[r]))&&(n&&(n+=" "),n+=t);return n};function WS(e,...t){let n,r,s,o=i;function i(l){const d=t.reduce((m,p)=>p(m),e());return n=zS(d),r=n.cache.get,s=n.cache.set,o=a,a(l)}function a(l){const d=r(l);if(d)return d;const m=GS(l,n);return s(l,m),m}return function(){return o(VS.apply(null,arguments))}}const Je=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Jf=/^\[(?:([a-z-]+):)?(.+)\]$/i,JS=/^\d+\/\d+$/,QS=new Set(["px","full","screen"]),YS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,XS=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ZS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,e0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,t0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Kn=e=>js(e)||QS.has(e)||JS.test(e),ur=e=>Ps(e,"length",l0),js=e=>!!e&&!Number.isNaN(Number(e)),Qa=e=>Ps(e,"number",js),eo=e=>!!e&&Number.isInteger(Number(e)),n0=e=>e.endsWith("%")&&js(e.slice(0,-1)),le=e=>Jf.test(e),fr=e=>YS.test(e),r0=new Set(["length","size","percentage"]),s0=e=>Ps(e,r0,Qf),o0=e=>Ps(e,"position",Qf),i0=new Set(["image","url"]),a0=e=>Ps(e,i0,u0),c0=e=>Ps(e,"",d0),to=()=>!0,Ps=(e,t,n)=>{const r=Jf.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},l0=e=>XS.test(e)&&!ZS.test(e),Qf=()=>!1,d0=e=>e0.test(e),u0=e=>t0.test(e),f0=()=>{const e=Je("colors"),t=Je("spacing"),n=Je("blur"),r=Je("brightness"),s=Je("borderColor"),o=Je("borderRadius"),i=Je("borderSpacing"),a=Je("borderWidth"),l=Je("contrast"),d=Je("grayscale"),m=Je("hueRotate"),p=Je("invert"),g=Je("gap"),x=Je("gradientColorStops"),b=Je("gradientColorStopPositions"),y=Je("inset"),j=Je("margin"),k=Je("opacity"),A=Je("padding"),N=Je("saturate"),$=Je("scale"),Q=Je("sepia"),T=Je("skew"),C=Je("space"),O=Je("translate"),R=()=>["auto","contain","none"],K=()=>["auto","hidden","clip","visible","scroll"],X=()=>["auto",le,t],P=()=>[le,t],B=()=>["",Kn,ur],M=()=>["auto",js,le],fe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ve=()=>["solid","dashed","dotted","double","none"],ke=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>["start","end","center","between","around","evenly","stretch"],Fe=()=>["","0",le],F=()=>["auto","avoid","all","avoid-page","page","left","right","column"],me=()=>[js,le];return{cacheSize:500,separator:":",theme:{colors:[to],spacing:[Kn,ur],blur:["none","",fr,le],brightness:me(),borderColor:[e],borderRadius:["none","","full",fr,le],borderSpacing:P(),borderWidth:B(),contrast:me(),grayscale:Fe(),hueRotate:me(),invert:Fe(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[n0,ur],inset:X(),margin:X(),opacity:me(),padding:P(),saturate:me(),scale:me(),sepia:Fe(),skew:me(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",le]}],container:["container"],columns:[{columns:[fr]}],"break-after":[{"break-after":F()}],"break-before":[{"break-before":F()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...fe(),le]}],overflow:[{overflow:K()}],"overflow-x":[{"overflow-x":K()}],"overflow-y":[{"overflow-y":K()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",eo,le]}],basis:[{basis:X()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",le]}],grow:[{grow:Fe()}],shrink:[{shrink:Fe()}],order:[{order:["first","last","none",eo,le]}],"grid-cols":[{"grid-cols":[to]}],"col-start-end":[{col:["auto",{span:["full",eo,le]},le]}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":[to]}],"row-start-end":[{row:["auto",{span:[eo,le]},le]}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",le]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",le]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...ce()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ce(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ce(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[A]}],px:[{px:[A]}],py:[{py:[A]}],ps:[{ps:[A]}],pe:[{pe:[A]}],pt:[{pt:[A]}],pr:[{pr:[A]}],pb:[{pb:[A]}],pl:[{pl:[A]}],m:[{m:[j]}],mx:[{mx:[j]}],my:[{my:[j]}],ms:[{ms:[j]}],me:[{me:[j]}],mt:[{mt:[j]}],mr:[{mr:[j]}],mb:[{mb:[j]}],ml:[{ml:[j]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",le,t]}],"min-w":[{"min-w":[le,t,"min","max","fit"]}],"max-w":[{"max-w":[le,t,"none","full","min","max","fit","prose",{screen:[fr]},fr]}],h:[{h:[le,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[le,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[le,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[le,t,"auto","min","max","fit"]}],"font-size":[{text:["base",fr,ur]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Qa]}],"font-family":[{font:[to]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",le]}],"line-clamp":[{"line-clamp":["none",js,Qa]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Kn,le]}],"list-image":[{"list-image":["none",le]}],"list-style-type":[{list:["none","disc","decimal",le]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ve(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Kn,ur]}],"underline-offset":[{"underline-offset":["auto",Kn,le]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...fe(),o0]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",s0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},a0]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...ve(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:ve()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...ve()]}],"outline-offset":[{"outline-offset":[Kn,le]}],"outline-w":[{outline:[Kn,ur]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Kn,ur]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",fr,c0]}],"shadow-color":[{shadow:[to]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...ke(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ke()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",fr,le]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[p]}],saturate:[{saturate:[N]}],sepia:[{sepia:[Q]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[Q]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",le]}],duration:[{duration:me()}],ease:[{ease:["linear","in","out","in-out",le]}],delay:[{delay:me()}],animate:[{animate:["none","spin","ping","pulse","bounce",le]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[$]}],"scale-x":[{"scale-x":[$]}],"scale-y":[{"scale-y":[$]}],rotate:[{rotate:[eo,le]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",le]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",le]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",le]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Kn,ur,Qa]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},m0=WS(f0);function W(...e){return m0(Kf(e))}const p0=MS("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),br=w.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},o)=>{const i=r?eS:"button";return c.jsx(i,{className:W(p0({variant:t,size:n,className:e})),ref:o,...s})});br.displayName="Button";const ol=rS,g0=tS,Yf=w.forwardRef(({className:e,...t},n)=>c.jsx(Af,{ref:n,className:W("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Yf.displayName=Af.displayName;const Yi=w.forwardRef(({className:e,children:t,hideCloseButton:n,...r},s)=>c.jsxs(g0,{children:[c.jsx(Yf,{}),c.jsxs(Ef,{ref:s,"aria-modal":"true",className:W("fixed left-[50%] top-[50%] z-50 grid max-h-[calc(100dvh-24px)] w-[calc(100vw-24px)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,!n&&c.jsxs(nS,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[c.jsx(co,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Yi.displayName=Ef.displayName;const il=({className:e,...t})=>c.jsx("div",{className:W("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});il.displayName="DialogHeader";const Xf=({className:e,...t})=>c.jsx("div",{className:W("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Xf.displayName="DialogFooter";const Xi=w.forwardRef(({className:e,...t},n)=>c.jsx(Pf,{ref:n,className:W("text-lg font-semibold leading-none tracking-tight",e),...t}));Xi.displayName=Pf.displayName;const Zi=w.forwardRef(({className:e,...t},n)=>c.jsx(Nf,{ref:n,className:W("text-sm text-muted-foreground",e),...t}));Zi.displayName=Nf.displayName;const h0={"app.restoring":"Restoring workspace…","layout.workspace.pathAria":"Workspace path","layout.workspace.empty":"No workspace","layout.action.rewind":"Rewind session","layout.action.filePreview":"File preview","layout.action.filePreviewToggle":"Toggle file preview","layout.action.openNavigation":"Open navigation","terminal.title":"Terminal","terminal.status.connected":"Terminal connected","terminal.status.disconnected":"Terminal disconnected","terminal.action.minimize":"Minimize terminal","terminal.action.restore":"Restore terminal","terminal.action.close":"Close terminal","sidebar.brand.badge":"WEB","sidebar.action.collapse":"Collapse sidebar","sidebar.action.expand":"Expand sidebar","sidebar.navigationAria":"Task navigation","sidebar.action.newTask":"New Task","sidebar.action.newTaskShort":"New task","sidebar.action.terminal":"Terminal","sidebar.action.terminalToggle":"Toggle terminal","sidebar.action.searchTasks":"Search tasks","sidebar.unreadTasks":"{count} unread tasks","sidebar.section.skills":"Skills","sidebar.section.mcp":"MCP","sidebar.section.settings":"Settings","sidebar.status.user":"User","sidebar.status.feedLive":"Task feed live","sidebar.status.feedOffline":"Task feed offline","sidebar.empty.title":"No tasks yet","sidebar.empty.hint":"Dispatch one from the home view","sidebar.group.running":"RUNNING","sidebar.group.queued":"QUEUED","sidebar.group.interrupted":"INTERRUPTED","sidebar.group.failed":"FAILED","sidebar.group.cancelled":"CANCELLED","sidebar.group.done":"DONE","sidebar.group.showMore":"Show {count} more","sidebar.group.showLess":"Show less","sidebar.view.project":"Projects","sidebar.view.status":"Status","sidebar.view.projectAria":"Group sessions by project","sidebar.view.statusAria":"Group sessions by status","sidebar.project.active":"active","sidebar.project.expand":"Expand {name}","sidebar.project.collapse":"Collapse {name}","sidebar.project.newTask":"New task in {name}","sidebar.project.reorder":"Reorder {name}, position {position} of {count}","sidebar.project.reorderHint":"Drag to reorder, or use Up and Down arrow keys","sidebar.project.reordered":"Moved {name} to position {position}","sidebar.project.projects":"Projects","sidebar.catalog.syncing":"Syncing task history…","sidebar.catalog.loaded":"{count} loaded","sidebar.catalog.incomplete":"Task history is incomplete","sidebar.catalog.retry":"Retry","projects.dialog.title":"Projects","projects.dialog.description":"Bind local folders to switch task context without restarting Blade.","projects.bind.placeholder":"/absolute/path/to/project","projects.bind.pathLabel":"Project path","projects.bind.action":"Bind","projects.bind.failed":"Failed to bind project","projects.pick.action":"Choose project folder","projects.pick.actionShort":"Choose","projects.pick.picking":"Choosing…","projects.pick.failed":"Failed to choose a project folder","projects.unbind.action":"Unbind project","projects.unavailable":"unavailable","sidebar.language.label":"Language","sidebar.language.aria":"Switch language","sidebar.language.en":"EN","sidebar.language.zh":"中","session.env.worktree":"worktree","session.env.local":"local","session.action.select":"Select {title}","session.action.save":"Save {title}","session.action.cancel":"Cancel {title}","session.action.more":"More actions for {title}","session.action.fork":"Fork {title}","session.action.forkShort":"Fork","session.action.rename":"Rename {title}","session.action.renameShort":"Rename","session.action.archive":"Archive {title}","session.action.archiveShort":"Archive","session.action.export":"Export {title} as Markdown","session.action.exportShort":"Export Markdown","session.action.exportingShort":"Exporting…","session.action.delete":"Delete {title}","session.action.deleteShort":"Delete","session.action.stop":"Stop {title}","session.action.stopping":"Stopping {title}","session.action.retry":"Retry {title}","session.action.retrying":"Retrying {title}","session.reason.cancelledByUser":"Cancelled by user","session.title.codeReview":"Code Review","session.forkedFrom":"Forked from","session.retriedFrom":"Retried from","session.retryShort":"retry","session.queued":"#{position}/{depth} queued","archive.title":"Archive","archive.subtitle":"Stored safely outside the active task list","archive.open":"Open session archive","archive.refresh":"Refresh archived sessions","archive.retry":"Retry","archive.loading":"Loading archive…","archive.empty":"No archived sessions","archive.restore":"Restore {title}","archive.restoreShort":"Restore","archive.restoreAncestor":"Restore the archive root first","archive.inherited":"Archived with {id}","taskSwitcher.title":"Task switcher","taskSwitcher.description":"Search and open tasks across every project.","taskSwitcher.searchAria":"Search tasks","taskSwitcher.placeholder":"Search title, project, branch, status, or session ID…","taskSwitcher.results":"{count} results","taskSwitcher.recent":"Recent tasks","taskSwitcher.scope":"{count} tasks indexed","taskSwitcher.indexing":"Indexing tasks…","taskSwitcher.resultsAria":"Task search results","taskSwitcher.current":"Current","taskSwitcher.unread":"{count} unread","taskSwitcher.needsAction":"{count} need action","taskSwitcher.new":"New","taskSwitcher.empty":"No matching tasks","taskSwitcher.emptyHint":"Try a project, branch, status, or shorter phrase.","taskSwitcher.hint.navigate":"navigate","taskSwitcher.hint.open":"open","taskSwitcher.hint.toggle":"toggle","taskSwitcher.action.failed":"Task action failed","commandCenter.title":"Command center","commandCenter.description":"Search tasks or run workspace and application actions.","commandCenter.searchAria":"Search actions","commandCenter.placeholder":"Search actions, settings, or tools…","commandCenter.modeAria":"Command center mode","commandCenter.mode.tasks":"Tasks","commandCenter.mode.commands":"Actions","commandCenter.actions":"{count} actions","commandCenter.resultsAria":"Action search results","commandCenter.empty":"No matching actions","commandCenter.emptyHint":"Try a tool, panel, or setting name.","commandCenter.action.newTask":"New task","commandCenter.action.newTaskDescription":"Open a clean task composer","commandCenter.action.preview":"Toggle preview","commandCenter.action.previewDescription":"Review files, diffs, and run logs","commandCenter.action.terminal":"Toggle terminal","commandCenter.action.terminalDescription":"Open or close the workspace shell","commandCenter.action.settings":"Open settings","commandCenter.action.settingsDescription":"Configure appearance and behavior","commandCenter.action.models":"Configure models","commandCenter.action.modelsDescription":"Select providers and task models","commandCenter.action.shortcuts":"View keyboard shortcuts","commandCenter.action.shortcutsDescription":"Browse global and contextual keys","commandCenter.action.skills":"Manage skills","commandCenter.action.skillsDescription":"Discover and configure agent capabilities","commandCenter.action.mcp":"Manage MCP servers","commandCenter.action.mcpDescription":"Configure connected tools and servers","commandCenter.action.sidebar":"Toggle sidebar","commandCenter.action.sidebarDescription":"Show or hide project navigation","taskHome.eyebrow":"Task dispatcher · Ready","taskHome.feed.connecting":"Task dispatcher · Connecting","taskHome.feed.reconnecting":"Task dispatcher · Reconnecting","taskHome.feed.offline":"Task dispatcher · Offline","taskHome.feed.offlineDescription":"Live task updates are paused. Running tasks continue on the server.","taskHome.feed.retry":"Reconnect","taskHome.hero.prefix":"What should Blade build in","taskHome.hero.projectFallback":"current workspace","taskHome.hero.subtitle":"Dispatch a task and keep moving. Each task runs in its own worktree, persists state, and returns with a reviewable workspace when it's done.","taskHome.templates.title":"Templates","taskHome.templates.hint":"1–4 to prefill","taskHome.template.explore.title":"Explore","taskHome.template.explore.description":"Trace behavior and explain the system","taskHome.template.explore.hint":"Trace a call · map a module","taskHome.template.build.title":"Build","taskHome.template.build.description":"Implement a production-ready feature","taskHome.template.build.hint":"Ship a feature end-to-end","taskHome.template.review.title":"Review","taskHome.template.review.description":"Find correctness and regression risks","taskHome.template.review.hint":"Audit current changes","taskHome.review.attachmentsUnsupported":"Code review does not accept attachments","taskHome.review.outputSchemaUnsupported":"Code review uses its own structured report schema","taskHome.review.usage":"Usage: /review [uncommitted | base <ref> | commit <sha>]","taskHome.review.running":"Read-only code review in progress","taskHome.review.stale":"Review target changed while the reviewer was running","taskHome.review.aborted":"Code review aborted","taskHome.review.interrupted":"Code review interrupted by process restart","taskHome.review.failed":"Code review failed","taskHome.review.startFailed":"Failed to start code review","taskHome.review.invalidTarget":"The selected review target is invalid or has no changes","taskHome.review.conflict":"This session already has active work","taskHome.template.fix.title":"Fix","taskHome.template.fix.description":"Diagnose and repair a concrete failure","taskHome.template.fix.hint":"Bisect · reproduce · patch","taskHome.context.isolationToggleTitle":"Toggle task isolation","taskHome.context.projectSelect":"Select target project","taskHome.context.isolation.worktree":"Isolated worktree","taskHome.context.isolation.local":"Local workspace","taskHome.context.branchFallback":"no branch","taskHome.context.preparing":"Preparing worktree","taskHome.setup.aria":"Task setup status","taskHome.setup.title":"Finish setup","taskHome.setup.description":"Keep drafting while Blade verifies the workspace and model.","taskHome.setup.workspace.title":"Workspace","taskHome.setup.workspace.loading":"Checking available workspaces…","taskHome.setup.workspace.ready":"{project} selected","taskHome.setup.workspace.required":"Choose an available project","taskHome.setup.workspace.empty":"No project","taskHome.setup.workspace.action":"Choose","taskHome.setup.workspace.retry":"Reload workspaces","taskHome.setup.model.title":"Model","taskHome.setup.model.loading":"Checking configuration…","taskHome.setup.model.ready":"Ready for this task","taskHome.setup.model.required":"Configure or select a model","taskHome.setup.model.action":"Configure","taskHome.setup.model.retry":"Retry","taskHome.composer.placeholder":"Describe the outcome, constraints, and verification you expect...","taskHome.error.dismiss":"Dismiss","taskHome.recent.title":"Recent tasks","taskHome.recent.total":"{count} total","taskHome.recent.partial":"{count} loaded · syncing","taskHome.recent.incomplete":"{count} loaded · history incomplete","taskSwitcher.indexingLoaded":"{count} loaded · syncing history","taskHome.footer.note":"Worktree isolation keeps parallel tasks from touching your active checkout","capacity.title":"{inFlight} running · {queued} queued · max {max}","capacity.suffix.running":" running","capacity.queued":"{queued} queued","recent.status.running":"running","recent.status.queued":"queued","recent.status.paused":"paused","recent.status.failed":"failed","recent.status.cancelled":"cancelled","recent.status.done":"done","recent.time.justNow":"just now","recent.time.minutes":"{n}m ago","recent.time.hours":"{n}h ago","recent.time.days":"{n}d ago","recent.session.fallbackShort":"Session {id}","recent.session.fallbackDated":"Session {y}-{m}-{d} {hh}:{mm}","attention.unreadAnnouncement":"{count} unread task updates","attention.notification.completed":"Task completed","attention.notification.failed":"Task failed","attention.notification.interrupted":"Task interrupted","attention.notification.permission":"Approval required","attention.notification.question":"Answer required","attention.notification.elicitation":"MCP input required","interaction.permission.title":"Permission required: {tool}","interaction.permission.once":"Allow once","interaction.permission.session":"Allow for session","interaction.permission.project":"Allow for project","interaction.permission.deny":"Deny","interaction.permission.failed":"Failed to respond to permission","interaction.question.answered":"Questions answered","interaction.question.other":"Other","interaction.question.submit":"Submit answers","interaction.question.failed":"Failed to submit answers","interaction.elicitation.title":"MCP input requested","interaction.elicitation.submit":"Submit to MCP","interaction.elicitation.open":"Open external URL","interaction.elicitation.decline":"Decline","interaction.elicitation.cancel":"Cancel","interaction.elicitation.responded":"MCP request answered","interaction.elicitation.cancelled":"MCP request cancelled","interaction.elicitation.failed":"Failed to respond to MCP request","interaction.elicitation.warning":"Only continue if you trust this MCP server and understand the request.","interaction.bar.permissionTitle":"Agent needs approval","interaction.bar.permissionHint":"Review the pending tool request before this task can continue.","interaction.bar.questionTitle":"Agent needs your answer","interaction.bar.questionHint":"Answer the pending question before this task can continue.","interaction.bar.elicitationTitle":"MCP server needs your input","interaction.bar.elicitationHint":"Review the MCP request before this task can continue.","interaction.bar.review":"Review request","interaction.badge.permission":"Needs approval","interaction.badge.question":"Needs answer","interaction.badge.elicitation":"MCP input","artifact.env.isolated":"isolated","artifact.env.local":"local","artifact.review":"Review changes","artifact.commits":"{count} commits","artifact.apply":"Apply","artifact.retryApply":"Retry apply","artifact.applying":"Applying","artifact.applied":"Applied","artifact.discard":"Discard task changes","artifact.discarded":"Discarded","artifact.conflict":"The task changes could not be applied safely.","artifact.conflictHint":"The isolated changes are preserved. Review them, resolve the source project, then retry or discard.","artifact.discardDialog.title":"Discard isolated changes?","artifact.discardDialog.description":"Remove {count} changed files from the isolated task workspace for {project}.","artifact.discardDialog.warning":"This permanently removes the task worktree and branch. Your source project is not modified.","artifact.discardDialog.cancel":"Keep changes","artifact.discardDialog.confirm":"Discard changes","chat.list.empty.eyebrow":"Blade · Ready","chat.list.empty.title":"Start a conversation to begin","chat.list.empty.hint":"Ask a question, describe a change, or paste a stack trace.","chat.list.loading.eyebrow":"Conversation history","chat.list.loading.title":"Restoring conversation…","chat.list.loading.hint":"Loading messages, task state, and live updates. Larger conversations may take a moment.","chat.list.showEarlier":"Show {count} earlier messages","chat.list.showEarlierWithRemaining":"Show {count} earlier messages, {remaining} hidden","chat.list.jumpLatest":"Jump to latest","chat.turns.aria":"Jump to a previous message","chat.turns.label":"Turn {n}","chat.timeline.thinking":"Thought process","chat.timeline.tools.runningOne":"Running 1 command","chat.timeline.tools.running":"Running {count} commands","chat.timeline.tools.completedOne":"Executed 1 command","chat.timeline.tools.completed":"Executed {count} commands","chat.timeline.tools.completedOneWithError":"Executed 1 command · failed","chat.timeline.tools.completedWithErrors":"Executed {count} commands · {errors} failed","chat.error.dismiss":"Dismiss error","chat.error.queueFull":"The guidance queue is full. Wait for pending instructions to start, then retry.","chat.error.turnChanged":"The active turn changed before this message was accepted. Review and retry it.","chat.error.title.submission":"Message not sent.","chat.error.title.execution":"Run stopped.","chat.error.title.navigation":"Task not opened.","chat.error.title.generic":"Action failed.","chat.error.action.returnDraft":"Return to draft","chat.error.action.editResend":"Edit and resend","chat.error.action.retryTask":"Retry task","chat.error.action.retryingTask":"Retrying…","chat.error.action.checkModels":"Check model settings","task.failure.authentication":"Provider authentication failed. Check model credentials.","task.failure.permission":"Provider rejected this request. Check account and model permissions.","task.failure.rateLimit":"Provider rate limit or quota exceeded.","task.failure.timeout":"Provider request timed out.","task.failure.network":"Provider connection failed.","task.failure.modelUnavailable":"The selected model is unavailable.","task.failure.contextLimit":"The request exceeded the model context limit.","task.failure.unsupportedInput":"The selected model does not support this input.","task.failure.runtime":"Agent execution failed.","chat.connection.reconnecting":"Reconnecting live updates. The active run continues in the background.","chat.connection.offline":"Live updates are offline. Progress shown here may be stale.","chat.connection.retry":"Reconnect","chat.footer.disclaimer":"Blade can make mistakes. Please check important information.","chat.input.placeholder.default":"Type @ for files, / for commands...","chat.input.placeholder.steering":"Add guidance to steer the active turn...","chat.input.steering.status":"Active turn is steerable","chat.input.steering.queued":"Guidance accepted · {count} pending","chat.input.steering.enterHint":" · Enter sends guidance","chat.input.followUp.queued":"Follow-up accepted · {count} queued for the next turn","chat.input.steering.recoveredOne":"Recovered {count} queued instruction after restart","chat.input.steering.recoveredMany":"Recovered {count} queued instructions after restart","chat.input.attachment.add":"Attach images","chat.input.attachment.remove":"Remove","chat.input.attachment.countLimit":"You can attach up to {count} images.","chat.input.attachment.sizeLimit":"Images must stay under {size} total. Remove an image or choose smaller files.","chat.input.attachment.readFailed":"Blade could not read one of these images.","chat.input.attachment.usage":"{count}/{limit} images · {used} of {budget}","chat.input.attachment.modelUnsupported":"{model} does not support images. Choose a vision model or remove the images.","chat.input.attachment.modelRequired":"Choose a vision-capable model before attaching images.","chat.input.model.placeholder":"Select Model","chat.input.model.empty":"No models configured","chat.input.model.vision":"Vision","chat.input.model.change":"Change model","chat.input.model.locked":"Wait for the active turn to finish before switching models","chat.input.effort.label":"Effort {effort}","chat.input.effort.heading":"Reasoning effort","chat.input.effort.change":"Change reasoning effort","chat.input.effort.locked":"Wait for the active turn to finish before changing reasoning effort","chat.input.effort.option":"Use {effort} reasoning effort","chat.input.effort.autoHint":"near high","chat.input.serviceTier.label":"Speed {tier}","chat.input.serviceTier.heading":"Provider service tier","chat.input.serviceTier.change":"Change provider service tier","chat.input.serviceTier.locked":"Wait for the current turn to finish before changing service tier","chat.input.serviceTier.option":"Use {tier} service tier","chat.input.serviceTier.fastHint":"priority","chat.input.serviceTier.flexHint":"lower cost","chat.input.responseVerbosity.label":"Output {verbosity}","chat.input.responseVerbosity.heading":"Response verbosity","chat.input.responseVerbosity.change":"Change response verbosity","chat.input.responseVerbosity.locked":"Wait for the current turn to finish before changing response verbosity","chat.input.responseVerbosity.option":"Use {verbosity} response verbosity","chat.input.responseVerbosity.autoHint":"model default","chat.input.outputSchema.title":"Structured output","chat.input.outputSchema.description":"Require this turn to finish with an object that matches the JSON Schema.","chat.input.outputSchema.change":"Set structured output schema","chat.input.outputSchema.locked":"Wait for the current turn to finish before changing the output schema","chat.input.outputSchema.editor":"JSON Schema editor","chat.input.outputSchema.placeholder":"Paste a JSON Schema object","chat.input.outputSchema.example":"Use example","chat.input.outputSchema.clear":"Clear","chat.input.outputSchema.invalid":"Enter a valid JSON object. The server validates the complete schema.","chat.input.outputSchema.shellUnsupported":"Structured output cannot be combined with a shell command.","chat.structuredOutput.title":"Structured output","chat.structuredOutput.copy":"Copy structured output","chat.input.communicationStyle.label":"Style {style}","chat.input.communicationStyle.heading":"Communication style","chat.input.communicationStyle.change":"Change communication style","chat.input.communicationStyle.locked":"Wait for the current turn to finish before changing communication style","chat.input.communicationStyle.option":"Use {style} communication style","chat.input.communicationStyle.autoHint":"Blade default","chat.input.communicationStyle.pragmaticHint":"direct","chat.input.communicationStyle.friendlyHint":"warm","chat.input.communicationStyle.explanatoryHint":"explain choices","chat.notice.dismiss":"Dismiss notice","chat.input.mode.default":"Manual approval","chat.input.mode.default.desc":"Every important action needs your approval","chat.input.mode.autoEdit":"Auto approval","chat.input.mode.autoEdit.desc":"Let the AI review and approve important actions","chat.input.mode.yolo":"Full access","chat.input.mode.yolo.desc":"Run directly on your machine without asking","chat.input.mode.yolo.confirm.title":"Enable full access mode?","chat.input.mode.yolo.confirm.desc":"In this mode the agent will execute all actions — including file writes, shell commands, and network requests — without asking for permission. Only enable this if you trust the current context.","chat.input.mode.yolo.confirm.cancel":"Cancel","chat.input.mode.yolo.confirm.accept":"Enable","chat.input.mode.plan":"Plan","chat.input.mode.plan.desc":"Draft a plan first without making changes","chat.input.mode.aria":"Agent action approval","chat.input.action.stop":"Stop active turn","chat.input.action.stopping":"Stopping active turn","chat.input.action.steer":"Steer active turn","chat.input.action.send":"Send message","chat.input.action.submitting":"Submitting message","chat.review.title":"Code Review","chat.review.target":"Target","chat.review.target.uncommitted":"Uncommitted changes","chat.review.target.base":"Changes against {ref}","chat.review.target.commit":"Commit {ref}","chat.review.status":"Status","chat.review.status.completed":"Completed","chat.review.status.stale":"Stale","chat.review.status.failed":"Failed","chat.review.status.aborted":"Aborted","chat.review.status.interrupted":"Interrupted","chat.review.findings":"Findings","chat.review.noFindings":"No actionable findings","chat.review.confidence":"confidence {value}","chat.review.error":"Error","chat.subagent.resumedFromTitle":"Resumed from {id}","chat.subagent.resumedDepth":"resumed · depth {depth}","chat.subagent.loadingLogs":"Loading subagent logs...","chat.subagent.resumedAs":"Resumed as {id} · {status} · depth {depth}","chat.subagent.resume":"Resume","chat.subagent.resumeAria":"Resume subagent","chat.subagent.followUpAria":"Subagent follow-up","chat.subagent.followUpPlaceholder":"Describe the follow-up work","chat.subagent.cancel":"Cancel","chat.subagent.resumeAgent":"Resume agent","chat.subagent.resumeFailed":"Failed to resume subagent","chat.markdown.copyCode":"Copy code","chat.rewind.title":"Rewind session","chat.rewind.description":"Return to the point before a user message.","chat.rewind.loading":"Loading checkpoints","chat.rewind.empty":"Nothing to rewind to yet","chat.rewind.checkpointAria":"Rewind checkpoint","chat.rewind.userMessage":"User message","chat.rewind.fileCountOne":"{count} file","chat.rewind.fileCountMany":"{count} files","chat.rewind.restoreCode":"Restore code changes","chat.rewind.restoreCodeHint":"Revert files changed at and after this checkpoint.","chat.rewind.cancel":"Cancel","chat.rewind.confirm":"Rewind","chat.rewind.loadFailed":"Failed to load rewind checkpoints","chat.rewind.failed":"Rewind failed. Review the session error and try again.","status.context":"Context","status.tokenLimitTooltip":"Token limit is estimated. It updates when the model reports its context size.","status.phase.running":"Generating...","status.phase.compacting":"Compacting context...","status.phase.switchingModel":"Switching model...","status.phase.waitingPermission":"Waiting for permission...","status.phase.error":"Run failed","preview.title":"Preview","preview.action.resize":"Resize preview","preview.action.close":"Close preview","preview.action.retry":"Retry","preview.tab.diff":"Diff","preview.tab.files":"Files","preview.tab.logs":"Logs","preview.diff.loadingTitle":"Loading task diff…","preview.diff.loadingHint":"Reading the durable worktree artifact.","preview.diff.failedTitle":"Failed to load task diff","preview.diff.discardedTitle":"Changes discarded","preview.diff.discardedHint":"The isolated workspace was removed. The source project was not changed.","preview.diff.emptyTitle":"No patch yet","preview.diff.emptyHint":"Run a tool that changes files to see diffs here.","preview.diff.searchAria":"Search changed files","preview.diff.searchPlaceholder":"Filter changed files…","preview.diff.changedFiles":"{count} changed files","preview.diff.expandAll":"Expand all","preview.diff.collapseAll":"Collapse all","preview.diff.showMoreFiles":"Show {count} more files","preview.diff.showMoreLines":"Show {count} more lines","preview.diff.noMatches":"No matching changed files","preview.diff.patch":"Patch","preview.diff.line":"Line {line}","preview.files.loadingTitle":"Loading files…","preview.files.loadingHint":"Fetching workspace tree.","preview.files.failedTitle":"Failed to load files","preview.files.emptyTitle":"No files yet","preview.files.emptyHint":"Select a project to load its workspace tree.","preview.files.treeFailed":"Failed to load workspace tree","preview.files.searchAria":"Search workspace files","preview.files.searchPlaceholder":"Find a file…","preview.files.searchResultsAria":"File search results","preview.files.searchFailed":"Failed to search workspace files","preview.files.noMatches":"No matching files","preview.files.directoryLoading":"Loading folder…","preview.files.directoryEmpty":"Empty folder","preview.files.selectTitle":"Select a file to preview","preview.files.status.loading":"Loading…","preview.files.status.truncated":"Truncated","preview.files.status.ready":"Ready","preview.files.truncatedNotice":"Preview truncated to 200k characters.","preview.files.pickHint":"Pick a file from the tree to preview.","preview.files.contentFailed":"Failed to load file","preview.files.editorLoading":"Loading editor…","preview.logs.searchAria":"Search tool logs","preview.logs.searchPlaceholder":"Search tool, summary, or output…","preview.logs.filterAria":"Filter logs by status","preview.logs.filter.all":"All","preview.logs.filter.running":"Running","preview.logs.filter.error":"Failed","preview.logs.filter.success":"Success","preview.logs.noMatches":"No matching logs","preview.logs.noMatchesHint":"Try another phrase or status.","preview.logs.emptyTitle":"No logs yet","preview.logs.emptyHint":"Tool runs will appear here.","preview.logs.expand":"Expand","preview.logs.collapse":"Collapse","preview.logs.showMore":"Show {count} more logs","preview.logs.status.running":"Running","preview.logs.status.error":"Failed","preview.logs.status.success":"Success","goal.aria.section":"Goal controls","goal.status.active":"Goal running","goal.status.paused":"Goal paused","goal.status.blocked":"Goal blocked","goal.status.usageLimited":"Usage limited","goal.status.budgetLimited":"Budget reached","goal.status.complete":"Goal complete","goal.field.objective":"Goal objective","goal.action.edit":"Edit goal","goal.action.pause":"Pause goal","goal.action.resume":"Resume goal","goal.action.delete":"Delete goal","goal.action.expand":"Expand goal details","goal.action.collapse":"Collapse goal details","goal.action.cancel":"Cancel","goal.action.save":"Save","goal.metrics.tokens":"tokens","goal.metrics.continuationOne":"{n} continuation","goal.metrics.continuationMany":"{n} continuations","goal.dialog.title":"Delete this goal?","goal.dialog.description":"The goal state will be removed. Session history and workspace files are not affected.","settings.title":"Settings","settings.nav.aria":"Settings sections","settings.action.back":"Back","settings.category.settings":"Settings","settings.category.integrations":"Integrations","settings.tab.general":"General","settings.tab.trust":"Security","settings.tab.models":"Models","settings.tab.shortcuts":"Shortcuts","settings.tab.mcp":"MCP","settings.tab.skills":"Skills","settings.tab.plugins":"Plugins","settings.tab.hooks":"Hooks","settings.tab.schedules":"Scheduled Tasks","settings.common.retry":"Retry","settings.common.dismiss":"Dismiss","settings.common.cancel":"Cancel","settings.common.enable":"Enable","settings.general.loading":"Loading settings...","settings.general.loadError":"Failed to load settings","settings.general.saveError":"Failed to save settings","settings.general.responseLanguage":"Response Language","settings.general.responseLanguageHint":"AI will respond in this language","settings.general.autoSave":"Auto-save sessions","settings.general.communicationStyle":"Communication Style","settings.general.communicationStyleHint":"How the agent phrases its replies across every session","settings.appearance.heading":"Appearance","settings.appearance.theme":"Theme Preference","settings.appearance.theme.dark":"Dark","settings.appearance.theme.light":"Light","settings.appearance.theme.system":"System","settings.appearance.compactSidebar":"Compact sidebar","settings.appearance.codeTheme":"Code theme","settings.appearance.codeThemeHint":"Syntax highlighting colors","settings.notifications.heading":"Notifications","settings.notifications.buildFinished":"Build finished","settings.notifications.errorsOnly":"Errors only","settings.notifications.systemSounds":"System sounds","settings.notifications.blocked":"Browser notifications are blocked","settings.notifications.unavailable":"Browser notifications are unavailable","settings.notifications.enablePrompt":"Enable alerts while this tab is in the background","settings.privacy.heading":"Privacy","settings.privacy.telemetry":"Telemetry","settings.privacy.crash":"Crash reports","settings.models.description":"Configure API keys and model settings for different providers.","settings.models.loading":"Loading models...","settings.models.loadChannelsFailed":"Failed to load provider channels","settings.models.saveFailed":"Failed to save model","settings.models.deleteFailed":"Failed to delete model","settings.models.updateFailed":"Failed to update model","settings.models.updateChannelFailed":"Failed to update provider channel","settings.models.probeFailed":"Provider probe failed","settings.models.deleteChannelFailed":"Failed to delete provider channel","settings.models.empty":"No models configured yet","settings.models.add":"+ Add New Model","settings.models.missingCredential":"Missing credential","settings.models.configured":"Configured","settings.models.deleting":"Deleting...","settings.models.deleteModel":"Delete model","settings.models.deleteChannel":"Delete channel","settings.models.deleteModelAria":"Delete {name}","settings.models.deleteModelPrompt":"Delete {name} and its saved configuration?","settings.models.deleteChannelAria":"Delete channel {name}","settings.models.deleteChannelPrompt":"Delete channel {name}, its credential, and {count} configured model(s)? Fallback references will also be removed.","settings.models.editModelAria":"Edit {name}","settings.models.editChannelAria":"Edit channel {name}","settings.models.testChannelAria":"Test {name}","settings.models.deleteChannelActionAria":"Delete channel {name}","settings.models.modelCountOne":"{count} model","settings.models.modelCountMany":"{count} models","settings.models.defaultEndpoint":"default endpoint","settings.shortcuts.searchPlaceholder":"Search actions...","settings.shortcuts.scope.all":"All scopes","settings.shortcuts.scope.global":"Global","settings.shortcuts.scope.chat":"Chat","settings.shortcuts.scope.layout":"Layout","settings.shortcuts.reset":"Reset","settings.shortcuts.col.action":"Action","settings.shortcuts.col.shortcut":"Shortcut","settings.shortcuts.col.scope":"Scope","settings.shortcuts.empty":"No shortcuts found.","settings.shortcuts.action.searchTasks":"Search tasks","settings.shortcuts.action.openCommands":"Open command center","settings.shortcuts.action.newTask":"New task","settings.shortcuts.action.focusComposer":"Focus composer","settings.shortcuts.action.toggleSidebar":"Toggle sidebar","settings.common.reload":"Reload","settings.trust.state.notRequired":"No trust required","settings.trust.state.trusted":"Workspace trusted","settings.trust.state.review":"Review required","settings.trust.state.error":"Trust store error","settings.trust.selectSession":"Select a project session to review folder trust.","settings.trust.heading":"Workspace trust","settings.trust.inheritedFrom":" · inherited from {source}","settings.trust.reloadAria":"Reload workspace trust","settings.trust.revoke":"Revoke","settings.trust.trustWorkspace":"Trust workspace","settings.trust.restartNotice":"Restart Blade to reload project models, MCP, LSP, permissions, and plugins.","settings.trust.revokeAria":"Revoke workspace trust","settings.trust.confirmTrust":"Allow {count} project source(s) to configure models, MCP, LSP, permissions, environment, instructions, commands, skills, agents, or plugins?","settings.trust.confirmRevoke":"Block project-controlled executable configuration after restart?","settings.trust.saving":"Saving...","settings.trust.trustReviewed":"Trust reviewed workspace","settings.trust.revokeTrust":"Revoke trust","settings.trust.empty":"No project-controlled executable configuration was found.","settings.trust.loadFailed":"Failed to load workspace trust","settings.trust.updateFailed":"Failed to update workspace trust","settings.hooks.state.disabled":"Hooks disabled","settings.hooks.state.notRequired":"No external hooks","settings.hooks.state.review":"Review required","settings.hooks.state.trusted":"Trusted","settings.hooks.state.modified":"Changed since approval","settings.hooks.state.error":"Trust store error","settings.hooks.selectSession":"Select a project session to review its hooks.","settings.hooks.heading":"Hook trust","settings.hooks.reloadAria":"Reload hook trust","settings.hooks.revoke":"Revoke","settings.hooks.trustDigest":"Trust digest","settings.hooks.currentSession":"Current session execution","settings.hooks.session.open":"Open a session to control its hooks.","settings.hooks.session.loading":"Loading session state...","settings.hooks.session.disabled":"Disabled by workspace configuration.","settings.hooks.session.paused":"Paused only for this session.","settings.hooks.session.active":"Hooks may run for this session after trust checks.","settings.hooks.session.unavailable":"Disabled by this session runtime or host policy.","settings.hooks.session.enableAria":"Enable hooks for current session","settings.hooks.session.pauseAria":"Pause hooks for current session","settings.hooks.session.unavailableAria":"Hooks unavailable for current session","settings.hooks.confirmTrustAria":"Trust project hooks","settings.hooks.confirmRevokeAria":"Revoke project hook trust","settings.hooks.confirmTrust":"Run these {count} hooks with your user permissions until their configuration changes?","settings.hooks.confirmRevoke":"Stop all configured hooks for this project until explicitly trusted again?","settings.hooks.saving":"Saving...","settings.hooks.trustReviewed":"Trust reviewed hooks","settings.hooks.revokeTrust":"Revoke trust","settings.hooks.empty":"No configured command, HTTP, or prompt hooks.","settings.hooks.loadFailed":"Failed to load hook trust","settings.hooks.updateFailed":"Failed to update hook trust","settings.hooks.sessionUpdateFailed":"Failed to update session hooks","settings.plugins.selectProject":"Select a project to manage its plugins.","settings.plugins.heading":"Workspace plugins","settings.plugins.changesNote":"Changes apply to future session snapshots and persist in the selected scope.","settings.plugins.reloadAria":"Reload plugins","settings.plugins.sourcePolicy":"Source policy","settings.plugins.savePolicyAria":"Save plugin source policy","settings.plugins.saving":"Saving…","settings.plugins.saveForProject":"Save for project","settings.plugins.restrictAria":"Restrict plugin sources","settings.plugins.restrictAllowlists":"Restrict to allowlists","settings.plugins.requireShaAria":"Require full Git commit SHA","settings.plugins.requireSha":"Require full Git SHA","settings.plugins.environmentLocked":" · environment locked","settings.plugins.gitHostsAria":"Allowed plugin Git hosts","settings.plugins.marketplacesAria":"Allowed plugin Marketplaces","settings.plugins.localRootsAria":"Allowed local plugin roots","settings.plugins.emptyAllowlists":"Empty allowlists deny every plugin source.","settings.plugins.installHeading":"Install trusted plugin","settings.plugins.sourceAria":"Plugin source","settings.plugins.install":"Install","settings.plugins.trustSource":"I trust this source to activate Hooks, MCP servers, skills, and commands.","settings.plugins.activationScope":"Activation write scope","settings.plugins.activationScopeHint":"Higher-priority layers continue to determine the effective state.","settings.plugins.scopeAria":"Plugin activation scope","settings.plugins.scope.local":"Local","settings.plugins.scope.project":"Project","settings.plugins.scope.global":"Global","settings.plugins.scope.localDesc":"Only this checkout","settings.plugins.scope.projectDesc":"Shared project settings","settings.plugins.scope.globalDesc":"All projects","settings.plugins.scope.invocation":"Invocation","settings.plugins.scope.default":"Default","settings.plugins.layer.on":"on","settings.plugins.layer.off":"off","settings.plugins.capability.commands":"{count} commands","settings.plugins.capability.skills":"{count} skills","settings.plugins.capability.agents":"{count} agents","settings.plugins.capability.hooks":"{count} hooks","settings.plugins.capability.mcp":"{count} MCP","settings.plugins.noResources":"No declared resources","settings.plugins.effective":"effective: {scope}","settings.plugins.managed":"managed","settings.plugins.invocationScoped":"Invocation-scoped via --plugin-dir","settings.plugins.enableAria":"Enable {name}","settings.plugins.disableAria":"Disable {name}","settings.plugins.unavailableAria":"Unavailable {name}","settings.plugins.updateAria":"Update {name}","settings.plugins.uninstallAria":"Uninstall {name}","settings.plugins.confirmUpdate":"Confirm update","settings.plugins.update":"Update","settings.plugins.confirmRemove":"Confirm remove","settings.plugins.empty":"No plugins discovered for this project.","settings.plugins.marketplaces":"Marketplaces","settings.plugins.configuredCount":"{count} configured","settings.plugins.marketplaceSourceAria":"Marketplace source","settings.plugins.addMarketplaceAria":"Add marketplace","settings.plugins.add":"Add","settings.plugins.noDescription":"No description","settings.plugins.refreshMarketplaceAria":"Refresh marketplace {name}","settings.plugins.removeMarketplaceAria":"Remove marketplace {name}","settings.plugins.confirm":"Confirm","settings.plugins.installedSuffix":" · installed","settings.plugins.marketplaceEmpty":"Add a Marketplace to discover installable plugins.","settings.plugins.loadFailed":"Failed to load plugins","settings.plugins.actionFailed":"Plugin action failed","settings.plugins.updateFailed":"Failed to update plugin","settings.models.addModal.title":"Add Model","settings.models.addModal.close":"Close add model","settings.models.addModal.loadProvidersError":"Failed to load providers","settings.models.addModal.loadModelsError":"Failed to load models","settings.models.addModal.provider":"Provider","settings.models.addModal.loadingProviders":"Loading providers...","settings.models.addModal.selectProvider":"Select provider","settings.models.addModal.configuredSuffix":" - configured","settings.models.addModal.customOpenAI":"Custom OpenAI Endpoint","settings.models.addModal.customAnthropic":"Custom Anthropic Endpoint","settings.models.addModal.channelId":"Channel ID","settings.models.addModal.channelIdHint":"Stable config and credential identifier.","settings.models.addModal.channelName":"Channel name","settings.models.addModal.baseUrl":"Base URL","settings.models.addModal.anthropicProtocol":"Uses the Anthropic Messages protocol.","settings.models.addModal.openaiProtocol":"Uses the OpenAI Chat Completions protocol.","settings.models.addModal.modelId":"Model ID","settings.models.addModal.model":"Model","settings.models.addModal.loadingModels":"Loading models...","settings.models.addModal.selectModel":"Select model","settings.models.addModal.reasoningSuffix":" - reasoning","settings.models.addModal.visionSuffix":" - vision","settings.models.addModal.displayName":"Display name","settings.models.addModal.displayNamePlaceholder":"Optional alias","settings.models.addModal.apiKey":"API Key","settings.models.addModal.apiKeyAria":"API key","settings.models.addModal.apiKeyPlaceholder":"Stored separately in auth.json","settings.models.addModal.showApiKey":"Show API key","settings.models.addModal.hideApiKey":"Hide API key","settings.models.addModal.oauthNote":"This provider requires OAuth or ambient credentials. Configure it externally before selecting the model.","settings.models.addModal.saveModel":"Save Model","settings.models.addModal.saving":"Saving...","settings.models.addModal.channelIdError":'Channel ID must start with a lowercase letter and contain only lowercase letters, numbers, ".", "_" or "-"',"settings.models.addModal.invalidBaseUrl":"Base URL must be an absolute HTTP(S) URL","settings.models.editModal.srTitle":"Edit Model","settings.models.editModal.title":"Edit Model Overrides","settings.models.editModal.close":"Close edit model","settings.models.editModal.displayName":"Display name","settings.models.editModal.replaceApiKey":"Replace provider API key","settings.models.editModal.replaceApiKeyPlaceholder":"Leave empty to keep current credential","settings.models.editModal.baseUrlOverride":"Base URL override","settings.models.editModal.baseUrlPlaceholder":"Leave empty to use default endpoint","settings.models.editModal.streamIdleTimeout":"Stream idle timeout (ms)","settings.models.editModal.save":"Save","settings.models.editModal.saving":"Saving...","settings.models.editModal.streamIdleTimeoutError":"Stream idle timeout must be at least 1000ms","settings.models.editModal.credentialError":"Failed to update provider credential","settings.models.editProvider.title":"Edit Provider Channel","settings.models.editProvider.close":"Close edit provider","settings.models.editProvider.channelName":"Channel name","settings.models.editProvider.channelNameRequired":"Channel name is required","settings.models.editProvider.wireApi":"Wire API","settings.models.editProvider.baseUrl":"Base URL","settings.models.editProvider.baseUrlAria":"Provider Base URL","settings.models.editProvider.invalidBaseUrl":"Base URL must be an absolute HTTP(S) URL","settings.models.editProvider.apiKeyEnv":"API key environment variable","settings.models.editProvider.apiKeyEnvPlaceholder":"Optional, for example TEAM_GATEWAY_API_KEY","settings.models.editProvider.replaceApiKey":"Replace API key","settings.models.editProvider.apiKeyAria":"Provider API key","settings.models.editProvider.apiKeyPlaceholder":"Leave empty to keep current credential","settings.models.editProvider.save":"Save channel","settings.models.editProvider.saving":"Saving...","settings.style.auto":"Auto","settings.style.pragmatic":"Pragmatic","settings.style.friendly":"Friendly","settings.style.explanatory":"Explanatory","mcp.status.connected":"Connected","mcp.status.connecting":"Connecting...","mcp.status.reconnecting":"Recovering...","mcp.status.offline":"Offline","mcp.status.error":"Error","mcp.status.recoveringAttempt":"Recovering {attempt}/{max}","mcp.oauth.status.disabled":"Not configured","mcp.oauth.status.unavailable":"Unavailable in this runtime","mcp.oauth.status.unauthenticated":"Authorization required","mcp.oauth.status.authorizing":"Waiting for authorization...","mcp.oauth.status.authenticated":"Authorized","mcp.oauth.status.error":"Authorization failed","mcp.catalog.tag.official":"Official","mcp.catalog.tag.popular":"Popular","mcp.catalog.tag.community":"Community","mcp.action.refreshServers":"Refresh MCP servers","mcp.action.addServer":"Add server","mcp.action.close":"Close MCP","mcp.action.dismiss":"Dismiss","mcp.action.retry":"Retry","mcp.action.disconnect":"Disconnect","mcp.action.disconnecting":"Disconnecting...","mcp.action.stopRecovery":"Stop recovery","mcp.action.connect":"Connect","mcp.action.connecting":"Connecting...","mcp.action.authorizeFirst":"Authorize first","mcp.action.delete":"Delete","mcp.action.cancel":"Cancel","mcp.action.deleting":"Deleting...","mcp.action.deleteServer":"Delete server","mcp.tab.installed":"Installed ({count})","mcp.tab.catalog":"Catalog","mcp.servers.title":"Servers","mcp.servers.searchAria":"Search installed MCP servers","mcp.servers.searchPlaceholder":"Search servers...","mcp.servers.loading":"Loading servers...","mcp.servers.noMatch":"No servers match your search","mcp.servers.none":"No MCP servers configured","mcp.server.errorLabel":"Error: {error}","mcp.server.deleteAria":"Delete {name}","mcp.server.selectPrompt":"Select a server to view details","mcp.instructions.title":"Server instructions","mcp.instructions.detailsOmittedByPolicy":"[details omitted by runtime policy]","mcp.instructions.detailsOmitted":"Details omitted","mcp.instructions.truncated":"Truncated to the safe display budget","mcp.tasks.title":"Experimental MCP Tasks","mcp.tasks.summary":"{count} per Session · {interval}ms poll","mcp.tasks.disabledByDefault":"Disabled by default","mcp.tasks.enabled":"Enabled","mcp.tasks.disabled":"Disabled","mcp.oauth.signingOut":"Signing out...","mcp.oauth.signOut":"Sign out","mcp.oauth.continueAuthorization":"Continue authorization","mcp.oauth.resumeAuthorization":"Resume authorization","mcp.oauth.opening":"Opening...","mcp.oauth.authorize":"Authorize","mcp.delete.confirm":"Remove this server and its saved configuration?","mcp.tools.title":"Tools ({count})","mcp.tools.none":"No tools available","mcp.completion.title":"Argument completion","mcp.completion.connectPrompt":"Connect the server to request suggestions","mcp.completion.unsupported":"Server does not advertise MCP completions","mcp.completion.noTargets":"No completable prompt arguments or template variables","mcp.completion.targetAria":"MCP completion target","mcp.completion.partialAria":"MCP completion partial value","mcp.completion.partialPlaceholder":"Partial value","mcp.completion.completing":"Completing...","mcp.completion.complete":"Complete","mcp.completion.suggestionsAria":"MCP completion suggestions","mcp.completion.empty":"[empty]","mcp.completion.noSuggestions":"No suggestions","mcp.meta.truncatedSuffix":" · truncated","mcp.meta.detailsOmittedSuffix":" · details omitted","mcp.diagnostics.title":"Diagnostics","mcp.diagnostics.refreshAria":"Refresh {name} MCP logs","mcp.diagnostics.logsAria":"{name} MCP logs","mcp.log.levelAria":"MCP logging level","mcp.log.setting":"Setting...","mcp.log.loading":"Loading logs...","mcp.log.none":"No logs captured","mcp.catalog.searchAria":"Search MCP server catalog","mcp.catalog.searchPlaceholder":"Search MCP servers on npm (min 3 chars)...","mcp.catalog.retry":"Retry catalog","mcp.catalog.noDescription":"No description","mcp.catalog.byAuthor":"by {author}","mcp.catalog.installed":"Installed","mcp.catalog.installing":"Installing...","mcp.catalog.install":"Install","mcp.catalog.noPackages":"No packages found","mcp.catalog.noMore":"No more packages","mcp.catalog.packagesFound":"{count} packages found","mcp.catalog.browseGlama":"Browse more on Glama","mcp.error.connectFailed":"Failed to connect server","mcp.error.disconnectFailed":"Failed to disconnect server","mcp.error.deleteFailed":"Failed to delete server","mcp.error.loginFailed":"Failed to login MCP OAuth","mcp.error.logoutFailed":"Failed to logout MCP OAuth","mcp.error.loggingLevelFailed":"Failed to set MCP logging level","mcp.error.completionFailed":"MCP completion failed","mcp.add.title":"Add MCP Server","mcp.add.closeAria":"Close add MCP server","mcp.add.modeForm":"Form","mcp.add.jsonConfig":"JSON config","mcp.add.jsonConfigAria":"JSON configuration","mcp.add.serverName":"Server name","mcp.add.command":"Command","mcp.add.commandAria":"Server command","mcp.add.argsLabel":"Arguments (space separated)","mcp.add.argsAria":"Server arguments","mcp.add.invalidJson":"Enter valid JSON with a server name and transport.","mcp.add.nameCommandRequired":"Name and command are required.","mcp.add.adding":"Adding...","mcp.add.submit":"Add Server","mcp.install.title":"Install MCP Server","mcp.install.titleWithName":"Install {name}","mcp.install.closeAria":"Close MCP installation","mcp.install.args":"Arguments","mcp.install.commandPreview":"Command: npx {args}","mcp.install.nameRequired":"Server name is required.","skills.title":"Skills","skills.action.install":"Install skill","skills.action.installShort":"Install","skills.action.refreshAria":"Refresh skills","skills.action.closeAria":"Close skills","skills.action.dismiss":"Dismiss","skills.action.retry":"Retry","skills.action.cancel":"Cancel","skills.action.close":"Close","skills.action.hide":"Hide","skills.action.enable":"Enable","skills.action.disable":"Disable","skills.action.saving":"Saving...","skills.status.enabled":"Enabled","skills.status.disabled":"Disabled","skills.status.installed":"Installed","skills.noDescriptionShort":"No description","skills.noDescription":"No description available","skills.installed.title":"Installed","skills.installed.searchAria":"Search installed skills","skills.installed.searchPlaceholder":"Search skills...","skills.installed.loading":"Loading skills...","skills.installed.noMatch":"No skills match your search","skills.installed.empty":"No skills installed","skills.uninstall.managedHint":"Only Blade user skills can be uninstalled","skills.uninstall.managed":"Managed","skills.uninstall.action":"Uninstall","skills.uninstall.confirmAria":"Uninstall {name}","skills.uninstall.confirmPrompt":"Remove this skill from ~/.blade/skills?","skills.uninstall.inProgress":"Uninstalling...","skills.uninstall.confirm":"Uninstall skill","skills.details.title":"Details","skills.details.provider":"Provider","skills.details.location":"Location","skills.details.capabilities":"Capabilities","skills.details.allowedTools":"Allowed Tools ({count})","skills.detail.emptyState":"Select a skill to view details","skills.install.title":"Install Skill","skills.install.closeAria":"Close skill installation","skills.install.tab.catalog":"Catalog","skills.install.tab.repo":"Repo","skills.install.tab.local":"Local","skills.install.catalog.searchAria":"Search skill catalog","skills.install.catalog.searchPlaceholder":"Search catalog...","skills.install.catalog.loading":"Loading catalog...","skills.install.catalog.empty":"No skills found","skills.install.catalog.byAuthor":"by {author}","skills.install.catalog.tag.official":"Official","skills.install.catalog.tag.popular":"Popular","skills.install.catalog.tag.community":"Community","skills.install.repo.label":"GitHub URL","skills.install.repo.inputAria":"Skill repository URL","skills.install.repo.credentialsHint":"Uses Git credentials available to the Blade process","skills.install.local.label":"Local path","skills.install.local.inputAria":"Local skill path","skills.status.dialogTitle":"Install Status","skills.status.confirm.title":"Confirm Install","skills.status.confirm.prompt":"Install selected skill?","skills.status.installing.title":"Installing","skills.status.installing.description":"Downloading and verifying…","skills.status.failed.title":"Install Failed","skills.status.failed.fallback":"Installation failed.","skills.status.failed.hint":"Check access and try again.","skills.error.deleteFailed":"Failed to delete skill","skills.error.toggleFailed":"Failed to toggle skill","skills.error.installFailed":"Failed to install skill","schedule.title":"Scheduled Tasks","schedule.description":"Run headless task prompts automatically on a cron, interval, or one-time trigger.","schedule.new":"New schedule","schedule.newAria":"Create a new schedule","schedule.refresh":"Refresh","schedule.reloadAria":"Reload schedules","schedule.create":"Create","schedule.save":"Save","schedule.cancel":"Cancel","schedule.confirmDelete":"Confirm?","schedule.empty":"No schedules yet","schedule.enabled":"Enabled","schedule.disabled":"Disabled","schedule.never":"never","schedule.nextRun":"Next run","schedule.lastRun":"Last run","schedule.runCount":"{count} runs","schedule.trigger.kindAria":"Trigger type","schedule.trigger.cron":"Cron","schedule.trigger.interval":"Interval","schedule.trigger.once":"Once","schedule.field.title":"Title (optional)","schedule.field.cron":"Cron expression","schedule.field.interval":"Interval","schedule.field.runAt":"Run at","schedule.field.prompt":"Prompt","schedule.field.project":"Project path","schedule.field.model":"Model (optional)","schedule.field.permissionMode":"Permission mode","schedule.field.isolation":"Isolation","schedule.placeholder.title":"Nightly dependency audit","schedule.placeholder.cron":"0 9 * * 1 (min hour dom mon dow)","schedule.placeholder.interval":"30m / 2h / 1d","schedule.placeholder.prompt":"Describe the task to run…","schedule.placeholder.project":"/path/to/project","schedule.placeholder.model":"e.g. anthropic/claude-sonnet","schedule.model.current":"Use current model","schedule.permission.default":"Default","schedule.permission.autoEdit":"Auto edit","schedule.permission.yolo":"Yolo","schedule.permission.plan":"Plan","schedule.isolation.local":"Local","schedule.isolation.worktree":"Worktree","schedule.cadence.cron":"cron: {expr}","schedule.cadence.interval":"every {interval}","schedule.cadence.once":"once at {time}","schedule.status.queued":"queued","schedule.status.running":"running","schedule.status.completed":"completed","schedule.status.failed":"failed","schedule.status.cancelled":"cancelled","schedule.status.interrupted":"interrupted","schedule.status.error":"error","schedule.status.never":"no runs yet","schedule.runNowAria":'Run "{title}" now',"schedule.editAria":'Edit "{title}"',"schedule.deleteAria":'Delete "{title}"',"schedule.enableAria":'Enable "{title}"',"schedule.disableAria":'Disable "{title}"',"schedule.error.promptRequired":"A prompt is required.","schedule.error.projectRequired":"A project path is required.","schedule.error.cronRequired":"A cron expression is required.","schedule.error.invalidInterval":"Enter an interval like 30m, 2h, or 1d.","schedule.error.runAtRequired":"Pick a valid run time.","schedule.error.loadFailed":"Failed to load scheduled tasks.","schedule.error.createFailed":"Failed to create scheduled task.","schedule.error.updateFailed":"Failed to update scheduled task.","schedule.error.deleteFailed":"Failed to delete scheduled task.","schedule.error.toggleFailed":"Failed to change scheduled task status.","schedule.error.runFailed":"Failed to run scheduled task."},b0={"app.restoring":"正在恢复工作区…","layout.workspace.pathAria":"工作区路径","layout.workspace.empty":"未选择工作区","layout.action.rewind":"回溯会话","layout.action.filePreview":"文件预览","layout.action.filePreviewToggle":"切换文件预览","layout.action.openNavigation":"打开导航","terminal.title":"终端","terminal.status.connected":"终端已连接","terminal.status.disconnected":"终端未连接","terminal.action.minimize":"最小化终端","terminal.action.restore":"恢复终端","terminal.action.close":"关闭终端","sidebar.brand.badge":"网页版","sidebar.action.collapse":"收起侧边栏","sidebar.action.expand":"展开侧边栏","sidebar.navigationAria":"任务导航","sidebar.action.newTask":"新建任务","sidebar.action.newTaskShort":"新建任务","sidebar.action.terminal":"终端","sidebar.action.terminalToggle":"切换终端","sidebar.action.searchTasks":"搜索任务","sidebar.unreadTasks":"{count} 个未读任务","sidebar.section.skills":"技能","sidebar.section.mcp":"MCP","sidebar.section.settings":"设置","sidebar.status.user":"用户","sidebar.status.feedLive":"任务通道已连接","sidebar.status.feedOffline":"任务通道未连接","sidebar.empty.title":"暂无任务","sidebar.empty.hint":"在主页派发新任务","sidebar.group.running":"进行中","sidebar.group.queued":"排队中","sidebar.group.interrupted":"已暂停","sidebar.group.failed":"已失败","sidebar.group.cancelled":"已取消","sidebar.group.done":"已完成","sidebar.group.showMore":"再显示 {count} 条","sidebar.group.showLess":"收起","sidebar.view.project":"项目","sidebar.view.status":"状态","sidebar.view.projectAria":"按项目分组会话","sidebar.view.statusAria":"按状态分组会话","sidebar.project.active":"当前","sidebar.project.expand":"展开 {name}","sidebar.project.collapse":"收起 {name}","sidebar.project.newTask":"在 {name} 中新建任务","sidebar.project.reorder":"调整 {name} 的顺序,当前位置 {position}/{count}","sidebar.project.reorderHint":"拖拽调整顺序,或使用上下方向键移动","sidebar.project.reordered":"已将 {name} 移到第 {position} 位","sidebar.project.projects":"项目","sidebar.catalog.syncing":"正在同步任务历史…","sidebar.catalog.loaded":"已载入 {count} 条","sidebar.catalog.incomplete":"任务历史未完整加载","sidebar.catalog.retry":"重试","projects.dialog.title":"项目","projects.dialog.description":"绑定本地目录,无需重启 Blade 即可切换任务上下文。","projects.bind.placeholder":"/项目的绝对路径","projects.bind.pathLabel":"项目路径","projects.bind.action":"绑定","projects.bind.failed":"项目绑定失败","projects.pick.action":"选择项目文件夹","projects.pick.actionShort":"选择","projects.pick.picking":"选择中…","projects.pick.failed":"无法选择项目文件夹","projects.unbind.action":"解除项目绑定","projects.unavailable":"目录不可用","sidebar.language.label":"语言","sidebar.language.aria":"切换语言","sidebar.language.en":"EN","sidebar.language.zh":"中","session.env.worktree":"独立分支","session.env.local":"本地","session.action.select":"选择「{title}」","session.action.save":"保存「{title}」","session.action.cancel":"取消「{title}」","session.action.more":"「{title}」的更多操作","session.action.fork":"派生「{title}」","session.action.forkShort":"派生","session.action.rename":"重命名「{title}」","session.action.renameShort":"重命名","session.action.archive":"归档「{title}」","session.action.archiveShort":"归档","session.action.export":"将「{title}」导出为 Markdown","session.action.exportShort":"导出 Markdown","session.action.exportingShort":"正在导出…","session.action.delete":"删除「{title}」","session.action.deleteShort":"删除","session.action.stop":"停止「{title}」","session.action.stopping":"正在停止「{title}」","session.action.retry":"重试「{title}」","session.action.retrying":"正在重试「{title}」","session.reason.cancelledByUser":"已由用户取消","session.title.codeReview":"代码评审","session.forkedFrom":"派生自","session.retriedFrom":"重试自","session.retryShort":"重试","session.queued":"排队 #{position}/{depth}","archive.title":"归档","archive.subtitle":"安全保留,不占用当前任务列表","archive.open":"打开会话归档","archive.refresh":"刷新归档会话","archive.retry":"重试","archive.loading":"正在载入归档…","archive.empty":"暂无归档会话","archive.restore":"恢复「{title}」","archive.restoreShort":"恢复","archive.restoreAncestor":"请先恢复归档根会话","archive.inherited":"随 {id} 一同归档","taskSwitcher.title":"任务切换器","taskSwitcher.description":"跨项目搜索并打开任务。","taskSwitcher.searchAria":"搜索任务","taskSwitcher.placeholder":"搜索标题、项目、分支、状态或 Session ID…","taskSwitcher.results":"{count} 个结果","taskSwitcher.recent":"最近任务","taskSwitcher.scope":"已索引 {count} 个任务","taskSwitcher.indexing":"正在索引任务…","taskSwitcher.resultsAria":"任务搜索结果","taskSwitcher.current":"当前","taskSwitcher.unread":"{count} 个未读","taskSwitcher.needsAction":"{count} 个需要操作","taskSwitcher.new":"新","taskSwitcher.empty":"没有匹配的任务","taskSwitcher.emptyHint":"尝试项目、分支、状态或更短的关键词。","taskSwitcher.hint.navigate":"选择","taskSwitcher.hint.open":"打开","taskSwitcher.hint.toggle":"切换","taskSwitcher.action.failed":"任务操作失败","commandCenter.title":"命令中心","commandCenter.description":"搜索任务,或执行工作区与应用操作。","commandCenter.searchAria":"搜索操作","commandCenter.placeholder":"搜索操作、设置或工具…","commandCenter.modeAria":"命令中心模式","commandCenter.mode.tasks":"任务","commandCenter.mode.commands":"操作","commandCenter.actions":"{count} 个操作","commandCenter.resultsAria":"操作搜索结果","commandCenter.empty":"没有匹配的操作","commandCenter.emptyHint":"尝试工具、面板或设置名称。","commandCenter.action.newTask":"新建任务","commandCenter.action.newTaskDescription":"打开一个干净的任务编辑器","commandCenter.action.preview":"切换预览区","commandCenter.action.previewDescription":"审查文件、Diff 与运行日志","commandCenter.action.terminal":"切换终端","commandCenter.action.terminalDescription":"打开或关闭工作区 Shell","commandCenter.action.settings":"打开设置","commandCenter.action.settingsDescription":"配置外观与行为","commandCenter.action.models":"配置模型","commandCenter.action.modelsDescription":"选择 Provider 与任务模型","commandCenter.action.shortcuts":"查看键盘快捷键","commandCenter.action.shortcutsDescription":"浏览全局与上下文按键","commandCenter.action.skills":"管理 Skills","commandCenter.action.skillsDescription":"发现并配置 Agent 能力","commandCenter.action.mcp":"管理 MCP Server","commandCenter.action.mcpDescription":"配置已连接的工具与服务","commandCenter.action.sidebar":"切换侧边栏","commandCenter.action.sidebarDescription":"显示或隐藏项目导航","taskHome.eyebrow":"任务调度台 · 就绪","taskHome.feed.connecting":"任务调度台 · 正在连接","taskHome.feed.reconnecting":"任务调度台 · 正在重连","taskHome.feed.offline":"任务调度台 · 已离线","taskHome.feed.offlineDescription":"实时任务更新已暂停,服务端正在运行的任务不会停止。","taskHome.feed.retry":"重新连接","taskHome.hero.prefix":"要在这里让 Blade 做点什么:","taskHome.hero.projectFallback":"当前工作区","taskHome.hero.subtitle":"派发一个任务后即可继续手头的工作。每个任务在独立的 worktree 中运行、状态持久保存,完成时会以可复核的工作区形式返回。","taskHome.templates.title":"模板","taskHome.templates.hint":"按 1–4 快速填充","taskHome.template.explore.title":"探索","taskHome.template.explore.description":"追踪行为,梳理系统全貌","taskHome.template.explore.hint":"调用链 · 模块结构","taskHome.template.build.title":"开发","taskHome.template.build.description":"实现一个可上线的功能","taskHome.template.build.hint":"端到端交付特性","taskHome.template.review.title":"评审","taskHome.template.review.description":"找出正确性与回归风险","taskHome.template.review.hint":"审查当前改动","taskHome.review.attachmentsUnsupported":"代码评审不支持附件","taskHome.review.outputSchemaUnsupported":"代码评审使用内置结构化报告 Schema","taskHome.review.usage":"用法:/review [uncommitted | base <ref> | commit <sha>]","taskHome.review.running":"只读代码评审正在进行","taskHome.review.stale":"评审期间目标已发生变化","taskHome.review.aborted":"代码评审已中止","taskHome.review.interrupted":"代码评审因进程重启而中断","taskHome.review.failed":"代码评审失败","taskHome.review.startFailed":"启动代码评审失败","taskHome.review.invalidTarget":"评审目标无效或没有可评审的改动","taskHome.review.conflict":"当前会话已有任务正在运行","taskHome.template.fix.title":"修复","taskHome.template.fix.description":"定位并修好一个具体故障","taskHome.template.fix.hint":"二分 · 复现 · 打补丁","taskHome.context.isolationToggleTitle":"切换任务隔离方式","taskHome.context.projectSelect":"选择目标项目","taskHome.context.isolation.worktree":"独立 worktree","taskHome.context.isolation.local":"本地工作区","taskHome.context.branchFallback":"无分支","taskHome.context.preparing":"正在准备 worktree","taskHome.setup.aria":"任务准备状态","taskHome.setup.title":"完成准备","taskHome.setup.description":"你可以继续编辑草稿,Blade 正在核对工作区和模型。","taskHome.setup.workspace.title":"工作区","taskHome.setup.workspace.loading":"正在检查可用工作区…","taskHome.setup.workspace.ready":"已选择 {project}","taskHome.setup.workspace.required":"选择一个可用项目","taskHome.setup.workspace.empty":"无项目","taskHome.setup.workspace.action":"选择","taskHome.setup.workspace.retry":"重新加载工作区","taskHome.setup.model.title":"模型","taskHome.setup.model.loading":"正在检查配置…","taskHome.setup.model.ready":"可用于当前任务","taskHome.setup.model.required":"配置或选择一个模型","taskHome.setup.model.action":"配置","taskHome.setup.model.retry":"重试","taskHome.composer.placeholder":"描述目标、约束以及你期望的验收方式……","taskHome.error.dismiss":"关闭","taskHome.recent.title":"最近任务","taskHome.recent.total":"共 {count} 条","taskHome.recent.partial":"已载入 {count} 条 · 继续同步","taskHome.recent.incomplete":"已载入 {count} 条 · 历史不完整","taskSwitcher.indexingLoaded":"已载入 {count} 条 · 正在同步历史","taskHome.footer.note":"独立 worktree 让并行任务不会干扰你当前的工作副本","capacity.title":"{inFlight} 进行中 · {queued} 排队 · 上限 {max}","capacity.suffix.running":" 进行中","capacity.queued":"排队 {queued}","recent.status.running":"进行中","recent.status.queued":"排队中","recent.status.paused":"已暂停","recent.status.failed":"已失败","recent.status.cancelled":"已取消","recent.status.done":"已完成","recent.time.justNow":"刚刚","recent.time.minutes":"{n} 分钟前","recent.time.hours":"{n} 小时前","recent.time.days":"{n} 天前","recent.session.fallbackShort":"会话 {id}","recent.session.fallbackDated":"会话 {y}-{m}-{d} {hh}:{mm}","attention.unreadAnnouncement":"{count} 个未读任务更新","attention.notification.completed":"任务已完成","attention.notification.failed":"任务失败","attention.notification.interrupted":"任务已中断","attention.notification.permission":"需要审批","attention.notification.question":"需要回答","attention.notification.elicitation":"MCP 需要输入","interaction.permission.title":"需要授权:{tool}","interaction.permission.once":"仅本次允许","interaction.permission.session":"本会话允许","interaction.permission.project":"本项目允许","interaction.permission.deny":"拒绝","interaction.permission.failed":"授权响应失败","interaction.question.answered":"问题已回答","interaction.question.other":"其他","interaction.question.submit":"提交回答","interaction.question.failed":"回答提交失败","interaction.elicitation.title":"MCP 请求输入","interaction.elicitation.submit":"提交给 MCP","interaction.elicitation.open":"打开外部链接","interaction.elicitation.decline":"拒绝","interaction.elicitation.cancel":"取消","interaction.elicitation.responded":"已响应 MCP 请求","interaction.elicitation.cancelled":"MCP 请求已取消","interaction.elicitation.failed":"响应 MCP 请求失败","interaction.elicitation.warning":"仅在信任该 MCP 服务器并理解请求用途时继续。","interaction.bar.permissionTitle":"Agent 正在等待审批","interaction.bar.permissionHint":"请检查待处理的工具请求,审批后任务才会继续。","interaction.bar.questionTitle":"Agent 正在等待回答","interaction.bar.questionHint":"请回答待处理的问题,任务才能继续。","interaction.bar.elicitationTitle":"MCP 服务器正在等待输入","interaction.bar.elicitationHint":"请检查 MCP 请求,响应后任务才会继续。","interaction.bar.review":"查看请求","interaction.badge.permission":"需要审批","interaction.badge.question":"需要回答","interaction.badge.elicitation":"MCP 输入","artifact.env.isolated":"独立分支","artifact.env.local":"本地","artifact.review":"查看变更","artifact.commits":"{count} 次提交","artifact.apply":"应用","artifact.retryApply":"重新应用","artifact.applying":"应用中","artifact.applied":"已应用","artifact.discard":"丢弃任务变更","artifact.discarded":"已丢弃","artifact.conflict":"任务变更无法安全应用。","artifact.conflictHint":"隔离变更已保留。请查看变更、处理源项目状态,然后重试或丢弃。","artifact.discardDialog.title":"丢弃隔离变更?","artifact.discardDialog.description":"将删除 {project} 隔离任务工作区中的 {count} 个变更文件。","artifact.discardDialog.warning":"此操作会永久删除任务 worktree 和分支,不会修改源项目。","artifact.discardDialog.cancel":"保留变更","artifact.discardDialog.confirm":"丢弃变更","chat.list.empty.eyebrow":"Blade · 就绪","chat.list.empty.title":"发送一条消息开始对话","chat.list.empty.hint":"提问、描述改动,或者粘贴一段错误堆栈。","chat.list.loading.eyebrow":"历史对话","chat.list.loading.title":"正在恢复对话…","chat.list.loading.hint":"正在加载消息、任务状态和实时更新。对话较长时可能需要一点时间。","chat.list.showEarlier":"显示更早的 {count} 条消息","chat.list.showEarlierWithRemaining":"显示更早的 {count} 条消息,当前隐藏 {remaining} 条","chat.list.jumpLatest":"回到最新消息","chat.turns.aria":"跳转到之前的消息","chat.turns.label":"第 {n} 轮","chat.timeline.thinking":"思考过程","chat.timeline.tools.runningOne":"正在执行 1 条命令","chat.timeline.tools.running":"正在执行 {count} 条命令","chat.timeline.tools.completedOne":"已执行 1 条命令","chat.timeline.tools.completed":"已执行 {count} 条命令","chat.timeline.tools.completedOneWithError":"已执行 1 条命令 · 执行失败","chat.timeline.tools.completedWithErrors":"已执行 {count} 条命令 · {errors} 条失败","chat.error.dismiss":"关闭错误","chat.error.queueFull":"指令队列已满。请等待已有指令开始执行后重试。","chat.error.turnChanged":"当前轮次已发生变化,此消息尚未接收。请确认内容后重试。","chat.error.title.submission":"消息未发送。","chat.error.title.execution":"本轮运行已停止。","chat.error.title.navigation":"未能打开任务。","chat.error.title.generic":"操作失败。","chat.error.action.returnDraft":"返回草稿","chat.error.action.editResend":"编辑后重发","chat.error.action.retryTask":"重试任务","chat.error.action.retryingTask":"正在重试…","chat.error.action.checkModels":"检查模型设置","task.failure.authentication":"模型服务认证失败,请检查模型凭据。","task.failure.permission":"模型服务拒绝了请求,请检查账号和模型权限。","task.failure.rateLimit":"模型服务达到速率或额度限制。","task.failure.timeout":"模型服务请求超时。","task.failure.network":"无法连接模型服务。","task.failure.modelUnavailable":"当前选择的模型不可用。","task.failure.contextLimit":"请求超出模型上下文限制。","task.failure.unsupportedInput":"当前模型不支持此类输入。","task.failure.runtime":"Agent 运行失败。","chat.connection.reconnecting":"正在恢复实时更新,当前任务仍在后台继续运行。","chat.connection.offline":"实时更新已离线,当前显示的进度可能已经过期。","chat.connection.retry":"重新连接","chat.footer.disclaimer":"Blade 可能会出错,请核对重要信息。","chat.input.placeholder.default":"输入 @ 提及文件,/ 触发命令……","chat.input.placeholder.steering":"添加指令来引导当前轮次……","chat.input.steering.status":"当前轮次可被引导","chat.input.steering.queued":"引导指令已接收 · 待处理 {count} 条","chat.input.steering.enterHint":" · 回车下发指令","chat.input.followUp.queued":"后续指令已接收 · 下一轮排队 {count} 条","chat.input.steering.recoveredOne":"重启后已恢复 {count} 条排队指令","chat.input.steering.recoveredMany":"重启后已恢复 {count} 条排队指令","chat.input.attachment.add":"添加图片","chat.input.attachment.remove":"移除","chat.input.attachment.countLimit":"最多可添加 {count} 张图片。","chat.input.attachment.sizeLimit":"图片编码后总大小不能超过 {size},请移除图片或选择更小的文件。","chat.input.attachment.readFailed":"Blade 无法读取其中一张图片。","chat.input.attachment.usage":"{count}/{limit} 张图片 · 已用 {used} / {budget}","chat.input.attachment.modelUnsupported":"{model} 不支持图片输入,请选择视觉模型或移除图片。","chat.input.attachment.modelRequired":"请先选择支持图片输入的视觉模型。","chat.input.model.placeholder":"选择模型","chat.input.model.empty":"未配置模型","chat.input.model.vision":"视觉","chat.input.model.change":"切换模型","chat.input.model.locked":"请等待当前轮次结束后再切换模型","chat.input.effort.label":"推理 {effort}","chat.input.effort.heading":"推理强度","chat.input.effort.change":"切换推理强度","chat.input.effort.locked":"请等待当前轮次结束后再切换推理强度","chat.input.effort.option":"使用 {effort} 推理强度","chat.input.effort.autoHint":"接近 high","chat.input.serviceTier.label":"速度 {tier}","chat.input.serviceTier.heading":"Provider 服务等级","chat.input.serviceTier.change":"切换 Provider 服务等级","chat.input.serviceTier.locked":"请等待当前轮次结束后再切换服务等级","chat.input.serviceTier.option":"使用 {tier} 服务等级","chat.input.serviceTier.fastHint":"优先通道","chat.input.serviceTier.flexHint":"低成本","chat.input.responseVerbosity.label":"输出 {verbosity}","chat.input.responseVerbosity.heading":"响应详略","chat.input.responseVerbosity.change":"切换响应详略","chat.input.responseVerbosity.locked":"请等待当前轮次结束后再切换响应详略","chat.input.responseVerbosity.option":"使用 {verbosity} 响应详略","chat.input.responseVerbosity.autoHint":"模型默认","chat.input.outputSchema.title":"结构化输出","chat.input.outputSchema.description":"要求本轮最终返回符合该 JSON Schema 的对象。","chat.input.outputSchema.change":"设置结构化输出 Schema","chat.input.outputSchema.locked":"请等待当前轮次结束后再修改输出 Schema","chat.input.outputSchema.editor":"JSON Schema 编辑器","chat.input.outputSchema.placeholder":"粘贴 JSON Schema 对象","chat.input.outputSchema.example":"使用示例","chat.input.outputSchema.clear":"清除","chat.input.outputSchema.invalid":"请输入有效的 JSON 对象;完整 Schema 将由服务端校验。","chat.input.outputSchema.shellUnsupported":"结构化输出不能与 Shell 命令同时使用。","chat.structuredOutput.title":"结构化输出","chat.structuredOutput.copy":"复制结构化输出","chat.input.communicationStyle.label":"风格 {style}","chat.input.communicationStyle.heading":"沟通风格","chat.input.communicationStyle.change":"切换沟通风格","chat.input.communicationStyle.locked":"请等待当前轮次结束后再切换沟通风格","chat.input.communicationStyle.option":"使用 {style} 沟通风格","chat.input.communicationStyle.autoHint":"Blade 默认","chat.input.communicationStyle.pragmaticHint":"直接","chat.input.communicationStyle.friendlyHint":"协作","chat.input.communicationStyle.explanatoryHint":"解释取舍","chat.notice.dismiss":"关闭提示","chat.input.mode.default":"手动审批","chat.input.mode.default.desc":"每个重要操作都需要你的批准","chat.input.mode.autoEdit":"自动审批","chat.input.mode.autoEdit.desc":"让 AI 审核并批准重要操作","chat.input.mode.yolo":"完全访问","chat.input.mode.yolo.desc":"无需询问,直接在你的电脑上运行","chat.input.mode.yolo.confirm.title":"启用完全访问模式?","chat.input.mode.yolo.confirm.desc":"在此模式下,Agent 将直接执行所有操作(包括文件写入、Shell 命令和网络请求)而不请求许可。仅在你信任当前上下文时启用。","chat.input.mode.yolo.confirm.cancel":"取消","chat.input.mode.yolo.confirm.accept":"启用","chat.input.mode.plan":"计划","chat.input.mode.plan.desc":"先拟定计划,暂不做任何改动","chat.input.mode.aria":"Agent 操作审批","chat.input.action.stop":"停止当前轮次","chat.input.action.stopping":"正在停止当前轮次","chat.input.action.steer":"引导当前轮次","chat.input.action.send":"发送消息","chat.input.action.submitting":"正在提交消息","chat.review.title":"代码评审","chat.review.target":"目标","chat.review.target.uncommitted":"未提交改动","chat.review.target.base":"相对 {ref} 的改动","chat.review.target.commit":"提交 {ref}","chat.review.status":"状态","chat.review.status.completed":"已完成","chat.review.status.stale":"已过期","chat.review.status.failed":"失败","chat.review.status.aborted":"已中止","chat.review.status.interrupted":"已中断","chat.review.findings":"问题","chat.review.noFindings":"未发现可执行问题","chat.review.confidence":"置信度 {value}","chat.review.error":"错误","chat.subagent.resumedFromTitle":"从 {id} 恢复","chat.subagent.resumedDepth":"已恢复 · 层级 {depth}","chat.subagent.loadingLogs":"正在加载子智能体日志…","chat.subagent.resumedAs":"已恢复为 {id} · {status} · 层级 {depth}","chat.subagent.resume":"恢复","chat.subagent.resumeAria":"恢复子智能体","chat.subagent.followUpAria":"子智能体后续指令","chat.subagent.followUpPlaceholder":"描述需要继续处理的工作","chat.subagent.cancel":"取消","chat.subagent.resumeAgent":"恢复智能体","chat.subagent.resumeFailed":"恢复子智能体失败","chat.markdown.copyCode":"复制代码","chat.rewind.title":"回溯会话","chat.rewind.description":"返回到某条用户消息之前的节点。","chat.rewind.loading":"正在加载检查点","chat.rewind.empty":"暂无可回溯的检查点","chat.rewind.checkpointAria":"回溯检查点","chat.rewind.userMessage":"用户消息","chat.rewind.fileCountOne":"{count} 个文件","chat.rewind.fileCountMany":"{count} 个文件","chat.rewind.restoreCode":"恢复代码变更","chat.rewind.restoreCodeHint":"回滚此检查点及之后更改的文件。","chat.rewind.cancel":"取消","chat.rewind.confirm":"回溯","chat.rewind.loadFailed":"加载回溯检查点失败","chat.rewind.failed":"回溯失败。请检查会话错误后重试。","status.context":"上下文","status.tokenLimitTooltip":"此为估算的 token 上限,模型回报上下文尺寸后会自动更新。","status.phase.running":"生成中…","status.phase.compacting":"正在压缩上下文…","status.phase.switchingModel":"正在切换模型…","status.phase.waitingPermission":"等待授权…","status.phase.error":"运行失败","preview.title":"预览","preview.action.resize":"调整预览区宽度","preview.action.close":"关闭预览区","preview.action.retry":"重试","preview.tab.diff":"变更","preview.tab.files":"文件","preview.tab.logs":"日志","preview.diff.loadingTitle":"正在加载任务变更…","preview.diff.loadingHint":"正在读取持久化的 worktree 产物。","preview.diff.failedTitle":"任务变更加载失败","preview.diff.discardedTitle":"变更已丢弃","preview.diff.discardedHint":"隔离工作区已删除,源项目没有被修改。","preview.diff.emptyTitle":"暂无变更","preview.diff.emptyHint":"工具修改文件后,变更会显示在这里。","preview.diff.searchAria":"搜索变更文件","preview.diff.searchPlaceholder":"筛选变更文件…","preview.diff.changedFiles":"{count} 个变更文件","preview.diff.expandAll":"全部展开","preview.diff.collapseAll":"全部收起","preview.diff.showMoreFiles":"再显示 {count} 个文件","preview.diff.showMoreLines":"再显示 {count} 行","preview.diff.noMatches":"没有匹配的变更文件","preview.diff.patch":"补丁","preview.diff.line":"第 {line} 行","preview.files.loadingTitle":"正在加载文件…","preview.files.loadingHint":"正在获取工作区文件树。","preview.files.failedTitle":"文件加载失败","preview.files.emptyTitle":"暂无文件","preview.files.emptyHint":"选择项目后即可加载工作区文件树。","preview.files.treeFailed":"工作区文件树加载失败","preview.files.searchAria":"搜索工作区文件","preview.files.searchPlaceholder":"查找文件…","preview.files.searchResultsAria":"文件搜索结果","preview.files.searchFailed":"工作区文件搜索失败","preview.files.noMatches":"没有匹配的文件","preview.files.directoryLoading":"正在加载目录…","preview.files.directoryEmpty":"空目录","preview.files.selectTitle":"选择要预览的文件","preview.files.status.loading":"加载中…","preview.files.status.truncated":"已截断","preview.files.status.ready":"就绪","preview.files.truncatedNotice":"预览内容已截断至 20 万字符。","preview.files.pickHint":"从文件树中选择一个文件进行预览。","preview.files.contentFailed":"文件加载失败","preview.files.editorLoading":"正在加载编辑器…","preview.logs.searchAria":"搜索工具日志","preview.logs.searchPlaceholder":"搜索工具、摘要或输出…","preview.logs.filterAria":"按状态筛选日志","preview.logs.filter.all":"全部","preview.logs.filter.running":"进行中","preview.logs.filter.error":"失败","preview.logs.filter.success":"成功","preview.logs.noMatches":"没有匹配的日志","preview.logs.noMatchesHint":"尝试其他关键词或状态。","preview.logs.emptyTitle":"暂无日志","preview.logs.emptyHint":"工具运行记录会显示在这里。","preview.logs.expand":"展开","preview.logs.collapse":"收起","preview.logs.showMore":"再显示 {count} 条日志","preview.logs.status.running":"进行中","preview.logs.status.error":"失败","preview.logs.status.success":"成功","goal.aria.section":"目标控制条","goal.status.active":"目标进行中","goal.status.paused":"目标已暂停","goal.status.blocked":"目标已阻塞","goal.status.usageLimited":"用量受限","goal.status.budgetLimited":"预算已达上限","goal.status.complete":"目标已完成","goal.field.objective":"目标描述","goal.action.edit":"编辑目标","goal.action.pause":"暂停目标","goal.action.resume":"恢复目标","goal.action.delete":"删除目标","goal.action.expand":"展开目标详情","goal.action.collapse":"收起目标详情","goal.action.cancel":"取消","goal.action.save":"保存","goal.metrics.tokens":"tokens","goal.metrics.continuationOne":"续跑 {n} 次","goal.metrics.continuationMany":"续跑 {n} 次","goal.dialog.title":"删除此目标?","goal.dialog.description":"仅移除目标状态,会话历史与工作区文件不会受影响。","settings.title":"设置","settings.nav.aria":"设置分区","settings.action.back":"返回","settings.category.settings":"设置","settings.category.integrations":"集成","settings.tab.general":"通用","settings.tab.trust":"安全","settings.tab.models":"模型","settings.tab.shortcuts":"快捷键","settings.tab.mcp":"MCP","settings.tab.skills":"技能","settings.tab.plugins":"插件","settings.tab.hooks":"钩子","settings.tab.schedules":"定时任务","settings.common.retry":"重试","settings.common.dismiss":"忽略","settings.common.cancel":"取消","settings.common.enable":"启用","settings.general.loading":"正在加载设置…","settings.general.loadError":"加载设置失败","settings.general.saveError":"保存设置失败","settings.general.responseLanguage":"回复语言","settings.general.responseLanguageHint":"AI 将使用该语言回复","settings.general.autoSave":"自动保存会话","settings.general.communicationStyle":"沟通风格","settings.general.communicationStyleHint":"决定 Agent 在所有会话中的回复措辞","settings.appearance.heading":"外观","settings.appearance.theme":"主题偏好","settings.appearance.theme.dark":"深色","settings.appearance.theme.light":"浅色","settings.appearance.theme.system":"跟随系统","settings.appearance.compactSidebar":"紧凑侧边栏","settings.appearance.codeTheme":"代码主题","settings.appearance.codeThemeHint":"语法高亮配色","settings.notifications.heading":"通知","settings.notifications.buildFinished":"构建完成","settings.notifications.errorsOnly":"仅错误","settings.notifications.systemSounds":"系统提示音","settings.notifications.blocked":"浏览器通知已被拦截","settings.notifications.unavailable":"当前浏览器不支持通知","settings.notifications.enablePrompt":"在此标签页处于后台时接收提醒","settings.privacy.heading":"隐私","settings.privacy.telemetry":"遥测","settings.privacy.crash":"崩溃报告","settings.models.description":"为不同的服务商配置 API Key 与模型设置。","settings.models.loading":"正在加载模型…","settings.models.loadChannelsFailed":"加载服务商渠道失败","settings.models.saveFailed":"保存模型失败","settings.models.deleteFailed":"删除模型失败","settings.models.updateFailed":"更新模型失败","settings.models.updateChannelFailed":"更新服务商渠道失败","settings.models.probeFailed":"服务商渠道探测失败","settings.models.deleteChannelFailed":"删除服务商渠道失败","settings.models.empty":"尚未配置任何模型","settings.models.add":"+ 添加新模型","settings.models.missingCredential":"缺少凭据","settings.models.configured":"已配置","settings.models.deleting":"正在删除…","settings.models.deleteModel":"删除模型","settings.models.deleteChannel":"删除渠道","settings.models.deleteModelAria":"删除 {name}","settings.models.deleteModelPrompt":"删除 {name} 及其保存的配置?","settings.models.deleteChannelAria":"删除渠道 {name}","settings.models.deleteChannelPrompt":"删除渠道 {name}、其凭据以及 {count} 个已配置模型?相关的兜底引用也会一并移除。","settings.models.editModelAria":"编辑 {name}","settings.models.editChannelAria":"编辑渠道 {name}","settings.models.testChannelAria":"测试 {name}","settings.models.deleteChannelActionAria":"删除渠道 {name}","settings.models.modelCountOne":"{count} 个模型","settings.models.modelCountMany":"{count} 个模型","settings.models.defaultEndpoint":"默认端点","settings.shortcuts.searchPlaceholder":"搜索操作…","settings.shortcuts.scope.all":"全部范围","settings.shortcuts.scope.global":"全局","settings.shortcuts.scope.chat":"聊天","settings.shortcuts.scope.layout":"布局","settings.shortcuts.reset":"重置","settings.shortcuts.col.action":"操作","settings.shortcuts.col.shortcut":"快捷键","settings.shortcuts.col.scope":"范围","settings.shortcuts.empty":"未找到快捷键。","settings.shortcuts.action.searchTasks":"搜索任务","settings.shortcuts.action.openCommands":"打开命令中心","settings.shortcuts.action.newTask":"新建任务","settings.shortcuts.action.focusComposer":"聚焦输入框","settings.shortcuts.action.toggleSidebar":"切换侧边栏","settings.common.reload":"重新加载","settings.trust.state.notRequired":"无需信任","settings.trust.state.trusted":"工作区已信任","settings.trust.state.review":"需要审查","settings.trust.state.error":"信任存储错误","settings.trust.selectSession":"选择一个项目会话以查看文件夹信任。","settings.trust.heading":"工作区信任","settings.trust.inheritedFrom":" · 继承自 {source}","settings.trust.reloadAria":"重新加载工作区信任","settings.trust.revoke":"撤销","settings.trust.trustWorkspace":"信任工作区","settings.trust.restartNotice":"重启 Blade 以重新加载项目模型、MCP、LSP、权限和插件。","settings.trust.revokeAria":"撤销工作区信任","settings.trust.confirmTrust":"允许 {count} 个项目来源配置模型、MCP、LSP、权限、环境、指令、命令、技能、Agent 或插件?","settings.trust.confirmRevoke":"重启后阻止项目控制的可执行配置?","settings.trust.saving":"正在保存…","settings.trust.trustReviewed":"信任已审查的工作区","settings.trust.revokeTrust":"撤销信任","settings.trust.empty":"未找到项目控制的可执行配置。","settings.trust.loadFailed":"加载工作区信任失败","settings.trust.updateFailed":"更新工作区信任失败","settings.hooks.state.disabled":"钩子已禁用","settings.hooks.state.notRequired":"无外部钩子","settings.hooks.state.review":"需要审查","settings.hooks.state.trusted":"已信任","settings.hooks.state.modified":"批准后已变更","settings.hooks.state.error":"信任存储错误","settings.hooks.selectSession":"选择一个项目会话以查看其钩子。","settings.hooks.heading":"钩子信任","settings.hooks.reloadAria":"重新加载钩子信任","settings.hooks.revoke":"撤销","settings.hooks.trustDigest":"信任摘要","settings.hooks.currentSession":"当前会话执行","settings.hooks.session.open":"打开一个会话以控制其钩子。","settings.hooks.session.loading":"正在加载会话状态…","settings.hooks.session.disabled":"已被工作区配置禁用。","settings.hooks.session.paused":"仅在此会话中暂停。","settings.hooks.session.active":"通过信任检查后,钩子可在此会话运行。","settings.hooks.session.unavailable":"已被当前会话 runtime 或宿主策略禁用。","settings.hooks.session.enableAria":"为当前会话启用钩子","settings.hooks.session.pauseAria":"为当前会话暂停钩子","settings.hooks.session.unavailableAria":"当前会话无法使用钩子","settings.hooks.confirmTrustAria":"信任项目钩子","settings.hooks.confirmRevokeAria":"撤销项目钩子信任","settings.hooks.confirmTrust":"以你的用户权限运行这 {count} 个钩子,直到它们的配置发生变更?","settings.hooks.confirmRevoke":"停止此项目所有已配置的钩子,直到再次显式信任?","settings.hooks.saving":"正在保存…","settings.hooks.trustReviewed":"信任已审查的钩子","settings.hooks.revokeTrust":"撤销信任","settings.hooks.empty":"没有已配置的命令、HTTP 或提示词钩子。","settings.hooks.loadFailed":"加载钩子信任失败","settings.hooks.updateFailed":"更新钩子信任失败","settings.hooks.sessionUpdateFailed":"更新会话钩子失败","settings.plugins.selectProject":"选择一个项目以管理其插件。","settings.plugins.heading":"工作区插件","settings.plugins.changesNote":"更改将在后续会话快照生效并持久化到所选层级。","settings.plugins.reloadAria":"重新加载插件","settings.plugins.sourcePolicy":"来源策略","settings.plugins.savePolicyAria":"保存插件来源策略","settings.plugins.saving":"正在保存…","settings.plugins.saveForProject":"保存到项目","settings.plugins.restrictAria":"限制插件来源","settings.plugins.restrictAllowlists":"限制为允许列表","settings.plugins.requireShaAria":"要求完整 Git commit SHA","settings.plugins.requireSha":"要求完整 Git SHA","settings.plugins.environmentLocked":" · 环境已锁定","settings.plugins.gitHostsAria":"允许的插件 Git 主机","settings.plugins.marketplacesAria":"允许的插件市场","settings.plugins.localRootsAria":"允许的本地插件根目录","settings.plugins.emptyAllowlists":"空的允许列表将拒绝所有插件来源。","settings.plugins.installHeading":"安装可信插件","settings.plugins.sourceAria":"插件来源","settings.plugins.install":"安装","settings.plugins.trustSource":"我信任此来源可激活钩子、MCP 服务器、技能和命令。","settings.plugins.activationScope":"激活写入范围","settings.plugins.activationScopeHint":"更高优先级的层级仍将决定最终生效状态。","settings.plugins.scopeAria":"插件激活范围","settings.plugins.scope.local":"本地","settings.plugins.scope.project":"项目","settings.plugins.scope.global":"全局","settings.plugins.scope.localDesc":"仅当前检出","settings.plugins.scope.projectDesc":"共享的项目设置","settings.plugins.scope.globalDesc":"所有项目","settings.plugins.scope.invocation":"本次调用","settings.plugins.scope.default":"默认","settings.plugins.layer.on":"开","settings.plugins.layer.off":"关","settings.plugins.capability.commands":"{count} 个命令","settings.plugins.capability.skills":"{count} 个技能","settings.plugins.capability.agents":"{count} 个 Agent","settings.plugins.capability.hooks":"{count} 个钩子","settings.plugins.capability.mcp":"{count} 个 MCP","settings.plugins.noResources":"未声明任何资源","settings.plugins.effective":"生效范围:{scope}","settings.plugins.managed":"托管","settings.plugins.invocationScoped":"通过 --plugin-dir 限定为调用级","settings.plugins.enableAria":"启用 {name}","settings.plugins.disableAria":"停用 {name}","settings.plugins.unavailableAria":"{name} 不可用","settings.plugins.updateAria":"更新 {name}","settings.plugins.uninstallAria":"卸载 {name}","settings.plugins.confirmUpdate":"确认更新","settings.plugins.update":"更新","settings.plugins.confirmRemove":"确认移除","settings.plugins.empty":"未发现此项目的任何插件。","settings.plugins.marketplaces":"市场","settings.plugins.configuredCount":"{count} 个已配置","settings.plugins.marketplaceSourceAria":"市场来源","settings.plugins.addMarketplaceAria":"添加市场","settings.plugins.add":"添加","settings.plugins.noDescription":"无描述","settings.plugins.refreshMarketplaceAria":"刷新市场 {name}","settings.plugins.removeMarketplaceAria":"移除市场 {name}","settings.plugins.confirm":"确认","settings.plugins.installedSuffix":" · 已安装","settings.plugins.marketplaceEmpty":"添加市场以发现可安装的插件。","settings.plugins.loadFailed":"加载插件失败","settings.plugins.actionFailed":"插件操作失败","settings.plugins.updateFailed":"更新插件失败","settings.models.addModal.title":"添加模型","settings.models.addModal.close":"关闭添加模型","settings.models.addModal.loadProvidersError":"加载服务商失败","settings.models.addModal.loadModelsError":"加载模型失败","settings.models.addModal.provider":"服务商","settings.models.addModal.loadingProviders":"正在加载服务商…","settings.models.addModal.selectProvider":"选择服务商","settings.models.addModal.configuredSuffix":" - 已配置","settings.models.addModal.customOpenAI":"自定义 OpenAI 端点","settings.models.addModal.customAnthropic":"自定义 Anthropic 端点","settings.models.addModal.channelId":"渠道 ID","settings.models.addModal.channelIdHint":"稳定的配置与凭据标识符。","settings.models.addModal.channelName":"渠道名称","settings.models.addModal.baseUrl":"Base URL","settings.models.addModal.anthropicProtocol":"使用 Anthropic Messages 协议。","settings.models.addModal.openaiProtocol":"使用 OpenAI Chat Completions 协议。","settings.models.addModal.modelId":"模型 ID","settings.models.addModal.model":"模型","settings.models.addModal.loadingModels":"正在加载模型…","settings.models.addModal.selectModel":"选择模型","settings.models.addModal.reasoningSuffix":" - 推理","settings.models.addModal.visionSuffix":" - 视觉","settings.models.addModal.displayName":"显示名称","settings.models.addModal.displayNamePlaceholder":"可选别名","settings.models.addModal.apiKey":"API Key","settings.models.addModal.apiKeyAria":"API Key","settings.models.addModal.apiKeyPlaceholder":"单独存储在 auth.json 中","settings.models.addModal.showApiKey":"显示 API Key","settings.models.addModal.hideApiKey":"隐藏 API Key","settings.models.addModal.oauthNote":"该服务商需要 OAuth 或环境凭据,请在选择模型前在外部完成配置。","settings.models.addModal.saveModel":"保存模型","settings.models.addModal.saving":"正在保存…","settings.models.addModal.channelIdError":'渠道 ID 必须以小写字母开头,且只能包含小写字母、数字、"."、"_" 或 "-"。',"settings.models.addModal.invalidBaseUrl":"Base URL 必须是绝对的 HTTP(S) URL。","settings.models.editModal.srTitle":"编辑模型","settings.models.editModal.title":"编辑模型覆盖项","settings.models.editModal.close":"关闭编辑模型","settings.models.editModal.displayName":"显示名称","settings.models.editModal.replaceApiKey":"替换服务商 API Key","settings.models.editModal.replaceApiKeyPlaceholder":"留空则保留当前凭据","settings.models.editModal.baseUrlOverride":"Base URL 覆盖","settings.models.editModal.baseUrlPlaceholder":"留空则使用默认端点","settings.models.editModal.streamIdleTimeout":"流空闲超时(ms)","settings.models.editModal.save":"保存","settings.models.editModal.saving":"正在保存…","settings.models.editModal.streamIdleTimeoutError":"流空闲超时必须至少为 1000ms。","settings.models.editModal.credentialError":"更新服务商凭据失败","settings.models.editProvider.title":"编辑服务商渠道","settings.models.editProvider.close":"关闭编辑服务商","settings.models.editProvider.channelName":"渠道名称","settings.models.editProvider.channelNameRequired":"渠道名称不能为空","settings.models.editProvider.wireApi":"Wire API","settings.models.editProvider.baseUrl":"Base URL","settings.models.editProvider.baseUrlAria":"服务商 Base URL","settings.models.editProvider.invalidBaseUrl":"Base URL 必须是绝对的 HTTP(S) URL。","settings.models.editProvider.apiKeyEnv":"API Key 环境变量","settings.models.editProvider.apiKeyEnvPlaceholder":"可选,例如 TEAM_GATEWAY_API_KEY","settings.models.editProvider.replaceApiKey":"替换 API Key","settings.models.editProvider.apiKeyAria":"服务商 API Key","settings.models.editProvider.apiKeyPlaceholder":"留空则保留当前凭据","settings.models.editProvider.save":"保存渠道","settings.models.editProvider.saving":"正在保存…","settings.style.auto":"自动","settings.style.pragmatic":"务实","settings.style.friendly":"友好","settings.style.explanatory":"解释型","mcp.status.connected":"已连接","mcp.status.connecting":"连接中...","mcp.status.reconnecting":"恢复中...","mcp.status.offline":"离线","mcp.status.error":"错误","mcp.status.recoveringAttempt":"恢复中 {attempt}/{max}","mcp.oauth.status.disabled":"未配置","mcp.oauth.status.unavailable":"当前运行时不可用","mcp.oauth.status.unauthenticated":"需要授权","mcp.oauth.status.authorizing":"等待授权...","mcp.oauth.status.authenticated":"已授权","mcp.oauth.status.error":"授权失败","mcp.catalog.tag.official":"官方","mcp.catalog.tag.popular":"热门","mcp.catalog.tag.community":"社区","mcp.action.refreshServers":"刷新 MCP 服务器","mcp.action.addServer":"添加服务器","mcp.action.close":"关闭 MCP","mcp.action.dismiss":"忽略","mcp.action.retry":"重试","mcp.action.disconnect":"断开连接","mcp.action.disconnecting":"断开中...","mcp.action.stopRecovery":"停止恢复","mcp.action.connect":"连接","mcp.action.connecting":"连接中...","mcp.action.authorizeFirst":"请先授权","mcp.action.delete":"删除","mcp.action.cancel":"取消","mcp.action.deleting":"删除中...","mcp.action.deleteServer":"删除服务器","mcp.tab.installed":"已安装 ({count})","mcp.tab.catalog":"目录","mcp.servers.title":"服务器","mcp.servers.searchAria":"搜索已安装的 MCP 服务器","mcp.servers.searchPlaceholder":"搜索服务器...","mcp.servers.loading":"正在加载服务器...","mcp.servers.noMatch":"没有匹配的服务器","mcp.servers.none":"尚未配置 MCP 服务器","mcp.server.errorLabel":"错误:{error}","mcp.server.deleteAria":"删除 {name}","mcp.server.selectPrompt":"选择一个服务器以查看详情","mcp.instructions.title":"服务器说明","mcp.instructions.detailsOmittedByPolicy":"[详情已根据运行时策略省略]","mcp.instructions.detailsOmitted":"详情已省略","mcp.instructions.truncated":"已截断至安全显示上限","mcp.tasks.title":"实验性 MCP 任务","mcp.tasks.summary":"每会话 {count} 个 · {interval}ms 轮询","mcp.tasks.disabledByDefault":"默认禁用","mcp.tasks.enabled":"已启用","mcp.tasks.disabled":"已禁用","mcp.oauth.signingOut":"登出中...","mcp.oauth.signOut":"登出","mcp.oauth.continueAuthorization":"继续授权","mcp.oauth.resumeAuthorization":"恢复授权","mcp.oauth.opening":"打开中...","mcp.oauth.authorize":"授权","mcp.delete.confirm":"移除此服务器及其已保存的配置?","mcp.tools.title":"工具 ({count})","mcp.tools.none":"暂无可用工具","mcp.completion.title":"参数补全","mcp.completion.connectPrompt":"连接服务器后即可请求补全建议","mcp.completion.unsupported":"该服务器未声明支持 MCP 补全","mcp.completion.noTargets":"没有可补全的提示词参数或模板变量","mcp.completion.targetAria":"MCP 补全目标","mcp.completion.partialAria":"MCP 补全的部分值","mcp.completion.partialPlaceholder":"部分值","mcp.completion.completing":"补全中...","mcp.completion.complete":"补全","mcp.completion.suggestionsAria":"MCP 补全建议","mcp.completion.empty":"[空]","mcp.completion.noSuggestions":"暂无建议","mcp.meta.truncatedSuffix":" · 已截断","mcp.meta.detailsOmittedSuffix":" · 详情已省略","mcp.diagnostics.title":"诊断","mcp.diagnostics.refreshAria":"刷新 {name} 的 MCP 日志","mcp.diagnostics.logsAria":"{name} 的 MCP 日志","mcp.log.levelAria":"MCP 日志级别","mcp.log.setting":"设置中...","mcp.log.loading":"正在加载日志...","mcp.log.none":"未捕获到日志","mcp.catalog.searchAria":"搜索 MCP 服务器目录","mcp.catalog.searchPlaceholder":"在 npm 上搜索 MCP 服务器(至少 3 个字符)...","mcp.catalog.retry":"重试加载目录","mcp.catalog.noDescription":"暂无描述","mcp.catalog.byAuthor":"作者 {author}","mcp.catalog.installed":"已安装","mcp.catalog.installing":"安装中...","mcp.catalog.install":"安装","mcp.catalog.noPackages":"未找到任何包","mcp.catalog.noMore":"没有更多包了","mcp.catalog.packagesFound":"找到 {count} 个包","mcp.catalog.browseGlama":"在 Glama 上浏览更多","mcp.error.connectFailed":"连接服务器失败","mcp.error.disconnectFailed":"断开服务器失败","mcp.error.deleteFailed":"删除服务器失败","mcp.error.loginFailed":"MCP OAuth 登录失败","mcp.error.logoutFailed":"MCP OAuth 登出失败","mcp.error.loggingLevelFailed":"设置 MCP 日志级别失败","mcp.error.completionFailed":"MCP 补全失败","mcp.add.title":"添加 MCP 服务器","mcp.add.closeAria":"关闭添加 MCP 服务器","mcp.add.modeForm":"表单","mcp.add.jsonConfig":"JSON 配置","mcp.add.jsonConfigAria":"JSON 配置","mcp.add.serverName":"服务器名称","mcp.add.command":"命令","mcp.add.commandAria":"服务器命令","mcp.add.argsLabel":"参数(空格分隔)","mcp.add.argsAria":"服务器参数","mcp.add.invalidJson":"请输入包含服务器名称和传输方式的有效 JSON。","mcp.add.nameCommandRequired":"名称和命令为必填项。","mcp.add.adding":"添加中...","mcp.add.submit":"添加服务器","mcp.install.title":"安装 MCP 服务器","mcp.install.titleWithName":"安装 {name}","mcp.install.closeAria":"关闭 MCP 安装","mcp.install.args":"参数","mcp.install.commandPreview":"命令:npx {args}","mcp.install.nameRequired":"服务器名称为必填项。","skills.title":"技能","skills.action.install":"安装技能","skills.action.installShort":"安装","skills.action.refreshAria":"刷新技能","skills.action.closeAria":"关闭技能","skills.action.dismiss":"忽略","skills.action.retry":"重试","skills.action.cancel":"取消","skills.action.close":"关闭","skills.action.hide":"隐藏","skills.action.enable":"启用","skills.action.disable":"禁用","skills.action.saving":"保存中…","skills.status.enabled":"已启用","skills.status.disabled":"已禁用","skills.status.installed":"已安装","skills.noDescriptionShort":"暂无描述","skills.noDescription":"暂无可用描述","skills.installed.title":"已安装","skills.installed.searchAria":"搜索已安装的技能","skills.installed.searchPlaceholder":"搜索技能…","skills.installed.loading":"正在加载技能…","skills.installed.noMatch":"没有匹配的技能","skills.installed.empty":"尚未安装任何技能","skills.uninstall.managedHint":"仅可卸载 Blade 用户技能","skills.uninstall.managed":"受管理","skills.uninstall.action":"卸载","skills.uninstall.confirmAria":"卸载 {name}","skills.uninstall.confirmPrompt":"从 ~/.blade/skills 中移除此技能?","skills.uninstall.inProgress":"正在卸载…","skills.uninstall.confirm":"卸载技能","skills.details.title":"详情","skills.details.provider":"提供方","skills.details.location":"位置","skills.details.capabilities":"能力","skills.details.allowedTools":"允许的工具({count})","skills.detail.emptyState":"选择一个技能以查看详情","skills.install.title":"安装技能","skills.install.closeAria":"关闭技能安装","skills.install.tab.catalog":"目录","skills.install.tab.repo":"仓库","skills.install.tab.local":"本地","skills.install.catalog.searchAria":"搜索技能目录","skills.install.catalog.searchPlaceholder":"搜索目录…","skills.install.catalog.loading":"正在加载目录…","skills.install.catalog.empty":"未找到技能","skills.install.catalog.byAuthor":"作者:{author}","skills.install.catalog.tag.official":"官方","skills.install.catalog.tag.popular":"热门","skills.install.catalog.tag.community":"社区","skills.install.repo.label":"GitHub URL","skills.install.repo.inputAria":"技能仓库地址","skills.install.repo.credentialsHint":"使用 Blade 进程可用的 Git 凭据","skills.install.local.label":"本地路径","skills.install.local.inputAria":"本地技能路径","skills.status.dialogTitle":"安装状态","skills.status.confirm.title":"确认安装","skills.status.confirm.prompt":"安装所选技能?","skills.status.installing.title":"正在安装","skills.status.installing.description":"正在下载并校验…","skills.status.failed.title":"安装失败","skills.status.failed.fallback":"安装失败。","skills.status.failed.hint":"请检查访问权限后重试。","skills.error.deleteFailed":"删除技能失败","skills.error.toggleFailed":"切换技能状态失败","skills.error.installFailed":"安装技能失败","schedule.title":"定时任务","schedule.description":"按 cron、间隔或一次性触发器自动运行无界面任务提示词。","schedule.new":"新建定时任务","schedule.newAria":"创建新的定时任务","schedule.refresh":"刷新","schedule.reloadAria":"重新加载定时任务","schedule.create":"创建","schedule.save":"保存","schedule.cancel":"取消","schedule.confirmDelete":"确认?","schedule.empty":"暂无定时任务","schedule.enabled":"已启用","schedule.disabled":"已禁用","schedule.never":"从未","schedule.nextRun":"下次运行","schedule.lastRun":"上次运行","schedule.runCount":"已运行 {count} 次","schedule.trigger.kindAria":"触发器类型","schedule.trigger.cron":"Cron","schedule.trigger.interval":"间隔","schedule.trigger.once":"一次性","schedule.field.title":"标题(可选)","schedule.field.cron":"Cron 表达式","schedule.field.interval":"间隔","schedule.field.runAt":"运行时间","schedule.field.prompt":"提示词","schedule.field.project":"项目路径","schedule.field.model":"模型(可选)","schedule.field.permissionMode":"权限模式","schedule.field.isolation":"隔离方式","schedule.placeholder.title":"每晚依赖审查","schedule.placeholder.cron":"0 9 * * 1 (分 时 日 月 周)","schedule.placeholder.interval":"30m / 2h / 1d","schedule.placeholder.prompt":"描述要运行的任务…","schedule.placeholder.project":"/path/to/project","schedule.placeholder.model":"例如 anthropic/claude-sonnet","schedule.model.current":"使用当前模型","schedule.permission.default":"默认","schedule.permission.autoEdit":"自动编辑","schedule.permission.yolo":"Yolo","schedule.permission.plan":"规划","schedule.isolation.local":"本地","schedule.isolation.worktree":"工作树","schedule.cadence.cron":"cron:{expr}","schedule.cadence.interval":"每 {interval}","schedule.cadence.once":"于 {time} 运行一次","schedule.status.queued":"排队中","schedule.status.running":"运行中","schedule.status.completed":"已完成","schedule.status.failed":"失败","schedule.status.cancelled":"已取消","schedule.status.interrupted":"已中断","schedule.status.error":"出错","schedule.status.never":"尚未运行","schedule.runNowAria":"立即运行“{title}”","schedule.editAria":"编辑“{title}”","schedule.deleteAria":"删除“{title}”","schedule.enableAria":"启用“{title}”","schedule.disableAria":"禁用“{title}”","schedule.error.promptRequired":"提示词不能为空。","schedule.error.projectRequired":"项目路径不能为空。","schedule.error.cronRequired":"Cron 表达式不能为空。","schedule.error.invalidInterval":"请输入类似 30m、2h 或 1d 的间隔。","schedule.error.runAtRequired":"请选择有效的运行时间。","schedule.error.loadFailed":"加载定时任务失败。","schedule.error.createFailed":"创建定时任务失败。","schedule.error.updateFailed":"更新定时任务失败。","schedule.error.deleteFailed":"删除定时任务失败。","schedule.error.toggleFailed":"切换定时任务状态失败。","schedule.error.runFailed":"运行定时任务失败。"},k0=["en","zh"],Ya={en:h0,zh:b0},Zf="blade-ui-locale",al=typeof window<"u"&&typeof document<"u";function x0(){var e,t;if(al){try{const r=(e=window.localStorage)==null?void 0:e.getItem(Zf);if(r==="en"||r==="zh")return r}catch{}return(typeof navigator<"u"&&(navigator.language||((t=navigator.languages)==null?void 0:t[0]))||"").toLowerCase().startsWith("zh")?"zh":"en"}return"en"}let Es=x0();const hc=new Set;function y0(){for(const e of hc)e()}function S0(e){var t;if(e!==Es){if(Es=e,al){try{(t=window.localStorage)==null||t.setItem(Zf,e)}catch{}document!=null&&document.documentElement&&(document.documentElement.lang=e==="zh"?"zh-CN":"en")}y0()}}function em(e){return hc.add(e),()=>hc.delete(e)}function w0(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>{const s=t[r];return s==null?n:String(s)}):e}function He(e,t){const r=(Ya[Es]??Ya.en)[e]??Ya.en[e];return w0(r,t)}function Ft(){return w.useSyncExternalStore(em,()=>Es,()=>"en"),He}function v0(){return{locale:w.useSyncExternalStore(em,()=>Es,()=>"en"),setLocale:S0}}al&&(document!=null&&document.documentElement)&&(document.documentElement.lang=Es==="zh"?"zh-CN":"en");function gt(e,t){return{...e,...t}}function Br(e,t,n){return e>=t&&e<=n}function I0(e){return e===8205}function C0(e){return Br(e,55296,56319)}function Ou(e){return Br(e,127462,127487)}function tm(e){return Br(e,65024,65039)}function nm(e){return Br(e,768,879)||Br(e,6832,6911)||Br(e,7616,7679)||Br(e,65056,65071)}function Ci(e){return e>65535?2:1}function $u(e,t){for(;t<e.length;){const n=e.codePointAt(t);if(nm(n)||tm(n))t+=Ci(n);else break}return t}function cl(e,t){const n=e.codePointAt(t);let r=t+Ci(n);for(r=$u(e,r);r<e.length-1&&e[r]==="‍";){const s=e.codePointAt(r+1);r+=1+Ci(s),r=$u(e,r)}return Ou(n)&&r<e.length&&Ou(e.codePointAt(r))&&(r+=Ci(e.codePointAt(r))),r}function rm(e){return C0(e)||nm(e)||tm(e)||I0(e)}function j0(e){let t=0,n=0;for(;n<e.length;)n=cl(e,n),t++;return t}function T0(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=cl(e,r),n++,n>=t)return!0;return!1}function A0(e,t){let n=0,r=0;for(;r<e.length;)if(r=cl(e,r),n++,n>t)return!1;return!0}function E0(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(rm(e.charCodeAt(n)))return T0(e,t);if(n++,n>=t)return!0}return!1}function P0(e,t){let n=0;for(;n<e.length;){if(rm(e.charCodeAt(n)))return A0(e,t);if(n++,n>t)return!1}return!0}function H(e){return Array.isArray(e)}function tt(e){return h(typeof e,"bigint")}function ht(e){return h(typeof e,"boolean")}function ea(e){if($e(e)||!In(e))return!1;const t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function In(e){return h(typeof e,"function")}function ll(e){return Number.isInteger(e)}function Vt(e){return h(e,null)}function ye(e){return Number.isFinite(e)}function fn(e){return ne(e)&&!H(e)}function ne(e){return h(typeof e,"object")&&!Vt(e)}function ie(e){return h(typeof e,"string")}function dl(e){return h(typeof e,"symbol")}function $e(e){return h(e,void 0)}function h(e,t){return e===t}function Yr(e,t){return e>t}function Co(e,t){return e<t}function rr(e,t){return e<=t}function Ns(e,t){return e>=t}function sm(e,t){if(tt(e)||tt(t))return BigInt(e)%BigInt(t)===0n;const n=1e-10;if(!ye(e)||ll(e)&&1/t%1===0)return!0;const r=e%t;return Math.min(Math.abs(r),Math.abs(r-t),Math.abs(r+t))<n}function om(e){if(!ne(e))return!1;const t=globalThis.Object.getPrototypeOf(e);return Vt(t)?!1:h(typeof t.constructor,"function")&&!(h(t.constructor,globalThis.Object)||h(t.constructor.name,"Object"))}function Os(e){return tt(e)||ht(e)||Vt(e)||ye(e)||ie(e)||$e(e)}function N0(e){return j0(e)}function im(e,t){return P0(e,t)}function am(e,t){return E0(e,t)}function dt(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function jt(e,t,n){let r=!0;for(let s=t;s<e.length;s++)n(e[s],s)||(r=!1);return r}function $s(e,t){for(let n=0;n<e.length;n++)if(t(e[n],n))return!0;return!1}function cm(e,t){let n=!1;for(let r=0;r<e.length;r++)t(e[r],r)&&(n=!0);return n}function ul(e,t){return e.reduce((n,r,s)=>t(r,s)?++n:n,0)}function Ie(e,t,n){return h(e.length,0)?n():t(e[0],e.slice(1))}function Jn(e){return h(e,"__proto__")||h(e,"constructor")||h(e,"prototype")}function E(e,t){return Jn(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function fl(e){return D(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function nt(e){return Object.entries(e)}function D(e){return Object.getOwnPropertyNames(e)}function ml(e){return Object.getOwnPropertySymbols(e)}function pl(e){return Object.values(e)}function O0(e,t){if(!ne(t))return!1;const n=D(e);return h(n.length,D(t).length)&&n.every(r=>Xr(e[r],t[r]))}function $0(e,t){return H(t)&&h(e.length,t.length)&&e.every((n,r)=>Xr(e[r],t[r]))}function Xr(e,t){return H(e)?$0(e,t):ne(e)?O0(e,t):h(e,t)}const $i=Object.freeze(Object.defineProperty({__proto__:null,Counted:ul,Entries:nt,EntriesRegExp:fl,Every:dt,EveryAll:jt,GraphemeCount:N0,HasPropertyKey:E,IsArray:H,IsBigInt:tt,IsBoolean:ht,IsClassInstance:om,IsConstructor:ea,IsDeepEqual:Xr,IsEqual:h,IsFunction:In,IsGreaterEqualThan:Ns,IsGreaterThan:Yr,IsInteger:ll,IsLessEqualThan:rr,IsLessThan:Co,IsMaxLength:im,IsMinLength:am,IsMultipleOf:sm,IsNull:Vt,IsNumber:ye,IsObject:ne,IsObjectNotArray:fn,IsString:ie,IsSymbol:dl,IsUndefined:$e,IsUnsafePropertyKey:Jn,IsValueLike:Os,Keys:D,ShiftLeft:Ie,Some:$s,SomeAll:cm,Symbols:ml,Values:pl},Symbol.toStringTag,{value:"Module"})),R0=/^[\p{ID_Start}_$][\p{ID_Continue}_$\u200C\u200D]*$/u;function M0(e){return R0.test(e)}function wt(e,t){return`(${e} && ${t})`}function qe(e,t){return`(${e} || ${t})`}function Nt(e){return`!(${e})`}function Ri(e){return`Array.isArray(${e})`}function lm(e){return`typeof ${e} === "bigint"`}function F0(e){return`typeof ${e} === "boolean"`}function D0(e){return`Number.isInteger(${e})`}function _0(e){return`${e} === null`}function dm(e){return`Number.isFinite(${e})`}function um(e){return wt(fm(e),Nt(Ri(e)))}function fm(e){return`typeof ${e} === "object" && ${e} !== null`}function mm(e){return`typeof ${e} === "string"`}function L0(e){return`typeof ${e} === "symbol"`}function bc(e){return`${e} === undefined`}function U0(e){return`typeof ${e} === "function"`}function B0(e){return`Guard.IsConstructor(${e})`}function Gt(e,t){return`${e} === ${t}`}function pm(e,t){return`${e} > ${t}`}function gl(e,t){return`${e} < ${t}`}function Zr(e,t){return`${e} <= ${t}`}function jo(e,t){return`${e} >= ${t}`}function H0(e,t){return`Guard.IsMinLength(${e}, ${t})`}function q0(e,t){return`Guard.IsMaxLength(${e}, ${t})`}function Dn(e,t,n,r){return h(t,"0")?`${e}.every((${n[0]}, ${n[1]}) => ${r})`:`((value, callback) => { for(let index = ${t}; index < value.length; index++) if (!callback(value[index], index)) return false; return true })(${e}, (${n[0]}, ${n[1]}) => ${r})`}function z0(e,t,n){return`${e}.some((${t[0]}, ${t[1]}) => ${n})`}function K0(e,t,n){return`((value, callback) => { let result = false; for(let index = 0; index < value.length; index++) if (callback(value[index], index)) result = true; return result })(${e}, (${t[0]}, ${t[1]}) => ${n})`}function ta(e,t,n){return`${e}.reduce((result, ${t[0]}, ${t[1]}) => (${n}) ? ++result : result, 0)`}function gm(e){return`Object.entries(${e})`}function es(e){return`Object.getOwnPropertyNames(${e})`}function Kr(e,t){return h(t,'"__proto__"')||h(t,'"constructor"')?`Object.prototype.hasOwnProperty.call(${e}, ${t})`:`${t} in ${e}`}function hm(e,t){return`Guard.IsDeepEqual(${e}, ${t})`}function G0(e){return`[${e.join(", ")}]`}function xr(e,t){return`((${e.join(", ")}) => ${t})`}function Ke(e,t){return`${e}(${t.join(", ")})`}function hl(e,t){return`new ${e}(${t.join(", ")})`}function de(e,t){return`${e}${M0(t)?`.${t}`:`[${z(t)}]`}`}function z(e){if(!Os(e))throw Error("Unsupported Constant");return ie(e)?JSON.stringify(e):`${e}`}function V0(e,t,n){return`(${e} ? ${t} : ${n})`}function na(e){return`{ ${e.join("; ")}; }`}function Qn(e,t){return`const ${e} = ${t}`}function bm(e,t){return`if(${e}) { ${t} }`}function ra(e){return`return ${e}`}function It(e){return h(e.length,0)?"true":e.reduce((t,n)=>wt(t,n))}function bl(e){return h(e.length,0)?"false":e.reduce((t,n)=>qe(t,n))}function W0(e,t){return`Guard.IsMultipleOf(${e}, ${t})`}function J0(e){return e instanceof Boolean}function Q0(e){return e instanceof Number}function Y0(e){return e instanceof String}function To(e){return globalThis.ArrayBuffer.isView(e)}function km(e){return e instanceof globalThis.RegExp}function xm(e){return e instanceof globalThis.Date}function ym(e){return e instanceof globalThis.Set}function Sm(e){return e instanceof globalThis.Map}function X0(e){return E(e,"~kind")||E(e,"~unsafe")}function Z0(e){const t={},n=Object.getOwnPropertyDescriptors(e);for(const r of Object.keys(n)){if(Jn(r))continue;const s=n[r];E(s,"value")&&Object.defineProperty(t,r,{...s,value:Gr(s.value)})}return t}function ew(e){const t={};for(const n of D(e))Jn(n)||(t[n]=Gr(e[n]));for(const n of ml(e))t[n]=Gr(e[n]);return t}function tw(e){return om(e)?e:X0(e)?Z0(e):ew(e)}function nw(e){return e.map(t=>Gr(t))}function rw(e){return e.slice()}function sw(e){return new RegExp(e.source,e.flags)}function ow(e){return new Map(Gr([...e.entries()]))}function iw(e){return new Set(Gr([...e.values()]))}function Gr(e){return To(e)?rw(e):km(e)?sw(e):Sm(e)?ow(e):ym(e)?iw(e):H(e)?nw(e):ne(e)?tw(e):e}function kl(e){return Gr(e)}const aw={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Ao(){return aw}function cw(e,t){for(const n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function lw(e,t){return{...e,...t}}function he(e,t,n={}){const r=lw(t,n);return cw(r,e)}function Pn(e,t){const n={},r=Object.getOwnPropertyDescriptors(kl(e)),s=new Set(t);for(const o of Object.keys(r))s.has(o)||Object.defineProperty(n,o,r[o]);return n}function ue(e,t,n){const r=Ao(),s=kl(e);for(const o of Object.keys(t))Object.defineProperty(s,o,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[o]});for(const o of Object.keys(n))Object.defineProperty(s,o,{configurable:!0,enumerable:!0,writable:!0,value:n[o]});return s}function we(e,t){return ne(e)&&E(e,"~kind")&&h(e["~kind"],t)}function Yt(e){return ne(e)}function je(e,t,n){return he({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function Ts(e){return we(e,"Deferred")}function dw(e){return ue(e,{"~readonly":!0},{})}function xl(e,t){return ue(dw(e),{},t)}function uw(e,t,n,r){const s=G(e,t,n);return xl(s,r)}function fw(e){return ue(e,{"~optional":!0},{})}function yl(e,t){return ue(fw(e),{},t)}function mw(e,t,n,r){const s=G(e,t,n);return yl(s,r)}function Cr(e,t){return he({"~kind":"Array"},{type:"array",items:e},t)}function ut(e){return we(e,"Array")}function Sl(e){return Pn(e,["~kind","type","items"])}function Eo(e,t,n={}){return he({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function mn(e){return we(e,"Constructor")}function pw(e){return Pn(e,["~kind","type","parameters","instanceType"])}function Po(e,t,n={}){return he({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function pn(e){return we(e,"Function")}function gw(e){return Pn(e,["~kind","type","parameters","returnType"])}function dn(e,t){return he({"~kind":"Ref"},{$ref:e},t)}function kt(e){return we(e,"Ref")}function No(e,t){return he({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function wl(e){return we(e,"Generic")}function vl(e){return he({"~kind":"Any"},{},e)}function Nn(e){return we(e,"Any")}const hw="(?!)";function Tt(e){return he({"~kind":"Never"},{not:{}},e)}function Rs(e){return we(e,"Never")}function er(e,t={}){return je("AddOptional",[e],t)}function Mi(e,t={}){return yl(e,t)}function bw(e){return Mi(e)}function Xt(e){return Yt(e)&&E(e,"~optional")}function kw(e){return D(e).filter(t=>!Xt(e[t]))}function wm(e){return D(e)}function vm(e){return pl(e)}function Ae(e,t={}){const n=kw(e),r=n.length>0?{required:n}:{};return he({"~kind":"Object"},{type:"object",...r,properties:e},t)}function Le(e){return we(e,"Object")}function xw(e){return Pn(e,["~kind","type","properties","required"])}function Bt(e){return he({"~kind":"Unknown"},{},e)}function Cn(e){return we(e,"Unknown")}function Oo(e,t,n){const r=D(e).reduce((s,o)=>({...s,[o]:ue(e[o],{},{$id:o})}),{});return he({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function Ht(e){return we(e,"Cyclic")}function yw(e){return ue(e,{"~unsafe":null},{})}function Im(e){return fn(e)&&E(e,"~unsafe")&&Vt(e["~unsafe"])}function ct(e,t){var n;return((n=t[e.length])==null?void 0:n.call(t,...e))??(()=>{throw Error("Invalid Arguments")})()}function kc(...e){const[t,n]=ct(e,{2:(r,s)=>[r,s,s],1:r=>[r,Bt(),Bt()]});return he({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Zt(e){return we(e,"Infer")}function Fi(e,t,n,r={}){return he({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function gn(e){return we(e,"Dependent")}function Sw(e){return Pn(e,["~kind","if","then","else"])}function ww(e){return fn(e)}function vw(e){return D(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function Iw(e){return ie(e)||ye(e)}function Cw(e,t){const n=ww(e)?vw(e):e;return he({"~kind":"Enum"},{enum:n},t)}function hn(e){return we(e,"Enum")}function Fn(e,t={}){return he({"~kind":"Intersect"},{allOf:e},t)}function Ue(e){return we(e,"Intersect")}function jw(e){return Pn(e,["~kind","allOf"])}let Xa;function Tw(){try{return jm("null")(),!0}catch{return!1}}function Cm(){return $e(Xa)&&(Xa=Tw()),Xa&&Ao().useAcceleration}function jm(...e){return new globalThis.Function(...e)}function Ot(){throw new Error("Unreachable")}function Aw(e){const t=new Set;let n=e;for(;n&&n!==Object.prototype;){for(const r of Reflect.ownKeys(n))r!=="constructor"&&typeof r!="symbol"&&t.add(r);n=Object.getPrototypeOf(n)}return[...t]}function Ew(e){return typeof e=="number"}var $t;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})($t||($t={}));let Is=BigInt("14695981039346656037");const[Pw,Nw]=[BigInt("1099511628211"),BigInt("18446744073709551616")],Ow=Array.from({length:256}).map((e,t)=>BigInt(t)),Tm=new Float64Array(1),Am=new DataView(Tm.buffer),Em=new Uint8Array(Tm.buffer);function xt(e){Is=Is^Ow[e],Is=Is*Pw%Nw}function $w(e){xt($t.Array);for(const t of e)yr(t)}function Rw(e){xt($t.BigInt),Am.setBigInt64(0,e);for(const t of Em)xt(t)}function Ru(e){xt($t.Boolean),xt(e?1:0)}function Mw(e){xt($t.Constructor),yr(e.toString())}function Fw(e){xt($t.Date),yr(e.getTime())}function Dw(e){xt($t.Function),yr(e.toString())}function _w(e){xt($t.Null)}function Mu(e){xt($t.Number),Am.setFloat64(0,e,!0);for(const t of Em)xt(t)}function Lw(e){xt($t.Object);for(const t of Aw(e).sort())yr(t),yr(e[t])}function Uw(e){xt($t.RegExp),xc(e.toString())}const Bw=new TextEncoder;function xc(e){xt($t.String);for(const t of Bw.encode(e))xt(t)}function Hw(e){xt($t.Symbol),yr(e.toString())}function qw(e){xt($t.TypeArray);const t=new Uint8Array(e.buffer);for(let n=0;n<t.length;n++)xt(t[n])}function zw(e){return xt($t.Undefined)}function yr(e){return To(e)?qw(e):xm(e)?Fw(e):km(e)?Uw(e):J0(e)?Ru(e.valueOf()):Y0(e)?xc(e.valueOf()):Q0(e)?Mu(e.valueOf()):Ew(e)?Mu(e):H(e)?$w(e):ht(e)?Ru(e):tt(e)?Rw(e):ea(e)?Mw(e):Vt(e)?_w():ne(e)?Lw(e):ie(e)?xc(e):dl(e)?Hw(e):$e(e)?zw():In(e)?Dw(e):Ot()}function Pm(e){return Is=BigInt("14695981039346656037"),yr(e),Is}function sa(e){return Pm(e).toString(16).padStart(16,"0")}const Kw=Object.freeze(Object.defineProperty({__proto__:null,Hash:sa,HashCode:Pm},Symbol.toStringTag,{value:"Module"}));function Gw(e){switch(e.keyword){case"additionalProperties":return"must not have additional properties";case"anyOf":return"must match a schema in anyOf";case"boolean":return"schema is false";case"const":return"must be equal to constant";case"contains":return"must contain at least 1 valid item";case"dependencies":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"dependentRequired":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"enum":return"must be equal to one of the allowed values";case"exclusiveMaximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"exclusiveMinimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"format":return`must match format "${e.params.format}"`;case"if":return`must match "${e.params.failingKeyword}" schema`;case"maxItems":return`must not have more than ${e.params.limit} items`;case"maxLength":return`must not have more than ${e.params.limit} characters`;case"maxProperties":return`must not have more than ${e.params.limit} properties`;case"maximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"minItems":return`must not have fewer than ${e.params.limit} items`;case"minLength":return`must not have fewer than ${e.params.limit} characters`;case"minProperties":return`must not have fewer than ${e.params.limit} properties`;case"minimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"multipleOf":return`must be multiple of ${e.params.multipleOf}`;case"not":return"must not be valid";case"oneOf":return"must match exactly one schema in oneOf";case"pattern":return`must match pattern "${e.params.pattern}"`;case"propertyNames":return`property names ${e.params.propertyNames.join(", ")} are invalid`;case"required":return`must have required properties ${e.params.requiredProperties.join(", ")}`;case"type":return typeof e.params.type=="string"?`must be ${e.params.type}`:`must be either ${e.params.type.join(" or ")}`;case"unevaluatedItems":return"must not have unevaluated items";case"unevaluatedProperties":return"must not have unevaluated properties";case"uniqueItems":return"must not have duplicate items";case"~refine":return e.params.message;default:return"an unknown validation error occurred"}}let Vw=Gw;function Ww(){return Vw}class Nm{constructor(t,n){this.type=t,this.decode=n}Encode(t){const n=this.type,r=en(n)?i=>this.decode(n["~codec"].decode(i)):this.decode,s=en(n)?i=>n["~codec"].encode(t(i)):t,o={decode:r,encode:s};return ue(this.type,{"~codec":o},{})}}class Om{constructor(t){this.type=t}Decode(t){return new Nm(this.type,t)}}function Il(e){return new Om(e)}function Jw(e,t){return Il(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Qw(e,t){return Il(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function en(e){return Yt(e)&&E(e,"~codec")&&ne(e["~codec"])&&E(e["~codec"],"encode")&&E(e["~codec"],"decode")}function Yw(e){return fd(e)}function Di(e){return Yt(e)&&E(e,"~immutable")}function tr(e,t={}){return je("AddReadonly",[e],t)}function _i(e,t={}){return xl(e,t)}function Xw(e){return _i(e)}function Li(e){return Yt(e)&&E(e,"~readonly")}function Zw(e,t){const n=Cl(e)?[...e["~refine"],t]:[t];return ue(e,{"~refine":n},{})}function ev(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[s,o,()=>"Refine Error"]});return Zw(t,{check:n,error:r})}function tv(e){return fn(e)&&E(e,"check")&&E(e,"error")&&In(e.check)&&In(e.error)}function Cl(e){return Yt(e)&&E(e,"~refine")&&H(e["~refine"])&&dt(e["~refine"],0,t=>tv(t))}const nv="-?(?:0|[1-9][0-9]*)n";function jl(e){return he({"~kind":"BigInt"},{type:"bigint"},e)}function ts(e){return we(e,"BigInt")}function $m(e){return he({"~kind":"Boolean"},{type:"boolean"},e)}function jr(e){return we(e,"Boolean")}function yc(e){return he({"~kind":"Identifier"},{name:e})}function rv(e){return we(e,"Identifier")}const Rm="-?(?:0|[1-9][0-9]*)";function oa(e){return he({"~kind":"Integer"},{type:"integer"},e)}function _n(e){return we(e,"Integer")}class sv extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}}function ov(e){return tt(e)?"bigint":ht(e)?"boolean":ye(e)?"number":ie(e)?"string":(()=>{throw new sv(e)})()}function Me(e,t){return he({"~kind":"Literal"},{type:ov(e),const:e},t)}function Mm(e){return tt(e)||ht(e)||ye(e)||ie(e)}function iv(e){return We(e)&&tt(e.const)}function av(e){return We(e)&&ht(e.const)}function Fm(e){return We(e)&&ye(e.const)}function Dm(e){return We(e)&&ie(e.const)}function We(e){return we(e,"Literal")}function Tl(e){return he({"~kind":"Null"},{type:"null"},e)}function $o(e){return we(e,"Null")}const _m="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Sr(e){return he({"~kind":"Number"},{type:"number"},e)}function nn(e){return we(e,"Number")}function Al(e){return he({"~kind":"Symbol"},{type:"symbol"},e)}function Ro(e){return we(e,"Symbol")}function Mo(...e){const[t,n,r]=ct(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[s,o,o],1:s=>[s,Bt(),Bt()]});return he({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function cv(e){return we(e,"Parameter")}const Lm=".*";function Ln(e){return he({"~kind":"String"},{type:"string"},e)}function On(e){return we(e,"String")}function Ve(e,t={}){return he({"~kind":"Union"},{anyOf:e},t)}function ae(e){return we(e,"Union")}function lv(e){return Pn(e,["~kind","anyOf"])}function Um(e){const t=GT(e);return h(t.length,2)?t[0]:[]}function dv(e){return!0}function Bm(e){return Ie(e,(t,n)=>uv(t)?Bm(n):!1,()=>!0)}function Hm(e){return h(e.length,0)?!1:Bm(e)}function uv(e){return ae(e)?Hm(e.anyOf):We(e)?dv(e.const):!1}function qm(e){return Hm(e)}function zm(e){return he({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function Km(e,t,n=[]){return Ie(e,(r,s)=>Km(s,t,[...n,`${r}${t}`]),()=>n)}function fv(e,t){return h(e.length,0)?[`${t}`]:Km(e,t)}function Gm(e,t,n=[]){return Ie(t,(r,s)=>Gm(e,s,[...n,...Vm(e,r)]),()=>n)}function Vm(e,t){return ae(t)?Gm(e,t.anyOf):We(t)?fv(e,t.const):Ot()}function Wm(e,t){return Ie(t,(n,r)=>Wm(Vm(e,n),r),()=>e)}function mv(e){return e.map(t=>Me(t))}function pv(e){const t=Wm([],e),n=mv(t);return Ve(n)}function gv(e){return h(e.length,0)?Ot():h(e.length,1)&&We(e[0])?e[0]:pv(e)}function Jm(e){const t=Um(e);return h(t.length,0)?Ln():qm(t)?gv(t):zm(e)}function El(e){const t=Jm(e);return zt(t)?Ln():t}function wr(e,t){const n="object",r={[e]:t};return he({"~kind":"Record"},{type:n,patternProperties:r})}function hv(e){return wr(Wr,e)}function bv(e){return Ae({true:e,false:e})}function bn(e,t={}){const[n,r,s]=[e,e.length,!1];return he({"~kind":"Tuple"},{type:"array",additionalItems:s,items:n,minItems:r},t)}function st(e){return we(e,"Tuple")}function kv(e){return Pn(e,["~kind","type","items","minItems","additionalItems"])}function xv(e){return Pn(e,["~readonly"])}function Qm(e,t){return ue(xv(e),{},t)}function yv(e,t,n,r){const s=G(e,t,n);return Qm(s,r)}function Sv(e,t={}){return je("RemoveReadonly",[e],t)}function wv(e,t={}){return Qm(e,t)}function vv(e){return Pn(e,["~optional"])}function Ym(e,t){return ue(vv(e),{},t)}function Iv(e,t,n,r){const s=G(e,t,n);return Ym(s,r)}function Cv(e,t={}){return je("RemoveOptional",[e],t)}function Xm(e,t={}){return Ym(e,t)}function Zm(e){return e.reduceRight((n,r,s)=>({[s]:r,...n}),{})}function jv(e){const t=Zm(e.items);return Ae(t)}function Tv(e,t){return Li(e)?!!Li(t):!1}function Av(e,t){return Xt(e)?!!Xt(t):!1}function Ev(e,t){const n=Tv(e,t),r=Av(e,t),s=rn([e,t]),o=wv(Xm(s));return n&&r?_i(Mi(o)):n&&!r?_i(o):!n&&r?Mi(o):o}function Pv(e,t,n){return n in e?n in t?Ev(e[n],t[n]):e[n]:n in t?t[n]:Tt()}function Nv(e,t){return[...new Set([...D(t),...D(e)])].reduce((r,s)=>({...r,[s]:Pv(e,t,s)}),{})}function Fu(e){return Le(e)?e.properties:st(e)?Zm(e.items):Ot()}function Ov(e,t){const n=Fu(e),r=Fu(t),s=Nv(n,r);return Ae(s)}function $v(e,t){const n=ga(e,t);return h(n,Zl)?e:h(n,ed)||h(n,Xl)?t:Tt()}function Du(e){return Le(e)||st(e)}function Rv(e,t){const n=ae(e),r=ae(t);return n||r}function Mv(e,t){const n=Vr(e),r=Vr(t),s=Rv(n,r),o=Du(n),i=Du(r);return s?rn([n,r]):o&&i?Ov(n,r):o&&!i?n:!o&&i?r:$v(n,r)}function ep(e,t,n=[]){return Ie(t,(r,s)=>ep(e,s,[...n,Mv(e,r)]),()=>h(n.length,0)?[e]:n)}function tp(e,t,n=[]){return Ie(e,(r,s)=>tp(s,t,[...n,...Ui([r],t)]),()=>n)}function Ui(e,t=[]){return Ie(e,(n,r)=>ae(n)?Ui(r,tp(n.anyOf,t)):Ui(r,ep(n,t)),()=>t)}function Fv(e,t){const n=nr({},e,t);return Kt(n)?[]:[e]}function Dv(e,t){return e.reduce((n,r)=>[...n,...Fv(r,t)],[])}function np(e,t){const n=Vr(e),r=ae(n)?n.anyOf:[n],s=Dv(r,t);return or(s)}function Ms(e,t,n){const r=Fn([e,t]),s=np(n,e);return or([r,s])}function Tr(e){const t=e.map(n=>Me(n));return or(t)}function rn(e){const t=Ui(e),n=yg(t);return Fs(n)}function sr(e){const t=El(e);return Vr(t)}function or(e){const t=yg(e);return Fs(t)}function Vr(e){return gn(e)?Ms(e.if,e.then,e.else):hn(e)?Tr(e.enum):Ue(e)?rn(e.allOf):zt(e)?sr(e.pattern):ae(e)?or(e.anyOf):e}function Fs(e){return h(e.length,1)?e[0]:h(e.length,0)?Tt():Ve(e)}function _v(e,t){const n=Tr(e);return aa(n,t)}function Lv(e,t){return wr(Fo,t)}function Uv(e,t){const n=rn(e);return aa(n,t)}function Bv(e,t){return ie(e)||ye(e)?Ae({[e]:t}):h(e,!1)?Ae({false:t}):h(e,!0)?Ae({true:t}):Ae({})}function Hv(e,t){return wr(ca,t)}function qv(e,t){return E(e,"pattern")&&(ie(e.pattern)||e.pattern instanceof RegExp)?wr(e.pattern.toString(),t):wr(Wr,t)}function zv(e,t){const n=Um(e);return qm(n)?aa(sr(e),t):wr(e,t)}function Kv(e){return ae(e)?ia(e.anyOf):[e]}function ia(e){return e.reduce((t,n)=>[...t,...Kv(n)],[])}function Gv(e){return e.some(t=>On(t)||nn(t)||_n(t))}function Vv(e,t){return h(Gv(e),!0)?wr(Wr,t):void 0}function Wv(e,t){return e.reduce((n,r)=>We(r)&&(ie(r.const)||ye(r.const))?{...n,[r.const]:t}:n,{})}function Jv(e,t){const n=Wv(e,t);return Ae(n)}function Qv(e,t){const n=ia(e),r=Vv(n,t);return Yt(r)?r:Jv(n,t)}function aa(e,t){return Nn(e)?hv(t):jr(e)?bv(t):hn(e)?_v(e.enum,t):_n(e)?Lv(e,t):Ue(e)?Uv(e.allOf,t):We(e)?Bv(e.const,t):nn(e)?Hv(e,t):ae(e)?Qv(e.anyOf,t):On(e)?qv(e,t):zt(e)?zv(e.pattern,t):Ae({})}function rp(e,t,n){return Ye([e])?ue(aa(e,t),{},n):sp(e,t,n)}function Yv(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return rp(o,i,s)}const Fo=`^${Rm}$`,ca=`^${_m}$`,Wr=`^${Lm}$`;function sp(e,t,n={}){return je("Record",[e,t],n)}function Pl(e,t,n={}){return rp(e,t,n)}function Xv(e,t){return wr(e,t)}function Sc(e){return h(e,Wr)?Ln():h(e,Fo)?oa():h(e,ca)?Sr():Jm(e)}function kn(e){return D(e.patternProperties)[0]}function la(e){const t=kn(e);return Sc(t)}function qt(e){return e.patternProperties[kn(e)]}function At(e){return we(e,"Record")}function da(e){return he({"~kind":"Rest"},{type:"rest",items:e},{})}function ua(e){return we(e,"Rest")}function op(e){return he({"~kind":"This"},{$ref:"#"},e)}function ip(e){return we(e,"This")}function Nl(e){return he({"~kind":"Undefined"},{type:"undefined"},e)}function Ds(e){return we(e,"Undefined")}function ap(e){return he({"~kind":"Void"},{type:"void"},e)}function ns(e){return we(e,"Void")}function Zv(e,t){return h(e,"Array")?Cr(t[0]):h(e,"Capitalize")?Cg(t[0]):h(e,"ConstructorParameters")?Mg(t[0]):h(e,"Evaluate")?GN(t[0]):h(e,"Exclude")?Dg(t[0],t[1]):h(e,"Extract")?_g(t[0],t[1]):h(e,"Index")?od(t[0],t[1]):h(e,"InstanceType")?Kg(t[0]):h(e,"Lowercase")?jg(t[0]):h(e,"NonNullable")?Qg(t[0]):h(e,"Omit")?Xg(t[0],t[1]):h(e,"Parameters")?th(t[0]):h(e,"Partial")?rh(t[0]):h(e,"Pick")?oh(t[0],t[1]):h(e,"Readonly")?ah(t[0]):h(e,"KeyOf")?ld(t[0]):h(e,"Record")?sp(t[0],t[1]):h(e,"Required")?dh(t[0]):h(e,"ReturnType")?fh(t[0]):h(e,"Uncapitalize")?Tg(t[0]):h(e,"Uppercase")?Ag(t[0]):Nc(dn(e),t)}function rs(){throw Error("Unreachable")}function cp(e,t=[]){return Ie(e,(n,r)=>cp(r,[...t,n[1]]),()=>t)}function ir(e){return h(e.length,3)?[e[0],...cp(e[1])]:[]}function eI(e){return Mo(e[0],e[2],e[4])}function tI(e){return Mo(e[0],e[2],e[2])}function nI(e){return Mo(e[0],Bt(),e[2])}function rI(e){return Mo(e,Bt(),Bt())}function sI(e){return ir(e)}function oI(e){return e[1]}function iI(e){return ir(e)}function aI(e){return e[1]}function cI(e){return Zv(e[0],e[1])}function lI(e){return null}function dI(e){return Ln()}function uI(e){return Sr()}function fI(e){return $m()}function mI(e){return Nl()}function pI(e){return Tl()}function gI(e){return oa()}function hI(e){return jl()}function bI(e){return Bt()}function kI(e){return vl()}function xI(e){return Ae({})}function yI(e){return Tt()}function SI(e){return Al()}function wI(e){return ap()}function vI(e){return op()}function II(e){return Me(BigInt(e))}function CI(e){return Me(h(e,"true"))}function jI(e){return Me(parseFloat(e))}function TI(e){return Me(e)}function AI(e){return e[1]}function EI(e){return Me(e)}function PI(e){return h(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function NI(e){return e[1]}function OI(e){return og(e)}function $I(e){return h(e.length,6)?Fi(e[1],e[3],e[5]):Fi(e[1],e[3],Bt())}function RI(e){return e.length>0}function MI(e){return e.reduce((t,n)=>h(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function FI(e){return h(e.length,6)?[e[1],e[3],e[5]]:[]}function DI(e){return H(e)&&h(e.length,3)?e[1]:e}function _I(e){return h(e.length,2)?e[1]:[]}function _u(e,t){return t.reduce((n,r)=>{const s=r;return h(s.length,1)?od(n,s[0]):h(s.length,0)?Cr(n):rs()},e)}function Lu(e,t){return h(t.length,3)?$g(e,t[0],t[1],t[2]):e}function LI(e,t){return H(t)&&h(t.length,0)?e:ph(e,t)}function UI(e){const[t,n,r,s,o]=e;return LI(Lu(t?ld(_u(n,r)):_u(n,r),s),o)}function Ol(e,t){return h(t.length,3)?(()=>{const[n,r,s]=t,o=Ol(r,s);if(h(n,"&"))return Ue(o)?Fn([e,...o.allOf]):Fn([e,o]);if(h(n,"|"))return ae(o)?Ve([e,...o.anyOf]):Ve([e,o]);rs()})():e}function BI(e){const[t,n]=e;return Ol(t,n)}function HI(e){const[t,n]=e;return Ol(t,n)}function qI(e){return KN(e[1])}function zI(e){return e[1]}function KI(e){return No(e[0],e[2])}function GI(e){return h(e.length,4)?kc(e[1],e[3]):h(e.length,2)?kc(e[1],Bt()):rs()}function VI(e){return`${e}`}function WI(e){return _n(e[3])?Fo:nn(e[3])?ca:Ro(e[3])||On(e[3])?Wr:rs()}function JI(e){return e.length>0}function QI(e){return e.length>0}function YI(e){const[t,n,r,s,o]=e;return{[n]:t&&r?tr(er(o)):t&&!r?tr(o):!t&&r?er(o):o}}function XI(e){return ir(e)}function lp(e){return e.reduce((t,n)=>E(n,Fo)||E(n,ca)||E(n,Wr)?[t[0],gt(t[1],n)]:[gt(t[0],n),t[1]],[{},{}])}function ZI(e){return lp(e[1])}function eC(e){const[t,n]=e,r=h(D(n).length,0)?{}:{patternProperties:n};return Ae(t,r)}function tC(e){return h(e.length,5)?tr(er(e[4])):h(e.length,3)?e[2]:h(e.length,4)?h(e[2],"readonly")?tr(e[3]):er(e[3]):rs()}function nC(e){if(!H(e)||!h(e.length,3))return e;const[t,n,r]=e;return t&&r?tr(er(n)):t&&!r?tr(n):!t&&r?er(n):n}function rC(e){return h(e.length,2)?da(e[1]):h(e.length,1)?e[0]:rs()}function sC(e){return ir(e)}function oC(e){return bn(e[1])}function iC(e){return tr(er(e[4]))}function aC(e){return tr(e[3])}function cC(e){return er(e[3])}function lC(e){return e[2]}function dC(e){return h(e.length,2)?da(e[1]):h(e.length,1)?e[0]:rs()}function uC(e){return ir(e)}function fC(e){return Po(e[1],e[4])}function mC(e){return Eo(e[2],e[5])}function Uu(e,t){return h(e,"remove")?Sv(t):h(e,"add")?tr(t):t}function pC(e){return h(e.length,2)&&h(e[0],"-")?"remove":h(e.length,2)&&h(e[0],"+")||h(e.length,1)?"add":"none"}function Bu(e,t){return h(e,"remove")?Cv(t):h(e,"add")?er(t):t}function gC(e){return h(e.length,2)&&h(e[0],"-")?"remove":h(e.length,2)&&h(e[0],"+")||h(e.length,1)?"add":"none"}function hC(e){return h(e.length,2)?[e[1]]:[]}function bC(e){return H(e[6])&&h(e[6].length,1)?Oc(yc(e[3]),e[5],e[6][0],Uu(e[1],Bu(e[8],e[10]))):Oc(yc(e[3]),e[5],dn(e[3]),Uu(e[1],Bu(e[8],e[10])))}function kC(e){return dn(e)}function xC(e){return BigInt(e)}function yC(e){return parseFloat(e)}function SC(e){return h(e,"true")}function wC(e){return null}function vC(e){return{[e[0]]:e[2]}}function IC(e){return ir(e)}function CC(e){return e.reduce((t,n)=>gt(t,n),{})}function jC(e){return CC(e[1])}function TC(e){return ir(e)}function AC(e){return e[1]}function EC(e){return jl()}function PC(e){return Ln()}function NC(e){return Sr()}function OC(e){return oa()}function $C(e){return Tt()}function RC(e){return Me(e)}function MC(e){return Ve(e[1])}function FC(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function DC(e){return[e[0],...e[1]]}function _C(e){return e[1]}function LC(e){return ir(e)}function UC(e){return h(e.length,2)?e[1]:[]}function BC(e){const t=e[2],n=e[3],[r,s]=e[4],o=h(D(s).length,0)?{}:{patternProperties:s};return{[e[1]]:No(t,Ql(n,r,o))}}function HC(e){const t=e[2],[n,r]=e[3],s=h(D(r).length,0)?{}:{patternProperties:r};return{[e[1]]:Ql(t,n,s)}}function qC(e){return{[e[1]]:No(e[2],e[4])}}function zC(e){return{[e[1]]:e[3]}}function KC(e){return null}function GC(e){return ir(e)}function VC(e){return e[1]}function WC(e){const[t,n]=[e[0],e[1]];return VN(gt(t,lp(n)[0]))}function $l(e){return h(e.length,2)}function Re(e,t,n){return $l(e)?t(e[0],e[1]):n()}function JC(e,t){return h(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function Rt(e,t){for(let n=0;n<e.length;n++){const r=JC(e[n],t);if($l(r))return r}return[]}function wc(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}const QC=[...wc(97,122),...wc(65,90)],dp="0",up=wc(49,57),Rl=[dp,...up],YC=" ",Ml=`
3
3
  `,Do="_",Fl=".",XC="$",fp="-",mp="//",pp="/*",ZC="*/";function gp(e){const t=e.indexOf(ZC);return h(t,-1)?"":e.slice(t+2)}function hp(e){const t=e.indexOf(Ml);return h(t,-1)?"":e.slice(t)}function ej(e){return e.replace(/^[ \t\r\f\v]+/,"")}function vc(e){const t=ej(e);return t.startsWith(pp)?vc(gp(t.slice(2))):t.startsWith(mp)?vc(hp(t.slice(2))):t}function jn(e){const t=e.trimStart();return t.startsWith(pp)?jn(gp(t.slice(2))):t.startsWith(mp)?jn(hp(t.slice(2))):t}function bp(e,t){return Re(Rt([e],t),(n,r)=>[n,r],()=>["",t])}function tj(e,t){return e.includes(t)}function Bi(e,t,n,r=""){return Re(Rt(e,n),(s,o)=>tj(t,s)?Bi(e,t,o,r):Bi(e,t,o,`${r}${s}`),()=>[r,n])}function nj(e){return Rt(up,e)}const rj=[...Rl,Do];function sj(e){return Bi(rj,[Do],e)}function oj(e){return Re(Rt([dp],e),(t,n)=>[t,n],()=>Re(nj(e),(t,n)=>Re(sj(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[]))}function kp(e){return oj(jn(e))}function ij(e){return bp(fp,e)}function aj(e){return Re(ij(e),(t,n)=>Re(kp(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function cj(e){return aj(jn(e))}function lj(e){return Re(cj(e),(t,n)=>Re(Rt(["n"],n),(r,s)=>[`${t}`,s],()=>[]),()=>[])}function xp(e){return lj(e)}function Za(e,t){return Rt([e],t)}function I(e,t){return h(e,"")?["",t]:e.startsWith(Ml)?Za(e,vc(t)):e.startsWith(YC)?Za(e,t):Za(e,jn(t))}const yp=[...QC,Do,XC];function dj(e){return Rt(yp,e)}const uj=[...yp,...Rl];function Sp(e,t=""){return Re(Rt(uj,e),(n,r)=>Sp(r,`${t}${n}`),()=>[t,e])}function fj(e){return Re(dj(e),(t,n)=>Re(Sp(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function et(e){return fj(jn(e))}const mj=[...Rl,Do];function pj(e){return $l(Rt([Fl],e))}function wp(e){return Re(Bi(mj,[Do],e),(t,n)=>h(t,"")?[]:[t,n],()=>[])}function gj(e){return Re(Rt([Fl],e),(t,n)=>Re(wp(n),(r,s)=>[`0${t}${r}`,s],()=>[]),()=>[])}function hj(e){return Re(kp(e),(t,n)=>Re(Rt([Fl],n),(r,s)=>Re(wp(s),(o,i)=>[`${t}${r}${o}`,i],()=>[`${t}`,s]),()=>[`${t}`,n]),()=>[])}function bj(e){return pj(e)?gj(e):hj(e)}function kj(e){return bj(jn(e))}function xj(e){return bp(fp,e)}function yj(e){return Re(xj(e),(t,n)=>Re(kj(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function Dl(e){return yj(jn(e))}function Sj(e){return h(e,"")?[]:[e.slice(0,1),e.slice(1)]}function vp(e,t){return Ie(e,(n,r)=>t.startsWith(n)?!0:vp(r,t),()=>!1)}function _o(e,t,n=""){return Re(Sj(t),(r,s)=>vp(e,t)?[n,t]:_o(e,s,`${n}${r}`),()=>[])}function wj(e,t,n){return Re(Rt([e],n),(r,s)=>Re(_o([t],s),(o,i)=>Re(Rt([t],i),(a,l)=>[`${o}`,l],()=>[]),()=>[]),()=>[])}function vj(e,t,n){return Re(Rt([e],n),(r,s)=>Re(_o([Ml,t],s),(o,i)=>Re(Rt([t],i),(a,l)=>[`${o}`,l],()=>[]),()=>[]),()=>[])}function Ij(e,t,n,r){return n?wj(e,t,jn(r)):vj(e,t,jn(r))}function Cj(e,t){return Rt(e,t)}function jj(e,t){return Ij(e,e,!1,t)}function Tj(e,t){return Re(Cj(e,t),(n,r)=>jj(n,`${n}${r}`),()=>[])}function _l(e,t){return Tj(e,jn(t))}function Aj(e,t){return Re(_o(e,t),(n,r)=>h(n,"")?[]:[n,r],()=>[])}const u=(e,t,n=()=>[])=>e.length===2?t(e):n(),Ej=e=>u(u(et(e),([t,n])=>u(I("extends",n),([r,s])=>u(ge(s),([o,i])=>u(I("=",i),([a,l])=>u(ge(l),([d,m])=>[[t,r,o,a,d],m]))))),([t,n])=>[eI(t),n]),Pj=e=>u(u(et(e),([t,n])=>u(I("extends",n),([r,s])=>u(ge(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[tI(t),n]),Nj=e=>u(u(et(e),([t,n])=>u(I("=",n),([r,s])=>u(ge(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[nI(t),n]),Oj=e=>u(et(e),([t,n])=>[rI(t),n]),Ip=e=>u(u(Ej(e),([t,n])=>[t,n],()=>u(Pj(e),([t,n])=>[t,n],()=>u(Nj(e),([t,n])=>[t,n],()=>u(Oj(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Cp=(e,t=[])=>u(u(I(",",e),([n,r])=>u(Ip(r),([s,o])=>[[n,s],o])),([n,r])=>Cp(r,[...t,n]),()=>[t,e]),$j=e=>u(u(u(Ip(e),([t,n])=>u(Cp(n),([r,s])=>u(u(I(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[sI(t),n]),Ll=e=>u(u(I("<",e),([t,n])=>u($j(n),([r,s])=>u(I(">",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[oI(t),n]),jp=(e,t=[])=>u(u(I(",",e),([n,r])=>u(ge(r),([s,o])=>[[n,s],o])),([n,r])=>jp(r,[...t,n]),()=>[t,e]),Rj=e=>u(u(u(ge(e),([t,n])=>u(jp(n),([r,s])=>u(u(I(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[iI(t),n]),Mj=e=>u(u(I("<",e),([t,n])=>u(Rj(n),([r,s])=>u(I(">",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[aI(t),n]),Fj=e=>u(u(et(e),([t,n])=>u(Mj(n),([r,s])=>[[t,r],s])),([t,n])=>[cI(t),n]),Tp=e=>u(u(u(I(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[lI(),n]),Ap=e=>u(I("string",e),([t,n])=>[dI(),n]),Ep=e=>u(I("number",e),([t,n])=>[uI(),n]),Dj=e=>u(I("boolean",e),([t,n])=>[fI(),n]),_j=e=>u(I("undefined",e),([t,n])=>[mI(),n]),Lj=e=>u(I("null",e),([t,n])=>[pI(),n]),Pp=e=>u(I("integer",e),([t,n])=>[gI(),n]),Uj=e=>u(I("bigint",e),([t,n])=>[hI(),n]),Bj=e=>u(I("unknown",e),([t,n])=>[bI(),n]),Hj=e=>u(I("any",e),([t,n])=>[kI(),n]),qj=e=>u(I("object",e),([t,n])=>[xI(),n]),zj=e=>u(I("never",e),([t,n])=>[yI(),n]),Np=e=>u(I("symbol",e),([t,n])=>[SI(),n]),Kj=e=>u(I("void",e),([t,n])=>[wI(),n]),Gj=e=>u(I("this",e),([t,n])=>[vI(),n]),Vj=e=>u(u(I("${",e),([t,n])=>u(ge(n),([r,s])=>u(I("}",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[AI(t),n]),ec=e=>u(_o(["${","`"],e),([t,n])=>[EI(t),n]),Op=e=>u(u(u(ec(e),([t,n])=>u(Vj(n),([r,s])=>u(Op(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u(u(ec(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u(u(ec(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[PI(t),n]),$p=e=>u(u(I("`",e),([t,n])=>u(Op(n),([r,s])=>u(I("`",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[NI(t),n]),Wj=e=>u($p(e),([t,n])=>[OI(t),n]),Jj=e=>u(u(u(I("if",e),([t,n])=>u(ge(n),([r,s])=>u(I("then",s),([o,i])=>u(ge(i),([a,l])=>u(I("else",l),([d,m])=>u(ge(m),([p,g])=>[[t,r,o,a,d,p],g])))))),([t,n])=>[t,n],()=>u(u(I("if",e),([t,n])=>u(ge(n),([r,s])=>u(I("then",s),([o,i])=>u(ge(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[t,n],()=>[])),([t,n])=>[$I(t),n]),Qj=e=>u(xp(e),([t,n])=>[II(t),n]),Yj=e=>u(u(I("true",e),([t,n])=>[t,n],()=>u(I("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[CI(t),n]),Xj=e=>u(Dl(e),([t,n])=>[jI(t),n]),Zj=e=>u(_l(["'",'"'],e),([t,n])=>[TI(t),n]),eT=e=>u(u(u(I("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[RI(t),n]),Rp=(e,t=[])=>u(u(u(I("[",e),([n,r])=>u(ge(r),([s,o])=>u(I("]",o),([i,a])=>[[n,s,i],a]))),([n,r])=>[n,r],()=>u(u(I("[",e),([n,r])=>u(I("]",r),([s,o])=>[[n,s],o])),([n,r])=>[n,r],()=>[])),([n,r])=>Rp(r,[...t,n]),()=>[t,e]),tT=e=>u(Rp(e),([t,n])=>[MI(t),n]),nT=e=>u(u(u(I("extends",e),([t,n])=>u(ge(n),([r,s])=>u(I("?",s),([o,i])=>u(ge(i),([a,l])=>u(I(":",l),([d,m])=>u(ge(m),([p,g])=>[[t,r,o,a,d,p],g])))))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[FI(t),n]),rT=e=>u(u(u(I("(",e),([t,n])=>u(ge(n),([r,s])=>u(I(")",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u(Ap(e),([t,n])=>[t,n],()=>u(Ep(e),([t,n])=>[t,n],()=>u(Dj(e),([t,n])=>[t,n],()=>u(_j(e),([t,n])=>[t,n],()=>u(Lj(e),([t,n])=>[t,n],()=>u(Pp(e),([t,n])=>[t,n],()=>u(Uj(e),([t,n])=>[t,n],()=>u(Bj(e),([t,n])=>[t,n],()=>u(Hj(e),([t,n])=>[t,n],()=>u(qj(e),([t,n])=>[t,n],()=>u(zj(e),([t,n])=>[t,n],()=>u(Np(e),([t,n])=>[t,n],()=>u(Kj(e),([t,n])=>[t,n],()=>u(Gj(e),([t,n])=>[t,n],()=>u(Qj(e),([t,n])=>[t,n],()=>u(Yj(e),([t,n])=>[t,n],()=>u(Xj(e),([t,n])=>[t,n],()=>u(Zj(e),([t,n])=>[t,n],()=>u(Wj(e),([t,n])=>[t,n],()=>u(Jj(e),([t,n])=>[t,n],()=>u(pT(e),([t,n])=>[t,n],()=>u(bT(e),([t,n])=>[t,n],()=>u(vT(e),([t,n])=>[t,n],()=>u(wT(e),([t,n])=>[t,n],()=>u(TT(e),([t,n])=>[t,n],()=>u(Fj(e),([t,n])=>[t,n],()=>u(AT(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[DI(t),n]),sT=e=>u(u(u(I("with",e),([t,n])=>u(Yp(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[_I(t),n]),Mp=e=>u(u(eT(e),([t,n])=>u(rT(n),([r,s])=>u(tT(s),([o,i])=>u(nT(i),([a,l])=>u(sT(l),([d,m])=>[[t,r,o,a,d],m]))))),([t,n])=>[UI(t),n]),Fp=e=>u(u(u(I("&",e),([t,n])=>u(Mp(n),([r,s])=>u(Fp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Dp=e=>u(u(Mp(e),([t,n])=>u(Fp(n),([r,s])=>[[t,r],s])),([t,n])=>[BI(t),n]),_p=e=>u(u(u(I("|",e),([t,n])=>u(Dp(n),([r,s])=>u(_p(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),fa=e=>u(u(Dp(e),([t,n])=>u(_p(n),([r,s])=>[[t,r],s])),([t,n])=>[HI(t),n]),oT=e=>u(u(I("readonly",e),([t,n])=>u(fa(n),([r,s])=>[[t,r],s])),([t,n])=>[qI(t),n]),iT=e=>u(u(I("|",e),([t,n])=>u(fa(n),([r,s])=>[[t,r],s])),([t,n])=>[zI(t),n]),aT=e=>u(u(Ll(e),([t,n])=>u(I("=",n),([r,s])=>u(ge(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[KI(t),n]),cT=e=>u(u(u(I("infer",e),([t,n])=>u(et(n),([r,s])=>u(I("extends",s),([o,i])=>u(fa(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[t,n],()=>u(u(I("infer",e),([t,n])=>u(et(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>[])),([t,n])=>[GI(t),n]),ge=e=>u(u(cT(e),([t,n])=>[t,n],()=>u(iT(e),([t,n])=>[t,n],()=>u(oT(e),([t,n])=>[t,n],()=>u(fa(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),lT=e=>u(Dl(e),([t,n])=>[VI(t),n]),dT=e=>u(et(e),([t,n])=>[t,n]),uT=e=>u(_l(["'",'"'],e),([t,n])=>[t,n]),fT=e=>u(u(I("[",e),([t,n])=>u(et(n),([r,s])=>u(I(":",s),([o,i])=>u(u(Pp(i),([a,l])=>[a,l],()=>u(Ep(i),([a,l])=>[a,l],()=>u(Ap(i),([a,l])=>[a,l],()=>u(Np(i),([a,l])=>[a,l],()=>[])))),([a,l])=>u(I("]",l),([d,m])=>[[t,r,o,a,d],m]))))),([t,n])=>[WI(t),n]),Lp=e=>u(u(lT(e),([t,n])=>[t,n],()=>u(dT(e),([t,n])=>[t,n],()=>u(uT(e),([t,n])=>[t,n],()=>u(fT(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Up=e=>u(u(u(I("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[JI(t),n]),Bp=e=>u(u(u(I("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>u([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[QI(t),n]),Hp=e=>u(u(Up(e),([t,n])=>u(Lp(n),([r,s])=>u(Bp(s),([o,i])=>u(I(":",i),([a,l])=>u(ge(l),([d,m])=>[[t,r,o,a,d],m]))))),([t,n])=>[YI(t),n]),ma=e=>u(u(u(I(",",e),([t,n])=>u(I(`
4
4
  `,n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>u(u(I(";",e),([t,n])=>u(I(`
@@ -27,6 +27,6 @@ ${m}`:""].filter(Boolean).join(`
27
27
  `)}]}))},J2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=bt(s,e.subagentSessionId,r);if(!i)return;const a=String(e.serverName),l=String(e.action),d=`mcp-instructions:${String(e.revision)}:${a}:${l}`;o(i.messageId,i.subagent.id,m=>({toolCalls:[...(m.toolCalls||[]).filter(p=>p.toolCallId!==d),{toolCallId:d,toolName:"MCP Instructions",arguments:JSON.stringify({serverName:a,action:l,reason:e.reason}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`MCP instructions ${l}: ${a}`+(e.truncated===!0?" (truncated)":""),output:[typeof e.text=="string"?e.text:"",e.sha256?`SHA-256: ${String(e.sha256)}`:"",e.detailsOmitted===!0?"Details omitted by runtime policy":""].filter(Boolean).join(`
28
28
  `)}]}))},Q2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=bt(s,e.subagentSessionId,r);if(!i)return;const a=String(e.taskId),l=String(e.status),d=`mcp-task:${a}`;o(i.messageId,i.subagent.id,m=>({toolCalls:[...(m.toolCalls||[]).filter(p=>p.toolCallId!==d),{toolCallId:d,toolName:"MCP Task",arguments:JSON.stringify({taskId:a,serverName:e.serverName,toolName:e.toolName}),toolKind:"readonly",status:l==="failed"||l==="cancelled"?"error":l==="completed"?"success":"running",startTime:Number(e.createdAt)||Date.now(),summary:`MCP task ${l}: ${a} · ${String(e.serverName)}/${String(e.toolName)}`,output:[typeof e.statusMessage=="string"?e.statusMessage:"",e.hasResult===!0?"Result available via TaskOutput":"",typeof e.error=="string"?`Error: ${e.error}`:""].filter(Boolean).join(`
29
29
  `)}]}))},Y2=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=bt(s,e.subagentSessionId,r);if(!i)return;const a=Array.isArray(e.files)?e.files.filter(d=>!!d&&typeof d=="object"&&!Array.isArray(d)):[],l=`project-rules:${a.map(d=>String(d.id)).join(",")}`;o(i.messageId,i.subagent.id,d=>({toolCalls:[...(d.toolCalls||[]).filter(m=>m.toolCallId!==l),{toolCallId:l,toolName:"Project Rules",arguments:JSON.stringify({triggerPaths:e.triggerPaths,blockedWrite:e.blockedWrite}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`Project rules loaded: ${a.length}`,output:a.map(m=>`${String(m.relativePath)} ${String(m.source)} SHA-256: ${String(m.contentSha256)}`).join(`
30
- `)}]}))},X2=(e,t,n)=>{const{currentSessionId:r,setConfirmation:s}=t();if(e.sessionId!==r)return;const o=e.requestId||"",i=Wt(t,n,o?`assistant-permission-${o}`:void 0);if(!i)return;const a=e.details,l=e.toolName||(a==null?void 0:a.toolName)||"Tool";s(i,{toolCallId:o,toolName:l,description:e.description,diff:(a==null?void 0:a.details)||(a==null?void 0:a.diff)||"",allowRemember:(a==null?void 0:a.type)!=="mcpSampling",status:"pending"}),n(d=>({agentPhase:"waiting_permission",isStreaming:!0,sessions:d.sessions.map(m=>m.sessionId===e.sessionId&&m.projectPath===e.projectPath?{...m,pendingInteraction:{type:"permission",requestId:o}}:m)}))},Z2=(e,t,n)=>{var x,b;const{currentSessionId:r,currentSessionRef:s,messages:o,setConfirmation:i,setElicitation:a}=t();if(e.sessionId!==r)return;const l=e.requestId,d=o.find(y=>{var j,k;return((k=(j=y.agentContent)==null?void 0:j.confirmation)==null?void 0:k.toolCallId)===l}),m=(x=d==null?void 0:d.agentContent)==null?void 0:x.confirmation;d&&(m==null?void 0:m.status)==="pending"&&i(d.id,{...m,status:"denied"});const p=o.find(y=>{var j,k;return((k=(j=y.agentContent)==null?void 0:j.elicitation)==null?void 0:k.toolCallId)===l}),g=(b=p==null?void 0:p.agentContent)==null?void 0:b.elicitation;p&&(g==null?void 0:g.status)==="pending"&&a(p.id,{...g,status:"cancelled"}),n({agentPhase:"running",error:"Permission request timed out",errorContext:{kind:"interaction",...s?{sessionRef:s}:{}}})},gf=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"running",isStreaming:!0})},e5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"compacting"})},t5=(e,t,n)=>{e.sessionId===t().currentSessionId&&(t().resetContextUsage(),n({agentPhase:"running"}))},n5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"switching_model"})},r5=(e,t,n)=>{const{currentSessionId:r,setQuestion:s}=t();if(e.sessionId!==r)return;const o=e.requestId||e.toolCallId||"",i=Wt(t,n,o?`assistant-question-${o}`:void 0);i&&(s(i,{toolCallId:o,questions:e.questions,status:"pending"}),n(a=>({agentPhase:"waiting_permission",isStreaming:!0,sessions:a.sessions.map(l=>l.sessionId===e.sessionId&&l.projectPath===e.projectPath?{...l,pendingInteraction:{type:"question",requestId:o}}:l)})))},s5=(e,t,n)=>{const{currentSessionId:r,setElicitation:s}=t();if(e.sessionId!==r)return;const o=e.requestId||e.toolCallId||"",i=Wt(t,n,o?`assistant-elicitation-${o}`:void 0),a=e.elicitation;!i||!a||(s(i,{toolCallId:o,details:a,status:"pending"}),n(l=>({agentPhase:"waiting_permission",isStreaming:!0,sessions:l.sessions.map(d=>d.sessionId===e.sessionId&&d.projectPath===e.projectPath?{...d,pendingInteraction:{type:"elicitation",requestId:o}}:d)})))},o5=(e,t,n)=>{const{currentSessionId:r}=t();if(e.sessionId!==r)return;const s=e.requestId;n(o=>({agentPhase:"running",sessions:o.sessions.map(i=>{var a;return i.sessionId===e.sessionId&&i.projectPath===e.projectPath&&((a=i.pendingInteraction)==null?void 0:a.requestId)===s?{...i,pendingInteraction:void 0}:i})}))},ic=(e,t)=>{const{currentSessionId:n,endAgentResponse:r}=t();e.sessionId===n&&r()},i5=(e,t,n)=>{const{currentSessionId:r,currentSessionRef:s,endAgentResponse:o}=t();if(e.sessionId!==r)return;const i=e.taskFailure&&typeof e.taskFailure=="object"&&!Array.isArray(e.taskFailure)?e.taskFailure:void 0,a=ry(i==null?void 0:i.code);n({agentPhase:"error",error:e.error||"An error occurred",errorContext:{kind:"execution",...s?{sessionRef:s}:{},...a?{failureCode:a}:{}}}),o()},a5=(e,t,n)=>{const{currentSessionId:r}=t();if(e.sessionId===r)if(e.status==="idle")n({isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0});else if(e.status==="queued"||e.status==="running"||e.status==="waiting_permission"){const s=typeof e.queued=="number"?Math.max(0,e.queued):0;n({isStreaming:!0,agentPhase:e.status==="waiting_permission"?"waiting_permission":"running",currentRunId:typeof e.runId=="string"?e.runId:t().currentRunId,pendingSteeringCount:s,pendingInputDelivery:s>0&&(e.pendingInputDelivery==="current_turn"||e.pendingInputDelivery==="next_turn")?e.pendingInputDelivery:null,recoveredSteeringCount:typeof e.recovered=="number"?Math.max(0,e.recovered):t().recoveredSteeringCount})}else e.status==="error"&&n({isStreaming:!1,isStopping:!1,agentPhase:"error",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null})},c5=(e,t,n)=>{const{currentSessionId:r,endAgentResponse:s,messages:o,updateSubagent:i}=t();if(e.sessionId===r){n(a=>({isStreaming:!1,agentPhase:"idle",messages:a.messages.map(l=>{var m;const d=(m=l.agentContent)==null?void 0:m.elicitation;return(d==null?void 0:d.status)!=="pending"||!l.agentContent?l:{...l,agentContent:{...l.agentContent,elicitation:{...d,status:"cancelled"}}}})}));for(const a of o)for(const l of Zn(a.agentContent))l.status==="running"&&i(a.id,l.id,{status:"failed"});s()}},l5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):1,pendingInputDelivery:"current_turn"})},d5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):1,pendingInputDelivery:"next_turn"})},u5=(e,t,n)=>{if(e.sessionId!==t().currentSessionId)return;const r=typeof e.queued=="number"?Math.max(0,e.queued):0;n({pendingSteeringCount:r,pendingInputDelivery:r>0?t().pendingInputDelivery:null,recoveredSteeringCount:typeof e.recovered=="number"?Math.max(0,e.recovered):t().recoveredSteeringCount})},f5=(e,t,n)=>{if(e.sessionId!==t().currentSessionId)return;const r=typeof e.queued=="number"?Math.max(0,e.queued):0;n({agentPhase:"running",pendingSteeringCount:r,pendingInputDelivery:r>0?"current_turn":null,recoveredSteeringCount:typeof e.recovered=="number"?Math.max(0,e.recovered):t().recoveredSteeringCount})},m5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:e.goal??null})},p5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:null})},g5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:e.goal??t().goal,isStreaming:!0,agentPhase:"running"})},h5=(e,t,n)=>{if(e.sessionId!==t().currentSessionId||!Array.isArray(e.messages))return;const r=Date.now(),s=e.messages.flatMap((o,i)=>{if(typeof o!="object"||o===null)return[];const a=o;return!["user","assistant","system","tool"].includes(String(a.role))||!Array.isArray(a.content)&&typeof a.content!="string"?[]:[{id:`rewind-${i}-${r}`,role:a.role,content:a.content,timestamp:r+i,metadata:typeof a.metadata=="object"&&a.metadata!==null?a.metadata:void 0,thinkingContent:typeof a.thinkingContent=="string"?a.thinkingContent:typeof a.reasoningContent=="string"?a.reasoningContent:void 0,tool_call_id:typeof a.tool_call_id=="string"?a.tool_call_id:void 0,name:typeof a.name=="string"?a.name:void 0,tool_calls:a.tool_calls}]});n({messages:Pi(s),isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1})},b5=(e,t,n)=>{const r=t().currentSessionRef;if(!r||e.sessionId!==r.sessionId||e.projectPath!==r.projectPath)return;const s=e.status,o=s==="completed"||s==="stale"?"completed":s==="aborted"?"cancelled":s==="interrupted"?"interrupted":"failed";n(i=>({sessions:i.sessions.map(a=>a.sessionId===r.sessionId&&a.projectPath===r.projectPath?{...a,taskStatus:o,taskStatusReason:void 0,taskFailure:void 0,taskCompletedAt:new Date().toISOString()}:a)})),t().selectSession(r)},k5=(e,t,n)=>{oy({...e,messageId:`review-${String(e.reviewId??"active")}`,arguments:"{}"},t,n)},x5=(e,t,n)=>{iy(e,t)},y5=(e,t,n)=>{ay(e,t,n)},wi={"message.created":b2,"message.delta":k2,"message.complete":x2,"structured.output":y2,"thinking.delta":S2,"thinking.completed":w2,"tool.start":oy,"tool.progress":iy,"tool.result":ay,"mcp.catalog.changed":v2,"mcp.content.changed":I2,"mcp.resource.updated":C2,"mcp.connection.changed":j2,"mcp.log":T2,"mcp.instructions.changed":A2,"mcp.task.changed":E2,"project.rules.loaded":P2,"user.shell.started":N2,"user.shell.output":O2,"user.shell.completed":$2,"token.usage":R2,"task.updated":M2,"subagent.start":F2,"subagent.update":D2,"subagent.delta":_2,"subagent.thinking.delta":L2,"subagent.tool.start":B2,"subagent.tool.progress":q2,"subagent.tool.result":H2,"subagent.mcp.catalog.changed":z2,"subagent.mcp.content.changed":K2,"subagent.mcp.resource.updated":G2,"subagent.mcp.connection.changed":V2,"subagent.mcp.log":W2,"subagent.mcp.instructions.changed":J2,"subagent.mcp.task.changed":Q2,"subagent.project.rules.loaded":Y2,"subagent.complete":U2,"permission.asked":X2,"permission.timeout":Z2,"turn.started":gf,"committed.turn_started":gf,"committed.turn_completed":ic,"committed.turn_aborted":ic,"compaction.started":e5,"compaction.completed":t5,"model.fallback":n5,"question.required":r5,"elicitation.required":s5,"interaction.resolved":o5,"session.completed":ic,"session.error":i5,"session.status":a5,"run.cancelled":c5,"steering.queued":l5,"follow_up.queued":d5,"follow_up.started":f5,"steering.applied":u5,"goal.updated":m5,"goal.cleared":p5,"goal.continuation.started":g5,"session.rewound":h5,"review.tool.started":k5,"review.tool.progress":x5,"review.tool.completed":y5,"review.completed":b5},S5=new Set(["message.complete","thinking.completed","session.completed","session.error","run.cancelled","committed.turn_completed","committed.turn_aborted"]),hf=(e,t)=>n=>{const r=e().currentSessionRef,s=n.properties;if(!r||s.sessionId!==r.sessionId||s.projectPath!==r.projectPath)return;if(S5.has(n.type)){wn.drainAll();const i=wi[n.type];i&&i(n.properties,e,t);return}if(n.type==="tool.start"&&wn.drainAll(),n.type==="message.delta"){const{currentSessionId:i,currentAssistantMessageId:a,hasToolCalls:l}=e();if(s.sessionId!==i)return;const d=s.messageId||a,m=s.delta;if(!a){const x=wi["message.delta"];x&&x(s,e,t);return}const p=l?"after":"before",g=`content:${d}:${p}`;wn.drainAllExcept(g),wn.append(g,m,x=>{const{appendDelta:b}=e();d&&b(d,x,p)});return}if(n.type==="thinking.delta"){const{currentSessionId:i,currentAssistantMessageId:a}=e();if(s.sessionId!==i)return;if(!a){const p=wi["thinking.delta"];p&&p(s,e,t);return}const l=s.delta,d=s.messageId||a,m=`thinking:${d}`;wn.drainAllExcept(m),wn.append(m,l,p=>{const{appendThinking:g}=e();d&&g(d,p)});return}if(n.type==="subagent.delta"){const{currentSessionId:i}=e();if(s.sessionId!==i)return;const a=s.delta;if(!a)return;const l=s.subagentSessionId||"",d=`subagent:${l}`,{currentAssistantMessageId:m,messages:p}=e(),g=bt(p,l||void 0,m);wn.append(d,a,x=>{const{currentAssistantMessageId:b,messages:y,updateSubagent:j}=e(),k=g||bt(y,l||void 0,b);k&&j(k.messageId,k.subagent.id,A=>({sessionId:A.sessionId||l,output:(A.output||"")+x}))});return}if(n.type==="subagent.thinking.delta"){const{currentSessionId:i}=e();if(s.sessionId!==i)return;const a=s.delta;if(!a)return;const l=s.subagentSessionId||"",d=`subagent-thinking:${l}`,{currentAssistantMessageId:m,messages:p}=e(),g=bt(p,l||void 0,m);wn.append(d,a,x=>{const{currentAssistantMessageId:b,messages:y,updateSubagent:j}=e(),k=g||bt(y,l||void 0,b);k&&j(k.messageId,k.subagent.id,A=>({sessionId:A.sessionId||l,thinking:(A.thinking||"")+x}))});return}const o=wi[n.type];o&&o(n.properties,e,t)},w5=(e,t)=>{const n=new WeakMap;let r=null;return{isStreaming:!1,isStopping:!1,agentPhase:"idle",sessionEventConnectionState:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,eventUnsubscribe:null,currentAssistantMessageId:null,hasToolCalls:!1,setStreaming:s=>e({isStreaming:s}),setAgentPhase:s=>e({agentPhase:s}),setRunId:s=>e({currentRunId:s}),prepareEventSubscription:async(s,o)=>{const i=o??hf(t,e);let a=null,l="connecting";return a=await re.openEventSubscription(s,i,{onConnectionStateChange:d=>{l=d,a&&r===a&&e({sessionEventConnectionState:d})}}),n.set(a,l),a},replaceEventSubscription:s=>{const o=t().eventUnsubscribe;if(r=s,e({eventUnsubscribe:s,sessionEventConnectionState:s?n.get(s)??"connected":"idle"}),wn.reset(),o&&o!==s)try{o()}catch(i){console.warn("Failed to clean up previous event subscription",i)}},setCurrentAssistantMessageId:s=>e({currentAssistantMessageId:s}),setHasToolCalls:s=>e({hasToolCalls:s}),startAgentResponse:s=>{e({currentAssistantMessageId:s,hasToolCalls:!1,isStreaming:!0,agentPhase:"running"})},endAgentResponse:()=>{wn.drainAll(),e({currentAssistantMessageId:null,hasToolCalls:!1,isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null})},subscribeToEvents:async s=>{const o=await t().prepareEventSubscription(s);t().replaceEventSubscription(o)},reconnectSessionEvents:async()=>{const s=t().currentSessionRef;if(s){t().unsubscribeFromEvents(),e({sessionEventConnectionState:"connecting"});try{await t().subscribeToEvents(s)}catch(o){throw e({sessionEventConnectionState:"offline"}),o}}},unsubscribeFromEvents:()=>{const{eventUnsubscribe:s}=t();r=null,e({eventUnsubscribe:null,sessionEventConnectionState:"idle"});try{s==null||s()}catch(o){console.warn("Failed to clean up event subscription",o)}finally{wn.reset()}},handleEvent:s=>{hf(t,e)(s)}}};function v5(e){var t;return((t=e.taskPromptSummary)==null?void 0:t.trimStart().startsWith("/review"))===!0}function ru(e,t){var r;const n=(r=e.taskStatusReason)==null?void 0:r.trim();if(v5(e)){if(e.taskStatus==="running")return t("taskHome.review.running");if(n!=null&&n.startsWith("Code review stale:"))return t("taskHome.review.stale");if(n==="Code review aborted")return t("taskHome.review.aborted");if(n==="Code review interrupted by process restart")return t("taskHome.review.interrupted");if(e.taskStatus==="failed")return t("taskHome.review.failed")}return e.taskFailure?t(sy(e.taskFailure.code)):n==="user-cancel"?t("session.reason.cancelledByUser"):n||void 0}let ac=0;function vi(e,t){const n=e.findIndex(s=>s.id===t.id);if(n===-1)return[...e,t];const r=e.slice();return r[n]=t,r}const I5=ui(e=>({schedules:[],isLoading:!1,hasLoaded:!1,error:null,loadSchedules:async()=>{const t=++ac;e({isLoading:!0,error:null});try{const n=await re.listSchedules();if(t!==ac)return;e({schedules:n,isLoading:!1,hasLoaded:!0})}catch(n){if(t!==ac)return;e({error:n instanceof Error?n.message:He("schedule.error.loadFailed"),isLoading:!1,hasLoaded:!0})}},createSchedule:async t=>{e({error:null});try{const n=await re.createSchedule(t);return e(r=>({schedules:vi(r.schedules,n)})),n}catch(n){throw e({error:n instanceof Error?n.message:He("schedule.error.createFailed")}),n}},updateSchedule:async(t,n)=>{e({error:null});try{const r=await re.updateSchedule(t,n);return e(s=>({schedules:vi(s.schedules,r)})),r}catch(r){throw e({error:r instanceof Error?r.message:He("schedule.error.updateFailed")}),r}},deleteSchedule:async t=>{e({error:null});try{await re.deleteSchedule(t),e(n=>({schedules:n.schedules.filter(r=>r.id!==t)}))}catch(n){throw e({error:n instanceof Error?n.message:He("schedule.error.deleteFailed")}),n}},toggleSchedule:async(t,n)=>{e({error:null});try{const r=n?await re.enableSchedule(t):await re.disableSchedule(t);return e(s=>({schedules:vi(s.schedules,r)})),r}catch(r){throw e({error:r instanceof Error?r.message:He("schedule.error.toggleFailed")}),r}},runSchedule:async t=>{e({error:null});try{const n=await re.runSchedule(t);return e(r=>({schedules:vi(r.schedules,n)})),n}catch(n){throw e({error:n instanceof Error?n.message:He("schedule.error.runFailed")}),n}}})),C5=e=>e==="system"?typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches:e==="dark",Ni=e=>{if(typeof document>"u")return;const t=document.documentElement;if(t.classList.remove("light","dark"),e==="system"){const r=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";t.classList.add(r)}else t.classList.add(e)},ln={language:"zh-CN",theme:"dracula",uiTheme:"system",autoSaveSessions:!0,notifyBuild:!0,notifyErrors:!1,notifySounds:!1,privacyTelemetry:!1,privacyCrash:!0,communicationStyle:"auto"},vo=ui((e,t)=>({...ln,isLoading:!1,error:null,loadSettings:async()=>{e({isLoading:!0,error:null});try{const n=await fetch("/configs");if(!n.ok)throw new Error(He("settings.general.loadError"));const r=await n.json(),s=r.uiTheme??ln.uiTheme;e({language:r.language??ln.language,theme:r.theme??ln.theme,uiTheme:s,autoSaveSessions:r.autoSaveSessions??ln.autoSaveSessions,notifyBuild:r.notifyBuild??ln.notifyBuild,notifyErrors:r.notifyErrors??ln.notifyErrors,notifySounds:r.notifySounds??ln.notifySounds,privacyTelemetry:r.privacyTelemetry??ln.privacyTelemetry,privacyCrash:r.privacyCrash??ln.privacyCrash,communicationStyle:r.communicationStyle??ln.communicationStyle,isLoading:!1}),Ni(s)}catch(n){e({error:n.message,isLoading:!1})}},updateSettings:async n=>{const r=t();e({...n,error:null}),n.uiTheme&&Ni(n.uiTheme);try{if(!(await fetch("/configs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:n,options:{scope:"global"}})})).ok)throw new Error(He("settings.general.saveError"))}catch(s){e({language:r.language,theme:r.theme,uiTheme:r.uiTheme,autoSaveSessions:r.autoSaveSessions,notifyBuild:r.notifyBuild,notifyErrors:r.notifyErrors,notifySounds:r.notifySounds,privacyTelemetry:r.privacyTelemetry,privacyCrash:r.privacyCrash,communicationStyle:r.communicationStyle,error:s.message}),n.uiTheme&&Ni(r.uiTheme)}}}));Ni(ln.uiTheme);const Q_=()=>vo(e=>C5(e.uiTheme)),cy="blade.projects.selected";function bf(){return typeof localStorage>"u"?null:localStorage.getItem(cy)}function Ii(e){typeof localStorage<"u"&&localStorage.setItem(cy,e)}const j5=new Set(["queued","running","completed","failed","cancelled","interrupted"]),cc=new Set(["default","autoEdit","yolo","plan"]),kf=new Set(["auto","off","minimal","low","medium","high","xhigh","max"]),xf=new Set(["auto","standard","fast","flex"]),yf=new Set(["auto","low","medium","high"]),Sf=new Set(["auto","pragmatic","friendly","explanatory"]);function T5(e){return typeof e=="string"&&j5.has(e)}function A5(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e;if(!["changedFiles","additions","deletions","commits"].some(r=>typeof t[r]!="number"||!Number.isInteger(t[r])||t[r]<0))return{changedFiles:t.changedFiles,additions:t.additions,deletions:t.deletions,commits:t.commits}}function wf(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=ry(t.code);if(!(!n||typeof t.message!="string"||typeof t.retryable!="boolean"))return{code:n,message:He(sy(n)),retryable:p2(n)}}function E5(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e;if(!(!["applied","discarded","conflicted"].includes(String(t.status))||typeof t.updatedAt!="string"))return{status:t.status,updatedAt:t.updatedAt,...typeof t.sourceCommit=="string"?{sourceCommit:t.sourceCommit}:{},...typeof t.changedFiles=="number"&&Number.isInteger(t.changedFiles)&&t.changedFiles>=0?{changedFiles:t.changedFiles}:{},...typeof t.message=="string"?{message:t.message}:{}}}function xs(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:void 0}const P5=(e,t)=>{let n=null,r=!1,s=!1,o=0;const i=new Map,a=d=>{const m=ze(d),p=++o;i.set(m,p),re.getSession(d).then(g=>{i.get(m)===p&&e(x=>({sessions:vn(x.sessions,g)}))}).catch(()=>{i.get(m)===p&&t().loadSessions()}).finally(()=>{i.get(m)===p&&i.delete(m)})},l=d=>{const m=ze(d),p=++o;i.set(m,p),queueMicrotask(()=>{i.get(m)===p&&i.delete(m)})};return{taskEventsConnected:!1,taskEventConnectionState:"connecting",taskEventUnsubscribe:null,taskWorkspaceInfo:null,isTaskWorkspaceLoading:!1,taskWorkspaceError:null,boundProjects:[],selectedProjectPath:bf(),isDispatchingTask:!1,isBindingProject:!1,cancellingTaskKeys:[],retryingTaskKeys:[],taskDeliveryActions:{},unreadTaskKeys:o2(),handleTaskEvent:d=>{if(d.type==="session.created"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;a({sessionId:T,projectPath:C});return}if(d.type==="session.deleted"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;const O={sessionId:T,projectPath:C};l(O),t().removeSession(O);return}if(d.type==="session.archived"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;const O={sessionId:T,projectPath:C};l(O),t().removeSession(O),t().loadArchivedSessions();return}if(d.type==="session.unarchived"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;a({sessionId:T,projectPath:C}),t().loadArchivedSessions();return}if(d.type==="session.updated"){const T=d.properties.sessionId,C=d.properties.projectPath,O=d.properties.title,R=d.properties.selectedModelId,K=d.properties.permissionMode,X=d.properties.reasoningEffort,P=d.properties.serviceTier,B=d.properties.responseVerbosity,M=d.properties.communicationStyle;if(typeof T!="string"||typeof C!="string"||!(typeof O=="string"&&O.trim()||typeof R=="string"&&R.trim()||cc.has(K)||kf.has(X)||xf.has(P)||yf.has(B)||Sf.has(M)))return;const fe={sessionId:T,projectPath:C};if(oe(t().currentSessionRef,fe)&&cc.has(K)&&Pt.getState().setMode(K),!t().sessions.some(ke=>oe(pe(ke),fe))){a(fe);return}e(ke=>({sessions:ke.sessions.map(ce=>oe({sessionId:ce.sessionId,projectPath:ce.projectPath},fe)?{...ce,...typeof O=="string"&&O.trim()?{title:O}:{},...typeof R=="string"&&R.trim()?{selectedModelId:R}:{},...cc.has(K)?{permissionMode:K}:{},...kf.has(X)?{reasoningEffort:X}:{},...xf.has(P)?{serviceTier:P}:{},...yf.has(B)?{responseVerbosity:B}:{},...Sf.has(M)?{communicationStyle:M}:{}}:ce)}));return}if(d.type==="task.delivery"){const T=d.properties.sessionId,C=d.properties.projectPath,O=E5(d.properties.taskDelivery);if(typeof T!="string"||typeof C!="string"||!O)return;const R={sessionId:T,projectPath:C},K=d.properties.taskWorktreeRemoved===!0;e(X=>({sessions:X.sessions.map(P=>oe(pe(P),R)?{...P,taskDelivery:O,...K?{taskWorktreePath:void 0,taskWorktreeBranch:void 0}:{},lastMessageTime:typeof d.properties.updatedAt=="string"?d.properties.updatedAt:P.lastMessageTime}:P)}));return}if(d.type==="interaction.pending"){const T=d.properties.sessionId,C=d.properties.projectPath,O=d.properties.interactionType,R=d.properties.requestId;if(typeof T!="string"||typeof C!="string"||O!=="permission"&&O!=="question"&&O!=="elicitation"||typeof R!="string"||!R)return;const K={sessionId:T,projectPath:C},X=t().sessions.find(B=>oe(pe(B),K));if(!X){t().loadSessions();return}if(e(B=>({sessions:B.sessions.map(M=>oe(pe(M),K)?{...M,pendingInteraction:{type:O,requestId:R}}:M)})),!(typeof document<"u"&&document.visibilityState==="visible"&&oe(t().currentSessionRef,K))&&vo.getState().notifyErrors){const M=X.title??X.sessionId??T;mf({ref:K,title:`Blade · ${He(O==="question"?"attention.notification.question":O==="elicitation"?"attention.notification.elicitation":"attention.notification.permission")}`,body:M,onOpen:fe=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(Ki,{detail:fe})))}})}return}if(d.type==="interaction.resolved"){const T=d.properties.sessionId,C=d.properties.projectPath,O=d.properties.requestId;if(typeof T!="string"||typeof C!="string"||typeof O!="string")return;const R={sessionId:T,projectPath:C};e(K=>({sessions:K.sessions.map(X=>{var P;return oe(pe(X),R)&&((P=X.pendingInteraction)==null?void 0:P.requestId)===O?{...X,pendingInteraction:void 0}:X})}));return}if(d.type==="schedule.fired"){I5.getState().loadSchedules();return}if(d.type!=="task.status")return;const m=d.properties.sessionId,p=d.properties.projectPath,g=d.properties.taskStatus;if(typeof m!="string"||typeof p!="string"||!T5(g))return;const x={sessionId:m,projectPath:p},b=xs(d.properties.taskInFlight,0),y=xs(d.properties.taskQueueDepth,0),j=xs(d.properties.taskConcurrencyLimit,1);b!==void 0&&y!==void 0&&j!==void 0&&e(T=>{var C;return{taskWorkspaceInfo:T.taskWorkspaceInfo?{...T.taskWorkspaceInfo,taskAdmission:{inFlight:b,queued:y,maxConcurrent:j,maxQueued:((C=T.taskWorkspaceInfo.taskAdmission)==null?void 0:C.maxQueued)??100}}:null}});const k=t().sessions.find(T=>oe(pe(T),x)),A=typeof document<"u"&&document.visibilityState==="visible"&&oe(t().currentSessionRef,x),N=s2(k==null?void 0:k.taskStatus,g,A),$=ze(x),Q=!t().unreadTaskKeys.includes($);if(N&&Q){e(O=>{const R=[...O.unreadTaskKeys,$];return go(R),{unreadTaskKeys:R}});const T=vo.getState();if(T.notifySounds&&Zx(g)&&i2(g),g==="completed"?T.notifyBuild:T.notifyErrors){const O=He(g==="completed"?"attention.notification.completed":g==="failed"?"attention.notification.failed":"attention.notification.interrupted"),R=wf(d.properties.taskFailure),K=k?ru({...k,taskStatus:g,taskFailure:R??k.taskFailure,taskStatusReason:typeof d.properties.taskStatusReason=="string"?d.properties.taskStatusReason:k.taskStatusReason,taskPromptSummary:typeof d.properties.taskPromptSummary=="string"?d.properties.taskPromptSummary:k.taskPromptSummary},He):(R==null?void 0:R.message)??(typeof d.properties.taskStatusReason=="string"?d.properties.taskStatusReason:void 0),X=(k==null?void 0:k.title)??(k==null?void 0:k.sessionId)??m;mf({ref:x,title:`Blade · ${O}`,body:K?`${X} · ${K}`:X,onOpen:P=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(Ki,{detail:P})))}})}}if(!k){a(x);return}e(T=>({sessions:T.sessions.map(C=>oe({sessionId:C.sessionId,projectPath:C.projectPath},x)?{...C,taskStatus:g,taskStatusReason:typeof d.properties.taskStatusReason=="string"?d.properties.taskStatusReason:void 0,taskFailure:g==="failed"?wf(d.properties.taskFailure)??C.taskFailure:void 0,taskPromptSummary:typeof d.properties.taskPromptSummary=="string"?d.properties.taskPromptSummary:C.taskPromptSummary,taskStartedAt:typeof d.properties.taskStartedAt=="string"?d.properties.taskStartedAt:g==="queued"?void 0:C.taskStartedAt,taskCompletedAt:typeof d.properties.taskCompletedAt=="string"?d.properties.taskCompletedAt:g==="queued"||g==="running"?void 0:C.taskCompletedAt,taskDiffStat:A5(d.properties.taskDiffStat)??C.taskDiffStat,taskQueuePosition:g==="queued"?xs(d.properties.taskQueuePosition,1)??C.taskQueuePosition:void 0,taskQueueDepth:g==="queued"?xs(d.properties.taskQueueDepth,0)??C.taskQueueDepth:void 0,taskConcurrencyLimit:xs(d.properties.taskConcurrencyLimit,1)??C.taskConcurrencyLimit,lastMessageTime:typeof d.properties.updatedAt=="string"?d.properties.updatedAt:C.lastMessageTime}:C)}))},subscribeToTaskEvents:async()=>{if(r=!0,!t().taskEventUnsubscribe){if(n)return n;e({taskEventsConnected:!1,taskEventConnectionState:"connecting"}),n=(async()=>{try{const d=await re.openTaskEventSubscription(m=>t().handleTaskEvent(m),{onConnectionChange:m=>{e({taskEventsConnected:m})},onConnectionStateChange:m=>{r&&(m==="reconnecting"||m==="offline")&&(s=!0),e({taskEventsConnected:m==="connected",taskEventConnectionState:m}),m==="connected"&&s&&(s=!1,Promise.all([t().loadSessions(),t().loadTaskWorkspaceInfo(),t().loadBoundProjects(),Pt.getState().loadModels()]))}});if(!r||t().taskEventUnsubscribe){d();return}e({taskEventUnsubscribe:d})}catch(d){throw s=!0,e({taskEventsConnected:!1,taskEventConnectionState:"offline"}),d}})();try{await n}finally{n=null}}},reconnectTaskEvents:async()=>{s=!0,t().unsubscribeFromTaskEvents(),await t().subscribeToTaskEvents()},unsubscribeFromTaskEvents:()=>{var d,m;r=!1,(m=(d=t()).taskEventUnsubscribe)==null||m.call(d),e({taskEventUnsubscribe:null,taskEventsConnected:!1,taskEventConnectionState:"offline"})},loadTaskWorkspaceInfo:async()=>{e({isTaskWorkspaceLoading:!0,taskWorkspaceError:null});try{const d=await re.getWorkspaceInfo();e({taskWorkspaceInfo:d,isTaskWorkspaceLoading:!1})}catch(d){e({isTaskWorkspaceLoading:!1,taskWorkspaceError:d instanceof Error?d.message:"Failed to load task workspace"})}},loadBoundProjects:async()=>{try{const d=await re.listProjects(),m=bf(),p=d.find(g=>g.available&&g.path===m)??d.find(g=>g.isCurrent)??d.find(g=>g.available);p&&Ii(p.path),e({boundProjects:d,selectedProjectPath:(p==null?void 0:p.path)??null})}catch(d){e({error:d instanceof Error?d.message:"Failed to load projects"})}},bindProject:async d=>{e({isBindingProject:!0,error:null});try{const m=await re.bindProject(d);Ii(m.path),e(p=>({boundProjects:[...p.boundProjects.filter(g=>g.path!==m.path),m].sort((g,x)=>g.isCurrent!==x.isCurrent?g.isCurrent?-1:1:g.name.localeCompare(x.name)),selectedProjectPath:m.path,isBindingProject:!1}))}catch(m){throw e({isBindingProject:!1,error:m instanceof Error?m.message:"Failed to bind project"}),m}},unbindProject:async d=>{try{await re.unbindProject(d),e(m=>{const p=m.boundProjects.filter(x=>x.path!==d||x.isCurrent),g=m.selectedProjectPath===d?p.find(x=>x.isCurrent)??p.find(x=>x.available):void 0;return g&&Ii(g.path),{boundProjects:p,...g?{selectedProjectPath:g.path}:{}}})}catch(m){throw e({error:m instanceof Error?m.message:"Failed to unbind project"}),m}},selectProject:d=>{Ii(d),e({selectedProjectPath:d})},markTaskRead:d=>{const m=ze(d);e(p=>{const g=p.unreadTaskKeys.filter(x=>x!==m);return go(g),{unreadTaskKeys:g}})},clearUnreadTasks:()=>{go([]),e({unreadTaskKeys:[]})},cancelTask:async d=>{const m=ze(d);if(!t().cancellingTaskKeys.includes(m)){e(p=>({cancellingTaskKeys:[...p.cancellingTaskKeys,m],error:null,errorContext:null}));try{await re.abortSession(d);const p=oe(t().currentSessionRef,d);p&&t().unsubscribeFromEvents(),e(g=>({sessions:g.sessions.map(x=>oe(pe(x),d)?{...x,taskStatus:"cancelled",taskQueuePosition:void 0,taskQueueDepth:void 0,taskCompletedAt:x.taskCompletedAt??new Date().toISOString()}:x),...p?{isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,eventUnsubscribe:null}:{}}))}catch(p){throw e({error:p instanceof Error?p.message:"Failed to stop task",errorContext:{kind:"task_action",sessionRef:d}}),p}finally{e(p=>({cancellingTaskKeys:p.cancellingTaskKeys.filter(g=>g!==m)}))}}},retryTask:async d=>{const m=ze(d);if(t().retryingTaskKeys.includes(m))return;const p=t().getNavigationVersion(),g=t().selectedProjectPath,x=()=>t().getNavigationVersion()===p&&t().selectedProjectPath===g;e(b=>({retryingTaskKeys:[...b.retryingTaskKeys,m],error:null,errorContext:null}));try{const b=await re.retryTask(d);e(y=>({sessions:vn(y.sessions,b.session)})),t().markTaskRead(d),x()&&await t().selectSession(pe(b.session))}catch(b){throw x()&&e({error:b instanceof Error?b.message:"Failed to retry task",errorContext:{kind:"task_action",sessionRef:d}}),b}finally{e(b=>({retryingTaskKeys:b.retryingTaskKeys.filter(y=>y!==m)}))}},deliverTask:async(d,m)=>{const p=ze(d);if(!t().taskDeliveryActions[p]){e(g=>({taskDeliveryActions:{...g.taskDeliveryActions,[p]:m},error:null,errorContext:null}));try{const g=await re.deliverTask(d,m);e(x=>({sessions:vn(x.sessions,g)})),t().markTaskRead(d)}catch(g){throw e({error:g instanceof Error?g.message:"Failed to deliver task changes",errorContext:{kind:"task_action",sessionRef:d}}),g}finally{e(g=>{const{[p]:x,...b}=g.taskDeliveryActions;return{taskDeliveryActions:b}})}}},dispatchTask:async d=>{const m=t().getNavigationVersion(),p=t().selectedProjectPath,g=d.projectPath??p??void 0,x=()=>t().getNavigationVersion()===m&&t().selectedProjectPath===p;e({isDispatchingTask:!0,error:null,errorContext:null});try{const b=await re.createTask({...d,projectPath:g});e(y=>({sessions:vn(y.sessions,b.session),isDispatchingTask:!1})),x()&&await t().selectSession(pe(b.session))}catch(b){throw e({isDispatchingTask:!1,...x()?{error:b instanceof Error?b.message:"Failed to dispatch task"}:{}}),b}},startCodeReview:async d=>{const m=t().getNavigationVersion(),p=t().selectedProjectPath,g=d.projectPath??p??void 0,x=()=>t().getNavigationVersion()===m&&t().selectedProjectPath===p;e({isDispatchingTask:!0,error:null,errorContext:null});let b,y=!1;try{b=await re.createSession(g,"Code Review");const j=pe(b);await re.startCodeReview(j,{kind:d.kind,...d.ref?{ref:d.ref}:{},...d.instructions?{instructions:d.instructions}:{},...d.modelId?{modelId:d.modelId}:{}}),y=!0;const k={...b,taskStatus:"running",taskStatusReason:He("taskHome.review.running"),taskPromptSummary:`/review ${d.kind}${d.ref?` ${d.ref}`:""}`};e(A=>({sessions:vn(A.sessions,k),isDispatchingTask:!1})),x()&&await t().selectSession(j)}catch(j){throw b&&!y&&await re.deleteSession(pe(b)).catch(()=>{}),e({isDispatchingTask:!1,...x()?{error:j instanceof Error?j.message:He("taskHome.review.startFailed")}:{}}),j}}}},N5=e=>({tokenUsage:ao,updateTokenUsage:t=>e(n=>{const{costUsd:r,...s}=t;return{tokenUsage:{...n.tokenUsage,...s,totalInputTokens:n.tokenUsage.totalInputTokens+Math.max(0,t.inputTokens??0),totalOutputTokens:n.tokenUsage.totalOutputTokens+Math.max(0,t.outputTokens??0),cacheReadTokens:n.tokenUsage.cacheReadTokens+Math.max(0,t.cacheReadTokens??0),cacheWriteTokens:n.tokenUsage.cacheWriteTokens+Math.max(0,t.cacheWriteTokens??0),estimatedCostUsd:n.tokenUsage.estimatedCostUsd+Math.max(0,r??0)}}}),resetContextUsage:()=>e(t=>({tokenUsage:{...t.tokenUsage,inputTokens:0,outputTokens:0,totalTokens:0}})),setMaxContextTokens:(t,n=!1)=>e(r=>({tokenUsage:{...r.tokenUsage,maxContextTokens:t,isDefaultMaxTokens:n}}))}),L=ui()((...e)=>({...f2(...e),...P5(...e),...QD(...e),...w5(...e),...N5(...e)}));function O5(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function $5({open:e,onOpenChange:t}){const n=Ft(),r=L(T=>T.currentSessionRef),s=L(T=>T.isStreaming),o=L(T=>T.isTemporarySession),i=L(T=>T.rewindSession),[a,l]=w.useState([]),[d,m]=w.useState(null),[p,g]=w.useState(!1),[x,b]=w.useState(!1),[y,j]=w.useState(!1),[k,A]=w.useState(null);w.useEffect(()=>{if(!e||!r)return;let T=!1;return b(!0),A(null),l([]),m(null),g(!1),re.listRewindCheckpoints(r).then(C=>{var O;T||(l(C),m(((O=C[0])==null?void 0:O.messageId)??null))}).catch(C=>{T||A(C instanceof Error?C.message:n("chat.rewind.loadFailed"))}).finally(()=>{T||b(!1)}),()=>{T=!0}},[r,e]);const N=w.useMemo(()=>a.find(T=>T.messageId===d)??null,[a,d]),$=!!N&&!x&&!y&&!s&&!o,Q=async()=>{if(!N||!$)return;j(!0),A(null);const T=await i(N.messageId,p?"both":"conversation");j(!1),T?t(!1):A(n("chat.rewind.failed"))};return c.jsx(ol,{open:e,onOpenChange:t,children:c.jsxs(Yi,{className:"max-w-[620px] gap-0 overflow-hidden border-[#E5E7EB] bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b]",children:[c.jsx(il,{className:"border-b border-[#E5E7EB] px-6 py-5 dark:border-zinc-800",children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-md bg-[#F3F4F6] text-[#4B5563] dark:bg-zinc-800 dark:text-zinc-300",children:c.jsx(Su,{className:"h-4 w-4"})}),c.jsxs("div",{children:[c.jsx(Xi,{className:"text-[15px] font-semibold text-[#111827] dark:text-zinc-100",children:n("chat.rewind.title")}),c.jsx(Zi,{className:"mt-1 text-[12px] text-[#6B7280] dark:text-zinc-400",children:n("chat.rewind.description")})]})]})}),c.jsxs("div",{className:"min-h-[260px] px-6 py-4",children:[x&&c.jsxs("div",{className:"flex h-[220px] items-center justify-center text-[#6B7280] dark:text-zinc-400",children:[c.jsx(lt,{className:"mr-2 h-4 w-4 animate-spin"}),c.jsx("span",{className:"text-xs font-mono",children:n("chat.rewind.loading")})]}),!x&&k&&c.jsx("div",{role:"alert",className:"rounded-md border border-rose-200 bg-rose-50 px-4 py-3 text-xs text-rose-700 dark:border-rose-900/60 dark:bg-rose-950/30 dark:text-rose-300",children:k}),!x&&!k&&a.length===0&&c.jsxs("div",{className:"flex h-[220px] flex-col items-center justify-center text-center",children:[c.jsx(Su,{className:"mb-3 h-5 w-5 text-[#9CA3AF] dark:text-zinc-600"}),c.jsx("p",{className:"text-sm text-[#4B5563] dark:text-zinc-300",children:n("chat.rewind.empty")})]}),!x&&a.length>0&&c.jsx("div",{role:"radiogroup","aria-label":n("chat.rewind.checkpointAria"),className:"max-h-[310px] space-y-1 overflow-y-auto",children:a.map(T=>{const C=T.messageId===d;return c.jsxs("button",{type:"button",role:"radio","aria-checked":C,onClick:()=>m(T.messageId),className:W("w-full rounded-md border px-4 py-3 text-left transition-colors",C?"border-[#22C55E] bg-[#F0FDF4] dark:border-[#22C55E] dark:bg-[#052E16]/50":"border-transparent hover:bg-[#F9FAFB] dark:hover:bg-zinc-900"),children:[c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsx("p",{className:"line-clamp-2 text-[13px] leading-5 text-[#111827] dark:text-zinc-100",children:T.preview||n("chat.rewind.userMessage")}),c.jsx("span",{className:"shrink-0 text-[10px] font-mono text-[#9CA3AF] dark:text-zinc-500",children:O5(T.createdAt)})]}),c.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] font-mono text-[#6B7280] dark:text-zinc-500",children:[c.jsx("span",{children:T.messageId.slice(0,10)}),T.fileCount>0&&c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(dS,{className:"h-3 w-3"}),T.fileCount===1?n("chat.rewind.fileCountOne",{count:T.fileCount}):n("chat.rewind.fileCountMany",{count:T.fileCount})]})]})]},T.messageId)})})]}),c.jsx("div",{className:"border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800",children:c.jsxs("label",{className:"flex cursor-pointer items-start gap-3",children:[c.jsx("input",{type:"checkbox",checked:p,disabled:!N||N.fileCount===0,onChange:T=>g(T.target.checked),className:"mt-0.5 h-4 w-4 accent-[#16A34A] disabled:opacity-40"}),c.jsxs("span",{children:[c.jsx("span",{className:"block text-[12px] font-medium text-[#374151] dark:text-zinc-200",children:n("chat.rewind.restoreCode")}),c.jsx("span",{className:"mt-0.5 block text-[11px] text-[#6B7280] dark:text-zinc-500",children:n("chat.rewind.restoreCodeHint")})]})]})}),c.jsxs(Xf,{className:"border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800",children:[c.jsx(br,{variant:"ghost",onClick:()=>t(!1),disabled:y,children:n("chat.rewind.cancel")}),c.jsxs(br,{onClick:()=>void Q(),disabled:!$,className:"bg-[#16A34A] text-white hover:bg-[#15803D]",children:[y?c.jsx(lt,{className:"mr-2 h-4 w-4 animate-spin"}):c.jsx(Qi,{className:"mr-2 h-4 w-4"}),n("chat.rewind.confirm")]})]})]})})}function ly({inFlight:e,queued:t,maxConcurrent:n,compact:r=!1,className:s}){const o=Ft(),i=Math.max(1,n),a=Array.from({length:Math.min(i,12)}),l=Math.min(e,i);return c.jsxs("div",{className:W("inline-flex items-center gap-2 font-mono",r?"text-[10.5px]":"text-[11px]",s),title:o("capacity.title",{inFlight:e,queued:t,max:n}),children:[c.jsx("span",{className:W("inline-flex items-center gap-[3px] rounded-sm",r?"px-0":"px-0.5"),children:a.map((d,m)=>{const p=m<l;return c.jsx("span",{className:W("block",r?"h-2.5 w-[3px] rounded-[1px]":"h-3 w-[3px] rounded-[1px]",p?"bg-[hsl(var(--deck-accent))] shadow-[0_0_4px_hsl(var(--deck-accent)/0.65)]":"bg-[hsl(var(--deck-border-strong))]/60")},m)})}),c.jsxs("span",{className:"tabular-nums text-[hsl(var(--deck-ink-muted))]",children:[c.jsx("span",{className:"text-[hsl(var(--deck-ink))]",children:e}),c.jsx("span",{className:"mx-[2px] opacity-40",children:"/"}),c.jsx("span",{children:n}),c.jsx("span",{className:"opacity-60",children:o("capacity.suffix.running")})]}),t>0&&c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm border border-amber-300/60 bg-amber-50 px-1.5 py-[1px] text-[10px] text-amber-800 dark:border-amber-800/60 dark:bg-amber-950/40 dark:text-amber-300",children:[c.jsx("span",{className:"h-1 w-1 rounded-full bg-amber-500"}),o("capacity.queued",{queued:t})]})]})}function vf(){const e=document.querySelector("textarea[data-blade-composer]:not(:disabled)");if(!e)return!1;e.focus();const t=e.value.length;return e.setSelectionRange(t,t),!0}const dy=[{id:"searchTasks",key:"k",primaryModifier:!0,scope:"Global"},{id:"openCommands",key:"p",primaryModifier:!0,shiftKey:!0,scope:"Global"},{id:"newTask",key:"n",primaryModifier:!1,scope:"Global"},{id:"focusComposer",key:"/",primaryModifier:!1,scope:"Chat"},{id:"toggleSidebar",key:"b",primaryModifier:!0,scope:"Layout"}];function R5(e){const t=e.key.toLocaleLowerCase();return dy.find(n=>{if(n.key!==t||e.altKey||e.shiftKey!==!!n.shiftKey)return!1;const r=e.metaKey||e.ctrlKey;return n.primaryModifier?r:!r})??null}function M5(e){return e instanceof Element?!!e.closest('input, textarea, select, [contenteditable="true"], [role="textbox"], [role="combobox"]'):!1}function F5(e){var r;const t=typeof navigator>"u"?null:navigator,n=((r=t==null?void 0:t.userAgentData)==null?void 0:r.platform)??(t==null?void 0:t.platform)??"";return/mac|iphone|ipad|ipod/i.test(n)}function D5(e,t){const n=e.key==="/"?"/":e.key.toLocaleUpperCase(),r=F5();return[...e.primaryModifier?[r?"⌘":"Ctrl"]:[],...e.shiftKey?[r?"⇧":"Shift"]:[],n]}function Vc(e,t){const n=dy.find(r=>r.id===e);return n?D5(n).join(""):""}const uy="blade.sidebar.view",fy="blade.preview.width",lc=640,_5=360,L5=960,U5=()=>{if(typeof localStorage>"u")return"project";const e=localStorage.getItem(uy);return e==="status"||e==="project"?e:"project"},my=e=>Math.min(L5,Math.max(_5,Math.round(e))),B5=()=>{if(typeof localStorage>"u")return lc;const e=localStorage.getItem(fy);if(!e)return lc;const t=Number(e);return Number.isFinite(t)?my(t):lc},kr=ui(e=>({isSidebarOpen:!0,toggleSidebar:()=>e(t=>({isSidebarOpen:!t.isSidebarOpen})),setSidebarOpen:t=>e({isSidebarOpen:t}),sidebarView:U5(),setSidebarView:t=>{typeof localStorage<"u"&&localStorage.setItem(uy,t),e({sidebarView:t})},isFilePreviewOpen:!1,toggleFilePreview:()=>e(t=>({isFilePreviewOpen:!t.isFilePreviewOpen})),setFilePreviewOpen:t=>e({isFilePreviewOpen:t}),previewWidth:B5(),setPreviewWidth:t=>{const n=my(t);typeof localStorage<"u"&&localStorage.setItem(fy,String(n)),e({previewWidth:n})},previewTab:"diff",setPreviewTab:t=>e({previewTab:t}),previewTargetPath:null,previewRequestId:0,openFilePreview:t=>e(n=>({isFilePreviewOpen:!0,previewTab:(t==null?void 0:t.tab)??n.previewTab,previewTargetPath:(t==null?void 0:t.targetPath)??null,previewRequestId:n.previewRequestId+1})),isSettingsOpen:!1,settingsSection:"general",toggleSettings:()=>e(t=>({isSettingsOpen:!t.isSettingsOpen,...t.isSettingsOpen?{}:{settingsSection:"general"}})),openSettings:(t="general")=>e({isSettingsOpen:!0,settingsSection:t}),isTerminalOpen:!1,toggleTerminal:()=>e(t=>({isTerminalOpen:!t.isTerminalOpen})),isTaskSwitcherOpen:!1,taskSwitcherMode:"tasks",setTaskSwitcherOpen:(t,n)=>e(r=>({isTaskSwitcherOpen:t,taskSwitcherMode:n??r.taskSwitcherMode})),setTaskSwitcherMode:t=>e({taskSwitcherMode:t})}));function H5(){const e=kr(r=>r.setTaskSwitcherOpen),t=kr(r=>r.toggleSidebar),n=L(r=>r.startTemporarySession);w.useEffect(()=>{const r=s=>{if(s.repeat)return;const o=R5(s);if(!o)return;const i=kr.getState(),a=i.isTaskSwitcherOpen,l=M5(s.target),d=!!document.querySelector('[role="dialog"]');if(o.id==="searchTasks"||o.id==="openCommands"){if(d&&!a)return;s.preventDefault();const m=o.id==="searchTasks"?"tasks":"commands",p=a&&i.taskSwitcherMode===m;e(!p,m);return}if(!(l||d)){if(o.id==="newTask"){s.preventDefault(),n(),requestAnimationFrame(()=>vf());return}if(o.id==="focusComposer"){vf()&&s.preventDefault();return}o.id==="toggleSidebar"&&(s.preventDefault(),t())}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,n,t])}const su=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Of,{ref:r,className:W("overflow-hidden relative",e),...n,children:[c.jsx(sS,{className:"h-full w-full rounded-[inherit] [&>div]:!block !overflow-auto",children:t}),c.jsx(py,{}),c.jsx(oS,{})]}));su.displayName=Of.displayName;const py=w.forwardRef(({className:e,orientation:t="vertical",...n},r)=>c.jsx($f,{ref:r,orientation:t,className:W("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:c.jsx(iS,{className:"relative flex-1 rounded-full bg-border"})}));py.displayName=$f.displayName;function ho(e,t){var s;const n=(s=e.title)==null?void 0:s.trim();if(n==="Code Review")return t("session.title.codeReview");if(n)return n;const r=e.firstMessageTime||e.lastMessageTime;if(r){const o=new Date(r);if(!Number.isNaN(o.getTime()))return t("recent.session.fallbackDated",{y:String(o.getFullYear()).slice(-2),m:String(o.getMonth()+1).padStart(2,"0"),d:String(o.getDate()).padStart(2,"0"),hh:String(o.getHours()).padStart(2,"0"),mm:String(o.getMinutes()).padStart(2,"0")})}return t("recent.session.fallbackShort",{id:e.sessionId.slice(0,6)})}async function gy(e,t=!1){const n=await re.exportSessionMarkdown(e,t),r=new Blob([n.markdown],{type:"text/markdown;charset=utf-8"}),s=URL.createObjectURL(r),o=document.createElement("a");o.href=s,o.download=n.filename,o.hidden=!0,document.body.appendChild(o);try{o.click()}finally{o.remove(),await new Promise(i=>{window.setTimeout(()=>{URL.revokeObjectURL(s),i()},0)})}return n}const Gn=cS,Vn=lS,Mn=w.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>c.jsx(aS,{children:c.jsx(Rf,{ref:s,align:t,sideOffset:n,className:W("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]: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 origin-[--radix-popover-content-transform-origin]",e),...r})}));Mn.displayName=Rf.displayName;function q5(){const e=Ft(),t=L(b=>b.archivedSessions),n=L(b=>b.archivedCatalogLoadState),r=L(b=>b.archivedCatalogError),s=L(b=>b.loadArchivedSessions),o=L(b=>b.unarchiveSession),i=L(b=>b.setError),[a,l]=w.useState(!1),[d,m]=w.useState(null),[p,g]=w.useState(null),x=b=>{l(b),b&&s()};return c.jsxs(Gn,{open:a,onOpenChange:x,children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",className:"flex h-8 w-full items-center justify-between rounded-md px-2.5 font-mono text-[12.5px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]","aria-label":e("archive.open"),children:[c.jsxs("span",{className:"flex items-center gap-2.5",children:[c.jsx(Mf,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-ink-faint))]"}),e("archive.title")]}),t.length>0&&c.jsx("span",{className:"rounded-sm bg-[hsl(var(--deck-surface))] px-1.5 py-0.5 text-[9px] text-[hsl(var(--deck-ink-faint))]",children:t.length})]})}),c.jsxs(Mn,{role:"dialog","aria-label":e("archive.title"),side:"right",align:"end",sideOffset:8,className:"w-[340px] overflow-hidden p-0",children:[c.jsxs("div",{className:"flex h-10 items-center justify-between border-b border-[hsl(var(--deck-hairline))] px-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-mono text-[11px] font-medium uppercase tracking-[0.08em] text-[hsl(var(--deck-ink))]",children:e("archive.title")}),c.jsx("div",{className:"text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:e("archive.subtitle")})]}),c.jsx("button",{type:"button",onClick:()=>void s(),"aria-label":e("archive.refresh"),className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(lo,{className:W("h-3 w-3",(n==="loading"||n==="hydrating")&&"animate-spin")})})]}),r?c.jsxs("div",{className:"px-3 py-4 text-[11px] text-red-600 dark:text-red-400",children:[c.jsx("div",{children:r}),c.jsx("button",{type:"button",onClick:()=>void s(),className:"mt-2 font-mono text-[10px] text-[hsl(var(--deck-accent))] focus-visible:outline-none focus-visible:underline",children:e("archive.retry")})]}):t.length===0&&(n==="loading"||n==="hydrating")?c.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(lt,{className:"h-3 w-3 animate-spin"}),e("archive.loading")]}):t.length===0?c.jsx("div",{className:"flex h-24 items-center justify-center px-6 text-center text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:e("archive.empty")}):c.jsx(su,{className:"max-h-[340px]",children:c.jsx("div",{className:"divide-y divide-[hsl(var(--deck-hairline))]",children:t.map(b=>{var N;const y=pe(b),j=ze(y),k=d===j,A=b.projectPath.split("/").filter(Boolean).at(-1)??b.projectPath;return c.jsxs("div",{className:"flex min-h-[58px] items-center gap-2 px-3 py-2",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"truncate font-mono text-[11.5px] text-[hsl(var(--deck-ink))]",children:ho(b,e)}),c.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx("span",{className:"truncate",children:A}),b.archivedAt&&c.jsxs(c.Fragment,{children:[c.jsx("span",{"aria-hidden":!0,children:"·"}),c.jsx("span",{children:new Date(b.archivedAt).toLocaleString()})]})]}),b.archivedBySessionId!==b.sessionId&&c.jsx("div",{className:"mt-0.5 truncate text-[9px] text-[hsl(var(--deck-accent))]",children:e("archive.inherited",{id:((N=b.archivedBySessionId)==null?void 0:N.slice(0,8))??""})})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[c.jsx("button",{type:"button",disabled:p!==null,onClick:async()=>{g(j);try{await gy(y)}catch($){i($ instanceof Error?$.message:"Session export failed")}finally{g(null)}},"aria-label":e("session.action.export",{title:ho(b,e)}),title:e("session.action.exportShort"),className:"flex h-7 w-7 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-35",children:p===j?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Ff,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",disabled:k||b.archivedBySessionId!==b.sessionId,onClick:async()=>{m(j);try{await o(y)}finally{m(null)}},"aria-label":e("archive.restore",{title:ho(b,e)}),title:b.archivedBySessionId!==b.sessionId?e("archive.restoreAncestor"):e("archive.restoreShort"),className:"flex h-7 w-7 items-center justify-center rounded text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-35",children:k?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(uS,{className:"h-3.5 w-3.5"})})]})]},j)})})})]})]})}function ou({className:e,size:t=28,pulse:n=!0}){return c.jsxs("span",{className:W("inline-flex relative justify-center items-center","text-[hsl(var(--deck-ink))]",e),style:{width:t,height:t},"aria-hidden":"true",children:[c.jsxs("svg",{viewBox:"0 0 32 32",width:t,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M16 3 L28 16 L16 29 L4 16 Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),c.jsx("path",{d:"M16 8 L24 16 L16 24",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.55"}),c.jsx("path",{d:"M16 3 L20 7",stroke:"hsl(var(--deck-accent))",strokeWidth:"2",strokeLinecap:"round"})]}),n&&c.jsx("span",{className:"absolute top-[3px] right-[3px] h-1.5 w-1.5 rounded-full",style:{background:"hsl(var(--deck-accent-glow))",boxShadow:"0 0 6px hsl(var(--deck-accent-glow) / 0.9)"}})]})}const If={en:"sidebar.language.en",zh:"sidebar.language.zh"};function hy({className:e,variant:t="pill"}){const{locale:n,setLocale:r}=v0(),s=Ft();if(t==="compact"){const o=n==="en"?"zh":"en";return c.jsx("button",{type:"button",onClick:()=>r(o),"aria-label":s("sidebar.language.aria"),title:s("sidebar.language.label"),className:W("flex justify-center items-center w-10 h-10 font-mono font-medium rounded-md transition-colors text-[11px] text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",e),children:s(If[n])})}return c.jsx("div",{role:"group","aria-label":s("sidebar.language.aria"),className:W("inline-flex h-8 items-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-[2px] font-mono text-[11px]",e),children:k0.map(o=>{const i=o===n;return c.jsx("button",{type:"button",onClick:()=>r(o),"aria-pressed":i,className:W("flex justify-center items-center px-2 h-full transition-colors min-w-[28px] rounded-[4px]",i?"bg-[hsl(var(--deck-ink))] text-[hsl(var(--deck-canvas))]":"text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),children:s(If[o])},o)})})}const z5="[data-mobile-navigation-trigger]";function Y_(e){return by(z5,e)}function by(e,t){const n=document.querySelector(e);return!n||n.getClientRects().length===0?!1:(t.preventDefault(),n.focus({preventScroll:!0}),!0)}function ky({open:e,onOpenChange:t}){const n=Ft(),{boundProjects:r,selectedProjectPath:s,isBindingProject:o,loadBoundProjects:i,bindProject:a,unbindProject:l,selectProject:d,startTemporarySession:m}=L(),[p,g]=w.useState(""),[x,b]=w.useState(null),[y,j]=w.useState(!1),k=w.useRef(0);w.useEffect(()=>{if(e){i();return}k.current+=1,j(!1)},[i,e]);const A=async T=>{await a(T),g(""),m(),t(!1)},N=async T=>{if(T.preventDefault(),!(!p.trim()||o||y)){b(null);try{await A(p.trim())}catch(C){b(C instanceof Error?C.message:n("projects.bind.failed"))}}},$=async()=>{if(y||o)return;const T=++k.current;b(null),j(!0);try{const C=await re.pickProjectDirectory();if(T!==k.current||C.cancelled)return;g(C.path),await A(C.path)}catch(C){if(T!==k.current)return;b(C instanceof Error?C.message:n("projects.pick.failed"))}finally{T===k.current&&j(!1)}},Q=T=>{d(T),m(),t(!1)};return e?c.jsx(ol,{open:e,onOpenChange:t,children:c.jsxs(Yi,{onCloseAutoFocus:T=>by("[data-project-setup-trigger]",T),className:"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))] sm:max-w-xl",children:[c.jsxs(il,{children:[c.jsxs(Xi,{className:"flex items-center gap-2 font-mono text-[16px]",children:[c.jsx(Oi,{className:"h-4 w-4 text-[hsl(var(--deck-accent))]"}),n("projects.dialog.title")]}),c.jsx(Zi,{className:"text-[12px] text-[hsl(var(--deck-ink-muted))]",children:n("projects.dialog.description")})]}),c.jsxs("form",{onSubmit:N,className:"flex gap-2",children:[c.jsx("input",{value:p,onChange:T=>g(T.target.value),disabled:o,placeholder:n("projects.bind.placeholder"),"aria-label":n("projects.bind.pathLabel"),className:"h-9 min-w-0 flex-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 font-mono text-[12px] outline-none placeholder:text-[hsl(var(--deck-ink-faint))] focus:border-[hsl(var(--deck-accent)/0.65)]"}),c.jsxs("button",{type:"button",onClick:()=>void $(),disabled:y||o,title:n("projects.pick.action"),"aria-label":n("projects.pick.action"),className:"inline-flex h-9 shrink-0 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))] disabled:cursor-wait disabled:opacity-50",children:[y?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(fS,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"hidden sm:inline",children:n(y?"projects.pick.picking":"projects.pick.actionShort")})]}),c.jsxs("button",{type:"submit",disabled:!p.trim()||o||y,className:"inline-flex h-9 items-center gap-2 rounded-md bg-[hsl(var(--deck-ink))] px-3 font-mono text-[12px] text-[hsl(var(--deck-canvas))] transition-opacity disabled:opacity-40",children:[o?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Oi,{className:"h-3.5 w-3.5"}),n("projects.bind.action")]})]}),x&&c.jsx("div",{role:"alert",className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:x}),c.jsx("div",{className:"max-h-72 space-y-1 overflow-y-auto",children:r.map(T=>{const C=T.path===s;return c.jsxs("div",{className:W("group flex items-center gap-3 rounded-md border px-3 py-2",C?"border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))]":"border-transparent hover:border-[hsl(var(--deck-border))] hover:bg-[hsl(var(--deck-surface))]"),children:[c.jsx(uo,{className:W("h-4 w-4 shrink-0",C?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]")}),c.jsxs("button",{type:"button",disabled:!T.available,onClick:()=>Q(T.path),className:"min-w-0 flex-1 text-left disabled:cursor-not-allowed disabled:opacity-50",children:[c.jsx("span",{className:"block truncate font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:T.name}),c.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[T.gitBranch&&c.jsxs(c.Fragment,{children:[c.jsx(el,{className:"h-2.5 w-2.5"}),c.jsx("span",{children:T.gitBranch}),c.jsx("span",{children:"·"})]}),c.jsx("span",{className:"truncate",children:T.path}),!T.available&&c.jsxs("span",{className:"shrink-0 text-red-500",children:["· ",n("projects.unavailable")]})]})]}),!T.isCurrent&&c.jsx("button",{type:"button",onClick:()=>void l(T.path).catch(()=>{}),title:n("projects.unbind.action"),"aria-label":n("projects.unbind.action"),className:"rounded p-1.5 text-[hsl(var(--deck-ink-faint))] opacity-0 transition group-hover:opacity-100 hover:bg-red-50 hover:text-red-600 focus-visible:opacity-100 dark:hover:bg-red-950/30",children:c.jsx(Df,{className:"h-3.5 w-3.5"})})]},T.path)})})]})}):null}const K5={running:"bg-blue-500 dark:bg-blue-400 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse",queued:"bg-amber-400 dark:bg-amber-300",interrupted:"bg-orange-500 dark:bg-orange-400",failed:"bg-red-500 dark:bg-red-400",cancelled:"bg-zinc-400 dark:bg-zinc-500",completed:"bg-[hsl(var(--deck-accent))]"};function G5({session:e,isActive:t,isForking:n,isUnread:r,anyForking:s,isEditing:o,editingTitle:i,title:a,context:l,isCancelling:d,isRetrying:m,isExporting:p,onSelect:g,onCancelTask:x,onRetryTask:b,onFork:y,onArchive:j,onExport:k,onStartRename:A,onDelete:N,onEditingTitleChange:$,onSaveRename:Q,onCancelRename:T}){const C=Ft(),[O,R]=w.useState(!1),K=w.useRef(null),X=w.useRef(null);return o?c.jsxs("div",{className:"flex h-9 w-full items-center gap-2 bg-[hsl(var(--deck-surface))] px-3",children:[c.jsx("input",{type:"text",value:i,onChange:P=>$(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Q(),P.key==="Escape"&&T()},autoFocus:!0,className:"flex-1 rounded bg-[hsl(var(--deck-canvas))] px-2 py-1 font-mono text-[13px] text-[hsl(var(--deck-ink))] outline-none focus:ring-1 focus:ring-[hsl(var(--deck-accent))]"}),c.jsx("button",{"aria-label":C("session.action.save",{title:a}),onClick:Q,className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-canvas))]",children:c.jsx(_f,{className:"w-3 h-3"})}),c.jsx("button",{"aria-label":C("session.action.cancel",{title:a}),onClick:T,className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-canvas))]",children:c.jsx(co,{className:"w-3 h-3"})})]}):c.jsxs("div",{className:W("flex relative items-center w-full transition-colors group min-h-[54px]",t?"bg-[hsl(var(--deck-surface))]":"hover:bg-[hsl(var(--deck-surface))]/60"),children:[t&&c.jsx("span",{className:"absolute left-0 top-1/2 h-6 w-[2px] -translate-y-1/2 rounded-r bg-[hsl(var(--deck-accent))]"}),c.jsxs("button",{type:"button","aria-label":C("session.action.select",{title:a}),"aria-current":t?"true":void 0,"aria-busy":n?"true":void 0,onClick:g,className:"flex min-h-[54px] min-w-0 flex-1 cursor-pointer items-center gap-2 py-1.5 pl-4 pr-2 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx("span",{className:W("h-1.5 w-1.5 shrink-0 rounded-full",e.pendingInteraction?"animate-pulse bg-amber-500 shadow-[0_0_5px_rgba(245,158,11,0.75)]":K5[e.taskStatus]),title:e.pendingInteraction?C(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission"):e.taskStatus}),c.jsxs("span",{className:"flex-1 min-w-0 font-mono",children:[c.jsxs("span",{className:W("flex gap-2 items-center text-left truncate text-[12px]",t?"text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:[c.jsx("span",{className:"truncate",children:a}),r&&c.jsx("span",{title:C("taskSwitcher.new"),className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.75)]"}),e.pendingInteraction&&c.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-amber-100 px-1.5 py-0.5 text-[8.5px] text-amber-800 dark:bg-amber-950/60 dark:text-amber-300",title:C(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission"),children:[c.jsx(As,{className:"h-2.5 w-2.5"}),C(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission")]}),e.relationType==="fork"&&e.parentId&&c.jsxs("span",{title:`${C("session.forkedFrom")} ${e.parentId.slice(0,6)}`,"aria-label":`${C("session.forkedFrom")} ${e.parentId.slice(0,6)}`,className:"shrink-0 text-[9px] text-[hsl(var(--deck-accent))]",children:[C("session.forkedFrom")," ",e.parentId.slice(0,6)]}),e.taskRetriedFrom&&c.jsx("span",{title:`${C("session.retriedFrom")} ${e.taskRetriedFrom.sessionId.slice(0,6)}`,className:"shrink-0 text-[9px] text-[hsl(var(--deck-accent))]",children:C("session.retryShort")})]}),c.jsxs("span",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 truncate text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx("span",{className:"truncate",children:l.project}),c.jsx("span",{className:"opacity-50",children:"·"}),c.jsx("span",{className:"truncate",children:l.environment}),l.queue&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"opacity-50",children:"·"}),c.jsx("span",{className:"text-amber-700 truncate dark:text-amber-400",children:l.queue})]}),l.diff&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"opacity-50",children:"·"}),c.jsx("span",{className:"truncate text-[hsl(var(--deck-accent))]",children:l.diff})]})]}),l.reason&&c.jsx("span",{title:l.reason,className:"mt-0.5 block truncate text-[9.5px] text-red-600 dark:text-red-400",children:l.reason})]}),n&&c.jsx(lt,{className:"h-3 w-3 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"})]}),c.jsxs("div",{className:W("flex items-center gap-0.5 pr-2 transition-opacity group-focus-within:opacity-100",e.taskStatus==="running"||e.taskStatus==="queued"||e.taskRetryAvailable&&(e.taskStatus==="failed"||e.taskStatus==="interrupted"||e.taskStatus==="cancelled")?"opacity-100":"opacity-50 group-hover:opacity-100"),children:[(e.taskStatus==="running"||e.taskStatus==="queued")&&c.jsx("button",{type:"button","aria-label":C(d?"session.action.stopping":"session.action.stop",{title:a}),disabled:d,onClick:P=>{P.stopPropagation(),x()},className:"flex h-6 w-6 items-center justify-center rounded text-red-500 transition-colors hover:bg-red-500/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60",children:d?c.jsx(lt,{className:"h-3 w-3 animate-spin"}):c.jsx(tl,{className:"h-3 w-3"})}),e.taskRetryAvailable&&(e.taskStatus==="failed"||e.taskStatus==="interrupted"||e.taskStatus==="cancelled")&&c.jsx("button",{ref:K,type:"button","aria-label":C(m?"session.action.retrying":"session.action.retry",{title:a}),disabled:m,onClick:P=>{P.stopPropagation(),b()},className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-60",children:m?c.jsx(lt,{className:"h-3 w-3 animate-spin"}):c.jsx(Qi,{className:"h-3 w-3"})}),c.jsxs(Gn,{open:O,onOpenChange:R,children:[c.jsx(Vn,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":C("session.action.more",{title:a}),"aria-expanded":O,className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-canvas))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(mS,{className:"h-3.5 w-3.5"})})}),c.jsxs(Mn,{ref:X,role:"menu","aria-label":C("session.action.more",{title:a}),side:"right",align:"start",sideOffset:6,className:"w-40 p-1",onOpenAutoFocus:P=>{var B,M;P.preventDefault(),(M=(B=X.current)==null?void 0:B.querySelector('[role="menuitem"]:not([disabled])'))==null||M.focus()},onKeyDown:P=>{P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),R(!1),window.setTimeout(()=>{var B;return(B=K.current)==null?void 0:B.focus()},0))},children:[c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.fork",{title:a}),disabled:s,onClick:P=>{P.stopPropagation(),y(),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-45",children:[c.jsx(pS,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.forkShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.rename",{title:a}),onClick:P=>{A(P),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none",children:[c.jsx(gS,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.renameShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.archive",{title:a}),disabled:e.taskStatus==="running"||e.taskStatus==="queued",onClick:P=>{P.stopPropagation(),j(),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-35",children:[c.jsx(Mf,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.archiveShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.export",{title:a}),disabled:p,onClick:P=>{P.stopPropagation(),k(),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none disabled:cursor-wait disabled:opacity-45",children:[p?c.jsx(lt,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):c.jsx(Ff,{className:"h-3 w-3","aria-hidden":!0}),C(p?"session.action.exportingShort":"session.action.exportShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.delete",{title:a}),onClick:P=>{N(P),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-red-600 transition-colors hover:bg-red-500/10 focus-visible:bg-red-500/10 focus-visible:outline-none dark:text-red-400",children:[c.jsx(Df,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.deleteShort")]})]})]})]})]})}function V5({onExpand:e,onNewChat:t,onOpenTaskSwitcher:n,onToggleTerminal:r,onToggleSettings:s,isTerminalOpen:o,taskEventsConnected:i,unreadCount:a,className:l}){const d=Ft(),m=[{icon:Lf,action:s,labelKey:"sidebar.section.settings"}];return c.jsxs("div",{className:W("flex flex-col gap-2 items-center py-5 h-screen border-r w-[64px] border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))]",l),children:[c.jsx("button",{onClick:e,className:"rounded-md p-1 transition-colors hover:bg-[hsl(var(--deck-surface))]","aria-label":d("sidebar.action.expand"),children:c.jsx(ou,{size:28})}),c.jsx("button",{onClick:t,"aria-label":d("sidebar.action.newTaskShort"),title:d("sidebar.action.newTaskShort"),className:"mt-6 flex h-10 w-10 items-center justify-center rounded-md bg-[hsl(var(--deck-ink))] text-[hsl(var(--deck-canvas))] transition-colors hover:bg-[hsl(var(--deck-ink))]/85",children:c.jsx(nl,{className:"h-4 w-4 stroke-[2.5]"})}),c.jsx("button",{onClick:r,"aria-label":d("sidebar.action.terminalToggle"),title:d("sidebar.action.terminal"),className:W("flex h-10 w-10 items-center justify-center rounded-md border transition-colors",o?"border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"border-transparent text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]"),children:c.jsx(Uf,{className:"w-4 h-4"})}),c.jsxs("button",{onClick:n,"aria-label":d("sidebar.action.searchTasks"),title:`${d("sidebar.action.searchTasks")} (${Vc("searchTasks")})`,className:"relative flex h-10 w-10 items-center justify-center rounded-md border border-transparent text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:[c.jsx(rl,{className:"h-4 w-4"}),a>0&&c.jsx("span",{"aria-label":d("sidebar.unreadTasks",{count:a}),className:"absolute right-0.5 top-0.5 flex min-h-4 min-w-4 items-center justify-center rounded-full bg-[hsl(var(--deck-accent))] px-1 font-mono text-[8px] font-semibold text-white",children:a>99?"99+":a})]}),c.jsx("div",{className:"flex-1"}),c.jsx("div",{className:"my-2 h-px w-6 bg-[hsl(var(--deck-hairline))]"}),m.map(({icon:p,action:g,labelKey:x})=>c.jsx("button",{"data-settings-trigger":!0,onClick:g,"aria-label":d(x),title:d(x),className:"flex h-10 w-10 items-center justify-center rounded-md text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:c.jsx(p,{className:"w-4 h-4"})},x)),c.jsx(hy,{variant:"compact"}),c.jsx("div",{className:"mt-1",children:c.jsx("div",{role:"status","aria-label":d(i?"sidebar.status.feedLive":"sidebar.status.feedOffline"),className:W("h-2 w-2 rounded-full",i?"bg-[hsl(var(--deck-accent))] shadow-[0_0_6px_hsl(var(--deck-accent-glow)/0.9)]":"bg-[hsl(var(--deck-ink-faint))]/60"),title:d(i?"sidebar.status.feedLive":"sidebar.status.feedOffline")})})]})}const xy="blade.sidebar.project-order.v1";function mi(e){const t=new Set,n=[];for(const r of e)typeof r!="string"||!r||t.has(r)||(t.add(r),n.push(r));return n}function W5(){if(typeof window>"u")return[];try{const e=JSON.parse(window.localStorage.getItem(xy)??"[]");return Array.isArray(e)?mi(e):[]}catch{return[]}}function J5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(xy,JSON.stringify(mi(e)))}catch{}}function Q5(e,t){const n=new Map(mi(t).map((s,o)=>[s,o])),r=n.size;return e.map((s,o)=>({project:s,rank:n.get(s.path)??r+o})).sort((s,o)=>s.rank-o.rank).map(({project:s})=>s)}function Y5(e,t,n){const r=mi(e),s=r.indexOf(t),o=r.indexOf(n);if(s<0||o<0||s===o)return r;const[i]=r.splice(s,1);return r.splice(o,0,i),r}function X5(e,t,n){const r=mi(e),s=r.indexOf(t),o=s+n;return s<0||o<0||o>=r.length||([r[s],r[o]]=[r[o],r[s]]),r}function Z5({name:e,path:t,count:n,countIsPartial:r=!1,isActive:s,hasRunning:o,unreadCount:i,collapsed:a,onToggle:l,onSelect:d,onCreateTask:m,reorderPosition:p,reorderCount:g,isDragging:x=!1,onDragStart:b,onDragEnd:y,onReorderKeyDown:j}){const k=Ft();return c.jsxs("div",{className:W("group/proj flex w-full items-center gap-2 px-5 pb-1.5 pt-3 text-left transition-colors","hover:bg-[hsl(var(--deck-surface))]/40"),children:[c.jsx("button",{type:"button",draggable:!0,"data-project-drag-handle":t,onDragStart:b,onDragEnd:y,onKeyDown:j,"aria-label":k("sidebar.project.reorder",{name:e,position:p,count:g}),title:k("sidebar.project.reorderHint"),className:W("-ml-2 flex h-6 w-4 shrink-0 cursor-grab items-center justify-center rounded-sm text-[hsl(var(--deck-ink-faint))] opacity-45 transition-[opacity,color,background-color] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink-muted))] hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] active:cursor-grabbing group-hover/proj:opacity-100",x&&"cursor-grabbing opacity-100 text-[hsl(var(--deck-accent))]"),children:c.jsx(hS,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",onClick:l,"aria-expanded":!a,"aria-label":k(a?"sidebar.project.expand":"sidebar.project.collapse",{name:e}),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(bS,{className:W("h-3 w-3 text-[hsl(var(--deck-ink-faint))] transition-transform duration-150",!a&&"rotate-90")})}),c.jsxs("button",{type:"button",onClick:d??l,title:t,"aria-current":s?"true":void 0,className:"flex min-h-6 min-w-0 flex-1 items-center gap-2 rounded-sm text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx(uo,{className:W("h-3.5 w-3.5 shrink-0",s?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]")}),c.jsx("span",{className:W("flex-1 truncate font-mono text-[11.5px] font-medium tracking-[-0.01em]",s?"text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:e}),o&&c.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-blue-500 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse dark:bg-blue-400","aria-hidden":!0}),i>0&&c.jsx("span",{"aria-label":k("sidebar.unreadTasks",{count:i}),className:"shrink-0 rounded-full bg-[hsl(var(--deck-accent))] px-1.5 py-0.5 font-mono text-[8px] font-semibold text-white",children:i}),c.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[n.toString().padStart(2,"0"),r?"+":""]})]}),m&&c.jsx("button",{type:"button",onClick:m,title:k("sidebar.project.newTask",{name:e}),"aria-label":k("sidebar.project.newTask",{name:e}),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-[hsl(var(--deck-ink-faint))] opacity-0 transition-[opacity,color,background-color] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-accent))] focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] group-hover/proj:opacity-100",children:c.jsx(nl,{className:"h-3.5 w-3.5"})})]})}function Wc(e){const t=e.lastMessageTime||e.firstMessageTime;if(!t)return 0;const n=new Date(t).getTime();return Number.isNaN(n)?0:n}function Cf(e){return e.pendingInteraction?0:e.taskStatus==="running"?1:e.taskStatus==="queued"?2:3}function iu(e,t){return Cf(e)-Cf(t)||Wc(t)-Wc(e)}const e_=["running","queued","interrupted","failed","cancelled","completed"],t_={running:"RUNNING",queued:"QUEUED",interrupted:"INTERRUPTED",failed:"FAILED",cancelled:"CANCELLED",completed:"DONE"},ys=e=>e.length>1?e.replace(/\/+$/,""):e;function yy(e){const t=new Map;for(const n of e){if(!n)continue;const r=ze(pe(n));t.has(r)||t.set(r,n)}return Array.from(t.values())}function n_(e){const t=yy(e),n=[];for(const r of e_){const s=t.filter(o=>o.taskStatus===r).sort(iu);s.length>0&&n.push({code:t_[r],status:r,sessions:s})}return n}function r_(e,t,n=[]){const r=yy(e),s=new Map,o=n.map(ys),i=new Map(o.map((d,m)=>[d,m]));for(const d of o)s.set(d,[]);for(const d of r){const m=fi(d,t),p=s.get(m);p?p.push(d):s.set(m,[d])}const a=t?ys(t):null,l=Array.from(s.entries()).map(([d,m])=>{const p=[...m].sort(iu),g=m.reduce((x,b)=>Math.max(x,Wc(b)),0);return{path:d,name:qc(d),isActive:a?ys(d)===a:!1,isBound:i.has(ys(d)),hasRunning:m.some(x=>x.taskStatus==="running"),lastActivity:g,sessions:p}});return l.sort((d,m)=>d.isBound!==m.isBound?d.isBound?-1:1:d.isBound&&m.isBound?(i.get(ys(d.path))??Number.MAX_SAFE_INTEGER)-(i.get(ys(m.path))??Number.MAX_SAFE_INTEGER):m.lastActivity-d.lastActivity),l}const jf=12,s_={RUNNING:"sidebar.group.running",QUEUED:"sidebar.group.queued",INTERRUPTED:"sidebar.group.interrupted",FAILED:"sidebar.group.failed",CANCELLED:"sidebar.group.cancelled",DONE:"sidebar.group.done"},o_={RUNNING:"text-blue-700 dark:text-blue-400",QUEUED:"text-amber-700 dark:text-amber-400",INTERRUPTED:"text-orange-700 dark:text-orange-400",FAILED:"text-red-700 dark:text-red-400",CANCELLED:"text-[hsl(var(--deck-ink-faint))]",DONE:"text-[hsl(var(--deck-accent))]"};function i_({view:e,sessions:t,activeProjectPath:n,boundProjects:r,currentSessionRef:s,unreadTaskKeys:o,catalogLoadState:i,catalogError:a,onSelectProject:l,onCreateTask:d,onRetryCatalog:m,renderRow:p}){const g=Ft(),[x,b]=w.useState({}),[y,j]=w.useState({}),[k,A]=w.useState(W5),[N,$]=w.useState(null),[Q,T]=w.useState(null),[C,O]=w.useState(""),R=i==="loading"||i==="hydrating",K=R||i==="error",X=w.useMemo(()=>e==="status"?n_(t):[],[t,e]),P=w.useMemo(()=>e==="project"?r_(t,n,r.map(F=>F.path)):[],[n,r,t,e]),B=w.useMemo(()=>Q5(P,k),[P,k]),M=(F,me)=>{const Se=y[F]??!1,Ee=Se?me:me.filter((Z,_)=>{if(_<jf)return!0;const Ge=pe(Z);return!!Z.pendingInteraction||o.includes(ze(Ge))||!!(s&&oe(Ge,s))}),Pe=me.length-Ee.length,U=Se?me.length>jf:Pe>0;return c.jsxs(c.Fragment,{children:[Ee.map(p),U&&c.jsx("button",{type:"button",onClick:()=>j(Z=>({...Z,[F]:!Se})),className:"mx-4 my-1 rounded-md px-3 py-1.5 text-left font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink-muted))]",children:Se?g("sidebar.group.showLess"):g("sidebar.group.showMore",{count:Pe})})]})},fe=R?c.jsxs("div",{role:"status","aria-live":"polite",className:"mx-4 mt-2 flex items-center gap-2 rounded-md bg-[hsl(var(--deck-surface))]/55 px-3 py-2 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(lt,{className:"h-3 w-3 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"flex-1 min-w-0",children:g("sidebar.catalog.syncing")}),c.jsx("span",{className:"tabular-nums shrink-0",children:g("sidebar.catalog.loaded",{count:t.length})})]}):i==="error"?c.jsxs("div",{role:"alert",title:a??void 0,className:"mx-4 mt-2 flex items-center gap-2 rounded-md bg-amber-50/80 px-3 py-2 font-mono text-[9.5px] text-amber-800 dark:bg-amber-950/35 dark:text-amber-300",children:[c.jsx(As,{className:"w-3 h-3 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0",children:g("sidebar.catalog.incomplete")}),c.jsxs("button",{type:"button",onClick:m,className:"inline-flex min-h-6 shrink-0 items-center gap-1 rounded px-1.5 font-medium hover:bg-amber-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-amber-500 dark:hover:bg-amber-900/50",children:[c.jsx(lo,{className:"h-2.5 w-2.5"}),g("sidebar.catalog.retry")]})]}):null;if(e==="status")return c.jsxs("div",{className:"flex flex-col",children:[fe,X.map((F,me)=>c.jsxs("div",{children:[c.jsxs("div",{className:W("flex items-center justify-between px-5 pb-2 pt-3 font-mono text-[10px] tracking-[0.16em]",o_[F.code]??"text-[hsl(var(--deck-ink-faint))]",me===0&&"pt-2"),children:[c.jsx("span",{children:g(s_[F.code])}),c.jsxs("span",{className:"text-[hsl(var(--deck-ink-faint))]",children:[F.sessions.length.toString().padStart(2,"0"),K?"+":""]})]}),M(`status:${F.code}`,F.sessions)]},F.code))]});const ve=B.some(F=>F.isActive),ke=F=>!!(s&&F.sessions.some(me=>oe(pe(me),s))),ce=(F,me)=>{if(F.join("\0")===B.map(Ee=>Ee.path).join("\0"))return;A(F),J5(F);const Se=B.find(Ee=>Ee.path===me);O(g("sidebar.project.reordered",{name:(Se==null?void 0:Se.name)??me,position:F.indexOf(me)+1}))},Fe=(F,me)=>{const Se=F.sessions.filter(_=>o.includes(ze(pe(_)))).length,Ee=ke(F),Pe=Se>0,U=F.sessions.some(_=>!!_.pendingInteraction),Z=x[F.path]??(ve&&!F.isActive&&!(Ee||F.hasRunning||Pe||U));return c.jsxs("div",{"data-project-group":F.path,onDragEnter:_=>{!N||N===F.path||(_.preventDefault(),T(F.path))},onDragOver:_=>{!N||N===F.path||(_.preventDefault(),_.dataTransfer.dropEffect="move")},onDrop:_=>{_.preventDefault();const Ge=N||_.dataTransfer.getData("text/plain");Ge&&Ge!==F.path&&ce(Y5(B.map(Ne=>Ne.path),Ge,F.path),Ge),$(null),T(null)},className:W("relative transition-colors",Q===F.path&&N!==F.path&&"bg-[hsl(var(--deck-accent-soft))]/55 before:absolute before:inset-y-1 before:left-0 before:w-0.5 before:rounded-full before:bg-[hsl(var(--deck-accent))]"),children:[c.jsx(Z5,{name:F.name,path:F.path,count:F.sessions.length,countIsPartial:K,isActive:F.isActive,hasRunning:F.hasRunning,unreadCount:Se,collapsed:Z,onSelect:()=>l(F.path),onCreateTask:()=>d(F.path),reorderPosition:me+1,reorderCount:B.length,isDragging:N===F.path,onDragStart:_=>{_.dataTransfer.effectAllowed="move",_.dataTransfer.setData("text/plain",F.path),$(F.path)},onDragEnd:()=>{$(null),T(null)},onReorderKeyDown:_=>{if(_.key!=="ArrowUp"&&_.key!=="ArrowDown")return;_.preventDefault();const Ge=X5(B.map(Ne=>Ne.path),F.path,_.key==="ArrowUp"?-1:1);ce(Ge,F.path)},onToggle:()=>b(_=>({..._,[F.path]:!Z}))}),!Z&&M(`project:${F.path}`,F.sessions)]},F.path)};return c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{className:"sr-only","aria-live":"polite",children:C}),fe,B.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"px-5 pb-0.5 pt-2 font-mono text-[9px] uppercase tracking-[0.16em] text-[hsl(var(--deck-ink-faint))]",children:g("sidebar.project.projects")}),B.map(Fe)]})]})}function a_({className:e,onNavigate:t}){const n=Ft(),{toggleSettings:r,toggleSidebar:s,isSidebarOpen:o,isTerminalOpen:i,toggleTerminal:a,sidebarView:l,setSidebarView:d,setTaskSwitcherOpen:m}=kr(),p=L(S=>S.sessions),g=L(S=>S.catalogLoadState),x=L(S=>S.catalogError),b=L(S=>S.currentSessionRef),y=L(S=>S.forkingSessionRef),j=L(S=>S.selectSession),k=L(S=>S.startTemporarySession),A=L(S=>S.deleteSession),N=L(S=>S.archiveSession),$=L(S=>S.forkSession),Q=L(S=>S.updateSession),T=L(S=>S.loadSessions),C=L(S=>S.setError),O=L(S=>S.taskEventsConnected),R=L(S=>S.taskWorkspaceInfo),K=L(S=>S.boundProjects),X=L(S=>S.selectedProjectPath),P=L(S=>S.bindProject),B=L(S=>S.selectProject),M=L(S=>S.cancelTask),fe=L(S=>S.cancellingTaskKeys),ve=L(S=>S.retryTask),ke=L(S=>S.retryingTaskKeys),ce=L(S=>S.unreadTaskKeys),[Fe,F]=w.useState(null),[me,Se]=w.useState(""),[Ee,Pe]=w.useState(null),[U,Z]=w.useState(!1),_=X??(R==null?void 0:R.cwd)??null,Ge=S=>ho(S,n),Ne=S=>{const Y=S.taskSourceProjectPath||S.projectPath,De=Y.split("/").filter(Boolean).at(-1)||Y,mt=S.taskIsolation==="worktree"?S.taskWorktreeBranch||n("session.env.worktree"):n("session.env.local"),zn=S.taskDiffStat?`+${S.taskDiffStat.additions} −${S.taskDiffStat.deletions}`:void 0,ms=S.taskStatus==="queued"&&S.taskQueuePosition?n("session.queued",{position:S.taskQueuePosition,depth:S.taskQueueDepth??S.taskQueuePosition}):void 0,ps=ru(S,n);return{project:De,environment:mt,diff:zn,queue:ms,reason:ps}},Oe=()=>{k(_??void 0),t==null||t()},on=async S=>{K.some(Y=>Y.path===S)?B(S):await P(S),k(S),t==null||t()},Sn=async S=>{K.some(Y=>Y.path===S)?B(S):await P(S),k(S),t==null||t()},Xe=S=>{S(),t==null||t()},qn=async(S,Y)=>{S.stopPropagation(),await A(pe(Y))},ft=async S=>{const Y=pe(S),De=ze(Y);if(!Ee){Pe(De);try{await gy(Y)}catch(mt){C(mt instanceof Error?mt.message:"Session export failed")}finally{Pe(null)}}},an=(S,Y)=>{S.stopPropagation(),F(ze(pe(Y))),Se(Ge(Y))},Rn=async S=>{if(!me.trim()){F(null);return}try{await Q(pe(S),me.trim()),F(null),await T()}catch(Y){console.error("Failed to rename session:",Y)}},_t=()=>{F(null),Se("")};return o?c.jsxs("div",{className:W("flex flex-col h-screen border-r w-[260px] border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))]",e),children:[c.jsxs("div",{className:"flex flex-col gap-6 px-5 pt-5 pb-5",children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx(ou,{size:26}),c.jsx("span",{className:"font-mono text-[15px] font-semibold tracking-[-0.01em] text-[hsl(var(--deck-ink))]",children:"Blade"}),c.jsx("span",{className:"ml-1 rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-1 py-[1px] font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:n("sidebar.brand.badge")})]}),c.jsx("button",{onClick:s,"aria-label":n("sidebar.action.collapse"),className:"flex h-8 w-8 items-center justify-center rounded transition-colors hover:bg-[hsl(var(--deck-surface))]",children:c.jsx(kS,{className:"h-3 w-3 text-[hsl(var(--deck-ink-muted))]"})})]}),c.jsxs("div",{className:"flex flex-col gap-1.5",children:[c.jsxs("button",{onClick:Oe,className:"flex h-9 w-full items-center justify-between rounded-md bg-[hsl(var(--deck-ink))] px-3 font-mono text-[13px] font-medium text-[hsl(var(--deck-canvas))] transition-colors hover:bg-[hsl(var(--deck-ink))]/88",children:[c.jsxs("span",{className:"flex gap-2 items-center",children:[c.jsx(nl,{className:"h-3.5 w-3.5 stroke-[2.5]"}),n("sidebar.action.newTask")]}),c.jsx("span",{className:"rounded-sm bg-white/10 px-1.5 py-[1px] font-mono text-[10px] text-white/80",children:Vc("newTask")})]}),c.jsxs("button",{onClick:()=>Xe(a),className:W("flex h-9 w-full items-center gap-2 rounded-md border px-3 font-mono text-[12.5px] transition-colors",i?"border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-muted))] hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]"),children:[c.jsx(Uf,{className:"h-3.5 w-3.5"}),n("sidebar.action.terminal")]}),c.jsxs("button",{type:"button",onClick:()=>Xe(()=>m(!0)),className:"flex h-9 w-full items-center justify-between rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 font-mono text-[12.5px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx(rl,{className:"h-3.5 w-3.5"}),n("sidebar.action.searchTasks")]}),c.jsx("span",{className:"rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-1.5 py-[1px] font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:ce.length>0?ce.length:Vc("searchTasks")})]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("div",{className:"flex flex-1 items-center gap-0.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-0.5",children:["project","status"].map(S=>c.jsx("button",{type:"button",onClick:()=>d(S),"aria-pressed":l===S,"aria-label":n(S==="project"?"sidebar.view.projectAria":"sidebar.view.statusAria"),className:W("flex-1 rounded-[5px] py-1 font-mono text-[11px] tracking-[0.02em] transition-colors",l===S?"bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))] shadow-sm":"text-[hsl(var(--deck-ink-faint))] hover:text-[hsl(var(--deck-ink-muted))]"),children:n(S==="project"?"sidebar.view.project":"sidebar.view.status")},S))}),c.jsx("button",{type:"button",onClick:()=>Z(!0),title:n("projects.bind.action"),"aria-label":n("projects.bind.action"),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-faint))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-accent))]",children:c.jsx(Oi,{className:"h-3.5 w-3.5"})})]})]}),c.jsx(su,{className:"flex-1 px-0",children:c.jsxs("div",{className:"flex flex-col",children:[(p.length>0||K.length>0||g==="loading"||g==="hydrating"||g==="error")&&c.jsx(i_,{view:l,sessions:p,activeProjectPath:_,boundProjects:K,currentSessionRef:b,unreadTaskKeys:ce,catalogLoadState:g,catalogError:x,onRetryCatalog:T,onSelectProject:S=>void on(S).catch(()=>{}),onCreateTask:S=>void Sn(S).catch(()=>{}),renderRow:S=>{const Y=pe(S),De=ze(Y),mt=oe(Y,b),zn=Fe===De,ms=oe(Y,y),ps=!!y;return c.jsx(G5,{session:S,sessionRef:Y,isActive:mt,isForking:ms,isUnread:ce.includes(ze(Y)),anyForking:ps,isEditing:zn,editingTitle:me,title:Ge(S),context:Ne(S),isCancelling:fe.includes(ze(Y)),isRetrying:ke.includes(ze(Y)),isExporting:Ee===De,onSelect:()=>(t==null||t(),j(Y)),onCancelTask:()=>{M(Y).catch(()=>{})},onRetryTask:()=>{ve(Y).catch(()=>{})},onFork:()=>void $(S),onArchive:()=>void N(Y),onExport:()=>void ft(S),onStartRename:gs=>an(gs,S),onDelete:gs=>qn(gs,S),onEditingTitleChange:Se,onSaveRename:()=>Rn(S),onCancelRename:_t},De)}}),p.length===0&&c.jsx("div",{className:"px-5 mt-6",children:c.jsxs("div",{className:"rounded-md border border-dashed border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]/60 px-4 py-6 text-center",children:[c.jsx("div",{className:"mx-auto mb-2 inline-flex h-8 w-8 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))]",children:c.jsx(Bf,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-ink-faint))]"})}),c.jsx("div",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:n("sidebar.empty.title")}),c.jsx("div",{className:"mt-1 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:n("sidebar.empty.hint")})]})})]})}),c.jsxs("div",{className:"flex flex-col gap-3 px-5 pt-3 pb-5",children:[c.jsxs("div",{className:"flex flex-col gap-0.5 border-t border-[hsl(var(--deck-hairline))] pt-3",children:[c.jsx(q5,{}),[{icon:Lf,action:()=>Xe(r),labelKey:"sidebar.section.settings"}].map(({icon:S,action:Y,labelKey:De})=>c.jsxs("button",{"data-settings-trigger":!0,onClick:Y,className:"flex h-8 w-full items-center gap-2.5 rounded-md px-2.5 font-mono text-[12.5px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:[c.jsx(S,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-ink-faint))]"}),n(De)]},De))]}),c.jsxs("div",{className:"flex gap-2 justify-between items-center",children:[c.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-[hsl(var(--deck-ink-faint))]",children:n("sidebar.language.label")}),c.jsx(hy,{})]}),c.jsxs("div",{className:"flex items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2",children:[c.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-[hsl(var(--deck-canvas-veil))]",children:c.jsx("div",{className:"h-2 w-2 rounded-full bg-[hsl(var(--deck-ink))]"})}),c.jsxs("div",{className:"flex flex-1 flex-col gap-[1px]",children:[c.jsx("span",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:n("sidebar.status.user")}),c.jsxs("span",{className:W("flex gap-1 items-center font-mono text-[10px]",O?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]"),children:[c.jsx("span",{className:W("h-1 w-1 rounded-full",O?"bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.9)]":"bg-[hsl(var(--deck-ink-faint))]/60")}),n(O?"sidebar.status.feedLive":"sidebar.status.feedOffline")]})]})]})]}),c.jsx(ky,{open:U,onOpenChange:Z})]}):c.jsx(V5,{className:e,onExpand:s,onNewChat:Oe,onOpenTaskSwitcher:()=>Xe(()=>m(!0)),onToggleTerminal:()=>Xe(a),onToggleSettings:()=>Xe(r),isTerminalOpen:i,taskEventsConnected:O,unreadCount:ce.length})}const c_=w.lazy(()=>Io(()=>import("./SettingsModal-DBsb7E9J.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.SettingsModal}))),Sy=()=>Io(()=>import("./TaskSwitcher-Z0KWY8g9.js"),__vite__mapDeps([4,1,3,2])).then(e=>({default:e.TaskSwitcher})),l_=w.lazy(Sy),d_=w.lazy(()=>Io(()=>import("./FilePreview-LvuYnyjv.js"),__vite__mapDeps([5,1,3,2])).then(e=>({default:e.FilePreview}))),u_=w.lazy(()=>Io(()=>import("./TerminalPanel-DVWTlxtd.js"),__vite__mapDeps([6,1,7,8,3,2])).then(e=>({default:e.TerminalPanel}))),dc=e=>{if(e.startsWith("/Users/")){const t=e.split("/");if(t.length>=3)return"~/"+t.slice(3).join("/")}return e},f_=e=>e.replace(/^~\//,"~/§").split("/").filter(Boolean).map((t,n,r)=>{var s;return n===0&&((s=r[0])!=null&&s.startsWith("~"))?"~":t.replace(/^§/,"")});function m_({children:e}){var Ee,Pe;const t=Ft();H5();const{isSidebarOpen:n,isFilePreviewOpen:r,isSettingsOpen:s,isTerminalOpen:o,isTaskSwitcherOpen:i,toggleFilePreview:a,openFilePreview:l,previewRequestId:d,setSidebarOpen:m}=kr();w.useEffect(()=>{const U=window.setTimeout(()=>{Sy()},1500);return()=>window.clearTimeout(U)},[]);const p=L(U=>U.currentSessionId),g=L(U=>U.currentSessionRef),x=L(U=>U.sessions),b=L(U=>U.isStreaming),y=L(U=>U.isTemporarySession),j=L(U=>U.taskWorkspaceInfo),k=L(U=>U.boundProjects),A=L(U=>U.selectedProjectPath),[N,$]=w.useState(null),[Q,T]=w.useState(!1),[C,O]=w.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 639px)").matches),[R,K]=w.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 1023px)").matches),X=w.useRef(null),P=w.useRef(null),B=w.useRef(null),M=w.useMemo(()=>x.find(U=>oe({sessionId:U.sessionId,projectPath:U.projectPath},g)),[g,x]),fe=(M==null?void 0:M.taskIsolation)==="worktree"&&M.taskSourceProjectPath&&(((Ee=M.taskDelivery)==null?void 0:Ee.status)==="applied"||((Pe=M.taskDelivery)==null?void 0:Pe.status)==="discarded")?M.taskSourceProjectPath:g==null?void 0:g.projectPath;w.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 900px)"),Z=()=>{U.matches&&m(!1)};return Z(),U.addEventListener("change",Z),()=>U.removeEventListener("change",Z)},[m]),w.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 639px)"),Z=()=>O(U.matches);return Z(),U.addEventListener("change",Z),()=>U.removeEventListener("change",Z)},[]),w.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 1023px)"),Z=()=>K(U.matches);return Z(),U.addEventListener("change",Z),()=>U.removeEventListener("change",Z)},[]),w.useEffect(()=>{if(!C||!n)return;const U=requestAnimationFrame(()=>{var Z,_;(_=(Z=X.current)==null?void 0:Z.querySelector("button"))==null||_.focus()});return()=>{var Z;cancelAnimationFrame(U),(Z=P.current)==null||Z.focus({preventScroll:!0})}},[C,n]);const ve=U=>{var Ne;if(!C||!n)return;if(U.key==="Escape"){U.preventDefault(),m(!1);return}if(U.key!=="Tab")return;const Z=Array.from(((Ne=X.current)==null?void 0:Ne.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))??[]);if(Z.length===0)return;const _=Z[0],Ge=Z[Z.length-1];U.shiftKey&&document.activeElement===_?(U.preventDefault(),Ge==null||Ge.focus()):!U.shiftKey&&document.activeElement===Ge&&(U.preventDefault(),_==null||_.focus())},ke=w.useMemo(()=>!p||y?A?dc(A):null:M!=null&&M.projectPath?dc(M.taskSourceProjectPath||M.projectPath):null,[p,M,y,A]),ce=w.useMemo(()=>ke?f_(ke):[],[ke]);w.useEffect(()=>{var Z;if(!g){$(((Z=k.find(_=>_.path===A))==null?void 0:Z.gitBranch)??null);return}(async()=>{try{const _=await re.getGitInfo({sessionId:g.sessionId,projectPath:fe??g.projectPath});$(_.branch)}catch{$(null)}})()},[k,g,fe,A]);const Fe=j==null?void 0:j.taskAdmission,F=fe??A??(j==null?void 0:j.cwd)??null,me=g?ze(g):`project:${A??"none"}`,Se=r&&R;return c.jsxs("div",{className:"flex h-screen overflow-hidden bg-[hsl(var(--deck-canvas))]",children:[C&&n&&!Se&&c.jsx("button",{type:"button","aria-label":t("sidebar.action.collapse"),onClick:()=>m(!1),className:"fixed inset-0 z-40 bg-black/25 backdrop-blur-[1px]"}),c.jsx("div",{ref:X,role:C&&n&&!Se?"dialog":void 0,"aria-modal":C&&n&&!Se?!0:void 0,"aria-label":C&&n&&!Se?t("sidebar.navigationAria"):void 0,"aria-hidden":Se||C&&!n?!0:void 0,inert:Se||C&&!n?!0:void 0,onKeyDown:ve,className:W("overflow-hidden",n?"w-[260px]":"w-[64px]",C?"fixed inset-y-0 left-0 z-50 shadow-2xl transition-none":"shrink-0 transition-[width] duration-300 ease-in-out",C&&!n&&"-translate-x-full"),children:c.jsx("div",{className:W("transition-all duration-300 ease-in-out",n?"w-[260px]":"w-[64px]"),children:c.jsx(a_,{onNavigate:()=>{C&&m(!1)}})})}),c.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[c.jsxs("header",{"aria-hidden":Se||void 0,inert:Se||void 0,className:"relative z-10 flex h-14 items-center gap-2 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]/90 px-3 backdrop-blur-md sm:gap-4 sm:px-6",children:[C&&c.jsx(br,{ref:P,"data-mobile-navigation-trigger":!0,variant:"ghost",size:"icon",onClick:()=>m(!0),"aria-label":t("layout.action.openNavigation"),title:t("layout.action.openNavigation"),className:"h-9 w-9 shrink-0 rounded-md text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:c.jsx(xS,{className:"h-4 w-4"})}),c.jsxs("div",{className:"flex gap-2 items-center min-w-0",children:[ce.length>0?c.jsx("nav",{"aria-label":t("layout.workspace.pathAria"),title:ke??void 0,className:"flex min-w-0 items-center font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:ce.map((U,Z)=>{const _=Z===ce.length-1,Ge=Z===0&&U==="~";return c.jsxs("span",{className:"flex items-center min-w-0",children:[Z>0&&c.jsx("span",{className:"mx-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),Z===0&&!Ge&&c.jsx("span",{className:"mr-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),c.jsx("span",{className:W("truncate",_?"font-medium text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:U})]},Z)})}):c.jsx("span",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:j!=null&&j.cwd?dc(j.cwd):t("layout.workspace.empty")}),N&&c.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 py-0.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))]",children:[c.jsx(el,{className:"h-3 w-3 text-[hsl(var(--deck-accent))]"}),N]})]}),c.jsxs("div",{className:"flex gap-3 items-center ml-auto",children:[Fe&&c.jsx("span",{className:"hidden items-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 py-1 md:inline-flex",children:c.jsx(ly,{inFlight:Fe.inFlight,queued:Fe.queued,maxConcurrent:Fe.maxConcurrent,compact:!0})}),c.jsxs("div",{className:"flex items-center gap-0.5",children:[c.jsx(br,{variant:"ghost",size:"icon","aria-label":t("layout.action.rewind"),title:t("layout.action.rewind"),disabled:!g||y||b,onClick:()=>T(!0),className:"h-8 w-8 rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] disabled:opacity-35",children:c.jsx(Qi,{className:"w-4 h-4"})}),c.jsx(br,{ref:B,variant:"ghost",size:"icon",onClick:()=>{if(r){a();return}l((!g||y)&&d===0?{tab:"files"}:void 0)},title:t("layout.action.filePreview"),"aria-label":t("layout.action.filePreviewToggle"),className:W("h-8 w-8 rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",r&&"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))] hover:text-[hsl(var(--deck-accent))]"),children:c.jsx(yS,{className:"w-4 h-4"})})]})]})]}),c.jsxs("main",{className:"flex-1 overflow-hidden relative flex bg-[hsl(var(--deck-canvas))]",children:[c.jsx("div",{"data-preview-background":"content","aria-hidden":Se||void 0,inert:Se||void 0,className:"flex relative flex-col flex-1 min-w-0",children:s?c.jsx(w.Suspense,{fallback:null,children:c.jsx(c_,{})}):e}),r&&c.jsx(w.Suspense,{fallback:null,children:c.jsx(d_,{returnFocusElement:B.current},me)})]})]}),o&&c.jsx(w.Suspense,{fallback:null,children:c.jsx(u_,{workspacePath:F},F??"default-workspace")}),i&&c.jsx(w.Suspense,{fallback:null,children:c.jsx(l_,{})}),c.jsx($5,{open:Q,onOpenChange:T})]})}const uc="BladeCode";function p_(){const e=Ft(),t=L(i=>i.unreadTaskKeys),n=L(i=>i.sessions),r=L(i=>i.selectSession),s=L(i=>i.selectProject),o=w.useMemo(()=>{const i=new Set(t);for(const a of n)a.pendingInteraction&&i.add(ze(pe(a)));return i.size},[n,t]);return w.useEffect(()=>(document.title=o>0?`(${o}) ${uc}`:uc,()=>{document.title=uc}),[o]),w.useEffect(()=>{const i=a=>{var g;const l=a.detail;if(!(l!=null&&l.sessionId)||!l.projectPath)return;const d=L.getState(),m=eu(d.sessions,l),p=m?fi(m,d.selectedProjectPath??((g=d.taskWorkspaceInfo)==null?void 0:g.cwd)??null):l.projectPath;d.boundProjects.some(x=>x.available&&x.path===p)&&s(p),r(l)};return window.addEventListener(Ki,i),()=>window.removeEventListener(Ki,i)},[s,r]),c.jsx("div",{className:"sr-only",role:"status","aria-live":"polite",children:o>0?e("attention.unreadAnnouncement",{count:o}):""})}const Jc=w.forwardRef(({className:e,...t},n)=>c.jsx("textarea",{className:W("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));Jc.displayName="Textarea";const g_=(e,t)=>{const n=[...e.matchAll(/(?:^|\s)(@(?:"[^"]*"|(?:[^\\ ]|\\ )*))/g)];for(const r of n){const s=r[1],o=r.index+(r[0].length-s.length),i=o+s.length;if(t>=o&&t<=i){let a=s.slice(1),l=!1;return a.startsWith('"')&&(l=!0,a=a.slice(1),a.endsWith('"')&&(a=a.slice(0,-1))),{hasQuery:!0,query:a,startIndex:o,endIndex:i,quoted:l}}}return{hasQuery:!1,query:"",startIndex:-1,endIndex:-1,quoted:!1}},h_=(e,t,n={})=>{const{debounceDelay:r=200,maxSuggestions:s=15,workspacePath:o}=n,[i,a]=w.useState([]),[l,d]=w.useState(0),[m,p]=w.useState(!1),g=w.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1,quoted:!1}:g_(e,t),[e,t]);w.useEffect(()=>{if(!g.hasQuery){a([]),p(!1);return}let y=!1;p(!0);const k=setTimeout(async()=>{try{const A=await fetch(`/suggestions/files?q=${encodeURIComponent(g.query)}&limit=${s}`,o?{headers:{"x-blade-directory":o}}:void 0);if(!A.ok)throw new Error("Failed to fetch suggestions");const N=await A.json();y||a(N)}catch(A){console.error("Failed to fetch file suggestions:",A),y||a([])}finally{y||p(!1)}},r);return()=>{y=!0,clearTimeout(k)}},[g.hasQuery,g.query,r,s,o]),w.useEffect(()=>{d(0)},[i]);const x=w.useCallback(()=>{d(y=>(y+1)%Math.max(i.length,1))},[i.length]),b=w.useCallback(()=>{d(y=>(y-1+i.length)%Math.max(i.length,1))},[i.length]);return{...g,suggestions:i,selectedIndex:l,loading:m,setSelectedIndex:d,selectNext:x,selectPrevious:b}},b_=(e,t=!1)=>e.includes(" ")||t?`@"${e}"`:`@${e}`,k_=(e,t,n)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const r=b_(n,t.quoted),s=e.slice(0,t.startIndex),o=e.slice(t.endIndex),i=s+r+" "+o,a=t.startIndex+r.length+1;return{newInput:i,newCursorPos:a}};function x_(){const[e,t]=w.useState([]),[n,r]=w.useState(-1),s=w.useRef(""),o=w.useCallback(d=>{d.trim()&&(t(m=>m[m.length-1]===d?m:[...m,d]),r(-1),s.current="")},[]),i=w.useCallback(d=>{if(e.length===0)return null;n===-1&&(s.current=d);const m=n===-1?e.length-1:Math.max(0,n-1);return r(m),e[m]??null},[e,n]),a=w.useCallback(()=>{if(n===-1)return null;const d=n+1;return d>=e.length?(r(-1),s.current):(r(d),e[d]??null)},[e,n]),l=w.useCallback(()=>{r(-1),s.current=""},[]);return{addToHistory:o,getPrevious:i,getNext:a,reset:l,historyIndex:n}}const y_=(e,t)=>{if(!e.startsWith("/"))return{hasQuery:!1,query:"",startIndex:-1,endIndex:-1};const n=e.indexOf(" "),r=n===-1?e.length:n;return t<=r?{hasQuery:!0,query:e.slice(1,t),startIndex:0,endIndex:t}:{hasQuery:!1,query:"",startIndex:-1,endIndex:-1}},S_=(e,t,n={})=>{const{debounceDelay:r=150,workspacePath:s}=n,[o,i]=w.useState([]),[a,l]=w.useState(0),[d,m]=w.useState(!1),p=w.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1}:y_(e,t),[e,t]);w.useEffect(()=>{if(!p.hasQuery){i([]),m(!1);return}let b=!1;m(!0);const j=setTimeout(async()=>{try{const k=await fetch(`/suggestions/commands?q=${encodeURIComponent(p.query)}`,s?{headers:{"x-blade-directory":s}}:void 0);if(!k.ok)throw new Error("Failed to fetch suggestions");const A=await k.json();b||i(A)}catch(k){console.error("Failed to fetch command suggestions:",k),b||i([])}finally{b||m(!1)}},r);return()=>{b=!0,clearTimeout(j)}},[p.hasQuery,p.query,r,s]),w.useEffect(()=>{l(0)},[o]);const g=w.useCallback(()=>{l(b=>(b+1)%Math.max(o.length,1))},[o.length]),x=w.useCallback(()=>{l(b=>(b-1+o.length)%Math.max(o.length,1))},[o.length]);return{...p,suggestions:o,selectedIndex:a,loading:d,setSelectedIndex:l,selectNext:g,selectPrevious:x}},w_=(e,t,n)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const r=e.slice(t.endIndex),s=n.command+" "+r.trimStart(),o=n.command.length+1;return{newInput:s,newCursorPos:o}},v_="blade.composer.draft.",Gi=new Map,wy=1;function Vi(){return typeof sessionStorage>"u"?null:sessionStorage}function Wi(e){return`${v_}${e}`}function I_(e){var n;if(!e)return{content:"",attachments:[],outputSchema:void 0};const t=Gi.get(e);if(t)return{content:t.content,attachments:[...t.attachments],outputSchema:t.outputSchema};try{const r=((n=Vi())==null?void 0:n.getItem(Wi(e)))??"";if(!r)return{content:"",attachments:[],outputSchema:void 0};try{const s=JSON.parse(r);if(s.version===wy&&typeof s.content=="string"&&(s.outputSchema===void 0||typeof s.outputSchema=="string"))return{content:s.content,attachments:[],outputSchema:s.outputSchema}}catch{}return{content:r,attachments:[],outputSchema:void 0}}catch{return{content:"",attachments:[],outputSchema:void 0}}}function cn(e,t){var s,o;if(!e)return;const n=Gi.get(e),r=t.outputSchema??(n==null?void 0:n.outputSchema);if(!t.content&&t.attachments.length===0&&!r){vy(e);return}Gi.set(e,{content:t.content,attachments:[...t.attachments],outputSchema:r});try{t.content||r?(s=Vi())==null||s.setItem(Wi(e),JSON.stringify({version:wy,content:t.content,...r?{outputSchema:r}:{}})):(o=Vi())==null||o.removeItem(Wi(e))}catch{}}function vy(e){var t;if(e){Gi.delete(e);try{(t=Vi())==null||t.removeItem(Wi(e))}catch{}}}function Qc(e){return e.reduce((t,n)=>t+n.dataUrl.length,0)}function C_(e){return`data:${e.type||"application/octet-stream"};base64,`.length+4*Math.ceil(e.size/3)}function j_(e,t){const r=Qc(e)+t.reduce((s,o)=>s+C_(o),0);return e.length+t.length>zr?{accepted:!1,reason:"count",estimatedBytes:r}:r>po?{accepted:!1,reason:"bytes",estimatedBytes:r}:{accepted:!0,estimatedBytes:r}}const T_=e=>typeof e=="object"&&"command"in e,Tf=({type:e,suggestions:t,selectedIndex:n,loading:r,onSelect:s,onHover:o,visible:i})=>{const a=w.useRef(null),l=w.useRef(null);if(w.useEffect(()=>{if(l.current&&a.current){const m=a.current,p=l.current,g=m.getBoundingClientRect(),x=p.getBoundingClientRect();x.bottom>g.bottom?m.scrollTop+=x.bottom-g.bottom+4:x.top<g.top&&(m.scrollTop-=g.top-x.top+4)}},[n]),!i||t.length===0&&!r)return null;const d=e==="command"?Hf:wu;return c.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-50",children:c.jsxs("div",{className:"mx-4 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700 rounded-lg shadow-xl overflow-hidden",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-[#E5E7EB] dark:border-zinc-800 text-xs text-[#6B7280] dark:text-zinc-400",children:[c.jsx(d,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:e==="command"?"Commands":"Files"}),r&&c.jsx(lt,{className:"h-3 w-3 animate-spin ml-auto"})]}),c.jsx("div",{ref:a,className:"max-h-64 overflow-y-auto py-1",children:t.length===0&&r?c.jsx("div",{className:"px-3 py-4 text-center text-[#6B7280] dark:text-zinc-500 text-sm",children:"Loading..."}):t.length===0?c.jsx("div",{className:"px-3 py-4 text-center text-[#6B7280] dark:text-zinc-500 text-sm",children:"No matches found"}):t.map((m,p)=>{const g=p===n,x=T_(m);return c.jsx("button",{ref:g?l:null,className:W("w-full text-left px-3 py-2 flex items-start gap-3 transition-colors",g?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] hover:bg-[#F3F4F6] hover:text-[#111827] dark:text-zinc-400 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-300"),onClick:()=>s(p),onMouseEnter:()=>o(p),children:x?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-mono text-sm text-blue-600 dark:text-blue-400",children:m.command}),m.argumentHint&&c.jsx("span",{className:"text-xs text-[#9CA3AF] dark:text-zinc-500 font-mono",children:m.argumentHint})]}),c.jsx("p",{className:"text-xs text-[#9CA3AF] dark:text-zinc-500 mt-0.5 truncate",children:m.description})]})}):c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx(wu,{className:"h-4 w-4 flex-shrink-0 text-[#9CA3AF] dark:text-zinc-500"}),c.jsx("span",{className:"font-mono text-sm truncate",children:m})]})},x?m.command:m)})}),c.jsxs("div",{className:"px-3 py-1.5 border-t border-[#E5E7EB] dark:border-zinc-800 text-xs text-[#9CA3AF] dark:text-zinc-500 flex items-center gap-4",children:[c.jsxs("span",{children:[c.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"↑↓"})," ","Navigate"]}),c.jsxs("span",{children:[c.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"Tab"})," ","Select"]}),c.jsxs("span",{children:[c.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"Esc"})," ","Close"]})]})]})})},fc=[{value:hr.DEFAULT,labelKey:"chat.input.mode.default",descriptionKey:"chat.input.mode.default.desc",icon:SS},{value:hr.AUTO_EDIT,labelKey:"chat.input.mode.autoEdit",descriptionKey:"chat.input.mode.autoEdit.desc",icon:wS},{value:hr.YOLO,labelKey:"chat.input.mode.yolo",descriptionKey:"chat.input.mode.yolo.desc",icon:qf,tone:"danger"},{value:hr.PLAN,labelKey:"chat.input.mode.plan",descriptionKey:"chat.input.mode.plan.desc",icon:vS}],A_=["off"],E_=["standard"],P_=[];function mc(e){return e<1024*1024?`${Math.max(1,Math.ceil(e/1024))} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function N_({onSend:e,onAbort:t,disabled:n,submitDisabled:r=!1,shellSubmitDisabled:s=!1,isStreaming:o,isStopping:i=!1,pendingSteeringCount:a=0,pendingInputDelivery:l=null,recoveredSteeringCount:d=0,variant:m="chat",draft:p,draftAttachments:g,draftRevision:x,draftKey:b,placeholder:y,workspacePath:j}){var xu;const k=Ft(),A=w.useRef(I_(b)),[N,$]=w.useState(A.current.content),[Q,T]=w.useState(A.current.attachments),C=w.useRef(N),O=w.useRef(Q),[R,K]=w.useState(A.current.outputSchema??""),X=w.useRef(R),[P,B]=w.useState(!1),[M,fe]=w.useState(null),[ve,ke]=w.useState(void 0),[ce,Fe]=w.useState(!1),[F,me]=w.useState(!1),[Se,Ee]=w.useState(!1),[Pe,U]=w.useState(!1),[Z,_]=w.useState(!1),[Ge,Ne]=w.useState(!1),[Oe,on]=w.useState(!1),[Sn,Xe]=w.useState(null),[qn,ft]=w.useState(null),an=N.trimStart().startsWith("!"),Rn=an?s:r,_t=w.useRef(null),S=w.useRef(!1),Y=w.useRef(null),De=w.useRef(null),{currentModelId:mt,configuredModels:zn,hasLoaded:ms,loadedWorkspacePath:ps,loadModels:gs,setCurrentModel:Iy,currentMode:_a,setMode:au}=Pt(),cu=kr(v=>v.isSettingsOpen),Cy=vo(v=>v.communicationStyle),lu=L(v=>v.setMaxContextTokens),Ce=L(v=>v.currentSessionRef),du=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.selectedModelId}),jy=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.reasoningEffort}),Ty=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.serviceTier}),Ay=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.responseVerbosity}),[Ey,uu]=w.useState(null),[Py,La]=w.useState(null),[Ny,Ua]=w.useState(null),[Oy,Ba]=w.useState(null),$y=zn.some(v=>v.id===du),hs=Ce?Ey??($y?du:mt):mt,Ze=zn.find(v=>v.id===hs),Ha=(Ze==null?void 0:Ze.supportedReasoningEfforts)??A_,fu=["auto",...Ha],Dr=Py??jy??"off",pi=(Ze==null?void 0:Ze.supportedServiceTiers)??E_,Ry=["auto",...pi],_r=Ny??Ty??"auto",gi=(Ze==null?void 0:Ze.supportedResponseVerbosities)??P_,My=["auto",...gi],Lr=Oy??Ay??"auto",mu=Cy??"auto",Fy=fu.length>1,Dy=pi.some(v=>v!=="standard"),_y=gi.length>0,pu=(Ze==null?void 0:Ze.displayName)||(Ze==null?void 0:Ze.model)||hs||k("chat.input.model.placeholder"),dr=((xu=Ze==null?void 0:Ze.input)==null?void 0:xu.includes("image"))===!0,Ys=Ze?k("chat.input.attachment.modelUnsupported",{model:pu}):k("chat.input.attachment.modelRequired"),hi=Q.length>0&&!dr,Jt=S_(N,ve,{workspacePath:j}),Qt=h_(N,ve,{workspacePath:j}),bs=x_(),Xs=Jt.hasQuery&&Jt.suggestions.length>0,bi=Qt.hasQuery&&Qt.suggestions.length>0,Ly=Xs||bi;w.useEffect(()=>{!cu&&(!ms||ps!==(j??null))&&gs(j??void 0)},[cu,gs,ps,ms,j]),w.useEffect(()=>{o&&(Fe(!1),me(!1),Ee(!1),U(!1),B(!1))},[o]),w.useEffect(()=>{uu(null),La(null),Ua(null),Ba(null)},[Ce==null?void 0:Ce.projectPath,Ce==null?void 0:Ce.sessionId]),w.useEffect(()=>{Dr!=="auto"&&!Ha.includes(Dr)&&La("auto")},[Dr,Ha]),w.useEffect(()=>{_r!=="auto"&&!pi.includes(_r)&&Ua("auto")},[_r,pi]),w.useEffect(()=>{Lr!=="auto"&&!gi.includes(Lr)&&Ba("auto")},[Lr,gi]),w.useEffect(()=>{ft(null)},[hs]),w.useEffect(()=>{if(p!==void 0){const v=g??O.current;C.current=p,O.current=v,$(p),T(v),Xe(null),ft(null),ke(p.length),cn(b,{content:p,attachments:v}),requestAnimationFrame(()=>{var V;return(V=Y.current)==null?void 0:V.focus()})}},[p,g,b,x]),w.useEffect(()=>()=>{cn(b,{content:C.current,attachments:O.current,outputSchema:X.current})},[b]),w.useEffect(()=>{if(!Ze)return;const v=!!Ze.contextWindow;lu(Ze.contextWindow||0,!v)},[Ze,lu]),w.useEffect(()=>{dr&&Xe(v=>v!==_t.current?v:(_t.current=null,null))},[dr]);const qa=w.useCallback(async()=>{if(!N.trim()&&Q.length===0||n||Rn||hi||S.current)return;let v;if(R.trim()){if(an){fe(k("chat.input.outputSchema.shellUnsupported")),B(!0);return}try{const q=JSON.parse(R);if(!q||typeof q!="object"||Array.isArray(q))throw new Error("schema root must be an object");v=q}catch{fe(k("chat.input.outputSchema.invalid")),B(!0);return}}N.trim()&&bs.addToHistory(N),S.current=!0,on(!0);const V=b;try{if(await e({content:N,modelId:hs??void 0,reasoningEffort:Dr,serviceTier:_r,responseVerbosity:Lr,communicationStyle:mu,attachments:Q,...v?{outputSchema:v}:{}})===!1)return;vy(V),C.current="",O.current=[],X.current="",$(""),T([]),K(""),fe(null),Xe(null),ft(null),_t.current=null,ke(void 0)}catch{}finally{S.current=!1,on(!1)}},[Q,hi,b,N,an,n,hs,Dr,Lr,mu,_r,Rn,e,R,bs,k]),Uy=w.useCallback(v=>{Xe(null),ft(null),_t.current=null,T(V=>{const q=V.filter(Te=>Te.id!==v);return O.current=q,cn(b,{content:C.current,attachments:q}),q})},[b]),gu=w.useCallback(v=>new Promise((V,q)=>{const Te=new FileReader;Te.onload=()=>{if(typeof Te.result!="string"){q(new Error("Failed to read image"));return}V({id:typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:v.name,mimeType:v.type,dataUrl:Te.result})},Te.onerror=()=>q(Te.error??new Error("Failed to read image")),Te.readAsDataURL(v)}),[]),ki=w.useCallback(async v=>{if(v.length===0)return;if(!dr){_t.current=Ys,ft(null),Xe(Ys);return}const V=j_(O.current,v),q=Te=>Te==="count"?k("chat.input.attachment.countLimit",{count:zr}):k("chat.input.attachment.sizeLimit",{size:mc(po)});if(!V.accepted){_t.current=null,ft(null),Xe(q(V.reason??"bytes"));return}try{const Te=await Promise.all(v.map(ks=>gu(ks))),Et=new Set(O.current.map(ks=>ks.dataUrl)),yu=Te.filter(ks=>Et.has(ks.dataUrl)?!1:(Et.add(ks.dataUrl),!0));if(yu.length===0){Xe(null),ft(null),_t.current=null;return}const xi=[...O.current,...yu];if(Qc(xi)>po){_t.current=null,ft(null),Xe(q("bytes"));return}O.current=xi,T(xi),Xe(null),ft(null),_t.current=null,cn(b,{content:C.current,attachments:xi})}catch{_t.current=null,ft(null),Xe(k("chat.input.attachment.readFailed"))}},[b,Ys,dr,gu,k]),By=w.useCallback(async v=>{const V=Array.from(v.target.files??[]).filter(q=>q.type.startsWith("image/"));await ki(V),v.target.value=""},[ki]),Hy=w.useCallback(async v=>{const V=Array.from(v.clipboardData.items).filter(q=>q.type.startsWith("image/")).map(q=>q.getAsFile()).filter(q=>q!==null);V.length!==0&&(v.preventDefault(),await ki(V))},[ki]),za=w.useCallback(v=>{const V=Jt.suggestions[v];if(!V)return;const{newInput:q,newCursorPos:Te}=w_(N,Jt,V);C.current=q,$(q),ke(Te),cn(b,{content:q,attachments:O.current}),requestAnimationFrame(()=>{Y.current&&(Y.current.focus(),Y.current.setSelectionRange(Te,Te))})},[b,N,Jt]),Ka=w.useCallback(v=>{const V=Qt.suggestions[v];if(!V)return;const{newInput:q,newCursorPos:Te}=k_(N,Qt,V);C.current=q,$(q),ke(Te),cn(b,{content:q,attachments:O.current}),requestAnimationFrame(()=>{Y.current&&(Y.current.focus(),Y.current.setSelectionRange(Te,Te))})},[Qt,b,N]),qy=w.useCallback(v=>{if(Xs){if(v.key==="ArrowDown"){v.preventDefault(),Jt.selectNext();return}if(v.key==="ArrowUp"){v.preventDefault(),Jt.selectPrevious();return}if(v.key==="Tab"||v.key==="Enter"&&!v.shiftKey){v.preventDefault(),za(Jt.selectedIndex);return}if(v.key==="Escape"){v.preventDefault(),ke(void 0);return}}if(bi){if(v.key==="ArrowDown"){v.preventDefault(),Qt.selectNext();return}if(v.key==="ArrowUp"){v.preventDefault(),Qt.selectPrevious();return}if(v.key==="Tab"||v.key==="Enter"&&!v.shiftKey){v.preventDefault(),Ka(Qt.selectedIndex);return}if(v.key==="Escape"){v.preventDefault(),ke(void 0);return}}if(v.key==="Enter"&&!v.shiftKey){v.preventDefault(),qa();return}if(v.key==="ArrowUp"&&!v.shiftKey){const V=v.target,q=V.selectionStart===0&&V.selectionEnd===0,Te=!N.includes(`
30
+ `)}]}))},X2=(e,t,n)=>{const{currentSessionId:r,setConfirmation:s}=t();if(e.sessionId!==r)return;const o=e.requestId||"",i=Wt(t,n,o?`assistant-permission-${o}`:void 0);if(!i)return;const a=e.details,l=e.toolName||(a==null?void 0:a.toolName)||"Tool";s(i,{toolCallId:o,toolName:l,description:e.description,diff:(a==null?void 0:a.details)||(a==null?void 0:a.diff)||"",allowRemember:(a==null?void 0:a.type)!=="mcpSampling",status:"pending"}),n(d=>({agentPhase:"waiting_permission",isStreaming:!0,sessions:d.sessions.map(m=>m.sessionId===e.sessionId&&m.projectPath===e.projectPath?{...m,pendingInteraction:{type:"permission",requestId:o}}:m)}))},Z2=(e,t,n)=>{var x,b;const{currentSessionId:r,currentSessionRef:s,messages:o,setConfirmation:i,setElicitation:a}=t();if(e.sessionId!==r)return;const l=e.requestId,d=o.find(y=>{var j,k;return((k=(j=y.agentContent)==null?void 0:j.confirmation)==null?void 0:k.toolCallId)===l}),m=(x=d==null?void 0:d.agentContent)==null?void 0:x.confirmation;d&&(m==null?void 0:m.status)==="pending"&&i(d.id,{...m,status:"denied"});const p=o.find(y=>{var j,k;return((k=(j=y.agentContent)==null?void 0:j.elicitation)==null?void 0:k.toolCallId)===l}),g=(b=p==null?void 0:p.agentContent)==null?void 0:b.elicitation;p&&(g==null?void 0:g.status)==="pending"&&a(p.id,{...g,status:"cancelled"}),n({agentPhase:"running",error:"Permission request timed out",errorContext:{kind:"interaction",...s?{sessionRef:s}:{}}})},gf=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"running",isStreaming:!0})},e5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"compacting"})},t5=(e,t,n)=>{e.sessionId===t().currentSessionId&&(t().resetContextUsage(),n({agentPhase:"running"}))},n5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"switching_model"})},r5=(e,t,n)=>{const{currentSessionId:r,setQuestion:s}=t();if(e.sessionId!==r)return;const o=e.requestId||e.toolCallId||"",i=Wt(t,n,o?`assistant-question-${o}`:void 0);i&&(s(i,{toolCallId:o,questions:e.questions,status:"pending"}),n(a=>({agentPhase:"waiting_permission",isStreaming:!0,sessions:a.sessions.map(l=>l.sessionId===e.sessionId&&l.projectPath===e.projectPath?{...l,pendingInteraction:{type:"question",requestId:o}}:l)})))},s5=(e,t,n)=>{const{currentSessionId:r,setElicitation:s}=t();if(e.sessionId!==r)return;const o=e.requestId||e.toolCallId||"",i=Wt(t,n,o?`assistant-elicitation-${o}`:void 0),a=e.elicitation;!i||!a||(s(i,{toolCallId:o,details:a,status:"pending"}),n(l=>({agentPhase:"waiting_permission",isStreaming:!0,sessions:l.sessions.map(d=>d.sessionId===e.sessionId&&d.projectPath===e.projectPath?{...d,pendingInteraction:{type:"elicitation",requestId:o}}:d)})))},o5=(e,t,n)=>{const{currentSessionId:r}=t();if(e.sessionId!==r)return;const s=e.requestId;n(o=>({agentPhase:"running",sessions:o.sessions.map(i=>{var a;return i.sessionId===e.sessionId&&i.projectPath===e.projectPath&&((a=i.pendingInteraction)==null?void 0:a.requestId)===s?{...i,pendingInteraction:void 0}:i})}))},ic=(e,t)=>{const{currentSessionId:n,endAgentResponse:r}=t();e.sessionId===n&&r()},i5=(e,t,n)=>{const{currentSessionId:r,currentSessionRef:s,endAgentResponse:o}=t();if(e.sessionId!==r)return;const i=e.taskFailure&&typeof e.taskFailure=="object"&&!Array.isArray(e.taskFailure)?e.taskFailure:void 0,a=ry(i==null?void 0:i.code);n({agentPhase:"error",error:e.error||"An error occurred",errorContext:{kind:"execution",...s?{sessionRef:s}:{},...a?{failureCode:a}:{}}}),o()},a5=(e,t,n)=>{const{currentSessionId:r}=t();if(e.sessionId===r)if(e.status==="idle")n({isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0});else if(e.status==="queued"||e.status==="running"||e.status==="waiting_permission"){const s=typeof e.queued=="number"?Math.max(0,e.queued):0;n({isStreaming:!0,agentPhase:e.status==="waiting_permission"?"waiting_permission":"running",currentRunId:typeof e.runId=="string"?e.runId:t().currentRunId,pendingSteeringCount:s,pendingInputDelivery:s>0&&(e.pendingInputDelivery==="current_turn"||e.pendingInputDelivery==="next_turn")?e.pendingInputDelivery:null,recoveredSteeringCount:typeof e.recovered=="number"?Math.max(0,e.recovered):t().recoveredSteeringCount})}else e.status==="error"&&n({isStreaming:!1,isStopping:!1,agentPhase:"error",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null})},c5=(e,t,n)=>{const{currentSessionId:r,endAgentResponse:s,messages:o,updateSubagent:i}=t();if(e.sessionId===r){n(a=>({isStreaming:!1,agentPhase:"idle",messages:a.messages.map(l=>{var m;const d=(m=l.agentContent)==null?void 0:m.elicitation;return(d==null?void 0:d.status)!=="pending"||!l.agentContent?l:{...l,agentContent:{...l.agentContent,elicitation:{...d,status:"cancelled"}}}})}));for(const a of o)for(const l of Zn(a.agentContent))l.status==="running"&&i(a.id,l.id,{status:"failed"});s()}},l5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):1,pendingInputDelivery:"current_turn"})},d5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):1,pendingInputDelivery:"next_turn"})},u5=(e,t,n)=>{if(e.sessionId!==t().currentSessionId)return;const r=typeof e.queued=="number"?Math.max(0,e.queued):0;n({pendingSteeringCount:r,pendingInputDelivery:r>0?t().pendingInputDelivery:null,recoveredSteeringCount:typeof e.recovered=="number"?Math.max(0,e.recovered):t().recoveredSteeringCount})},f5=(e,t,n)=>{if(e.sessionId!==t().currentSessionId)return;const r=typeof e.queued=="number"?Math.max(0,e.queued):0;n({agentPhase:"running",pendingSteeringCount:r,pendingInputDelivery:r>0?"current_turn":null,recoveredSteeringCount:typeof e.recovered=="number"?Math.max(0,e.recovered):t().recoveredSteeringCount})},m5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:e.goal??null})},p5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:null})},g5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:e.goal??t().goal,isStreaming:!0,agentPhase:"running"})},h5=(e,t,n)=>{if(e.sessionId!==t().currentSessionId||!Array.isArray(e.messages))return;const r=Date.now(),s=e.messages.flatMap((o,i)=>{if(typeof o!="object"||o===null)return[];const a=o;return!["user","assistant","system","tool"].includes(String(a.role))||!Array.isArray(a.content)&&typeof a.content!="string"?[]:[{id:`rewind-${i}-${r}`,role:a.role,content:a.content,timestamp:r+i,metadata:typeof a.metadata=="object"&&a.metadata!==null?a.metadata:void 0,thinkingContent:typeof a.thinkingContent=="string"?a.thinkingContent:typeof a.reasoningContent=="string"?a.reasoningContent:void 0,tool_call_id:typeof a.tool_call_id=="string"?a.tool_call_id:void 0,name:typeof a.name=="string"?a.name:void 0,tool_calls:a.tool_calls}]});n({messages:Pi(s),isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1})},b5=(e,t,n)=>{const r=t().currentSessionRef;if(!r||e.sessionId!==r.sessionId||e.projectPath!==r.projectPath)return;const s=e.status,o=s==="completed"||s==="stale"?"completed":s==="aborted"?"cancelled":s==="interrupted"?"interrupted":"failed";n(i=>({sessions:i.sessions.map(a=>a.sessionId===r.sessionId&&a.projectPath===r.projectPath?{...a,taskStatus:o,taskStatusReason:void 0,taskFailure:void 0,taskCompletedAt:new Date().toISOString()}:a)})),t().selectSession(r)},k5=(e,t,n)=>{oy({...e,messageId:`review-${String(e.reviewId??"active")}`,arguments:"{}"},t,n)},x5=(e,t,n)=>{iy(e,t)},y5=(e,t,n)=>{ay(e,t,n)},wi={"message.created":b2,"message.delta":k2,"message.complete":x2,"structured.output":y2,"thinking.delta":S2,"thinking.completed":w2,"tool.start":oy,"tool.progress":iy,"tool.result":ay,"mcp.catalog.changed":v2,"mcp.content.changed":I2,"mcp.resource.updated":C2,"mcp.connection.changed":j2,"mcp.log":T2,"mcp.instructions.changed":A2,"mcp.task.changed":E2,"project.rules.loaded":P2,"user.shell.started":N2,"user.shell.output":O2,"user.shell.completed":$2,"token.usage":R2,"task.updated":M2,"subagent.start":F2,"subagent.update":D2,"subagent.delta":_2,"subagent.thinking.delta":L2,"subagent.tool.start":B2,"subagent.tool.progress":q2,"subagent.tool.result":H2,"subagent.mcp.catalog.changed":z2,"subagent.mcp.content.changed":K2,"subagent.mcp.resource.updated":G2,"subagent.mcp.connection.changed":V2,"subagent.mcp.log":W2,"subagent.mcp.instructions.changed":J2,"subagent.mcp.task.changed":Q2,"subagent.project.rules.loaded":Y2,"subagent.complete":U2,"permission.asked":X2,"permission.timeout":Z2,"turn.started":gf,"committed.turn_started":gf,"committed.turn_completed":ic,"committed.turn_aborted":ic,"compaction.started":e5,"compaction.completed":t5,"model.fallback":n5,"question.required":r5,"elicitation.required":s5,"interaction.resolved":o5,"session.completed":ic,"session.error":i5,"session.status":a5,"run.cancelled":c5,"steering.queued":l5,"follow_up.queued":d5,"follow_up.started":f5,"steering.applied":u5,"goal.updated":m5,"goal.cleared":p5,"goal.continuation.started":g5,"session.rewound":h5,"review.tool.started":k5,"review.tool.progress":x5,"review.tool.completed":y5,"review.completed":b5},S5=new Set(["message.complete","thinking.completed","session.completed","session.error","run.cancelled","committed.turn_completed","committed.turn_aborted"]),hf=(e,t)=>n=>{const r=e().currentSessionRef,s=n.properties;if(!r||s.sessionId!==r.sessionId||s.projectPath!==r.projectPath)return;if(S5.has(n.type)){wn.drainAll();const i=wi[n.type];i&&i(n.properties,e,t);return}if(n.type==="tool.start"&&wn.drainAll(),n.type==="message.delta"){const{currentSessionId:i,currentAssistantMessageId:a,hasToolCalls:l}=e();if(s.sessionId!==i)return;const d=s.messageId||a,m=s.delta;if(!a){const x=wi["message.delta"];x&&x(s,e,t);return}const p=l?"after":"before",g=`content:${d}:${p}`;wn.drainAllExcept(g),wn.append(g,m,x=>{const{appendDelta:b}=e();d&&b(d,x,p)});return}if(n.type==="thinking.delta"){const{currentSessionId:i,currentAssistantMessageId:a}=e();if(s.sessionId!==i)return;if(!a){const p=wi["thinking.delta"];p&&p(s,e,t);return}const l=s.delta,d=s.messageId||a,m=`thinking:${d}`;wn.drainAllExcept(m),wn.append(m,l,p=>{const{appendThinking:g}=e();d&&g(d,p)});return}if(n.type==="subagent.delta"){const{currentSessionId:i}=e();if(s.sessionId!==i)return;const a=s.delta;if(!a)return;const l=s.subagentSessionId||"",d=`subagent:${l}`,{currentAssistantMessageId:m,messages:p}=e(),g=bt(p,l||void 0,m);wn.append(d,a,x=>{const{currentAssistantMessageId:b,messages:y,updateSubagent:j}=e(),k=g||bt(y,l||void 0,b);k&&j(k.messageId,k.subagent.id,A=>({sessionId:A.sessionId||l,output:(A.output||"")+x}))});return}if(n.type==="subagent.thinking.delta"){const{currentSessionId:i}=e();if(s.sessionId!==i)return;const a=s.delta;if(!a)return;const l=s.subagentSessionId||"",d=`subagent-thinking:${l}`,{currentAssistantMessageId:m,messages:p}=e(),g=bt(p,l||void 0,m);wn.append(d,a,x=>{const{currentAssistantMessageId:b,messages:y,updateSubagent:j}=e(),k=g||bt(y,l||void 0,b);k&&j(k.messageId,k.subagent.id,A=>({sessionId:A.sessionId||l,thinking:(A.thinking||"")+x}))});return}const o=wi[n.type];o&&o(n.properties,e,t)},w5=(e,t)=>{const n=new WeakMap;let r=null;return{isStreaming:!1,isStopping:!1,agentPhase:"idle",sessionEventConnectionState:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,eventUnsubscribe:null,currentAssistantMessageId:null,hasToolCalls:!1,setStreaming:s=>e({isStreaming:s}),setAgentPhase:s=>e({agentPhase:s}),setRunId:s=>e({currentRunId:s}),prepareEventSubscription:async(s,o)=>{const i=o??hf(t,e);let a=null,l="connecting";return a=await re.openEventSubscription(s,i,{onConnectionStateChange:d=>{l=d,a&&r===a&&e({sessionEventConnectionState:d})}}),n.set(a,l),a},replaceEventSubscription:s=>{const o=t().eventUnsubscribe;if(r=s,e({eventUnsubscribe:s,sessionEventConnectionState:s?n.get(s)??"connected":"idle"}),wn.reset(),o&&o!==s)try{o()}catch(i){console.warn("Failed to clean up previous event subscription",i)}},setCurrentAssistantMessageId:s=>e({currentAssistantMessageId:s}),setHasToolCalls:s=>e({hasToolCalls:s}),startAgentResponse:s=>{e({currentAssistantMessageId:s,hasToolCalls:!1,isStreaming:!0,agentPhase:"running"})},endAgentResponse:()=>{wn.drainAll(),e({currentAssistantMessageId:null,hasToolCalls:!1,isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null})},subscribeToEvents:async s=>{const o=await t().prepareEventSubscription(s);t().replaceEventSubscription(o)},reconnectSessionEvents:async()=>{const s=t().currentSessionRef;if(s){t().unsubscribeFromEvents(),e({sessionEventConnectionState:"connecting"});try{await t().subscribeToEvents(s)}catch(o){throw e({sessionEventConnectionState:"offline"}),o}}},unsubscribeFromEvents:()=>{const{eventUnsubscribe:s}=t();r=null,e({eventUnsubscribe:null,sessionEventConnectionState:"idle"});try{s==null||s()}catch(o){console.warn("Failed to clean up event subscription",o)}finally{wn.reset()}},handleEvent:s=>{hf(t,e)(s)}}};function v5(e){var t;return((t=e.taskPromptSummary)==null?void 0:t.trimStart().startsWith("/review"))===!0}function ru(e,t){var r;const n=(r=e.taskStatusReason)==null?void 0:r.trim();if(v5(e)){if(e.taskStatus==="running")return t("taskHome.review.running");if(n!=null&&n.startsWith("Code review stale:"))return t("taskHome.review.stale");if(n==="Code review aborted")return t("taskHome.review.aborted");if(n==="Code review interrupted by process restart")return t("taskHome.review.interrupted");if(e.taskStatus==="failed")return t("taskHome.review.failed")}return e.taskFailure?t(sy(e.taskFailure.code)):n==="user-cancel"?t("session.reason.cancelledByUser"):n||void 0}let ac=0;function vi(e,t){const n=e.findIndex(s=>s.id===t.id);if(n===-1)return[...e,t];const r=e.slice();return r[n]=t,r}const I5=ui(e=>({schedules:[],isLoading:!1,hasLoaded:!1,error:null,loadSchedules:async()=>{const t=++ac;e({isLoading:!0,error:null});try{const n=await re.listSchedules();if(t!==ac)return;e({schedules:n,isLoading:!1,hasLoaded:!0})}catch(n){if(t!==ac)return;e({error:n instanceof Error?n.message:He("schedule.error.loadFailed"),isLoading:!1,hasLoaded:!0})}},createSchedule:async t=>{e({error:null});try{const n=await re.createSchedule(t);return e(r=>({schedules:vi(r.schedules,n)})),n}catch(n){throw e({error:n instanceof Error?n.message:He("schedule.error.createFailed")}),n}},updateSchedule:async(t,n)=>{e({error:null});try{const r=await re.updateSchedule(t,n);return e(s=>({schedules:vi(s.schedules,r)})),r}catch(r){throw e({error:r instanceof Error?r.message:He("schedule.error.updateFailed")}),r}},deleteSchedule:async t=>{e({error:null});try{await re.deleteSchedule(t),e(n=>({schedules:n.schedules.filter(r=>r.id!==t)}))}catch(n){throw e({error:n instanceof Error?n.message:He("schedule.error.deleteFailed")}),n}},toggleSchedule:async(t,n)=>{e({error:null});try{const r=n?await re.enableSchedule(t):await re.disableSchedule(t);return e(s=>({schedules:vi(s.schedules,r)})),r}catch(r){throw e({error:r instanceof Error?r.message:He("schedule.error.toggleFailed")}),r}},runSchedule:async t=>{e({error:null});try{const n=await re.runSchedule(t);return e(r=>({schedules:vi(r.schedules,n)})),n}catch(n){throw e({error:n instanceof Error?n.message:He("schedule.error.runFailed")}),n}}})),C5=e=>e==="system"?typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches:e==="dark",Ni=e=>{if(typeof document>"u")return;const t=document.documentElement;if(t.classList.remove("light","dark"),e==="system"){const r=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";t.classList.add(r)}else t.classList.add(e)},ln={language:"zh-CN",theme:"dracula",uiTheme:"system",autoSaveSessions:!0,notifyBuild:!0,notifyErrors:!1,notifySounds:!1,privacyTelemetry:!1,privacyCrash:!0,communicationStyle:"auto"},vo=ui((e,t)=>({...ln,isLoading:!1,error:null,loadSettings:async()=>{e({isLoading:!0,error:null});try{const n=await fetch("/configs");if(!n.ok)throw new Error(He("settings.general.loadError"));const r=await n.json(),s=r.uiTheme??ln.uiTheme;e({language:r.language??ln.language,theme:r.theme??ln.theme,uiTheme:s,autoSaveSessions:r.autoSaveSessions??ln.autoSaveSessions,notifyBuild:r.notifyBuild??ln.notifyBuild,notifyErrors:r.notifyErrors??ln.notifyErrors,notifySounds:r.notifySounds??ln.notifySounds,privacyTelemetry:r.privacyTelemetry??ln.privacyTelemetry,privacyCrash:r.privacyCrash??ln.privacyCrash,communicationStyle:r.communicationStyle??ln.communicationStyle,isLoading:!1}),Ni(s)}catch(n){e({error:n.message,isLoading:!1})}},updateSettings:async n=>{const r=t();e({...n,error:null}),n.uiTheme&&Ni(n.uiTheme);try{if(!(await fetch("/configs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:n,options:{scope:"global"}})})).ok)throw new Error(He("settings.general.saveError"))}catch(s){e({language:r.language,theme:r.theme,uiTheme:r.uiTheme,autoSaveSessions:r.autoSaveSessions,notifyBuild:r.notifyBuild,notifyErrors:r.notifyErrors,notifySounds:r.notifySounds,privacyTelemetry:r.privacyTelemetry,privacyCrash:r.privacyCrash,communicationStyle:r.communicationStyle,error:s.message}),n.uiTheme&&Ni(r.uiTheme)}}}));Ni(ln.uiTheme);const Q_=()=>vo(e=>C5(e.uiTheme)),cy="blade.projects.selected";function bf(){return typeof localStorage>"u"?null:localStorage.getItem(cy)}function Ii(e){typeof localStorage<"u"&&localStorage.setItem(cy,e)}const j5=new Set(["queued","running","completed","failed","cancelled","interrupted"]),cc=new Set(["default","autoEdit","yolo","plan"]),kf=new Set(["auto","off","minimal","low","medium","high","xhigh","max"]),xf=new Set(["auto","standard","fast","flex"]),yf=new Set(["auto","low","medium","high"]),Sf=new Set(["auto","pragmatic","friendly","explanatory"]);function T5(e){return typeof e=="string"&&j5.has(e)}function A5(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e;if(!["changedFiles","additions","deletions","commits"].some(r=>typeof t[r]!="number"||!Number.isInteger(t[r])||t[r]<0))return{changedFiles:t.changedFiles,additions:t.additions,deletions:t.deletions,commits:t.commits}}function wf(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=ry(t.code);if(!(!n||typeof t.message!="string"||typeof t.retryable!="boolean"))return{code:n,message:He(sy(n)),retryable:p2(n)}}function E5(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e;if(!(!["applied","discarded","conflicted"].includes(String(t.status))||typeof t.updatedAt!="string"))return{status:t.status,updatedAt:t.updatedAt,...typeof t.sourceCommit=="string"?{sourceCommit:t.sourceCommit}:{},...typeof t.changedFiles=="number"&&Number.isInteger(t.changedFiles)&&t.changedFiles>=0?{changedFiles:t.changedFiles}:{},...typeof t.message=="string"?{message:t.message}:{}}}function xs(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:void 0}const P5=(e,t)=>{let n=null,r=!1,s=!1,o=0;const i=new Map,a=d=>{const m=ze(d),p=++o;i.set(m,p),re.getSession(d).then(g=>{i.get(m)===p&&e(x=>({sessions:vn(x.sessions,g)}))}).catch(()=>{i.get(m)===p&&t().loadSessions()}).finally(()=>{i.get(m)===p&&i.delete(m)})},l=d=>{const m=ze(d),p=++o;i.set(m,p),queueMicrotask(()=>{i.get(m)===p&&i.delete(m)})};return{taskEventsConnected:!1,taskEventConnectionState:"connecting",taskEventUnsubscribe:null,taskWorkspaceInfo:null,isTaskWorkspaceLoading:!1,taskWorkspaceError:null,boundProjects:[],selectedProjectPath:bf(),isDispatchingTask:!1,isBindingProject:!1,cancellingTaskKeys:[],retryingTaskKeys:[],taskDeliveryActions:{},unreadTaskKeys:o2(),handleTaskEvent:d=>{if(d.type==="session.created"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;a({sessionId:T,projectPath:C});return}if(d.type==="session.deleted"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;const O={sessionId:T,projectPath:C};l(O),t().removeSession(O);return}if(d.type==="session.archived"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;const O={sessionId:T,projectPath:C};l(O),t().removeSession(O),t().loadArchivedSessions();return}if(d.type==="session.unarchived"){const T=d.properties.sessionId,C=d.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;a({sessionId:T,projectPath:C}),t().loadArchivedSessions();return}if(d.type==="session.updated"){const T=d.properties.sessionId,C=d.properties.projectPath,O=d.properties.title,R=d.properties.selectedModelId,K=d.properties.permissionMode,X=d.properties.reasoningEffort,P=d.properties.serviceTier,B=d.properties.responseVerbosity,M=d.properties.communicationStyle;if(typeof T!="string"||typeof C!="string"||!(typeof O=="string"&&O.trim()||typeof R=="string"&&R.trim()||cc.has(K)||kf.has(X)||xf.has(P)||yf.has(B)||Sf.has(M)))return;const fe={sessionId:T,projectPath:C};if(oe(t().currentSessionRef,fe)&&cc.has(K)&&Pt.getState().setMode(K),!t().sessions.some(ke=>oe(pe(ke),fe))){a(fe);return}e(ke=>({sessions:ke.sessions.map(ce=>oe({sessionId:ce.sessionId,projectPath:ce.projectPath},fe)?{...ce,...typeof O=="string"&&O.trim()?{title:O}:{},...typeof R=="string"&&R.trim()?{selectedModelId:R}:{},...cc.has(K)?{permissionMode:K}:{},...kf.has(X)?{reasoningEffort:X}:{},...xf.has(P)?{serviceTier:P}:{},...yf.has(B)?{responseVerbosity:B}:{},...Sf.has(M)?{communicationStyle:M}:{}}:ce)}));return}if(d.type==="task.delivery"){const T=d.properties.sessionId,C=d.properties.projectPath,O=E5(d.properties.taskDelivery);if(typeof T!="string"||typeof C!="string"||!O)return;const R={sessionId:T,projectPath:C},K=d.properties.taskWorktreeRemoved===!0;e(X=>({sessions:X.sessions.map(P=>oe(pe(P),R)?{...P,taskDelivery:O,...K?{taskWorktreePath:void 0,taskWorktreeBranch:void 0}:{},lastMessageTime:typeof d.properties.updatedAt=="string"?d.properties.updatedAt:P.lastMessageTime}:P)}));return}if(d.type==="interaction.pending"){const T=d.properties.sessionId,C=d.properties.projectPath,O=d.properties.interactionType,R=d.properties.requestId;if(typeof T!="string"||typeof C!="string"||O!=="permission"&&O!=="question"&&O!=="elicitation"||typeof R!="string"||!R)return;const K={sessionId:T,projectPath:C},X=t().sessions.find(B=>oe(pe(B),K));if(!X){t().loadSessions();return}if(e(B=>({sessions:B.sessions.map(M=>oe(pe(M),K)?{...M,pendingInteraction:{type:O,requestId:R}}:M)})),!(typeof document<"u"&&document.visibilityState==="visible"&&oe(t().currentSessionRef,K))&&vo.getState().notifyErrors){const M=X.title??X.sessionId??T;mf({ref:K,title:`Blade · ${He(O==="question"?"attention.notification.question":O==="elicitation"?"attention.notification.elicitation":"attention.notification.permission")}`,body:M,onOpen:fe=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(Ki,{detail:fe})))}})}return}if(d.type==="interaction.resolved"){const T=d.properties.sessionId,C=d.properties.projectPath,O=d.properties.requestId;if(typeof T!="string"||typeof C!="string"||typeof O!="string")return;const R={sessionId:T,projectPath:C};e(K=>({sessions:K.sessions.map(X=>{var P;return oe(pe(X),R)&&((P=X.pendingInteraction)==null?void 0:P.requestId)===O?{...X,pendingInteraction:void 0}:X})}));return}if(d.type==="schedule.fired"){I5.getState().loadSchedules();return}if(d.type!=="task.status")return;const m=d.properties.sessionId,p=d.properties.projectPath,g=d.properties.taskStatus;if(typeof m!="string"||typeof p!="string"||!T5(g))return;const x={sessionId:m,projectPath:p},b=xs(d.properties.taskInFlight,0),y=xs(d.properties.taskQueueDepth,0),j=xs(d.properties.taskConcurrencyLimit,1);b!==void 0&&y!==void 0&&j!==void 0&&e(T=>{var C;return{taskWorkspaceInfo:T.taskWorkspaceInfo?{...T.taskWorkspaceInfo,taskAdmission:{inFlight:b,queued:y,maxConcurrent:j,maxQueued:((C=T.taskWorkspaceInfo.taskAdmission)==null?void 0:C.maxQueued)??100}}:null}});const k=t().sessions.find(T=>oe(pe(T),x)),A=typeof document<"u"&&document.visibilityState==="visible"&&oe(t().currentSessionRef,x),N=s2(k==null?void 0:k.taskStatus,g,A),$=ze(x),Q=!t().unreadTaskKeys.includes($);if(N&&Q){e(O=>{const R=[...O.unreadTaskKeys,$];return go(R),{unreadTaskKeys:R}});const T=vo.getState();if(T.notifySounds&&Zx(g)&&i2(g),g==="completed"?T.notifyBuild:T.notifyErrors){const O=He(g==="completed"?"attention.notification.completed":g==="failed"?"attention.notification.failed":"attention.notification.interrupted"),R=wf(d.properties.taskFailure),K=k?ru({...k,taskStatus:g,taskFailure:R??k.taskFailure,taskStatusReason:typeof d.properties.taskStatusReason=="string"?d.properties.taskStatusReason:k.taskStatusReason,taskPromptSummary:typeof d.properties.taskPromptSummary=="string"?d.properties.taskPromptSummary:k.taskPromptSummary},He):(R==null?void 0:R.message)??(typeof d.properties.taskStatusReason=="string"?d.properties.taskStatusReason:void 0),X=(k==null?void 0:k.title)??(k==null?void 0:k.sessionId)??m;mf({ref:x,title:`Blade · ${O}`,body:K?`${X} · ${K}`:X,onOpen:P=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(Ki,{detail:P})))}})}}if(!k){a(x);return}e(T=>({sessions:T.sessions.map(C=>oe({sessionId:C.sessionId,projectPath:C.projectPath},x)?{...C,taskStatus:g,taskStatusReason:typeof d.properties.taskStatusReason=="string"?d.properties.taskStatusReason:void 0,taskFailure:g==="failed"?wf(d.properties.taskFailure)??C.taskFailure:void 0,taskPromptSummary:typeof d.properties.taskPromptSummary=="string"?d.properties.taskPromptSummary:C.taskPromptSummary,taskStartedAt:typeof d.properties.taskStartedAt=="string"?d.properties.taskStartedAt:g==="queued"?void 0:C.taskStartedAt,taskCompletedAt:typeof d.properties.taskCompletedAt=="string"?d.properties.taskCompletedAt:g==="queued"||g==="running"?void 0:C.taskCompletedAt,taskDiffStat:A5(d.properties.taskDiffStat)??C.taskDiffStat,taskQueuePosition:g==="queued"?xs(d.properties.taskQueuePosition,1)??C.taskQueuePosition:void 0,taskQueueDepth:g==="queued"?xs(d.properties.taskQueueDepth,0)??C.taskQueueDepth:void 0,taskConcurrencyLimit:xs(d.properties.taskConcurrencyLimit,1)??C.taskConcurrencyLimit,lastMessageTime:typeof d.properties.updatedAt=="string"?d.properties.updatedAt:C.lastMessageTime}:C)}))},subscribeToTaskEvents:async()=>{if(r=!0,!t().taskEventUnsubscribe){if(n)return n;e({taskEventsConnected:!1,taskEventConnectionState:"connecting"}),n=(async()=>{try{const d=await re.openTaskEventSubscription(m=>t().handleTaskEvent(m),{onConnectionChange:m=>{e({taskEventsConnected:m})},onConnectionStateChange:m=>{r&&(m==="reconnecting"||m==="offline")&&(s=!0),e({taskEventsConnected:m==="connected",taskEventConnectionState:m}),m==="connected"&&s&&(s=!1,Promise.all([t().loadSessions(),t().loadTaskWorkspaceInfo(),t().loadBoundProjects(),Pt.getState().loadModels()]))}});if(!r||t().taskEventUnsubscribe){d();return}e({taskEventUnsubscribe:d})}catch(d){throw s=!0,e({taskEventsConnected:!1,taskEventConnectionState:"offline"}),d}})();try{await n}finally{n=null}}},reconnectTaskEvents:async()=>{s=!0,t().unsubscribeFromTaskEvents(),await t().subscribeToTaskEvents()},unsubscribeFromTaskEvents:()=>{var d,m;r=!1,(m=(d=t()).taskEventUnsubscribe)==null||m.call(d),e({taskEventUnsubscribe:null,taskEventsConnected:!1,taskEventConnectionState:"offline"})},loadTaskWorkspaceInfo:async()=>{e({isTaskWorkspaceLoading:!0,taskWorkspaceError:null});try{const d=await re.getWorkspaceInfo();e({taskWorkspaceInfo:d,isTaskWorkspaceLoading:!1})}catch(d){e({isTaskWorkspaceLoading:!1,taskWorkspaceError:d instanceof Error?d.message:"Failed to load task workspace"})}},loadBoundProjects:async()=>{try{const d=await re.listProjects(),m=bf(),p=d.find(g=>g.available&&g.path===m)??d.find(g=>g.isCurrent)??d.find(g=>g.available);p&&Ii(p.path),e({boundProjects:d,selectedProjectPath:(p==null?void 0:p.path)??null})}catch(d){e({error:d instanceof Error?d.message:"Failed to load projects"})}},bindProject:async d=>{e({isBindingProject:!0,error:null});try{const m=await re.bindProject(d);Ii(m.path),e(p=>({boundProjects:[...p.boundProjects.filter(g=>g.path!==m.path),m].sort((g,x)=>g.isCurrent!==x.isCurrent?g.isCurrent?-1:1:g.name.localeCompare(x.name)),selectedProjectPath:m.path,isBindingProject:!1}))}catch(m){throw e({isBindingProject:!1,error:m instanceof Error?m.message:"Failed to bind project"}),m}},unbindProject:async d=>{try{await re.unbindProject(d),e(m=>{const p=m.boundProjects.filter(x=>x.path!==d||x.isCurrent),g=m.selectedProjectPath===d?p.find(x=>x.isCurrent)??p.find(x=>x.available):void 0;return g&&Ii(g.path),{boundProjects:p,...g?{selectedProjectPath:g.path}:{}}})}catch(m){throw e({error:m instanceof Error?m.message:"Failed to unbind project"}),m}},selectProject:d=>{Ii(d),e({selectedProjectPath:d})},markTaskRead:d=>{const m=ze(d);e(p=>{const g=p.unreadTaskKeys.filter(x=>x!==m);return go(g),{unreadTaskKeys:g}})},clearUnreadTasks:()=>{go([]),e({unreadTaskKeys:[]})},cancelTask:async d=>{const m=ze(d);if(!t().cancellingTaskKeys.includes(m)){e(p=>({cancellingTaskKeys:[...p.cancellingTaskKeys,m],error:null,errorContext:null}));try{await re.abortSession(d);const p=oe(t().currentSessionRef,d);p&&t().unsubscribeFromEvents(),e(g=>({sessions:g.sessions.map(x=>oe(pe(x),d)?{...x,taskStatus:"cancelled",taskQueuePosition:void 0,taskQueueDepth:void 0,taskCompletedAt:x.taskCompletedAt??new Date().toISOString()}:x),...p?{isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,eventUnsubscribe:null}:{}}))}catch(p){throw e({error:p instanceof Error?p.message:"Failed to stop task",errorContext:{kind:"task_action",sessionRef:d}}),p}finally{e(p=>({cancellingTaskKeys:p.cancellingTaskKeys.filter(g=>g!==m)}))}}},retryTask:async d=>{const m=ze(d);if(t().retryingTaskKeys.includes(m))return;const p=t().getNavigationVersion(),g=t().selectedProjectPath,x=()=>t().getNavigationVersion()===p&&t().selectedProjectPath===g;e(b=>({retryingTaskKeys:[...b.retryingTaskKeys,m],error:null,errorContext:null}));try{const b=await re.retryTask(d);e(y=>({sessions:vn(y.sessions,b.session)})),t().markTaskRead(d),x()&&await t().selectSession(pe(b.session))}catch(b){throw x()&&e({error:b instanceof Error?b.message:"Failed to retry task",errorContext:{kind:"task_action",sessionRef:d}}),b}finally{e(b=>({retryingTaskKeys:b.retryingTaskKeys.filter(y=>y!==m)}))}},deliverTask:async(d,m)=>{const p=ze(d);if(!t().taskDeliveryActions[p]){e(g=>({taskDeliveryActions:{...g.taskDeliveryActions,[p]:m},error:null,errorContext:null}));try{const g=await re.deliverTask(d,m);e(x=>({sessions:vn(x.sessions,g)})),t().markTaskRead(d)}catch(g){throw e({error:g instanceof Error?g.message:"Failed to deliver task changes",errorContext:{kind:"task_action",sessionRef:d}}),g}finally{e(g=>{const{[p]:x,...b}=g.taskDeliveryActions;return{taskDeliveryActions:b}})}}},dispatchTask:async d=>{const m=t().getNavigationVersion(),p=t().selectedProjectPath,g=d.projectPath??p??void 0,x=()=>t().getNavigationVersion()===m&&t().selectedProjectPath===p;e({isDispatchingTask:!0,error:null,errorContext:null});try{const b=await re.createTask({...d,projectPath:g});e(y=>({sessions:vn(y.sessions,b.session),isDispatchingTask:!1})),x()&&await t().selectSession(pe(b.session))}catch(b){throw e({isDispatchingTask:!1,...x()?{error:b instanceof Error?b.message:"Failed to dispatch task"}:{}}),b}},startCodeReview:async d=>{const m=t().getNavigationVersion(),p=t().selectedProjectPath,g=d.projectPath??p??void 0,x=()=>t().getNavigationVersion()===m&&t().selectedProjectPath===p;e({isDispatchingTask:!0,error:null,errorContext:null});let b,y=!1;try{b=await re.createSession(g,"Code Review");const j=pe(b);await re.startCodeReview(j,{kind:d.kind,...d.ref?{ref:d.ref}:{},...d.instructions?{instructions:d.instructions}:{},...d.modelId?{modelId:d.modelId}:{}}),y=!0;const k={...b,taskStatus:"running",taskStatusReason:He("taskHome.review.running"),taskPromptSummary:`/review ${d.kind}${d.ref?` ${d.ref}`:""}`};e(A=>({sessions:vn(A.sessions,k),isDispatchingTask:!1})),x()&&await t().selectSession(j)}catch(j){throw b&&!y&&await re.deleteSession(pe(b)).catch(()=>{}),e({isDispatchingTask:!1,...x()?{error:j instanceof Error?j.message:He("taskHome.review.startFailed")}:{}}),j}}}},N5=e=>({tokenUsage:ao,updateTokenUsage:t=>e(n=>{const{costUsd:r,...s}=t;return{tokenUsage:{...n.tokenUsage,...s,totalInputTokens:n.tokenUsage.totalInputTokens+Math.max(0,t.inputTokens??0),totalOutputTokens:n.tokenUsage.totalOutputTokens+Math.max(0,t.outputTokens??0),cacheReadTokens:n.tokenUsage.cacheReadTokens+Math.max(0,t.cacheReadTokens??0),cacheWriteTokens:n.tokenUsage.cacheWriteTokens+Math.max(0,t.cacheWriteTokens??0),estimatedCostUsd:n.tokenUsage.estimatedCostUsd+Math.max(0,r??0)}}}),resetContextUsage:()=>e(t=>({tokenUsage:{...t.tokenUsage,inputTokens:0,outputTokens:0,totalTokens:0}})),setMaxContextTokens:(t,n=!1)=>e(r=>({tokenUsage:{...r.tokenUsage,maxContextTokens:t,isDefaultMaxTokens:n}}))}),L=ui()((...e)=>({...f2(...e),...P5(...e),...QD(...e),...w5(...e),...N5(...e)}));function O5(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function $5({open:e,onOpenChange:t}){const n=Ft(),r=L(T=>T.currentSessionRef),s=L(T=>T.isStreaming),o=L(T=>T.isTemporarySession),i=L(T=>T.rewindSession),[a,l]=w.useState([]),[d,m]=w.useState(null),[p,g]=w.useState(!1),[x,b]=w.useState(!1),[y,j]=w.useState(!1),[k,A]=w.useState(null);w.useEffect(()=>{if(!e||!r)return;let T=!1;return b(!0),A(null),l([]),m(null),g(!1),re.listRewindCheckpoints(r).then(C=>{var O;T||(l(C),m(((O=C[0])==null?void 0:O.messageId)??null))}).catch(C=>{T||A(C instanceof Error?C.message:n("chat.rewind.loadFailed"))}).finally(()=>{T||b(!1)}),()=>{T=!0}},[r,e]);const N=w.useMemo(()=>a.find(T=>T.messageId===d)??null,[a,d]),$=!!N&&!x&&!y&&!s&&!o,Q=async()=>{if(!N||!$)return;j(!0),A(null);const T=await i(N.messageId,p?"both":"conversation");j(!1),T?t(!1):A(n("chat.rewind.failed"))};return c.jsx(ol,{open:e,onOpenChange:t,children:c.jsxs(Yi,{className:"max-w-[620px] gap-0 overflow-hidden border-[#E5E7EB] bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b]",children:[c.jsx(il,{className:"border-b border-[#E5E7EB] px-6 py-5 dark:border-zinc-800",children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-md bg-[#F3F4F6] text-[#4B5563] dark:bg-zinc-800 dark:text-zinc-300",children:c.jsx(Su,{className:"h-4 w-4"})}),c.jsxs("div",{children:[c.jsx(Xi,{className:"text-[15px] font-semibold text-[#111827] dark:text-zinc-100",children:n("chat.rewind.title")}),c.jsx(Zi,{className:"mt-1 text-[12px] text-[#6B7280] dark:text-zinc-400",children:n("chat.rewind.description")})]})]})}),c.jsxs("div",{className:"min-h-[260px] px-6 py-4",children:[x&&c.jsxs("div",{className:"flex h-[220px] items-center justify-center text-[#6B7280] dark:text-zinc-400",children:[c.jsx(lt,{className:"mr-2 h-4 w-4 animate-spin"}),c.jsx("span",{className:"text-xs font-mono",children:n("chat.rewind.loading")})]}),!x&&k&&c.jsx("div",{role:"alert",className:"rounded-md border border-rose-200 bg-rose-50 px-4 py-3 text-xs text-rose-700 dark:border-rose-900/60 dark:bg-rose-950/30 dark:text-rose-300",children:k}),!x&&!k&&a.length===0&&c.jsxs("div",{className:"flex h-[220px] flex-col items-center justify-center text-center",children:[c.jsx(Su,{className:"mb-3 h-5 w-5 text-[#9CA3AF] dark:text-zinc-600"}),c.jsx("p",{className:"text-sm text-[#4B5563] dark:text-zinc-300",children:n("chat.rewind.empty")})]}),!x&&a.length>0&&c.jsx("div",{role:"radiogroup","aria-label":n("chat.rewind.checkpointAria"),className:"max-h-[310px] space-y-1 overflow-y-auto",children:a.map(T=>{const C=T.messageId===d;return c.jsxs("button",{type:"button",role:"radio","aria-checked":C,onClick:()=>m(T.messageId),className:W("w-full rounded-md border px-4 py-3 text-left transition-colors",C?"border-[#22C55E] bg-[#F0FDF4] dark:border-[#22C55E] dark:bg-[#052E16]/50":"border-transparent hover:bg-[#F9FAFB] dark:hover:bg-zinc-900"),children:[c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsx("p",{className:"line-clamp-2 text-[13px] leading-5 text-[#111827] dark:text-zinc-100",children:T.preview||n("chat.rewind.userMessage")}),c.jsx("span",{className:"shrink-0 text-[10px] font-mono text-[#9CA3AF] dark:text-zinc-500",children:O5(T.createdAt)})]}),c.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] font-mono text-[#6B7280] dark:text-zinc-500",children:[c.jsx("span",{children:T.messageId.slice(0,10)}),T.fileCount>0&&c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(dS,{className:"h-3 w-3"}),T.fileCount===1?n("chat.rewind.fileCountOne",{count:T.fileCount}):n("chat.rewind.fileCountMany",{count:T.fileCount})]})]})]},T.messageId)})})]}),c.jsx("div",{className:"border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800",children:c.jsxs("label",{className:"flex cursor-pointer items-start gap-3",children:[c.jsx("input",{type:"checkbox",checked:p,disabled:!N||N.fileCount===0,onChange:T=>g(T.target.checked),className:"mt-0.5 h-4 w-4 accent-[#16A34A] disabled:opacity-40"}),c.jsxs("span",{children:[c.jsx("span",{className:"block text-[12px] font-medium text-[#374151] dark:text-zinc-200",children:n("chat.rewind.restoreCode")}),c.jsx("span",{className:"mt-0.5 block text-[11px] text-[#6B7280] dark:text-zinc-500",children:n("chat.rewind.restoreCodeHint")})]})]})}),c.jsxs(Xf,{className:"border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800",children:[c.jsx(br,{variant:"ghost",onClick:()=>t(!1),disabled:y,children:n("chat.rewind.cancel")}),c.jsxs(br,{onClick:()=>void Q(),disabled:!$,className:"bg-[#16A34A] text-white hover:bg-[#15803D]",children:[y?c.jsx(lt,{className:"mr-2 h-4 w-4 animate-spin"}):c.jsx(Qi,{className:"mr-2 h-4 w-4"}),n("chat.rewind.confirm")]})]})]})})}function ly({inFlight:e,queued:t,maxConcurrent:n,compact:r=!1,className:s}){const o=Ft(),i=Math.max(1,n),a=Array.from({length:Math.min(i,12)}),l=Math.min(e,i);return c.jsxs("div",{className:W("inline-flex items-center gap-2 font-mono",r?"text-[10.5px]":"text-[11px]",s),title:o("capacity.title",{inFlight:e,queued:t,max:n}),children:[c.jsx("span",{className:W("inline-flex items-center gap-[3px] rounded-sm",r?"px-0":"px-0.5"),children:a.map((d,m)=>{const p=m<l;return c.jsx("span",{className:W("block",r?"h-2.5 w-[3px] rounded-[1px]":"h-3 w-[3px] rounded-[1px]",p?"bg-[hsl(var(--deck-accent))] shadow-[0_0_4px_hsl(var(--deck-accent)/0.65)]":"bg-[hsl(var(--deck-border-strong))]/60")},m)})}),c.jsxs("span",{className:"tabular-nums text-[hsl(var(--deck-ink-muted))]",children:[c.jsx("span",{className:"text-[hsl(var(--deck-ink))]",children:e}),c.jsx("span",{className:"mx-[2px] opacity-40",children:"/"}),c.jsx("span",{children:n}),c.jsx("span",{className:"opacity-60",children:o("capacity.suffix.running")})]}),t>0&&c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm border border-amber-300/60 bg-amber-50 px-1.5 py-[1px] text-[10px] text-amber-800 dark:border-amber-800/60 dark:bg-amber-950/40 dark:text-amber-300",children:[c.jsx("span",{className:"h-1 w-1 rounded-full bg-amber-500"}),o("capacity.queued",{queued:t})]})]})}function vf(){const e=document.querySelector("textarea[data-blade-composer]:not(:disabled)");if(!e)return!1;e.focus();const t=e.value.length;return e.setSelectionRange(t,t),!0}const dy=[{id:"searchTasks",key:"k",primaryModifier:!0,scope:"Global"},{id:"openCommands",key:"p",primaryModifier:!0,shiftKey:!0,scope:"Global"},{id:"newTask",key:"n",primaryModifier:!1,scope:"Global"},{id:"focusComposer",key:"/",primaryModifier:!1,scope:"Chat"},{id:"toggleSidebar",key:"b",primaryModifier:!0,scope:"Layout"}];function R5(e){const t=e.key.toLocaleLowerCase();return dy.find(n=>{if(n.key!==t||e.altKey||e.shiftKey!==!!n.shiftKey)return!1;const r=e.metaKey||e.ctrlKey;return n.primaryModifier?r:!r})??null}function M5(e){return e instanceof Element?!!e.closest('input, textarea, select, [contenteditable="true"], [role="textbox"], [role="combobox"]'):!1}function F5(e){var r;const t=typeof navigator>"u"?null:navigator,n=((r=t==null?void 0:t.userAgentData)==null?void 0:r.platform)??(t==null?void 0:t.platform)??"";return/mac|iphone|ipad|ipod/i.test(n)}function D5(e,t){const n=e.key==="/"?"/":e.key.toLocaleUpperCase(),r=F5();return[...e.primaryModifier?[r?"⌘":"Ctrl"]:[],...e.shiftKey?[r?"⇧":"Shift"]:[],n]}function Vc(e,t){const n=dy.find(r=>r.id===e);return n?D5(n).join(""):""}const uy="blade.sidebar.view",fy="blade.preview.width",lc=640,_5=360,L5=960,U5=()=>{if(typeof localStorage>"u")return"project";const e=localStorage.getItem(uy);return e==="status"||e==="project"?e:"project"},my=e=>Math.min(L5,Math.max(_5,Math.round(e))),B5=()=>{if(typeof localStorage>"u")return lc;const e=localStorage.getItem(fy);if(!e)return lc;const t=Number(e);return Number.isFinite(t)?my(t):lc},kr=ui(e=>({isSidebarOpen:!0,toggleSidebar:()=>e(t=>({isSidebarOpen:!t.isSidebarOpen})),setSidebarOpen:t=>e({isSidebarOpen:t}),sidebarView:U5(),setSidebarView:t=>{typeof localStorage<"u"&&localStorage.setItem(uy,t),e({sidebarView:t})},isFilePreviewOpen:!1,toggleFilePreview:()=>e(t=>({isFilePreviewOpen:!t.isFilePreviewOpen})),setFilePreviewOpen:t=>e({isFilePreviewOpen:t}),previewWidth:B5(),setPreviewWidth:t=>{const n=my(t);typeof localStorage<"u"&&localStorage.setItem(fy,String(n)),e({previewWidth:n})},previewTab:"diff",setPreviewTab:t=>e({previewTab:t}),previewTargetPath:null,previewRequestId:0,openFilePreview:t=>e(n=>({isFilePreviewOpen:!0,previewTab:(t==null?void 0:t.tab)??n.previewTab,previewTargetPath:(t==null?void 0:t.targetPath)??null,previewRequestId:n.previewRequestId+1})),isSettingsOpen:!1,settingsSection:"general",toggleSettings:()=>e(t=>({isSettingsOpen:!t.isSettingsOpen,...t.isSettingsOpen?{}:{settingsSection:"general"}})),openSettings:(t="general")=>e({isSettingsOpen:!0,settingsSection:t}),isTerminalOpen:!1,toggleTerminal:()=>e(t=>({isTerminalOpen:!t.isTerminalOpen})),isTaskSwitcherOpen:!1,taskSwitcherMode:"tasks",setTaskSwitcherOpen:(t,n)=>e(r=>({isTaskSwitcherOpen:t,taskSwitcherMode:n??r.taskSwitcherMode})),setTaskSwitcherMode:t=>e({taskSwitcherMode:t})}));function H5(){const e=kr(r=>r.setTaskSwitcherOpen),t=kr(r=>r.toggleSidebar),n=L(r=>r.startTemporarySession);w.useEffect(()=>{const r=s=>{if(s.repeat)return;const o=R5(s);if(!o)return;const i=kr.getState(),a=i.isTaskSwitcherOpen,l=M5(s.target),d=!!document.querySelector('[role="dialog"]');if(o.id==="searchTasks"||o.id==="openCommands"){if(d&&!a)return;s.preventDefault();const m=o.id==="searchTasks"?"tasks":"commands",p=a&&i.taskSwitcherMode===m;e(!p,m);return}if(!(l||d)){if(o.id==="newTask"){s.preventDefault(),n(),requestAnimationFrame(()=>vf());return}if(o.id==="focusComposer"){vf()&&s.preventDefault();return}o.id==="toggleSidebar"&&(s.preventDefault(),t())}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,n,t])}const su=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Of,{ref:r,className:W("overflow-hidden relative",e),...n,children:[c.jsx(sS,{className:"h-full w-full rounded-[inherit] [&>div]:!block !overflow-auto",children:t}),c.jsx(py,{}),c.jsx(oS,{})]}));su.displayName=Of.displayName;const py=w.forwardRef(({className:e,orientation:t="vertical",...n},r)=>c.jsx($f,{ref:r,orientation:t,className:W("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:c.jsx(iS,{className:"relative flex-1 rounded-full bg-border"})}));py.displayName=$f.displayName;function ho(e,t){var s;const n=(s=e.title)==null?void 0:s.trim();if(n==="Code Review")return t("session.title.codeReview");if(n)return n;const r=e.firstMessageTime||e.lastMessageTime;if(r){const o=new Date(r);if(!Number.isNaN(o.getTime()))return t("recent.session.fallbackDated",{y:String(o.getFullYear()).slice(-2),m:String(o.getMonth()+1).padStart(2,"0"),d:String(o.getDate()).padStart(2,"0"),hh:String(o.getHours()).padStart(2,"0"),mm:String(o.getMinutes()).padStart(2,"0")})}return t("recent.session.fallbackShort",{id:e.sessionId.slice(0,6)})}async function gy(e,t=!1){const n=await re.exportSessionMarkdown(e,t),r=new Blob([n.markdown],{type:"text/markdown;charset=utf-8"}),s=URL.createObjectURL(r),o=document.createElement("a");o.href=s,o.download=n.filename,o.hidden=!0,document.body.appendChild(o);try{o.click()}finally{o.remove(),await new Promise(i=>{window.setTimeout(()=>{URL.revokeObjectURL(s),i()},0)})}return n}const Gn=cS,Vn=lS,Mn=w.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>c.jsx(aS,{children:c.jsx(Rf,{ref:s,align:t,sideOffset:n,className:W("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]: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 origin-[--radix-popover-content-transform-origin]",e),...r})}));Mn.displayName=Rf.displayName;function q5(){const e=Ft(),t=L(b=>b.archivedSessions),n=L(b=>b.archivedCatalogLoadState),r=L(b=>b.archivedCatalogError),s=L(b=>b.loadArchivedSessions),o=L(b=>b.unarchiveSession),i=L(b=>b.setError),[a,l]=w.useState(!1),[d,m]=w.useState(null),[p,g]=w.useState(null),x=b=>{l(b),b&&s()};return c.jsxs(Gn,{open:a,onOpenChange:x,children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",className:"flex h-8 w-full items-center justify-between rounded-md px-2.5 font-mono text-[12.5px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]","aria-label":e("archive.open"),children:[c.jsxs("span",{className:"flex items-center gap-2.5",children:[c.jsx(Mf,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-ink-faint))]"}),e("archive.title")]}),t.length>0&&c.jsx("span",{className:"rounded-sm bg-[hsl(var(--deck-surface))] px-1.5 py-0.5 text-[9px] text-[hsl(var(--deck-ink-faint))]",children:t.length})]})}),c.jsxs(Mn,{role:"dialog","aria-label":e("archive.title"),side:"right",align:"end",sideOffset:8,className:"w-[340px] overflow-hidden p-0",children:[c.jsxs("div",{className:"flex h-10 items-center justify-between border-b border-[hsl(var(--deck-hairline))] px-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-mono text-[11px] font-medium uppercase tracking-[0.08em] text-[hsl(var(--deck-ink))]",children:e("archive.title")}),c.jsx("div",{className:"text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:e("archive.subtitle")})]}),c.jsx("button",{type:"button",onClick:()=>void s(),"aria-label":e("archive.refresh"),className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(lo,{className:W("h-3 w-3",(n==="loading"||n==="hydrating")&&"animate-spin")})})]}),r?c.jsxs("div",{className:"px-3 py-4 text-[11px] text-red-600 dark:text-red-400",children:[c.jsx("div",{children:r}),c.jsx("button",{type:"button",onClick:()=>void s(),className:"mt-2 font-mono text-[10px] text-[hsl(var(--deck-accent))] focus-visible:outline-none focus-visible:underline",children:e("archive.retry")})]}):t.length===0&&(n==="loading"||n==="hydrating")?c.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(lt,{className:"h-3 w-3 animate-spin"}),e("archive.loading")]}):t.length===0?c.jsx("div",{className:"flex h-24 items-center justify-center px-6 text-center text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:e("archive.empty")}):c.jsx(su,{className:"max-h-[340px]",children:c.jsx("div",{className:"divide-y divide-[hsl(var(--deck-hairline))]",children:t.map(b=>{var N;const y=pe(b),j=ze(y),k=d===j,A=b.projectPath.split("/").filter(Boolean).at(-1)??b.projectPath;return c.jsxs("div",{className:"flex min-h-[58px] items-center gap-2 px-3 py-2",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"truncate font-mono text-[11.5px] text-[hsl(var(--deck-ink))]",children:ho(b,e)}),c.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx("span",{className:"truncate",children:A}),b.archivedAt&&c.jsxs(c.Fragment,{children:[c.jsx("span",{"aria-hidden":!0,children:"·"}),c.jsx("span",{children:new Date(b.archivedAt).toLocaleString()})]})]}),b.archivedBySessionId!==b.sessionId&&c.jsx("div",{className:"mt-0.5 truncate text-[9px] text-[hsl(var(--deck-accent))]",children:e("archive.inherited",{id:((N=b.archivedBySessionId)==null?void 0:N.slice(0,8))??""})})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[c.jsx("button",{type:"button",disabled:p!==null,onClick:async()=>{g(j);try{await gy(y)}catch($){i($ instanceof Error?$.message:"Session export failed")}finally{g(null)}},"aria-label":e("session.action.export",{title:ho(b,e)}),title:e("session.action.exportShort"),className:"flex h-7 w-7 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-35",children:p===j?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Ff,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",disabled:k||b.archivedBySessionId!==b.sessionId,onClick:async()=>{m(j);try{await o(y)}finally{m(null)}},"aria-label":e("archive.restore",{title:ho(b,e)}),title:b.archivedBySessionId!==b.sessionId?e("archive.restoreAncestor"):e("archive.restoreShort"),className:"flex h-7 w-7 items-center justify-center rounded text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-35",children:k?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(uS,{className:"h-3.5 w-3.5"})})]})]},j)})})})]})]})}function ou({className:e,size:t=28,pulse:n=!0}){return c.jsxs("span",{className:W("inline-flex relative justify-center items-center","text-[hsl(var(--deck-ink))]",e),style:{width:t,height:t},"aria-hidden":"true",children:[c.jsxs("svg",{viewBox:"0 0 32 32",width:t,height:t,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M16 3 L28 16 L16 29 L4 16 Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),c.jsx("path",{d:"M16 8 L24 16 L16 24",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.55"}),c.jsx("path",{d:"M16 3 L20 7",stroke:"hsl(var(--deck-accent))",strokeWidth:"2",strokeLinecap:"round"})]}),n&&c.jsx("span",{className:"absolute top-[3px] right-[3px] h-1.5 w-1.5 rounded-full",style:{background:"hsl(var(--deck-accent-glow))",boxShadow:"0 0 6px hsl(var(--deck-accent-glow) / 0.9)"}})]})}const If={en:"sidebar.language.en",zh:"sidebar.language.zh"};function hy({className:e,variant:t="pill"}){const{locale:n,setLocale:r}=v0(),s=Ft();if(t==="compact"){const o=n==="en"?"zh":"en";return c.jsx("button",{type:"button",onClick:()=>r(o),"aria-label":s("sidebar.language.aria"),title:s("sidebar.language.label"),className:W("flex justify-center items-center w-10 h-10 font-mono font-medium rounded-md transition-colors text-[11px] text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",e),children:s(If[n])})}return c.jsx("div",{role:"group","aria-label":s("sidebar.language.aria"),className:W("inline-flex h-8 items-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-[2px] font-mono text-[11px]",e),children:k0.map(o=>{const i=o===n;return c.jsx("button",{type:"button",onClick:()=>r(o),"aria-pressed":i,className:W("flex justify-center items-center px-2 h-full transition-colors min-w-[28px] rounded-[4px]",i?"bg-[hsl(var(--deck-ink))] text-[hsl(var(--deck-canvas))]":"text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),children:s(If[o])},o)})})}const z5="[data-mobile-navigation-trigger]";function Y_(e){return by(z5,e)}function by(e,t){const n=document.querySelector(e);return!n||n.getClientRects().length===0?!1:(t.preventDefault(),n.focus({preventScroll:!0}),!0)}function ky({open:e,onOpenChange:t}){const n=Ft(),{boundProjects:r,selectedProjectPath:s,isBindingProject:o,loadBoundProjects:i,bindProject:a,unbindProject:l,selectProject:d,startTemporarySession:m}=L(),[p,g]=w.useState(""),[x,b]=w.useState(null),[y,j]=w.useState(!1),k=w.useRef(0);w.useEffect(()=>{if(e){i();return}k.current+=1,j(!1)},[i,e]);const A=async T=>{await a(T),g(""),m(),t(!1)},N=async T=>{if(T.preventDefault(),!(!p.trim()||o||y)){b(null);try{await A(p.trim())}catch(C){b(C instanceof Error?C.message:n("projects.bind.failed"))}}},$=async()=>{if(y||o)return;const T=++k.current;b(null),j(!0);try{const C=await re.pickProjectDirectory();if(T!==k.current||C.cancelled)return;g(C.path),await A(C.path)}catch(C){if(T!==k.current)return;b(C instanceof Error?C.message:n("projects.pick.failed"))}finally{T===k.current&&j(!1)}},Q=T=>{d(T),m(),t(!1)};return e?c.jsx(ol,{open:e,onOpenChange:t,children:c.jsxs(Yi,{onCloseAutoFocus:T=>by("[data-project-setup-trigger]",T),className:"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))] sm:max-w-xl",children:[c.jsxs(il,{children:[c.jsxs(Xi,{className:"flex items-center gap-2 font-mono text-[16px]",children:[c.jsx(Oi,{className:"h-4 w-4 text-[hsl(var(--deck-accent))]"}),n("projects.dialog.title")]}),c.jsx(Zi,{className:"text-[12px] text-[hsl(var(--deck-ink-muted))]",children:n("projects.dialog.description")})]}),c.jsxs("form",{onSubmit:N,className:"flex gap-2",children:[c.jsx("input",{value:p,onChange:T=>g(T.target.value),disabled:o,placeholder:n("projects.bind.placeholder"),"aria-label":n("projects.bind.pathLabel"),className:"h-9 min-w-0 flex-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 font-mono text-[12px] outline-none placeholder:text-[hsl(var(--deck-ink-faint))] focus:border-[hsl(var(--deck-accent)/0.65)]"}),c.jsxs("button",{type:"button",onClick:()=>void $(),disabled:y||o,title:n("projects.pick.action"),"aria-label":n("projects.pick.action"),className:"inline-flex h-9 shrink-0 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))] disabled:cursor-wait disabled:opacity-50",children:[y?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(fS,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"hidden sm:inline",children:n(y?"projects.pick.picking":"projects.pick.actionShort")})]}),c.jsxs("button",{type:"submit",disabled:!p.trim()||o||y,className:"inline-flex h-9 items-center gap-2 rounded-md bg-[hsl(var(--deck-ink))] px-3 font-mono text-[12px] text-[hsl(var(--deck-canvas))] transition-opacity disabled:opacity-40",children:[o?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Oi,{className:"h-3.5 w-3.5"}),n("projects.bind.action")]})]}),x&&c.jsx("div",{role:"alert",className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:x}),c.jsx("div",{className:"max-h-72 space-y-1 overflow-y-auto",children:r.map(T=>{const C=T.path===s;return c.jsxs("div",{className:W("group flex items-center gap-3 rounded-md border px-3 py-2",C?"border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))]":"border-transparent hover:border-[hsl(var(--deck-border))] hover:bg-[hsl(var(--deck-surface))]"),children:[c.jsx(uo,{className:W("h-4 w-4 shrink-0",C?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]")}),c.jsxs("button",{type:"button",disabled:!T.available,onClick:()=>Q(T.path),className:"min-w-0 flex-1 text-left disabled:cursor-not-allowed disabled:opacity-50",children:[c.jsx("span",{className:"block truncate font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:T.name}),c.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[T.gitBranch&&c.jsxs(c.Fragment,{children:[c.jsx(el,{className:"h-2.5 w-2.5"}),c.jsx("span",{children:T.gitBranch}),c.jsx("span",{children:"·"})]}),c.jsx("span",{className:"truncate",children:T.path}),!T.available&&c.jsxs("span",{className:"shrink-0 text-red-500",children:["· ",n("projects.unavailable")]})]})]}),!T.isCurrent&&c.jsx("button",{type:"button",onClick:()=>void l(T.path).catch(()=>{}),title:n("projects.unbind.action"),"aria-label":n("projects.unbind.action"),className:"rounded p-1.5 text-[hsl(var(--deck-ink-faint))] opacity-0 transition group-hover:opacity-100 hover:bg-red-50 hover:text-red-600 focus-visible:opacity-100 dark:hover:bg-red-950/30",children:c.jsx(Df,{className:"h-3.5 w-3.5"})})]},T.path)})})]})}):null}const K5={running:"bg-blue-500 dark:bg-blue-400 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse",queued:"bg-amber-400 dark:bg-amber-300",interrupted:"bg-orange-500 dark:bg-orange-400",failed:"bg-red-500 dark:bg-red-400",cancelled:"bg-zinc-400 dark:bg-zinc-500",completed:"bg-[hsl(var(--deck-accent))]"};function G5({session:e,isActive:t,isForking:n,isUnread:r,anyForking:s,isEditing:o,editingTitle:i,title:a,context:l,isCancelling:d,isRetrying:m,isExporting:p,onSelect:g,onCancelTask:x,onRetryTask:b,onFork:y,onArchive:j,onExport:k,onStartRename:A,onDelete:N,onEditingTitleChange:$,onSaveRename:Q,onCancelRename:T}){const C=Ft(),[O,R]=w.useState(!1),K=w.useRef(null),X=w.useRef(null);return o?c.jsxs("div",{className:"flex h-9 w-full items-center gap-2 bg-[hsl(var(--deck-surface))] px-3",children:[c.jsx("input",{type:"text",value:i,onChange:P=>$(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Q(),P.key==="Escape"&&T()},autoFocus:!0,className:"flex-1 rounded bg-[hsl(var(--deck-canvas))] px-2 py-1 font-mono text-[13px] text-[hsl(var(--deck-ink))] outline-none focus:ring-1 focus:ring-[hsl(var(--deck-accent))]"}),c.jsx("button",{"aria-label":C("session.action.save",{title:a}),onClick:Q,className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-canvas))]",children:c.jsx(_f,{className:"w-3 h-3"})}),c.jsx("button",{"aria-label":C("session.action.cancel",{title:a}),onClick:T,className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-canvas))]",children:c.jsx(co,{className:"w-3 h-3"})})]}):c.jsxs("div",{className:W("flex relative items-center w-full transition-colors group min-h-[54px]",t?"bg-[hsl(var(--deck-surface))]":"hover:bg-[hsl(var(--deck-surface))]/60"),children:[t&&c.jsx("span",{className:"absolute left-0 top-1/2 h-6 w-[2px] -translate-y-1/2 rounded-r bg-[hsl(var(--deck-accent))]"}),c.jsxs("button",{type:"button","aria-label":C("session.action.select",{title:a}),"aria-current":t?"true":void 0,"aria-busy":n?"true":void 0,onClick:g,className:"flex min-h-[54px] min-w-0 flex-1 cursor-pointer items-center gap-2 py-1.5 pl-4 pr-2 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx("span",{className:W("h-1.5 w-1.5 shrink-0 rounded-full",e.pendingInteraction?"animate-pulse bg-amber-500 shadow-[0_0_5px_rgba(245,158,11,0.75)]":K5[e.taskStatus]),title:e.pendingInteraction?C(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission"):e.taskStatus}),c.jsxs("span",{className:"flex-1 min-w-0 font-mono",children:[c.jsxs("span",{className:W("flex gap-2 items-center text-left truncate text-[12px]",t?"text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:[c.jsx("span",{className:"truncate",children:a}),r&&c.jsx("span",{title:C("taskSwitcher.new"),className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.75)]"}),e.pendingInteraction&&c.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-amber-100 px-1.5 py-0.5 text-[8.5px] text-amber-800 dark:bg-amber-950/60 dark:text-amber-300",title:C(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission"),children:[c.jsx(As,{className:"h-2.5 w-2.5"}),C(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission")]}),e.relationType==="fork"&&e.parentId&&c.jsxs("span",{title:`${C("session.forkedFrom")} ${e.parentId.slice(0,6)}`,"aria-label":`${C("session.forkedFrom")} ${e.parentId.slice(0,6)}`,className:"shrink-0 text-[9px] text-[hsl(var(--deck-accent))]",children:[C("session.forkedFrom")," ",e.parentId.slice(0,6)]}),e.taskRetriedFrom&&c.jsx("span",{title:`${C("session.retriedFrom")} ${e.taskRetriedFrom.sessionId.slice(0,6)}`,className:"shrink-0 text-[9px] text-[hsl(var(--deck-accent))]",children:C("session.retryShort")})]}),c.jsxs("span",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 truncate text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx("span",{className:"truncate",children:l.project}),c.jsx("span",{className:"opacity-50",children:"·"}),c.jsx("span",{className:"truncate",children:l.environment}),l.queue&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"opacity-50",children:"·"}),c.jsx("span",{className:"text-amber-700 truncate dark:text-amber-400",children:l.queue})]}),l.diff&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"opacity-50",children:"·"}),c.jsx("span",{className:"truncate text-[hsl(var(--deck-accent))]",children:l.diff})]})]}),l.reason&&c.jsx("span",{title:l.reason,className:"mt-0.5 block truncate text-[9.5px] text-red-600 dark:text-red-400",children:l.reason})]}),n&&c.jsx(lt,{className:"h-3 w-3 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"})]}),c.jsxs("div",{className:W("flex items-center gap-0.5 pr-2 transition-opacity group-focus-within:opacity-100",e.taskStatus==="running"||e.taskStatus==="queued"||e.taskRetryAvailable&&(e.taskStatus==="failed"||e.taskStatus==="interrupted"||e.taskStatus==="cancelled")?"opacity-100":"opacity-50 group-hover:opacity-100"),children:[(e.taskStatus==="running"||e.taskStatus==="queued")&&c.jsx("button",{type:"button","aria-label":C(d?"session.action.stopping":"session.action.stop",{title:a}),disabled:d,onClick:P=>{P.stopPropagation(),x()},className:"flex h-6 w-6 items-center justify-center rounded text-red-500 transition-colors hover:bg-red-500/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60",children:d?c.jsx(lt,{className:"h-3 w-3 animate-spin"}):c.jsx(tl,{className:"h-3 w-3"})}),e.taskRetryAvailable&&(e.taskStatus==="failed"||e.taskStatus==="interrupted"||e.taskStatus==="cancelled")&&c.jsx("button",{ref:K,type:"button","aria-label":C(m?"session.action.retrying":"session.action.retry",{title:a}),disabled:m,onClick:P=>{P.stopPropagation(),b()},className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-60",children:m?c.jsx(lt,{className:"h-3 w-3 animate-spin"}):c.jsx(Qi,{className:"h-3 w-3"})}),c.jsxs(Gn,{open:O,onOpenChange:R,children:[c.jsx(Vn,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":C("session.action.more",{title:a}),"aria-expanded":O,className:"flex h-6 w-6 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-canvas))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(mS,{className:"h-3.5 w-3.5"})})}),c.jsxs(Mn,{ref:X,role:"menu","aria-label":C("session.action.more",{title:a}),side:"right",align:"start",sideOffset:6,className:"w-40 p-1",onOpenAutoFocus:P=>{var B,M;P.preventDefault(),(M=(B=X.current)==null?void 0:B.querySelector('[role="menuitem"]:not([disabled])'))==null||M.focus()},onKeyDown:P=>{P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),R(!1),window.setTimeout(()=>{var B;return(B=K.current)==null?void 0:B.focus()},0))},children:[c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.fork",{title:a}),disabled:s,onClick:P=>{P.stopPropagation(),y(),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-45",children:[c.jsx(pS,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.forkShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.rename",{title:a}),onClick:P=>{A(P),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none",children:[c.jsx(gS,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.renameShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.archive",{title:a}),disabled:e.taskStatus==="running"||e.taskStatus==="queued",onClick:P=>{P.stopPropagation(),j(),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-35",children:[c.jsx(Mf,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.archiveShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.export",{title:a}),disabled:p,onClick:P=>{P.stopPropagation(),k(),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:bg-[hsl(var(--deck-surface))] focus-visible:text-[hsl(var(--deck-ink))] focus-visible:outline-none disabled:cursor-wait disabled:opacity-45",children:[p?c.jsx(lt,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):c.jsx(Ff,{className:"h-3 w-3","aria-hidden":!0}),C(p?"session.action.exportingShort":"session.action.exportShort")]}),c.jsxs("button",{type:"button",role:"menuitem","aria-label":C("session.action.delete",{title:a}),onClick:P=>{N(P),R(!1)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left font-mono text-[11px] text-red-600 transition-colors hover:bg-red-500/10 focus-visible:bg-red-500/10 focus-visible:outline-none dark:text-red-400",children:[c.jsx(Df,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.deleteShort")]})]})]})]})]})}function V5({onExpand:e,onNewChat:t,onOpenTaskSwitcher:n,onToggleTerminal:r,onToggleSettings:s,isTerminalOpen:o,taskEventsConnected:i,unreadCount:a,className:l}){const d=Ft(),m=[{icon:Lf,action:s,labelKey:"sidebar.section.settings"}];return c.jsxs("div",{className:W("flex flex-col gap-2 items-center py-5 h-screen border-r w-[64px] border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))]",l),children:[c.jsx("button",{onClick:e,className:"rounded-md p-1 transition-colors hover:bg-[hsl(var(--deck-surface))]","aria-label":d("sidebar.action.expand"),children:c.jsx(ou,{size:28})}),c.jsx("button",{onClick:t,"aria-label":d("sidebar.action.newTaskShort"),title:d("sidebar.action.newTaskShort"),className:"mt-6 flex h-10 w-10 items-center justify-center rounded-md bg-[hsl(var(--deck-ink))] text-[hsl(var(--deck-canvas))] transition-colors hover:bg-[hsl(var(--deck-ink))]/85",children:c.jsx(nl,{className:"h-4 w-4 stroke-[2.5]"})}),c.jsx("button",{onClick:r,"aria-label":d("sidebar.action.terminalToggle"),title:d("sidebar.action.terminal"),className:W("flex h-10 w-10 items-center justify-center rounded-md border transition-colors",o?"border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"border-transparent text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]"),children:c.jsx(Uf,{className:"w-4 h-4"})}),c.jsxs("button",{onClick:n,"aria-label":d("sidebar.action.searchTasks"),title:`${d("sidebar.action.searchTasks")} (${Vc("searchTasks")})`,className:"relative flex h-10 w-10 items-center justify-center rounded-md border border-transparent text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:[c.jsx(rl,{className:"h-4 w-4"}),a>0&&c.jsx("span",{"aria-label":d("sidebar.unreadTasks",{count:a}),className:"absolute right-0.5 top-0.5 flex min-h-4 min-w-4 items-center justify-center rounded-full bg-[hsl(var(--deck-accent))] px-1 font-mono text-[8px] font-semibold text-white",children:a>99?"99+":a})]}),c.jsx("div",{className:"flex-1"}),c.jsx("div",{className:"my-2 h-px w-6 bg-[hsl(var(--deck-hairline))]"}),m.map(({icon:p,action:g,labelKey:x})=>c.jsx("button",{"data-settings-trigger":!0,onClick:g,"aria-label":d(x),title:d(x),className:"flex h-10 w-10 items-center justify-center rounded-md text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:c.jsx(p,{className:"w-4 h-4"})},x)),c.jsx(hy,{variant:"compact"}),c.jsx("div",{className:"mt-1",children:c.jsx("div",{role:"status","aria-label":d(i?"sidebar.status.feedLive":"sidebar.status.feedOffline"),className:W("h-2 w-2 rounded-full",i?"bg-[hsl(var(--deck-accent))] shadow-[0_0_6px_hsl(var(--deck-accent-glow)/0.9)]":"bg-[hsl(var(--deck-ink-faint))]/60"),title:d(i?"sidebar.status.feedLive":"sidebar.status.feedOffline")})})]})}const xy="blade.sidebar.project-order.v1";function mi(e){const t=new Set,n=[];for(const r of e)typeof r!="string"||!r||t.has(r)||(t.add(r),n.push(r));return n}function W5(){if(typeof window>"u")return[];try{const e=JSON.parse(window.localStorage.getItem(xy)??"[]");return Array.isArray(e)?mi(e):[]}catch{return[]}}function J5(e){if(!(typeof window>"u"))try{window.localStorage.setItem(xy,JSON.stringify(mi(e)))}catch{}}function Q5(e,t){const n=new Map(mi(t).map((s,o)=>[s,o])),r=n.size;return e.map((s,o)=>({project:s,rank:n.get(s.path)??r+o})).sort((s,o)=>s.rank-o.rank).map(({project:s})=>s)}function Y5(e,t,n){const r=mi(e),s=r.indexOf(t),o=r.indexOf(n);if(s<0||o<0||s===o)return r;const[i]=r.splice(s,1);return r.splice(o,0,i),r}function X5(e,t,n){const r=mi(e),s=r.indexOf(t),o=s+n;return s<0||o<0||o>=r.length||([r[s],r[o]]=[r[o],r[s]]),r}function Z5({name:e,path:t,count:n,countIsPartial:r=!1,isActive:s,hasRunning:o,unreadCount:i,collapsed:a,onToggle:l,onSelect:d,onCreateTask:m,reorderPosition:p,reorderCount:g,isDragging:x=!1,onDragStart:b,onDragEnd:y,onReorderKeyDown:j}){const k=Ft();return c.jsxs("div",{className:W("group/proj flex w-full items-center gap-2 px-5 pb-1.5 pt-3 text-left transition-colors","hover:bg-[hsl(var(--deck-surface))]/40"),children:[c.jsx("button",{type:"button",draggable:!0,"data-project-drag-handle":t,onDragStart:b,onDragEnd:y,onKeyDown:j,"aria-label":k("sidebar.project.reorder",{name:e,position:p,count:g}),title:k("sidebar.project.reorderHint"),className:W("-ml-2 flex h-6 w-4 shrink-0 cursor-grab items-center justify-center rounded-sm text-[hsl(var(--deck-ink-faint))] opacity-45 transition-[opacity,color,background-color] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink-muted))] hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] active:cursor-grabbing group-hover/proj:opacity-100",x&&"cursor-grabbing opacity-100 text-[hsl(var(--deck-accent))]"),children:c.jsx(hS,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",onClick:l,"aria-expanded":!a,"aria-label":k(a?"sidebar.project.expand":"sidebar.project.collapse",{name:e}),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(bS,{className:W("h-3 w-3 text-[hsl(var(--deck-ink-faint))] transition-transform duration-150",!a&&"rotate-90")})}),c.jsxs("button",{type:"button",onClick:d??l,title:t,"aria-current":s?"true":void 0,className:"flex min-h-6 min-w-0 flex-1 items-center gap-2 rounded-sm text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx(uo,{className:W("h-3.5 w-3.5 shrink-0",s?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]")}),c.jsx("span",{className:W("flex-1 truncate font-mono text-[11.5px] font-medium tracking-[-0.01em]",s?"text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:e}),o&&c.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-blue-500 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse dark:bg-blue-400","aria-hidden":!0}),i>0&&c.jsx("span",{"aria-label":k("sidebar.unreadTasks",{count:i}),className:"shrink-0 rounded-full bg-[hsl(var(--deck-accent))] px-1.5 py-0.5 font-mono text-[8px] font-semibold text-white",children:i}),c.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[n.toString().padStart(2,"0"),r?"+":""]})]}),m&&c.jsx("button",{type:"button",onClick:m,title:k("sidebar.project.newTask",{name:e}),"aria-label":k("sidebar.project.newTask",{name:e}),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-[hsl(var(--deck-ink-faint))] opacity-0 transition-[opacity,color,background-color] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-accent))] focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] group-hover/proj:opacity-100",children:c.jsx(nl,{className:"h-3.5 w-3.5"})})]})}function Wc(e){const t=e.lastMessageTime||e.firstMessageTime;if(!t)return 0;const n=new Date(t).getTime();return Number.isNaN(n)?0:n}function Cf(e){return e.pendingInteraction?0:e.taskStatus==="running"?1:e.taskStatus==="queued"?2:3}function iu(e,t){return Cf(e)-Cf(t)||Wc(t)-Wc(e)}const e_=["running","queued","interrupted","failed","cancelled","completed"],t_={running:"RUNNING",queued:"QUEUED",interrupted:"INTERRUPTED",failed:"FAILED",cancelled:"CANCELLED",completed:"DONE"},ys=e=>e.length>1?e.replace(/\/+$/,""):e;function yy(e){const t=new Map;for(const n of e){if(!n)continue;const r=ze(pe(n));t.has(r)||t.set(r,n)}return Array.from(t.values())}function n_(e){const t=yy(e),n=[];for(const r of e_){const s=t.filter(o=>o.taskStatus===r).sort(iu);s.length>0&&n.push({code:t_[r],status:r,sessions:s})}return n}function r_(e,t,n=[]){const r=yy(e),s=new Map,o=n.map(ys),i=new Map(o.map((d,m)=>[d,m]));for(const d of o)s.set(d,[]);for(const d of r){const m=fi(d,t),p=s.get(m);p?p.push(d):s.set(m,[d])}const a=t?ys(t):null,l=Array.from(s.entries()).map(([d,m])=>{const p=[...m].sort(iu),g=m.reduce((x,b)=>Math.max(x,Wc(b)),0);return{path:d,name:qc(d),isActive:a?ys(d)===a:!1,isBound:i.has(ys(d)),hasRunning:m.some(x=>x.taskStatus==="running"),lastActivity:g,sessions:p}});return l.sort((d,m)=>d.isBound!==m.isBound?d.isBound?-1:1:d.isBound&&m.isBound?(i.get(ys(d.path))??Number.MAX_SAFE_INTEGER)-(i.get(ys(m.path))??Number.MAX_SAFE_INTEGER):m.lastActivity-d.lastActivity),l}const jf=12,s_={RUNNING:"sidebar.group.running",QUEUED:"sidebar.group.queued",INTERRUPTED:"sidebar.group.interrupted",FAILED:"sidebar.group.failed",CANCELLED:"sidebar.group.cancelled",DONE:"sidebar.group.done"},o_={RUNNING:"text-blue-700 dark:text-blue-400",QUEUED:"text-amber-700 dark:text-amber-400",INTERRUPTED:"text-orange-700 dark:text-orange-400",FAILED:"text-red-700 dark:text-red-400",CANCELLED:"text-[hsl(var(--deck-ink-faint))]",DONE:"text-[hsl(var(--deck-accent))]"};function i_({view:e,sessions:t,activeProjectPath:n,boundProjects:r,currentSessionRef:s,unreadTaskKeys:o,catalogLoadState:i,catalogError:a,onSelectProject:l,onCreateTask:d,onRetryCatalog:m,renderRow:p}){const g=Ft(),[x,b]=w.useState({}),[y,j]=w.useState({}),[k,A]=w.useState(W5),[N,$]=w.useState(null),[Q,T]=w.useState(null),[C,O]=w.useState(""),R=i==="loading"||i==="hydrating",K=R||i==="error",X=w.useMemo(()=>e==="status"?n_(t):[],[t,e]),P=w.useMemo(()=>e==="project"?r_(t,n,r.map(F=>F.path)):[],[n,r,t,e]),B=w.useMemo(()=>Q5(P,k),[P,k]),M=(F,me)=>{const Se=y[F]??!1,Ee=Se?me:me.filter((Z,_)=>{if(_<jf)return!0;const Ge=pe(Z);return!!Z.pendingInteraction||o.includes(ze(Ge))||!!(s&&oe(Ge,s))}),Pe=me.length-Ee.length,U=Se?me.length>jf:Pe>0;return c.jsxs(c.Fragment,{children:[Ee.map(p),U&&c.jsx("button",{type:"button",onClick:()=>j(Z=>({...Z,[F]:!Se})),className:"mx-4 my-1 rounded-md px-3 py-1.5 text-left font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink-muted))]",children:Se?g("sidebar.group.showLess"):g("sidebar.group.showMore",{count:Pe})})]})},fe=R?c.jsxs("div",{role:"status","aria-live":"polite",className:"mx-4 mt-2 flex items-center gap-2 rounded-md bg-[hsl(var(--deck-surface))]/55 px-3 py-2 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(lt,{className:"h-3 w-3 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"flex-1 min-w-0",children:g("sidebar.catalog.syncing")}),c.jsx("span",{className:"tabular-nums shrink-0",children:g("sidebar.catalog.loaded",{count:t.length})})]}):i==="error"?c.jsxs("div",{role:"alert",title:a??void 0,className:"mx-4 mt-2 flex items-center gap-2 rounded-md bg-amber-50/80 px-3 py-2 font-mono text-[9.5px] text-amber-800 dark:bg-amber-950/35 dark:text-amber-300",children:[c.jsx(As,{className:"w-3 h-3 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0",children:g("sidebar.catalog.incomplete")}),c.jsxs("button",{type:"button",onClick:m,className:"inline-flex min-h-6 shrink-0 items-center gap-1 rounded px-1.5 font-medium hover:bg-amber-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-amber-500 dark:hover:bg-amber-900/50",children:[c.jsx(lo,{className:"h-2.5 w-2.5"}),g("sidebar.catalog.retry")]})]}):null;if(e==="status")return c.jsxs("div",{className:"flex flex-col",children:[fe,X.map((F,me)=>c.jsxs("div",{children:[c.jsxs("div",{className:W("flex items-center justify-between px-5 pb-2 pt-3 font-mono text-[10px] tracking-[0.16em]",o_[F.code]??"text-[hsl(var(--deck-ink-faint))]",me===0&&"pt-2"),children:[c.jsx("span",{children:g(s_[F.code])}),c.jsxs("span",{className:"text-[hsl(var(--deck-ink-faint))]",children:[F.sessions.length.toString().padStart(2,"0"),K?"+":""]})]}),M(`status:${F.code}`,F.sessions)]},F.code))]});const ve=B.some(F=>F.isActive),ke=F=>!!(s&&F.sessions.some(me=>oe(pe(me),s))),ce=(F,me)=>{if(F.join("\0")===B.map(Ee=>Ee.path).join("\0"))return;A(F),J5(F);const Se=B.find(Ee=>Ee.path===me);O(g("sidebar.project.reordered",{name:(Se==null?void 0:Se.name)??me,position:F.indexOf(me)+1}))},Fe=(F,me)=>{const Se=F.sessions.filter(_=>o.includes(ze(pe(_)))).length,Ee=ke(F),Pe=Se>0,U=F.sessions.some(_=>!!_.pendingInteraction),Z=x[F.path]??(ve&&!F.isActive&&!(Ee||F.hasRunning||Pe||U));return c.jsxs("div",{"data-project-group":F.path,onDragEnter:_=>{!N||N===F.path||(_.preventDefault(),T(F.path))},onDragOver:_=>{!N||N===F.path||(_.preventDefault(),_.dataTransfer.dropEffect="move")},onDrop:_=>{_.preventDefault();const Ge=N||_.dataTransfer.getData("text/plain");Ge&&Ge!==F.path&&ce(Y5(B.map(Ne=>Ne.path),Ge,F.path),Ge),$(null),T(null)},className:W("relative transition-colors",Q===F.path&&N!==F.path&&"bg-[hsl(var(--deck-accent-soft))]/55 before:absolute before:inset-y-1 before:left-0 before:w-0.5 before:rounded-full before:bg-[hsl(var(--deck-accent))]"),children:[c.jsx(Z5,{name:F.name,path:F.path,count:F.sessions.length,countIsPartial:K,isActive:F.isActive,hasRunning:F.hasRunning,unreadCount:Se,collapsed:Z,onSelect:()=>l(F.path),onCreateTask:()=>d(F.path),reorderPosition:me+1,reorderCount:B.length,isDragging:N===F.path,onDragStart:_=>{_.dataTransfer.effectAllowed="move",_.dataTransfer.setData("text/plain",F.path),$(F.path)},onDragEnd:()=>{$(null),T(null)},onReorderKeyDown:_=>{if(_.key!=="ArrowUp"&&_.key!=="ArrowDown")return;_.preventDefault();const Ge=X5(B.map(Ne=>Ne.path),F.path,_.key==="ArrowUp"?-1:1);ce(Ge,F.path)},onToggle:()=>b(_=>({..._,[F.path]:!Z}))}),!Z&&M(`project:${F.path}`,F.sessions)]},F.path)};return c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{className:"sr-only","aria-live":"polite",children:C}),fe,B.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"px-5 pb-0.5 pt-2 font-mono text-[9px] uppercase tracking-[0.16em] text-[hsl(var(--deck-ink-faint))]",children:g("sidebar.project.projects")}),B.map(Fe)]})]})}function a_({className:e,onNavigate:t}){const n=Ft(),{toggleSettings:r,toggleSidebar:s,isSidebarOpen:o,isTerminalOpen:i,toggleTerminal:a,sidebarView:l,setSidebarView:d,setTaskSwitcherOpen:m}=kr(),p=L(S=>S.sessions),g=L(S=>S.catalogLoadState),x=L(S=>S.catalogError),b=L(S=>S.currentSessionRef),y=L(S=>S.forkingSessionRef),j=L(S=>S.selectSession),k=L(S=>S.startTemporarySession),A=L(S=>S.deleteSession),N=L(S=>S.archiveSession),$=L(S=>S.forkSession),Q=L(S=>S.updateSession),T=L(S=>S.loadSessions),C=L(S=>S.setError),O=L(S=>S.taskEventsConnected),R=L(S=>S.taskWorkspaceInfo),K=L(S=>S.boundProjects),X=L(S=>S.selectedProjectPath),P=L(S=>S.bindProject),B=L(S=>S.selectProject),M=L(S=>S.cancelTask),fe=L(S=>S.cancellingTaskKeys),ve=L(S=>S.retryTask),ke=L(S=>S.retryingTaskKeys),ce=L(S=>S.unreadTaskKeys),[Fe,F]=w.useState(null),[me,Se]=w.useState(""),[Ee,Pe]=w.useState(null),[U,Z]=w.useState(!1),_=X??(R==null?void 0:R.cwd)??null,Ge=S=>ho(S,n),Ne=S=>{const Y=S.taskSourceProjectPath||S.projectPath,De=Y.split("/").filter(Boolean).at(-1)||Y,mt=S.taskIsolation==="worktree"?S.taskWorktreeBranch||n("session.env.worktree"):n("session.env.local"),zn=S.taskDiffStat?`+${S.taskDiffStat.additions} −${S.taskDiffStat.deletions}`:void 0,ms=S.taskStatus==="queued"&&S.taskQueuePosition?n("session.queued",{position:S.taskQueuePosition,depth:S.taskQueueDepth??S.taskQueuePosition}):void 0,ps=ru(S,n);return{project:De,environment:mt,diff:zn,queue:ms,reason:ps}},Oe=()=>{k(_??void 0),t==null||t()},on=async S=>{K.some(Y=>Y.path===S)?B(S):await P(S),k(S),t==null||t()},Sn=async S=>{K.some(Y=>Y.path===S)?B(S):await P(S),k(S),t==null||t()},Xe=S=>{S(),t==null||t()},qn=async(S,Y)=>{S.stopPropagation(),await A(pe(Y))},ft=async S=>{const Y=pe(S),De=ze(Y);if(!Ee){Pe(De);try{await gy(Y)}catch(mt){C(mt instanceof Error?mt.message:"Session export failed")}finally{Pe(null)}}},an=(S,Y)=>{S.stopPropagation(),F(ze(pe(Y))),Se(Ge(Y))},Rn=async S=>{if(!me.trim()){F(null);return}try{await Q(pe(S),me.trim()),F(null),await T()}catch(Y){console.error("Failed to rename session:",Y)}},_t=()=>{F(null),Se("")};return o?c.jsxs("div",{className:W("flex flex-col h-screen border-r w-[260px] border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))]",e),children:[c.jsxs("div",{className:"flex flex-col gap-6 px-5 pt-5 pb-5",children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx(ou,{size:26}),c.jsx("span",{className:"font-mono text-[15px] font-semibold tracking-[-0.01em] text-[hsl(var(--deck-ink))]",children:"Blade"}),c.jsx("span",{className:"ml-1 rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-1 py-[1px] font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:n("sidebar.brand.badge")})]}),c.jsx("button",{onClick:s,"aria-label":n("sidebar.action.collapse"),className:"flex h-8 w-8 items-center justify-center rounded transition-colors hover:bg-[hsl(var(--deck-surface))]",children:c.jsx(kS,{className:"h-3 w-3 text-[hsl(var(--deck-ink-muted))]"})})]}),c.jsxs("div",{className:"flex flex-col gap-1.5",children:[c.jsxs("button",{onClick:Oe,className:"flex h-9 w-full items-center justify-between rounded-md bg-[hsl(var(--deck-ink))] px-3 font-mono text-[13px] font-medium text-[hsl(var(--deck-canvas))] transition-colors hover:bg-[hsl(var(--deck-ink))]/88",children:[c.jsxs("span",{className:"flex gap-2 items-center",children:[c.jsx(nl,{className:"h-3.5 w-3.5 stroke-[2.5]"}),n("sidebar.action.newTask")]}),c.jsx("span",{className:"rounded-sm bg-white/10 px-1.5 py-[1px] font-mono text-[10px] text-white/80",children:Vc("newTask")})]}),c.jsxs("button",{onClick:()=>Xe(a),className:W("flex h-9 w-full items-center gap-2 rounded-md border px-3 font-mono text-[12.5px] transition-colors",i?"border-[hsl(var(--deck-accent)/0.55)] bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-muted))] hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]"),children:[c.jsx(Uf,{className:"h-3.5 w-3.5"}),n("sidebar.action.terminal")]}),c.jsxs("button",{type:"button",onClick:()=>Xe(()=>m(!0)),className:"flex h-9 w-full items-center justify-between rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 font-mono text-[12.5px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]",children:[c.jsxs("span",{className:"flex items-center gap-2",children:[c.jsx(rl,{className:"h-3.5 w-3.5"}),n("sidebar.action.searchTasks")]}),c.jsx("span",{className:"rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-1.5 py-[1px] font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:ce.length>0?ce.length:Vc("searchTasks")})]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("div",{className:"flex flex-1 items-center gap-0.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-0.5",children:["project","status"].map(S=>c.jsx("button",{type:"button",onClick:()=>d(S),"aria-pressed":l===S,"aria-label":n(S==="project"?"sidebar.view.projectAria":"sidebar.view.statusAria"),className:W("flex-1 rounded-[5px] py-1 font-mono text-[11px] tracking-[0.02em] transition-colors",l===S?"bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))] shadow-sm":"text-[hsl(var(--deck-ink-faint))] hover:text-[hsl(var(--deck-ink-muted))]"),children:n(S==="project"?"sidebar.view.project":"sidebar.view.status")},S))}),c.jsx("button",{type:"button",onClick:()=>Z(!0),title:n("projects.bind.action"),"aria-label":n("projects.bind.action"),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-faint))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-accent))]",children:c.jsx(Oi,{className:"h-3.5 w-3.5"})})]})]}),c.jsx(su,{className:"flex-1 px-0",children:c.jsxs("div",{className:"flex flex-col",children:[(p.length>0||K.length>0||g==="loading"||g==="hydrating"||g==="error")&&c.jsx(i_,{view:l,sessions:p,activeProjectPath:_,boundProjects:K,currentSessionRef:b,unreadTaskKeys:ce,catalogLoadState:g,catalogError:x,onRetryCatalog:T,onSelectProject:S=>void on(S).catch(()=>{}),onCreateTask:S=>void Sn(S).catch(()=>{}),renderRow:S=>{const Y=pe(S),De=ze(Y),mt=oe(Y,b),zn=Fe===De,ms=oe(Y,y),ps=!!y;return c.jsx(G5,{session:S,sessionRef:Y,isActive:mt,isForking:ms,isUnread:ce.includes(ze(Y)),anyForking:ps,isEditing:zn,editingTitle:me,title:Ge(S),context:Ne(S),isCancelling:fe.includes(ze(Y)),isRetrying:ke.includes(ze(Y)),isExporting:Ee===De,onSelect:()=>(t==null||t(),j(Y)),onCancelTask:()=>{M(Y).catch(()=>{})},onRetryTask:()=>{ve(Y).catch(()=>{})},onFork:()=>void $(S),onArchive:()=>void N(Y),onExport:()=>void ft(S),onStartRename:gs=>an(gs,S),onDelete:gs=>qn(gs,S),onEditingTitleChange:Se,onSaveRename:()=>Rn(S),onCancelRename:_t},De)}}),p.length===0&&c.jsx("div",{className:"px-5 mt-6",children:c.jsxs("div",{className:"rounded-md border border-dashed border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]/60 px-4 py-6 text-center",children:[c.jsx("div",{className:"mx-auto mb-2 inline-flex h-8 w-8 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))]",children:c.jsx(Bf,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-ink-faint))]"})}),c.jsx("div",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:n("sidebar.empty.title")}),c.jsx("div",{className:"mt-1 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:n("sidebar.empty.hint")})]})})]})}),c.jsxs("div",{className:"flex flex-col gap-3 px-5 pt-3 pb-5",children:[c.jsxs("div",{className:"flex flex-col gap-0.5 border-t border-[hsl(var(--deck-hairline))] pt-3",children:[c.jsx(q5,{}),[{icon:Lf,action:()=>Xe(r),labelKey:"sidebar.section.settings"}].map(({icon:S,action:Y,labelKey:De})=>c.jsxs("button",{"data-settings-trigger":!0,onClick:Y,className:"flex h-8 w-full items-center gap-2.5 rounded-md px-2.5 font-mono text-[12.5px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:[c.jsx(S,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-ink-faint))]"}),n(De)]},De))]}),c.jsxs("div",{className:"flex gap-2 justify-between items-center",children:[c.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-[hsl(var(--deck-ink-faint))]",children:n("sidebar.language.label")}),c.jsx(hy,{})]}),c.jsxs("div",{className:"flex items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2",children:[c.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-[hsl(var(--deck-canvas-veil))]",children:c.jsx("div",{className:"h-2 w-2 rounded-full bg-[hsl(var(--deck-ink))]"})}),c.jsxs("div",{className:"flex flex-1 flex-col gap-[1px]",children:[c.jsx("span",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:n("sidebar.status.user")}),c.jsxs("span",{className:W("flex gap-1 items-center font-mono text-[10px]",O?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]"),children:[c.jsx("span",{className:W("h-1 w-1 rounded-full",O?"bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.9)]":"bg-[hsl(var(--deck-ink-faint))]/60")}),n(O?"sidebar.status.feedLive":"sidebar.status.feedOffline")]})]})]})]}),c.jsx(ky,{open:U,onOpenChange:Z})]}):c.jsx(V5,{className:e,onExpand:s,onNewChat:Oe,onOpenTaskSwitcher:()=>Xe(()=>m(!0)),onToggleTerminal:()=>Xe(a),onToggleSettings:()=>Xe(r),isTerminalOpen:i,taskEventsConnected:O,unreadCount:ce.length})}const c_=w.lazy(()=>Io(()=>import("./SettingsModal-BNz9vyER.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.SettingsModal}))),Sy=()=>Io(()=>import("./TaskSwitcher-HnRA3Mj8.js"),__vite__mapDeps([4,1,3,2])).then(e=>({default:e.TaskSwitcher})),l_=w.lazy(Sy),d_=w.lazy(()=>Io(()=>import("./FilePreview-BIjFuDdg.js"),__vite__mapDeps([5,1,3,2])).then(e=>({default:e.FilePreview}))),u_=w.lazy(()=>Io(()=>import("./TerminalPanel-Df2CK9n_.js"),__vite__mapDeps([6,1,7,8,3,2])).then(e=>({default:e.TerminalPanel}))),dc=e=>{if(e.startsWith("/Users/")){const t=e.split("/");if(t.length>=3)return"~/"+t.slice(3).join("/")}return e},f_=e=>e.replace(/^~\//,"~/§").split("/").filter(Boolean).map((t,n,r)=>{var s;return n===0&&((s=r[0])!=null&&s.startsWith("~"))?"~":t.replace(/^§/,"")});function m_({children:e}){var Ee,Pe;const t=Ft();H5();const{isSidebarOpen:n,isFilePreviewOpen:r,isSettingsOpen:s,isTerminalOpen:o,isTaskSwitcherOpen:i,toggleFilePreview:a,openFilePreview:l,previewRequestId:d,setSidebarOpen:m}=kr();w.useEffect(()=>{const U=window.setTimeout(()=>{Sy()},1500);return()=>window.clearTimeout(U)},[]);const p=L(U=>U.currentSessionId),g=L(U=>U.currentSessionRef),x=L(U=>U.sessions),b=L(U=>U.isStreaming),y=L(U=>U.isTemporarySession),j=L(U=>U.taskWorkspaceInfo),k=L(U=>U.boundProjects),A=L(U=>U.selectedProjectPath),[N,$]=w.useState(null),[Q,T]=w.useState(!1),[C,O]=w.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 639px)").matches),[R,K]=w.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 1023px)").matches),X=w.useRef(null),P=w.useRef(null),B=w.useRef(null),M=w.useMemo(()=>x.find(U=>oe({sessionId:U.sessionId,projectPath:U.projectPath},g)),[g,x]),fe=(M==null?void 0:M.taskIsolation)==="worktree"&&M.taskSourceProjectPath&&(((Ee=M.taskDelivery)==null?void 0:Ee.status)==="applied"||((Pe=M.taskDelivery)==null?void 0:Pe.status)==="discarded")?M.taskSourceProjectPath:g==null?void 0:g.projectPath;w.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 900px)"),Z=()=>{U.matches&&m(!1)};return Z(),U.addEventListener("change",Z),()=>U.removeEventListener("change",Z)},[m]),w.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 639px)"),Z=()=>O(U.matches);return Z(),U.addEventListener("change",Z),()=>U.removeEventListener("change",Z)},[]),w.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 1023px)"),Z=()=>K(U.matches);return Z(),U.addEventListener("change",Z),()=>U.removeEventListener("change",Z)},[]),w.useEffect(()=>{if(!C||!n)return;const U=requestAnimationFrame(()=>{var Z,_;(_=(Z=X.current)==null?void 0:Z.querySelector("button"))==null||_.focus()});return()=>{var Z;cancelAnimationFrame(U),(Z=P.current)==null||Z.focus({preventScroll:!0})}},[C,n]);const ve=U=>{var Ne;if(!C||!n)return;if(U.key==="Escape"){U.preventDefault(),m(!1);return}if(U.key!=="Tab")return;const Z=Array.from(((Ne=X.current)==null?void 0:Ne.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))??[]);if(Z.length===0)return;const _=Z[0],Ge=Z[Z.length-1];U.shiftKey&&document.activeElement===_?(U.preventDefault(),Ge==null||Ge.focus()):!U.shiftKey&&document.activeElement===Ge&&(U.preventDefault(),_==null||_.focus())},ke=w.useMemo(()=>!p||y?A?dc(A):null:M!=null&&M.projectPath?dc(M.taskSourceProjectPath||M.projectPath):null,[p,M,y,A]),ce=w.useMemo(()=>ke?f_(ke):[],[ke]);w.useEffect(()=>{var Z;if(!g){$(((Z=k.find(_=>_.path===A))==null?void 0:Z.gitBranch)??null);return}(async()=>{try{const _=await re.getGitInfo({sessionId:g.sessionId,projectPath:fe??g.projectPath});$(_.branch)}catch{$(null)}})()},[k,g,fe,A]);const Fe=j==null?void 0:j.taskAdmission,F=fe??A??(j==null?void 0:j.cwd)??null,me=g?ze(g):`project:${A??"none"}`,Se=r&&R;return c.jsxs("div",{className:"flex h-screen overflow-hidden bg-[hsl(var(--deck-canvas))]",children:[C&&n&&!Se&&c.jsx("button",{type:"button","aria-label":t("sidebar.action.collapse"),onClick:()=>m(!1),className:"fixed inset-0 z-40 bg-black/25 backdrop-blur-[1px]"}),c.jsx("div",{ref:X,role:C&&n&&!Se?"dialog":void 0,"aria-modal":C&&n&&!Se?!0:void 0,"aria-label":C&&n&&!Se?t("sidebar.navigationAria"):void 0,"aria-hidden":Se||C&&!n?!0:void 0,inert:Se||C&&!n?!0:void 0,onKeyDown:ve,className:W("overflow-hidden",n?"w-[260px]":"w-[64px]",C?"fixed inset-y-0 left-0 z-50 shadow-2xl transition-none":"shrink-0 transition-[width] duration-300 ease-in-out",C&&!n&&"-translate-x-full"),children:c.jsx("div",{className:W("transition-all duration-300 ease-in-out",n?"w-[260px]":"w-[64px]"),children:c.jsx(a_,{onNavigate:()=>{C&&m(!1)}})})}),c.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[c.jsxs("header",{"aria-hidden":Se||void 0,inert:Se||void 0,className:"relative z-10 flex h-14 items-center gap-2 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]/90 px-3 backdrop-blur-md sm:gap-4 sm:px-6",children:[C&&c.jsx(br,{ref:P,"data-mobile-navigation-trigger":!0,variant:"ghost",size:"icon",onClick:()=>m(!0),"aria-label":t("layout.action.openNavigation"),title:t("layout.action.openNavigation"),className:"h-9 w-9 shrink-0 rounded-md text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:c.jsx(xS,{className:"h-4 w-4"})}),c.jsxs("div",{className:"flex gap-2 items-center min-w-0",children:[ce.length>0?c.jsx("nav",{"aria-label":t("layout.workspace.pathAria"),title:ke??void 0,className:"flex min-w-0 items-center font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:ce.map((U,Z)=>{const _=Z===ce.length-1,Ge=Z===0&&U==="~";return c.jsxs("span",{className:"flex items-center min-w-0",children:[Z>0&&c.jsx("span",{className:"mx-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),Z===0&&!Ge&&c.jsx("span",{className:"mr-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),c.jsx("span",{className:W("truncate",_?"font-medium text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))]"),children:U})]},Z)})}):c.jsx("span",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:j!=null&&j.cwd?dc(j.cwd):t("layout.workspace.empty")}),N&&c.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 py-0.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))]",children:[c.jsx(el,{className:"h-3 w-3 text-[hsl(var(--deck-accent))]"}),N]})]}),c.jsxs("div",{className:"flex gap-3 items-center ml-auto",children:[Fe&&c.jsx("span",{className:"hidden items-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 py-1 md:inline-flex",children:c.jsx(ly,{inFlight:Fe.inFlight,queued:Fe.queued,maxConcurrent:Fe.maxConcurrent,compact:!0})}),c.jsxs("div",{className:"flex items-center gap-0.5",children:[c.jsx(br,{variant:"ghost",size:"icon","aria-label":t("layout.action.rewind"),title:t("layout.action.rewind"),disabled:!g||y||b,onClick:()=>T(!0),className:"h-8 w-8 rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] disabled:opacity-35",children:c.jsx(Qi,{className:"w-4 h-4"})}),c.jsx(br,{ref:B,variant:"ghost",size:"icon",onClick:()=>{if(r){a();return}l((!g||y)&&d===0?{tab:"files"}:void 0)},title:t("layout.action.filePreview"),"aria-label":t("layout.action.filePreviewToggle"),className:W("h-8 w-8 rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",r&&"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))] hover:text-[hsl(var(--deck-accent))]"),children:c.jsx(yS,{className:"w-4 h-4"})})]})]})]}),c.jsxs("main",{className:"flex-1 overflow-hidden relative flex bg-[hsl(var(--deck-canvas))]",children:[c.jsx("div",{"data-preview-background":"content","aria-hidden":Se||void 0,inert:Se||void 0,className:"flex relative flex-col flex-1 min-w-0",children:s?c.jsx(w.Suspense,{fallback:null,children:c.jsx(c_,{})}):e}),r&&c.jsx(w.Suspense,{fallback:null,children:c.jsx(d_,{returnFocusElement:B.current},me)})]})]}),o&&c.jsx(w.Suspense,{fallback:null,children:c.jsx(u_,{workspacePath:F},F??"default-workspace")}),i&&c.jsx(w.Suspense,{fallback:null,children:c.jsx(l_,{})}),c.jsx($5,{open:Q,onOpenChange:T})]})}const uc="BladeCode";function p_(){const e=Ft(),t=L(i=>i.unreadTaskKeys),n=L(i=>i.sessions),r=L(i=>i.selectSession),s=L(i=>i.selectProject),o=w.useMemo(()=>{const i=new Set(t);for(const a of n)a.pendingInteraction&&i.add(ze(pe(a)));return i.size},[n,t]);return w.useEffect(()=>(document.title=o>0?`(${o}) ${uc}`:uc,()=>{document.title=uc}),[o]),w.useEffect(()=>{const i=a=>{var g;const l=a.detail;if(!(l!=null&&l.sessionId)||!l.projectPath)return;const d=L.getState(),m=eu(d.sessions,l),p=m?fi(m,d.selectedProjectPath??((g=d.taskWorkspaceInfo)==null?void 0:g.cwd)??null):l.projectPath;d.boundProjects.some(x=>x.available&&x.path===p)&&s(p),r(l)};return window.addEventListener(Ki,i),()=>window.removeEventListener(Ki,i)},[s,r]),c.jsx("div",{className:"sr-only",role:"status","aria-live":"polite",children:o>0?e("attention.unreadAnnouncement",{count:o}):""})}const Jc=w.forwardRef(({className:e,...t},n)=>c.jsx("textarea",{className:W("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));Jc.displayName="Textarea";const g_=(e,t)=>{const n=[...e.matchAll(/(?:^|\s)(@(?:"[^"]*"|(?:[^\\ ]|\\ )*))/g)];for(const r of n){const s=r[1],o=r.index+(r[0].length-s.length),i=o+s.length;if(t>=o&&t<=i){let a=s.slice(1),l=!1;return a.startsWith('"')&&(l=!0,a=a.slice(1),a.endsWith('"')&&(a=a.slice(0,-1))),{hasQuery:!0,query:a,startIndex:o,endIndex:i,quoted:l}}}return{hasQuery:!1,query:"",startIndex:-1,endIndex:-1,quoted:!1}},h_=(e,t,n={})=>{const{debounceDelay:r=200,maxSuggestions:s=15,workspacePath:o}=n,[i,a]=w.useState([]),[l,d]=w.useState(0),[m,p]=w.useState(!1),g=w.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1,quoted:!1}:g_(e,t),[e,t]);w.useEffect(()=>{if(!g.hasQuery){a([]),p(!1);return}let y=!1;p(!0);const k=setTimeout(async()=>{try{const A=await fetch(`/suggestions/files?q=${encodeURIComponent(g.query)}&limit=${s}`,o?{headers:{"x-blade-directory":o}}:void 0);if(!A.ok)throw new Error("Failed to fetch suggestions");const N=await A.json();y||a(N)}catch(A){console.error("Failed to fetch file suggestions:",A),y||a([])}finally{y||p(!1)}},r);return()=>{y=!0,clearTimeout(k)}},[g.hasQuery,g.query,r,s,o]),w.useEffect(()=>{d(0)},[i]);const x=w.useCallback(()=>{d(y=>(y+1)%Math.max(i.length,1))},[i.length]),b=w.useCallback(()=>{d(y=>(y-1+i.length)%Math.max(i.length,1))},[i.length]);return{...g,suggestions:i,selectedIndex:l,loading:m,setSelectedIndex:d,selectNext:x,selectPrevious:b}},b_=(e,t=!1)=>e.includes(" ")||t?`@"${e}"`:`@${e}`,k_=(e,t,n)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const r=b_(n,t.quoted),s=e.slice(0,t.startIndex),o=e.slice(t.endIndex),i=s+r+" "+o,a=t.startIndex+r.length+1;return{newInput:i,newCursorPos:a}};function x_(){const[e,t]=w.useState([]),[n,r]=w.useState(-1),s=w.useRef(""),o=w.useCallback(d=>{d.trim()&&(t(m=>m[m.length-1]===d?m:[...m,d]),r(-1),s.current="")},[]),i=w.useCallback(d=>{if(e.length===0)return null;n===-1&&(s.current=d);const m=n===-1?e.length-1:Math.max(0,n-1);return r(m),e[m]??null},[e,n]),a=w.useCallback(()=>{if(n===-1)return null;const d=n+1;return d>=e.length?(r(-1),s.current):(r(d),e[d]??null)},[e,n]),l=w.useCallback(()=>{r(-1),s.current=""},[]);return{addToHistory:o,getPrevious:i,getNext:a,reset:l,historyIndex:n}}const y_=(e,t)=>{if(!e.startsWith("/"))return{hasQuery:!1,query:"",startIndex:-1,endIndex:-1};const n=e.indexOf(" "),r=n===-1?e.length:n;return t<=r?{hasQuery:!0,query:e.slice(1,t),startIndex:0,endIndex:t}:{hasQuery:!1,query:"",startIndex:-1,endIndex:-1}},S_=(e,t,n={})=>{const{debounceDelay:r=150,workspacePath:s}=n,[o,i]=w.useState([]),[a,l]=w.useState(0),[d,m]=w.useState(!1),p=w.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1}:y_(e,t),[e,t]);w.useEffect(()=>{if(!p.hasQuery){i([]),m(!1);return}let b=!1;m(!0);const j=setTimeout(async()=>{try{const k=await fetch(`/suggestions/commands?q=${encodeURIComponent(p.query)}`,s?{headers:{"x-blade-directory":s}}:void 0);if(!k.ok)throw new Error("Failed to fetch suggestions");const A=await k.json();b||i(A)}catch(k){console.error("Failed to fetch command suggestions:",k),b||i([])}finally{b||m(!1)}},r);return()=>{b=!0,clearTimeout(j)}},[p.hasQuery,p.query,r,s]),w.useEffect(()=>{l(0)},[o]);const g=w.useCallback(()=>{l(b=>(b+1)%Math.max(o.length,1))},[o.length]),x=w.useCallback(()=>{l(b=>(b-1+o.length)%Math.max(o.length,1))},[o.length]);return{...p,suggestions:o,selectedIndex:a,loading:d,setSelectedIndex:l,selectNext:g,selectPrevious:x}},w_=(e,t,n)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const r=e.slice(t.endIndex),s=n.command+" "+r.trimStart(),o=n.command.length+1;return{newInput:s,newCursorPos:o}},v_="blade.composer.draft.",Gi=new Map,wy=1;function Vi(){return typeof sessionStorage>"u"?null:sessionStorage}function Wi(e){return`${v_}${e}`}function I_(e){var n;if(!e)return{content:"",attachments:[],outputSchema:void 0};const t=Gi.get(e);if(t)return{content:t.content,attachments:[...t.attachments],outputSchema:t.outputSchema};try{const r=((n=Vi())==null?void 0:n.getItem(Wi(e)))??"";if(!r)return{content:"",attachments:[],outputSchema:void 0};try{const s=JSON.parse(r);if(s.version===wy&&typeof s.content=="string"&&(s.outputSchema===void 0||typeof s.outputSchema=="string"))return{content:s.content,attachments:[],outputSchema:s.outputSchema}}catch{}return{content:r,attachments:[],outputSchema:void 0}}catch{return{content:"",attachments:[],outputSchema:void 0}}}function cn(e,t){var s,o;if(!e)return;const n=Gi.get(e),r=t.outputSchema??(n==null?void 0:n.outputSchema);if(!t.content&&t.attachments.length===0&&!r){vy(e);return}Gi.set(e,{content:t.content,attachments:[...t.attachments],outputSchema:r});try{t.content||r?(s=Vi())==null||s.setItem(Wi(e),JSON.stringify({version:wy,content:t.content,...r?{outputSchema:r}:{}})):(o=Vi())==null||o.removeItem(Wi(e))}catch{}}function vy(e){var t;if(e){Gi.delete(e);try{(t=Vi())==null||t.removeItem(Wi(e))}catch{}}}function Qc(e){return e.reduce((t,n)=>t+n.dataUrl.length,0)}function C_(e){return`data:${e.type||"application/octet-stream"};base64,`.length+4*Math.ceil(e.size/3)}function j_(e,t){const r=Qc(e)+t.reduce((s,o)=>s+C_(o),0);return e.length+t.length>zr?{accepted:!1,reason:"count",estimatedBytes:r}:r>po?{accepted:!1,reason:"bytes",estimatedBytes:r}:{accepted:!0,estimatedBytes:r}}const T_=e=>typeof e=="object"&&"command"in e,Tf=({type:e,suggestions:t,selectedIndex:n,loading:r,onSelect:s,onHover:o,visible:i})=>{const a=w.useRef(null),l=w.useRef(null);if(w.useEffect(()=>{if(l.current&&a.current){const m=a.current,p=l.current,g=m.getBoundingClientRect(),x=p.getBoundingClientRect();x.bottom>g.bottom?m.scrollTop+=x.bottom-g.bottom+4:x.top<g.top&&(m.scrollTop-=g.top-x.top+4)}},[n]),!i||t.length===0&&!r)return null;const d=e==="command"?Hf:wu;return c.jsx("div",{className:"absolute bottom-full left-0 right-0 mb-2 z-50",children:c.jsxs("div",{className:"mx-4 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700 rounded-lg shadow-xl overflow-hidden",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-[#E5E7EB] dark:border-zinc-800 text-xs text-[#6B7280] dark:text-zinc-400",children:[c.jsx(d,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:e==="command"?"Commands":"Files"}),r&&c.jsx(lt,{className:"h-3 w-3 animate-spin ml-auto"})]}),c.jsx("div",{ref:a,className:"max-h-64 overflow-y-auto py-1",children:t.length===0&&r?c.jsx("div",{className:"px-3 py-4 text-center text-[#6B7280] dark:text-zinc-500 text-sm",children:"Loading..."}):t.length===0?c.jsx("div",{className:"px-3 py-4 text-center text-[#6B7280] dark:text-zinc-500 text-sm",children:"No matches found"}):t.map((m,p)=>{const g=p===n,x=T_(m);return c.jsx("button",{ref:g?l:null,className:W("w-full text-left px-3 py-2 flex items-start gap-3 transition-colors",g?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] hover:bg-[#F3F4F6] hover:text-[#111827] dark:text-zinc-400 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-300"),onClick:()=>s(p),onMouseEnter:()=>o(p),children:x?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-mono text-sm text-blue-600 dark:text-blue-400",children:m.command}),m.argumentHint&&c.jsx("span",{className:"text-xs text-[#9CA3AF] dark:text-zinc-500 font-mono",children:m.argumentHint})]}),c.jsx("p",{className:"text-xs text-[#9CA3AF] dark:text-zinc-500 mt-0.5 truncate",children:m.description})]})}):c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx(wu,{className:"h-4 w-4 flex-shrink-0 text-[#9CA3AF] dark:text-zinc-500"}),c.jsx("span",{className:"font-mono text-sm truncate",children:m})]})},x?m.command:m)})}),c.jsxs("div",{className:"px-3 py-1.5 border-t border-[#E5E7EB] dark:border-zinc-800 text-xs text-[#9CA3AF] dark:text-zinc-500 flex items-center gap-4",children:[c.jsxs("span",{children:[c.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"↑↓"})," ","Navigate"]}),c.jsxs("span",{children:[c.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"Tab"})," ","Select"]}),c.jsxs("span",{children:[c.jsx("kbd",{className:"px-1.5 py-0.5 bg-[#E5E7EB] dark:bg-zinc-800 rounded text-[#6B7280] dark:text-zinc-400",children:"Esc"})," ","Close"]})]})]})})},fc=[{value:hr.DEFAULT,labelKey:"chat.input.mode.default",descriptionKey:"chat.input.mode.default.desc",icon:SS},{value:hr.AUTO_EDIT,labelKey:"chat.input.mode.autoEdit",descriptionKey:"chat.input.mode.autoEdit.desc",icon:wS},{value:hr.YOLO,labelKey:"chat.input.mode.yolo",descriptionKey:"chat.input.mode.yolo.desc",icon:qf,tone:"danger"},{value:hr.PLAN,labelKey:"chat.input.mode.plan",descriptionKey:"chat.input.mode.plan.desc",icon:vS}],A_=["off"],E_=["standard"],P_=[];function mc(e){return e<1024*1024?`${Math.max(1,Math.ceil(e/1024))} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function N_({onSend:e,onAbort:t,disabled:n,submitDisabled:r=!1,shellSubmitDisabled:s=!1,isStreaming:o,isStopping:i=!1,pendingSteeringCount:a=0,pendingInputDelivery:l=null,recoveredSteeringCount:d=0,variant:m="chat",draft:p,draftAttachments:g,draftRevision:x,draftKey:b,placeholder:y,workspacePath:j}){var xu;const k=Ft(),A=w.useRef(I_(b)),[N,$]=w.useState(A.current.content),[Q,T]=w.useState(A.current.attachments),C=w.useRef(N),O=w.useRef(Q),[R,K]=w.useState(A.current.outputSchema??""),X=w.useRef(R),[P,B]=w.useState(!1),[M,fe]=w.useState(null),[ve,ke]=w.useState(void 0),[ce,Fe]=w.useState(!1),[F,me]=w.useState(!1),[Se,Ee]=w.useState(!1),[Pe,U]=w.useState(!1),[Z,_]=w.useState(!1),[Ge,Ne]=w.useState(!1),[Oe,on]=w.useState(!1),[Sn,Xe]=w.useState(null),[qn,ft]=w.useState(null),an=N.trimStart().startsWith("!"),Rn=an?s:r,_t=w.useRef(null),S=w.useRef(!1),Y=w.useRef(null),De=w.useRef(null),{currentModelId:mt,configuredModels:zn,hasLoaded:ms,loadedWorkspacePath:ps,loadModels:gs,setCurrentModel:Iy,currentMode:_a,setMode:au}=Pt(),cu=kr(v=>v.isSettingsOpen),Cy=vo(v=>v.communicationStyle),lu=L(v=>v.setMaxContextTokens),Ce=L(v=>v.currentSessionRef),du=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.selectedModelId}),jy=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.reasoningEffort}),Ty=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.serviceTier}),Ay=L(v=>{var V;return(V=v.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.responseVerbosity}),[Ey,uu]=w.useState(null),[Py,La]=w.useState(null),[Ny,Ua]=w.useState(null),[Oy,Ba]=w.useState(null),$y=zn.some(v=>v.id===du),hs=Ce?Ey??($y?du:mt):mt,Ze=zn.find(v=>v.id===hs),Ha=(Ze==null?void 0:Ze.supportedReasoningEfforts)??A_,fu=["auto",...Ha],Dr=Py??jy??"off",pi=(Ze==null?void 0:Ze.supportedServiceTiers)??E_,Ry=["auto",...pi],_r=Ny??Ty??"auto",gi=(Ze==null?void 0:Ze.supportedResponseVerbosities)??P_,My=["auto",...gi],Lr=Oy??Ay??"auto",mu=Cy??"auto",Fy=fu.length>1,Dy=pi.some(v=>v!=="standard"),_y=gi.length>0,pu=(Ze==null?void 0:Ze.displayName)||(Ze==null?void 0:Ze.model)||hs||k("chat.input.model.placeholder"),dr=((xu=Ze==null?void 0:Ze.input)==null?void 0:xu.includes("image"))===!0,Ys=Ze?k("chat.input.attachment.modelUnsupported",{model:pu}):k("chat.input.attachment.modelRequired"),hi=Q.length>0&&!dr,Jt=S_(N,ve,{workspacePath:j}),Qt=h_(N,ve,{workspacePath:j}),bs=x_(),Xs=Jt.hasQuery&&Jt.suggestions.length>0,bi=Qt.hasQuery&&Qt.suggestions.length>0,Ly=Xs||bi;w.useEffect(()=>{!cu&&(!ms||ps!==(j??null))&&gs(j??void 0)},[cu,gs,ps,ms,j]),w.useEffect(()=>{o&&(Fe(!1),me(!1),Ee(!1),U(!1),B(!1))},[o]),w.useEffect(()=>{uu(null),La(null),Ua(null),Ba(null)},[Ce==null?void 0:Ce.projectPath,Ce==null?void 0:Ce.sessionId]),w.useEffect(()=>{Dr!=="auto"&&!Ha.includes(Dr)&&La("auto")},[Dr,Ha]),w.useEffect(()=>{_r!=="auto"&&!pi.includes(_r)&&Ua("auto")},[_r,pi]),w.useEffect(()=>{Lr!=="auto"&&!gi.includes(Lr)&&Ba("auto")},[Lr,gi]),w.useEffect(()=>{ft(null)},[hs]),w.useEffect(()=>{if(p!==void 0){const v=g??O.current;C.current=p,O.current=v,$(p),T(v),Xe(null),ft(null),ke(p.length),cn(b,{content:p,attachments:v}),requestAnimationFrame(()=>{var V;return(V=Y.current)==null?void 0:V.focus()})}},[p,g,b,x]),w.useEffect(()=>()=>{cn(b,{content:C.current,attachments:O.current,outputSchema:X.current})},[b]),w.useEffect(()=>{if(!Ze)return;const v=!!Ze.contextWindow;lu(Ze.contextWindow||0,!v)},[Ze,lu]),w.useEffect(()=>{dr&&Xe(v=>v!==_t.current?v:(_t.current=null,null))},[dr]);const qa=w.useCallback(async()=>{if(!N.trim()&&Q.length===0||n||Rn||hi||S.current)return;let v;if(R.trim()){if(an){fe(k("chat.input.outputSchema.shellUnsupported")),B(!0);return}try{const q=JSON.parse(R);if(!q||typeof q!="object"||Array.isArray(q))throw new Error("schema root must be an object");v=q}catch{fe(k("chat.input.outputSchema.invalid")),B(!0);return}}N.trim()&&bs.addToHistory(N),S.current=!0,on(!0);const V=b;try{if(await e({content:N,modelId:hs??void 0,reasoningEffort:Dr,serviceTier:_r,responseVerbosity:Lr,communicationStyle:mu,attachments:Q,...v?{outputSchema:v}:{}})===!1)return;vy(V),C.current="",O.current=[],X.current="",$(""),T([]),K(""),fe(null),Xe(null),ft(null),_t.current=null,ke(void 0)}catch{}finally{S.current=!1,on(!1)}},[Q,hi,b,N,an,n,hs,Dr,Lr,mu,_r,Rn,e,R,bs,k]),Uy=w.useCallback(v=>{Xe(null),ft(null),_t.current=null,T(V=>{const q=V.filter(Te=>Te.id!==v);return O.current=q,cn(b,{content:C.current,attachments:q}),q})},[b]),gu=w.useCallback(v=>new Promise((V,q)=>{const Te=new FileReader;Te.onload=()=>{if(typeof Te.result!="string"){q(new Error("Failed to read image"));return}V({id:typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:v.name,mimeType:v.type,dataUrl:Te.result})},Te.onerror=()=>q(Te.error??new Error("Failed to read image")),Te.readAsDataURL(v)}),[]),ki=w.useCallback(async v=>{if(v.length===0)return;if(!dr){_t.current=Ys,ft(null),Xe(Ys);return}const V=j_(O.current,v),q=Te=>Te==="count"?k("chat.input.attachment.countLimit",{count:zr}):k("chat.input.attachment.sizeLimit",{size:mc(po)});if(!V.accepted){_t.current=null,ft(null),Xe(q(V.reason??"bytes"));return}try{const Te=await Promise.all(v.map(ks=>gu(ks))),Et=new Set(O.current.map(ks=>ks.dataUrl)),yu=Te.filter(ks=>Et.has(ks.dataUrl)?!1:(Et.add(ks.dataUrl),!0));if(yu.length===0){Xe(null),ft(null),_t.current=null;return}const xi=[...O.current,...yu];if(Qc(xi)>po){_t.current=null,ft(null),Xe(q("bytes"));return}O.current=xi,T(xi),Xe(null),ft(null),_t.current=null,cn(b,{content:C.current,attachments:xi})}catch{_t.current=null,ft(null),Xe(k("chat.input.attachment.readFailed"))}},[b,Ys,dr,gu,k]),By=w.useCallback(async v=>{const V=Array.from(v.target.files??[]).filter(q=>q.type.startsWith("image/"));await ki(V),v.target.value=""},[ki]),Hy=w.useCallback(async v=>{const V=Array.from(v.clipboardData.items).filter(q=>q.type.startsWith("image/")).map(q=>q.getAsFile()).filter(q=>q!==null);V.length!==0&&(v.preventDefault(),await ki(V))},[ki]),za=w.useCallback(v=>{const V=Jt.suggestions[v];if(!V)return;const{newInput:q,newCursorPos:Te}=w_(N,Jt,V);C.current=q,$(q),ke(Te),cn(b,{content:q,attachments:O.current}),requestAnimationFrame(()=>{Y.current&&(Y.current.focus(),Y.current.setSelectionRange(Te,Te))})},[b,N,Jt]),Ka=w.useCallback(v=>{const V=Qt.suggestions[v];if(!V)return;const{newInput:q,newCursorPos:Te}=k_(N,Qt,V);C.current=q,$(q),ke(Te),cn(b,{content:q,attachments:O.current}),requestAnimationFrame(()=>{Y.current&&(Y.current.focus(),Y.current.setSelectionRange(Te,Te))})},[Qt,b,N]),qy=w.useCallback(v=>{if(Xs){if(v.key==="ArrowDown"){v.preventDefault(),Jt.selectNext();return}if(v.key==="ArrowUp"){v.preventDefault(),Jt.selectPrevious();return}if(v.key==="Tab"||v.key==="Enter"&&!v.shiftKey){v.preventDefault(),za(Jt.selectedIndex);return}if(v.key==="Escape"){v.preventDefault(),ke(void 0);return}}if(bi){if(v.key==="ArrowDown"){v.preventDefault(),Qt.selectNext();return}if(v.key==="ArrowUp"){v.preventDefault(),Qt.selectPrevious();return}if(v.key==="Tab"||v.key==="Enter"&&!v.shiftKey){v.preventDefault(),Ka(Qt.selectedIndex);return}if(v.key==="Escape"){v.preventDefault(),ke(void 0);return}}if(v.key==="Enter"&&!v.shiftKey){v.preventDefault(),qa();return}if(v.key==="ArrowUp"&&!v.shiftKey){const V=v.target,q=V.selectionStart===0&&V.selectionEnd===0,Te=!N.includes(`
31
31
  `);if(q||Te){const Et=bs.getPrevious(N);Et!==null&&(v.preventDefault(),C.current=Et,$(Et),cn(b,{content:Et,attachments:O.current}),requestAnimationFrame(()=>{Y.current&&Y.current.setSelectionRange(Et.length,Et.length)}))}return}if(v.key==="ArrowDown"&&!v.shiftKey){const V=v.target,q=V.selectionStart===N.length&&V.selectionEnd===N.length,Te=!N.includes(`
32
- `);if((q||Te)&&bs.historyIndex!==-1){const Et=bs.getNext();Et!==null&&(v.preventDefault(),C.current=Et,$(Et),cn(b,{content:Et,attachments:O.current}),requestAnimationFrame(()=>{Y.current&&Y.current.setSelectionRange(Et.length,Et.length)}))}}},[Xs,bi,Jt,Qt,za,Ka,qa,b,N,bs]),zy=w.useCallback(v=>{const V=v.target.value;C.current=V,$(V),ke(v.target.selectionStart),cn(b,{content:V,attachments:O.current})},[b]),hu=w.useCallback(v=>{const V=v.target;ke(V.selectionStart)},[]);w.useEffect(()=>{Y.current&&(Y.current.style.height="inherit",Y.current.style.height=`${Math.min(Y.current.scrollHeight,200)}px`)},[N]);const Ga=fc.find(v=>v.value===_a)??fc[1],Ky=k(Ga.labelKey),Gy=Ga.icon,Vy=!!N.trim()||Q.length>0,bu=Q.length>=zr,Wy=Qc(Q),Va=Sn||(hi?Ys:null),ku=Va?null:qn,Wa=!!n||Oe,Jy=Wa||bu||!dr,Zs=dr?bu?k("chat.input.attachment.countLimit",{count:zr}):k("chat.input.attachment.add"):Ys,Qy=()=>{Wa||(ft(Zs),!dr&&!o&&zn.some(v=>{var V;return(V=v.input)==null?void 0:V.includes("image")})&&Fe(!0))};return c.jsxs("div",{className:m==="task"?"bg-transparent":"py-2.5 border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]",children:[c.jsxs("div",{className:m==="task"?"w-full":"px-4 w-full md:px-6",children:[c.jsxs("div",{className:`relative border rounded-lg bg-[hsl(var(--deck-surface))] transition-all duration-200 flex flex-col ${m==="task"?`min-h-[148px] shadow-[0_18px_60px_-24px_hsl(var(--deck-accent)/0.4)] focus-within:ring-1 ${an?"border-amber-400/70 focus-within:border-amber-500 focus-within:ring-amber-400/25":"border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-accent)/0.6)] focus-within:ring-[hsl(var(--deck-accent)/0.25)]"}`:`min-h-[56px] shadow-sm focus-within:ring-1 ${an?"border-amber-400/70 focus-within:border-amber-500 focus-within:ring-amber-400/25":"border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-border-strong))] focus-within:ring-[hsl(var(--deck-border-strong))]"}`}`,children:[c.jsx(Tf,{type:"command",suggestions:Jt.suggestions,selectedIndex:Jt.selectedIndex,loading:Jt.loading,onSelect:za,onHover:Jt.setSelectedIndex,visible:Xs}),c.jsx(Tf,{type:"file",suggestions:Qt.suggestions,selectedIndex:Qt.selectedIndex,loading:Qt.loading,onSelect:Ka,onHover:Qt.setSelectedIndex,visible:bi&&!Xs}),c.jsx(Jc,{ref:Y,"data-blade-composer":!0,value:N,onChange:zy,onKeyDown:qy,onPaste:Hy,onSelect:hu,onClick:hu,placeholder:y??k(o?"chat.input.placeholder.steering":"chat.input.placeholder.default"),className:`flex-1 w-full resize-none border-0 bg-transparent px-4 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none text-[#111827] dark:text-zinc-300 placeholder:text-[#9CA3AF] dark:placeholder:text-zinc-600 ${m==="task"?"min-h-[84px] py-4 text-[15px]":"py-2.5 text-[14px]"}`,disabled:n||Oe,"aria-busy":Oe}),an&&c.jsx("div",{className:"px-4 pb-2 font-mono text-[11px] text-amber-600 dark:text-amber-400",children:"$ user shell · runs in this Session workspace"}),o&&c.jsx("div",{className:"px-4 pb-2 text-[11px] font-mono text-amber-600 dark:text-amber-400",children:a>0&&l==="next_turn"?k("chat.input.followUp.queued",{count:a}):a>0?k("chat.input.steering.queued",{count:a}):c.jsxs(c.Fragment,{children:[k("chat.input.steering.status"),k("chat.input.steering.enterHint")]})}),d>0&&c.jsx("div",{className:"px-4 pb-2 text-[11px] font-mono text-cyan-600 dark:text-cyan-400",children:d===1?k("chat.input.steering.recoveredOne",{count:d}):k("chat.input.steering.recoveredMany",{count:d})}),Va&&c.jsxs("div",{role:"alert",className:"mx-4 mb-2 flex min-h-8 items-center gap-2 rounded-md border border-red-200 bg-red-50 px-2.5 py-1.5 text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:[c.jsx(As,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0",children:Va}),Sn&&c.jsx("button",{type:"button","aria-label":k("chat.error.dismiss"),onClick:()=>{Xe(null),_t.current=null},className:"flex justify-center items-center w-6 h-6 text-red-500 rounded shrink-0 hover:bg-red-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 dark:hover:bg-red-950",children:c.jsx(co,{className:"w-3 h-3"})})]}),ku&&c.jsxs("div",{role:"status","aria-live":"polite",className:"mx-4 mb-2 flex min-h-8 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-2.5 py-1.5 text-[11px] text-[hsl(var(--deck-ink-muted))]",children:[c.jsx(IS,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"flex-1 min-w-0",children:ku}),c.jsx("button",{type:"button","aria-label":k("chat.notice.dismiss"),onClick:()=>ft(null),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(co,{className:"w-3 h-3"})})]}),Q.length>0&&c.jsxs("div",{className:"px-4 pb-2",children:[c.jsx("div",{className:"mb-1.5 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:k("chat.input.attachment.usage",{count:Q.length,limit:zr,used:mc(Wy),budget:mc(po)})}),c.jsx("div",{className:"flex flex-wrap gap-2",children:Q.map(v=>c.jsxs("div",{title:v.name,className:"relative overflow-hidden rounded-md border border-[#E5E7EB] bg-[#F9FAFB] dark:border-zinc-800 dark:bg-zinc-900",children:[c.jsx("img",{src:v.dataUrl,alt:v.name,className:"object-cover w-20 h-20"}),c.jsx("button",{type:"button","aria-label":`${k("chat.input.attachment.remove")} ${v.name}`,title:`${k("chat.input.attachment.remove")} ${v.name}`,onClick:()=>Uy(v.id),className:"flex absolute top-1 right-1 justify-center items-center w-6 h-6 text-white rounded transition-colors bg-black/75 hover:bg-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white",children:c.jsx(co,{className:"w-3 h-3"})})]},v.id))})]}),c.jsxs("div",{className:"flex justify-between items-center px-3 py-2 mt-auto",children:[c.jsxs("div",{className:"flex gap-2 items-center",children:[Jy?c.jsx("button",{type:"button",disabled:Wa,"aria-disabled":"true","aria-label":Zs,title:Zs,onClick:Qy,className:"flex h-8 w-8 cursor-help items-center justify-center rounded-md text-[#9CA3AF] opacity-55 transition-colors hover:bg-[hsl(var(--deck-surface-2))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed dark:text-zinc-500",children:c.jsx(vu,{className:"w-4 h-4"})}):c.jsxs("label",{title:Zs,className:"relative flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[#9CA3AF] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-within:ring-1 focus-within:ring-[hsl(var(--deck-accent))] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-300",children:[c.jsx("input",{ref:De,type:"file",accept:"image/*",multiple:!0,"aria-label":Zs,className:"absolute inset-0 z-10 w-full h-full opacity-0 cursor-pointer",onChange:By}),c.jsx(vu,{className:"w-4 h-4"})]}),c.jsxs(Gn,{open:ce,onOpenChange:v=>{!o&&!Oe&&Fe(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,title:k(o?"chat.input.model.locked":"chat.input.model.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 text-xs text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[pu,c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsx(Mn,{className:"w-64 p-2 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700",align:"start",children:c.jsx("div",{className:"overflow-y-auto max-h-72",children:zn.length===0?c.jsx("div",{className:"text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-2",children:k("chat.input.model.empty")}):Object.entries(zn.reduce((v,V)=>{const q=V.provider||"unknown";return v[q]||(v[q]=[]),v[q].push(V),v},{})).map(([v,V])=>c.jsxs("div",{className:"mb-2",children:[c.jsx("div",{className:"text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-1 capitalize",children:v.replace(/-/g," ")}),V.map(q=>{var Te;return c.jsx("button",{className:`w-full text-left px-2 py-1.5 text-sm rounded hover:bg-[#E5E7EB] dark:hover:bg-zinc-800 transition-colors ${q.id===hs?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,onClick:()=>{if(ft(null),Ce){uu(q.id),Fe(!1);return}Iy(q.id,j??void 0).then(()=>Fe(!1)).catch(()=>{})},children:c.jsxs("span",{className:"flex gap-2 items-center min-w-0",children:[c.jsx("span",{className:"flex-1 min-w-0 truncate",children:q.displayName||q.model}),((Te=q.input)==null?void 0:Te.includes("image"))&&c.jsx("span",{className:"shrink-0 rounded bg-[hsl(var(--deck-accent-soft))] px-1.5 py-0.5 font-mono text-[8.5px] uppercase tracking-[0.08em] text-[hsl(var(--deck-accent))]",children:k("chat.input.model.vision")})]})},q.id)})]},v))})})]}),Fy&&c.jsxs(Gn,{open:F,onOpenChange:v=>{!o&&!Oe&&me(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.effort.change"),title:k(o?"chat.input.effort.locked":"chat.input.effort.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[k("chat.input.effort.label",{effort:Dr}),c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.effort.heading")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:fu.map(v=>c.jsxs("button",{type:"button","aria-label":k("chat.input.effort.option",{effort:v}),onClick:()=>{La(v),me(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${Dr===v?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[c.jsx("span",{className:"capitalize",children:v}),v==="auto"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.effort.autoHint")})]},v))})]})]}),Dy&&c.jsxs(Gn,{open:Se,onOpenChange:v=>{!o&&!Oe&&Ee(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.serviceTier.change"),title:k(o?"chat.input.serviceTier.locked":"chat.input.serviceTier.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[k("chat.input.serviceTier.label",{tier:_r}),c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.serviceTier.heading")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:Ry.map(v=>c.jsxs("button",{type:"button","aria-label":k("chat.input.serviceTier.option",{tier:v}),onClick:()=>{Ua(v),Ee(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${_r===v?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[c.jsx("span",{className:"capitalize",children:v}),v==="fast"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.serviceTier.fastHint")}),v==="flex"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.serviceTier.flexHint")})]},v))})]})]}),_y&&c.jsxs(Gn,{open:Pe,onOpenChange:v=>{!o&&!Oe&&U(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.responseVerbosity.change"),title:k(o?"chat.input.responseVerbosity.locked":"chat.input.responseVerbosity.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[k("chat.input.responseVerbosity.label",{verbosity:Lr}),c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.responseVerbosity.heading")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:My.map(v=>c.jsxs("button",{type:"button","aria-label":k("chat.input.responseVerbosity.option",{verbosity:v}),onClick:()=>{Ba(v),U(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${Lr===v?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[c.jsx("span",{className:"capitalize",children:v}),v==="auto"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.responseVerbosity.autoHint")})]},v))})]})]}),c.jsxs(Gn,{open:P,onOpenChange:v=>{!o&&!Oe&&B(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.outputSchema.change"),title:k(o?"chat.input.outputSchema.locked":"chat.input.outputSchema.change"),className:`flex h-7 items-center gap-1 rounded px-1.5 font-mono text-[10.5px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 ${R.trim()?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"text-[#6B7280] hover:bg-[#E5E7EB] hover:text-[#111827] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200"}`,children:[c.jsx(CS,{className:"h-3.5 w-3.5"}),R.trim()&&"JSON"]})}),c.jsxs(Mn,{className:"w-[min(440px,calc(100vw-24px))] border border-[#E5E7EB] bg-white p-0 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsxs("div",{className:"border-b border-[#E5E7EB] px-3 py-2.5 dark:border-zinc-800",children:[c.jsx("div",{className:"font-mono text-[11px] font-semibold text-[#111827] dark:text-zinc-100",children:k("chat.input.outputSchema.title")}),c.jsx("div",{className:"mt-0.5 text-[10.5px] leading-4 text-[#6B7280] dark:text-zinc-500",children:k("chat.input.outputSchema.description")})]}),c.jsxs("div",{className:"p-3",children:[c.jsx(Jc,{value:R,onChange:v=>{const V=v.target.value;X.current=V,K(V),fe(null),cn(b,{content:C.current,attachments:O.current,outputSchema:V})},spellCheck:!1,"aria-label":k("chat.input.outputSchema.editor"),"aria-invalid":!!M,placeholder:k("chat.input.outputSchema.placeholder"),className:"min-h-[180px] resize-y border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] font-mono text-[11px] leading-5 focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]"}),M&&c.jsxs("div",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-[10.5px] text-red-600 dark:text-red-400",children:[c.jsx(As,{className:"h-3.5 w-3.5"}),M]}),c.jsxs("div",{className:"mt-2.5 flex items-center justify-between gap-2",children:[c.jsx("button",{type:"button",onClick:()=>{const v=JSON.stringify({type:"object",properties:{summary:{type:"string"}},required:["summary"],additionalProperties:!1},null,2);X.current=v,K(v),fe(null),cn(b,{content:C.current,attachments:O.current,outputSchema:v})},className:"rounded px-2 py-1 font-mono text-[10.5px] text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))]",children:k("chat.input.outputSchema.example")}),c.jsx("button",{type:"button",onClick:()=>{X.current="",K(""),fe(null),cn(b,{content:C.current,attachments:O.current,outputSchema:""})},className:"rounded px-2 py-1 font-mono text-[10.5px] text-[#6B7280] hover:bg-[#F3F4F6] dark:text-zinc-400 dark:hover:bg-zinc-800",children:k("chat.input.outputSchema.clear")})]})]})]})]}),c.jsxs(Gn,{open:Z,onOpenChange:_,children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{className:`flex items-center gap-1.5 rounded px-2 py-1 text-xs transition-colors ${Ga.tone==="danger"?"text-amber-600 hover:bg-amber-500/10 dark:text-amber-400":"text-[#6B7280] hover:bg-[#E5E7EB] hover:text-[#111827] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200"}`,children:[c.jsx(Gy,{className:"h-3.5 w-3.5"}),Ky,c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-72 p-1.5 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700",align:"start",children:[c.jsx("div",{className:"px-2 pb-1.5 pt-1 text-[11px] font-medium text-[#9CA3AF] dark:text-zinc-500",children:k("chat.input.mode.aria")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:fc.map(v=>{const V=v.icon,q=_a===v.value,Te=v.tone==="danger";return c.jsxs("button",{type:"button","aria-pressed":q,className:`flex w-full items-start gap-2.5 rounded-md px-2 py-2 text-left transition-colors ${q?"bg-[#F3F4F6] dark:bg-zinc-800/70":"hover:bg-[#F3F4F6] dark:hover:bg-zinc-800/50"}`,onClick:()=>{v.value===hr.YOLO&&_a!==hr.YOLO?(_(!1),Ne(!0)):(au(v.value),_(!1))},children:[c.jsx(V,{className:`mt-0.5 h-4 w-4 shrink-0 ${Te?"text-amber-500":q?"text-[#111827] dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:`block text-[13px] font-medium leading-tight ${Te?"text-amber-600 dark:text-amber-400":"text-[#111827] dark:text-zinc-100"}`,children:k(v.labelKey)}),c.jsx("span",{className:"mt-0.5 block text-[11px] leading-snug text-[#6B7280] dark:text-zinc-500",children:k(v.descriptionKey)})]}),q&&c.jsx(_f,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"})]},v.value)})})]})]})]}),c.jsxs("div",{className:"flex gap-2 items-center",children:[o&&c.jsx(br,{size:"icon",onClick:()=>{t==null||t()},disabled:i,title:k(i?"chat.input.action.stopping":"chat.input.action.stop"),"aria-label":k(i?"chat.input.action.stopping":"chat.input.action.stop"),className:"w-8 h-8 text-white bg-red-500 hover:bg-red-600",children:i?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(tl,{className:"w-3 h-3"})}),c.jsx(br,{size:"icon",onClick:qa,disabled:!Vy||n||Rn||hi||Oe||Ly,title:k(Oe?"chat.input.action.submitting":o?"chat.input.action.steer":"chat.input.action.send"),"aria-label":k(Oe?"chat.input.action.submitting":o?"chat.input.action.steer":"chat.input.action.send"),className:"h-8 w-8 bg-[#111827] text-white hover:bg-[#0F172A] disabled:bg-[#E5E7EB] disabled:text-[#9CA3AF] dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white dark:disabled:bg-zinc-800 dark:disabled:text-zinc-600",children:Oe?c.jsx(lt,{className:"w-4 h-4 animate-spin"}):c.jsx(jS,{className:"w-4 h-4"})})]})]})]}),m==="chat"&&c.jsx("div",{className:"text-center text-xs text-[#6B7280] dark:text-zinc-600 mt-3 font-mono",children:k("chat.footer.disclaimer")})]}),c.jsx(ol,{open:Ge,onOpenChange:Ne,children:c.jsx(Yi,{className:"gap-0 rounded-xl border border-zinc-200 bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b] sm:max-w-[400px]","aria-describedby":"yolo-confirm-desc",hideCloseButton:!0,children:c.jsxs("div",{className:"flex flex-col gap-4 p-5",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-amber-100 dark:bg-amber-950/40",children:c.jsx(qf,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"})}),c.jsx(Xi,{className:"font-mono text-sm font-semibold",children:k("chat.input.mode.yolo.confirm.title")})]}),c.jsx(Zi,{id:"yolo-confirm-desc",className:"text-[13px] leading-relaxed text-zinc-600 dark:text-zinc-400",children:k("chat.input.mode.yolo.confirm.desc")}),c.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[c.jsx("button",{type:"button",onClick:()=>Ne(!1),className:"h-8 rounded-md px-3 font-mono text-[12px] font-medium text-zinc-600 transition-colors hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:k("chat.input.mode.yolo.confirm.cancel")}),c.jsx("button",{type:"button",onClick:()=>{au(hr.YOLO),Ne(!1)},className:"h-8 rounded-md bg-amber-600 px-3 font-mono text-[12px] font-semibold text-white transition-colors hover:bg-amber-700",children:k("chat.input.mode.yolo.confirm.accept")})]})]})})})]})}const O_={running:{dot:"bg-blue-500 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse",labelKey:"recent.status.running",text:"text-blue-700 dark:text-blue-400"},queued:{dot:"bg-amber-400",labelKey:"recent.status.queued",text:"text-amber-700 dark:text-amber-400"},interrupted:{dot:"bg-orange-500",labelKey:"recent.status.paused",text:"text-orange-700 dark:text-orange-400"},failed:{dot:"bg-red-500",labelKey:"recent.status.failed",text:"text-red-700 dark:text-red-400"},cancelled:{dot:"bg-zinc-400",labelKey:"recent.status.cancelled",text:"text-zinc-500"},completed:{dot:"bg-[hsl(var(--deck-accent))]",labelKey:"recent.status.done",text:"text-[hsl(var(--deck-accent))]"}};function $_(e,t){if(!e)return"";const n=new Date(e);if(Number.isNaN(n.getTime()))return"";const r=Date.now()-n.getTime(),s=Math.floor(r/6e4);if(s<1)return t("recent.time.justNow");if(s<60)return t("recent.time.minutes",{n:s});const o=Math.floor(s/60);if(o<24)return t("recent.time.hours",{n:o});const i=Math.floor(o/24);return t("recent.time.days",{n:i})}function R_(e){return e.split("/").filter(Boolean).at(-1)||e}function M_({sessions:e,onSelect:t,cancellingTaskKeys:n,retryingTaskKeys:r,unreadTaskKeys:s,onCancel:o,onRetry:i,catalogLoadState:a="ready",className:l}){const d=Ft(),m=[...e].sort(iu).slice(0,4),p=a==="loading"||a==="hydrating";return m.length===0?!p&&a!=="error"?null:c.jsxs("div",{role:a==="error"?"alert":"status",className:W("mt-7 flex items-center gap-2 rounded-md border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface))]/50 px-3 py-2 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",l),children:[p?c.jsx(lt,{className:"h-3 w-3 animate-spin text-[hsl(var(--deck-accent))]"}):c.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-amber-500"}),d(p?"sidebar.catalog.syncing":"sidebar.catalog.incomplete")]}):c.jsxs("div",{className:W("mt-7",l),children:[c.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[c.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:d("taskHome.recent.title")}),c.jsx("span",{className:"font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:d(p?"taskHome.recent.partial":a==="error"?"taskHome.recent.incomplete":"taskHome.recent.total",{count:e.length})})]}),c.jsx("div",{className:"grid grid-cols-1 gap-1 sm:grid-cols-2",children:m.map(g=>{const x=O_[g.taskStatus],b=g.pendingInteraction?g.pendingInteraction.type==="question"?"interaction.badge.question":g.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission":null,y=R_(g.taskSourceProjectPath||g.projectPath),j=ho(g,d),k=ze(pe(g)),A=g.taskStatus==="running"||g.taskStatus==="queued",N=n.includes(k),$=r.includes(k),Q=!!g.taskRetryAvailable&&(g.taskStatus==="failed"||g.taskStatus==="interrupted"||g.taskStatus==="cancelled"),T=s.includes(k),C=ru(g,d);return c.jsxs("div",{className:W("group flex items-center gap-3 rounded-md border border-transparent px-3 py-1.5 text-left transition-colors","hover:border-[hsl(var(--deck-border))] hover:bg-[hsl(var(--deck-surface))]"),children:[c.jsxs("button",{type:"button",onClick:()=>t(g),className:"flex min-w-0 flex-1 items-center gap-3 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx("span",{className:W("h-1.5 w-1.5 shrink-0 rounded-full",b?"animate-pulse bg-amber-500 shadow-[0_0_5px_rgba(245,158,11,0.75)]":x.dot)}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsxs("span",{className:"flex items-center gap-1.5 text-[12.5px] text-[hsl(var(--deck-ink))]",children:[c.jsx("span",{className:"truncate",children:j}),T&&c.jsx("span",{title:d("taskSwitcher.new"),className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.75)]"}),g.taskRetriedFrom&&c.jsx("span",{title:`${d("session.retriedFrom")} ${g.taskRetriedFrom.sessionId.slice(0,6)}`,className:"shrink-0 font-mono text-[8.5px] text-[hsl(var(--deck-accent))]",children:d("session.retryShort")})]}),c.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx("span",{className:"truncate",children:y}),c.jsx("span",{className:"opacity-40",children:"·"}),c.jsx("span",{className:W("shrink-0",b?"text-amber-700 dark:text-amber-400":x.text),children:d(b??x.labelKey)}),c.jsx("span",{className:"opacity-40",children:"·"}),c.jsx("span",{className:"shrink-0",children:$_(g.lastMessageTime||g.firstMessageTime,d)})]}),C&&c.jsx("span",{title:C,className:"mt-0.5 block truncate font-mono text-[9.5px] text-red-600 dark:text-red-400",children:C})]}),c.jsx(TS,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100"})]}),A&&c.jsx("button",{type:"button","aria-label":d(N?"session.action.stopping":"session.action.stop",{title:j}),disabled:N,onClick:()=>o(g),className:"rounded p-1.5 text-red-500 transition-colors hover:bg-red-500/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60",children:N?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(tl,{className:"h-3.5 w-3.5"})}),Q&&c.jsx("button",{type:"button","aria-label":d($?"session.action.retrying":"session.action.retry",{title:j}),disabled:$,onClick:()=>i(g),className:"rounded p-1.5 text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-60",children:$?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Qi,{className:"h-3.5 w-3.5"})})]},k)})})]})}function F_({index:e,title:t,description:n,icon:r,hint:s,onClick:o}){const i=String(e+1).padStart(2,"0"),a=`⌘${e+1}`;return c.jsxs("button",{type:"button",onClick:o,className:W("group relative flex min-h-[100px] flex-col justify-between overflow-hidden rounded-lg border p-3.5 text-left transition","border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]","hover:-translate-y-[1px] hover:border-[hsl(var(--deck-accent)/0.55)] hover:shadow-[0_10px_28px_-14px_hsl(var(--deck-accent)/0.35)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--deck-accent))] focus-visible:ring-offset-2 focus-visible:ring-offset-[hsl(var(--deck-canvas))]","dark:bg-[hsl(var(--deck-surface))] dark:hover:shadow-[0_10px_28px_-14px_hsl(var(--deck-accent)/0.55)]"),children:[c.jsx("span",{"aria-hidden":"true",className:W("pointer-events-none absolute right-3 top-3 h-2 w-2","border-r border-t border-[hsl(var(--deck-border-strong))]","transition-colors group-hover:border-[hsl(var(--deck-accent))]")}),c.jsxs("div",{className:"flex items-start justify-between",children:[c.jsx("span",{className:W("inline-flex h-8 w-8 items-center justify-center rounded-md border transition-colors","border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))]","group-hover:border-[hsl(var(--deck-accent)/0.5)] group-hover:bg-[hsl(var(--deck-accent-soft))]"),children:c.jsx(r,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))] transition-colors group-hover:text-[hsl(var(--deck-accent))]"})}),c.jsx("span",{className:"font-mono text-[10px] tracking-[0.16em] text-[hsl(var(--deck-ink-faint))]",children:i})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-[13px] font-semibold text-[hsl(var(--deck-ink))]",children:t}),c.jsx("div",{className:"mt-1 line-clamp-2 text-[11.5px] leading-[1.45] text-[hsl(var(--deck-ink-muted))]",children:n}),c.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[c.jsx("span",{className:"truncate font-mono text-[10px] text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100",children:s}),c.jsx("span",{className:"deck-kbd shrink-0 opacity-0 transition-opacity group-hover:opacity-100",children:a})]})]})]})}const pc=[{key:"explore",titleKey:"taskHome.template.explore.title",descriptionKey:"taskHome.template.explore.description",icon:rl,prompt:"Explore this codebase and explain ",hintKey:"taskHome.template.explore.hint"},{key:"build",titleKey:"taskHome.template.build.title",descriptionKey:"taskHome.template.build.description",icon:AS,prompt:"Build a production-ready ",hintKey:"taskHome.template.build.hint"},{key:"review",titleKey:"taskHome.template.review.title",descriptionKey:"taskHome.template.review.description",icon:ES,prompt:"/review uncommitted",hintKey:"taskHome.template.review.hint"},{key:"fix",titleKey:"taskHome.template.fix.title",descriptionKey:"taskHome.template.fix.description",icon:PS,prompt:"Investigate and fix ",hintKey:"taskHome.template.fix.hint"}];function D_(e,t){return t?t.split("/").filter(Boolean).at(-1)||t:e("taskHome.hero.projectFallback")}function __(){const e=Ft(),{taskWorkspaceInfo:t,isTaskWorkspaceLoading:n,taskWorkspaceError:r,isDispatchingTask:s,sessions:o,boundProjects:i,selectedProjectPath:a,error:l,selectProject:d,dispatchTask:m,startCodeReview:p,sendMessage:g,startTemporarySession:x,selectSession:b,cancelTask:y,cancellingTaskKeys:j,retryTask:k,retryingTaskKeys:A,unreadTaskKeys:N,taskEventConnectionState:$,catalogLoadState:Q,reconnectTaskEvents:T,clearError:C,loadTaskWorkspaceInfo:O,loadBoundProjects:R}=L(),K=kr(S=>S.openSettings),X=kr(S=>S.isSettingsOpen),P=Pt(S=>S.currentMode),B=Pt(S=>S.currentModelId),M=Pt(S=>S.configuredModels),fe=Pt(S=>S.isLoading),ve=Pt(S=>S.hasLoaded),ke=Pt(S=>S.loadedWorkspacePath),ce=Pt(S=>S.error),Fe=Pt(S=>S.loadModels),[F,me]=w.useState("worktree"),[Se,Ee]=w.useState(),[Pe,U]=w.useState(!1),Z=e($==="connected"?"taskHome.eyebrow":$==="reconnecting"?"taskHome.feed.reconnecting":$==="offline"?"taskHome.feed.offline":"taskHome.feed.connecting"),_=w.useMemo(()=>i.find(S=>S.path===a)??i.find(S=>S.isCurrent),[i,a]),Ge=w.useMemo(()=>r2(o,a,(t==null?void 0:t.cwd)??null),[a,o,t==null?void 0:t.cwd]),Ne=(_!=null&&_.available?_.path:void 0)??(t==null?void 0:t.cwd),Oe=`task:${Ne??"unavailable"}`;w.useEffect(()=>{!X&&Ne&&(!ve||ke!==Ne)&&Fe(Ne)},[X,Fe,ke,ve,Ne]);const on=!(_!=null&&_.available)&&n,Sn=_!=null&&_.available?null:r,Xe=!!(Ne&&!on&&!Sn),qn=!!(B&&M.some(S=>S.id===B)),ft=!ve||fe,an=Xe&&qn&&!ft&&ce===null,Rn=w.useMemo(()=>({project:D_(e,(_==null?void 0:_.path)??(t==null?void 0:t.cwd)),branch:(_==null?void 0:_.gitBranch)??(t==null?void 0:t.gitBranch)??e("taskHome.context.branchFallback")}),[_,t,e]),_t=w.useCallback(async S=>{const Y=S.content.trim();if(Y==="/review"||Y.startsWith("/review ")){if(S.attachments.length>0)throw new Error(e("taskHome.review.attachmentsUnsupported"));if(S.outputSchema)throw new Error(e("taskHome.review.outputSchemaUnsupported"));const De=Y.split(/\s+/),mt=De[1]||"uncommitted";if(mt!=="uncommitted"&&mt!=="base"&&mt!=="commit"||mt==="uncommitted"&&De.length!==2&&De.length!==1||(mt==="base"||mt==="commit")&&De.length!==3)throw new Error(e("taskHome.review.usage"));await p({projectPath:Ne,kind:mt,...De[2]?{ref:De[2]}:{},modelId:S.modelId??B??void 0});return}if(S.content.trimStart().startsWith("!")){x(Ne),await g({content:S.content,attachments:[]});return}await m({prompt:S.content,projectPath:Ne,isolation:F,permissionMode:P,modelId:S.modelId??B??void 0,reasoningEffort:S.reasoningEffort,serviceTier:S.serviceTier,responseVerbosity:S.responseVerbosity,communicationStyle:S.communicationStyle,...S.outputSchema?{outputSchema:S.outputSchema}:{},attachments:S.attachments.map(De=>({type:"image",content:De.dataUrl,mimeType:De.mimeType,name:De.name}))})},[P,B,m,F,g,p,x,Ne,e]);return w.useEffect(()=>{const S=Y=>{if(!(Y.metaKey||Y.ctrlKey))return;const De=Number.parseInt(Y.key,10);if(Number.isNaN(De)||De<1||De>pc.length)return;const mt=pc[De-1];mt&&(Y.preventDefault(),Ee({key:Oe,content:mt.prompt}))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[Oe]),c.jsx("main",{className:"deck-canvas relative flex-1 overflow-y-auto text-[hsl(var(--deck-ink))]",children:c.jsxs("div",{className:"mx-auto flex min-h-full w-full max-w-[960px] flex-col px-6 py-8 md:px-8 md:py-10",children:[c.jsxs("div",{className:"flex gap-4 items-start mb-6",children:[c.jsx(ou,{size:36,className:"hidden mt-1 sm:inline-flex"}),c.jsxs("div",{className:"flex-1",children:[c.jsxs("div",{className:W("deck-eyebrow flex items-center gap-2",$==="offline"?"text-amber-700 dark:text-amber-400":"text-[hsl(var(--deck-accent))]"),children:[$==="offline"?c.jsx(Iu,{className:"w-3 h-3"}):c.jsx("span",{className:"deck-pulse-dot"}),Z]}),c.jsxs("h1",{className:"mt-2.5 max-w-3xl text-balance text-[clamp(28px,3vw,34px)] font-medium leading-[1.12] tracking-[-0.028em] text-[hsl(var(--deck-ink))]",children:[e("taskHome.hero.prefix")," ",c.jsx("span",{className:"whitespace-nowrap font-mono text-[0.82em] text-[hsl(var(--deck-accent))]",children:Rn.project}),c.jsx("span",{className:"text-[hsl(var(--deck-ink-muted))]",children:"?"})]}),c.jsx("p",{className:"mt-2 max-w-[46rem] text-[13px] leading-[1.55] text-[hsl(var(--deck-ink-muted))]",children:e("taskHome.hero.subtitle")})]})]}),c.jsxs("div",{className:"mb-4",children:[c.jsxs("div",{className:"flex justify-between items-center mb-2",children:[c.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.templates.title")}),c.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(Hf,{className:"w-3 h-3"}),c.jsx("span",{children:e("taskHome.templates.hint")})]})]}),c.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4",children:pc.map((S,Y)=>c.jsx(F_,{index:Y,title:e(S.titleKey),description:e(S.descriptionKey),icon:S.icon,hint:e(S.hintKey),onClick:()=>Ee({key:Oe,content:S.prompt})},S.key))})]}),c.jsxs("div",{className:"rounded-xl border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] shadow-[0_28px_80px_-32px_hsl(var(--deck-accent)/0.28),0_2px_0_hsl(var(--deck-hairline))]",children:[c.jsxs("div",{className:"flex items-center gap-0 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface-2))]/50",children:[c.jsxs("div",{className:"flex flex-1 items-center min-w-0",children:[c.jsxs(Gn,{children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button","aria-label":e("taskHome.context.projectSelect"),disabled:i.length===0,className:"group flex h-9 min-w-0 items-center gap-2 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11.5px] text-[hsl(var(--deck-ink))] transition-colors hover:bg-[hsl(var(--deck-surface))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))] disabled:opacity-50",children:[c.jsx(uo,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"font-medium truncate",children:(_==null?void 0:_.name)??Rn.project}),c.jsx(Ss,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-ink-faint))] transition-transform group-data-[state=open]:rotate-180"})]})}),c.jsx(Mn,{align:"start",sideOffset:4,className:"w-56 rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-1 shadow-xl",children:c.jsxs("div",{className:"flex flex-col",children:[i.map(S=>c.jsxs("button",{type:"button",disabled:!S.available,onClick:()=>{d(S.path)},className:W("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-left font-mono text-[12px] transition-colors",S.path===a?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink))]",!S.available&&"opacity-40"),children:[c.jsx(uo,{className:"w-3 h-3 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0 truncate",children:S.name}),S.path===a&&c.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))]"})]},S.path)),i.length===0&&c.jsx("span",{className:"px-2.5 py-2 text-center font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.setup.workspace.empty")})]})})]}),c.jsxs("button",{type:"button","aria-pressed":F==="worktree",onClick:()=>me(S=>S==="worktree"?"local":"worktree"),className:W("flex h-9 shrink-0 items-center gap-1.5 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11px] transition-colors",F==="worktree"?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),title:e("taskHome.context.isolationToggleTitle"),children:[F==="worktree"?c.jsx(NS,{className:"w-3 h-3"}):c.jsx(OS,{className:"w-3 h-3"}),c.jsx("span",{className:"hidden sm:inline",children:e(F==="worktree"?"taskHome.context.isolation.worktree":"taskHome.context.isolation.local")})]}),c.jsxs("span",{className:"flex h-9 shrink-0 items-center gap-1.5 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:[c.jsx(el,{className:"w-3 h-3"}),c.jsx("span",{className:"hidden sm:inline",children:Rn.branch})]})]}),c.jsxs("div",{className:"flex gap-2 items-center px-3 shrink-0",children:[(t==null?void 0:t.taskAdmission)&&c.jsx(ly,{inFlight:t.taskAdmission.inFlight,queued:t.taskAdmission.queued,maxConcurrent:t.taskAdmission.maxConcurrent,compact:!0}),s&&c.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-accent))]",children:[c.jsx(lt,{className:"w-3 h-3 animate-spin"}),c.jsx("span",{className:"hidden sm:inline",children:e("taskHome.context.preparing")})]})]})]}),!an&&c.jsxs("section",{"aria-label":e("taskHome.setup.aria"),className:"border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))] px-3 py-3",children:[c.jsxs("div",{className:"mb-2.5",children:[c.jsx("h2",{className:"font-mono text-[11px] font-semibold uppercase tracking-[0.12em] text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.title")}),c.jsx("p",{className:"mt-0.5 text-[11px] text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.setup.description")})]}),c.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2.5",children:[c.jsx("span",{className:W("flex justify-center items-center w-7 h-7 rounded-md border shrink-0",Xe?"text-emerald-700 bg-emerald-50 border-emerald-300/70 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":Sn?"text-red-700 bg-red-50 border-red-300/70 dark:border-red-900/70 dark:bg-red-950/40 dark:text-red-300":"text-amber-700 bg-amber-50 border-amber-300/70 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300"),children:on?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):Xe?c.jsx(Cu,{className:"h-3.5 w-3.5"}):Sn?c.jsx(As,{className:"h-3.5 w-3.5"}):c.jsx(uo,{className:"h-3.5 w-3.5"})}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"block font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.workspace.title")}),c.jsx("span",{className:"mt-0.5 block truncate text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:on?e("taskHome.setup.workspace.loading"):Sn||(Xe?e("taskHome.setup.workspace.ready",{project:Rn.project}):e("taskHome.setup.workspace.required"))})]}),!Xe&&c.jsxs("div",{className:"flex gap-1 items-center shrink-0",children:[Sn&&c.jsx("button",{type:"button",onClick:()=>{Promise.all([O(),R()])},"aria-label":e("taskHome.setup.workspace.retry"),title:e("taskHome.setup.workspace.retry"),className:"flex h-8 w-8 items-center justify-center rounded-md text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-canvas))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(lo,{className:"h-3.5 w-3.5"})}),c.jsxs("button",{type:"button","data-project-setup-trigger":!0,onClick:()=>U(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] hover:border-[hsl(var(--deck-accent)/0.55)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx(Oi,{className:"w-3 h-3"}),e("taskHome.setup.workspace.action")]})]})]}),c.jsxs("div",{className:"flex min-w-0 items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2.5",children:[c.jsx("span",{className:W("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",qn&&!ce?"border-emerald-300/70 bg-emerald-50 text-emerald-700 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":ce?"border-red-300/70 bg-red-50 text-red-700 dark:border-red-900/70 dark:bg-red-950/40 dark:text-red-300":"border-amber-300/70 bg-amber-50 text-amber-700 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300"),children:ft?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):qn&&!ce?c.jsx(Cu,{className:"h-3.5 w-3.5"}):ce?c.jsx(As,{className:"h-3.5 w-3.5"}):c.jsx(ju,{className:"h-3.5 w-3.5"})}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"block font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.model.title")}),c.jsx("span",{title:ce??void 0,className:W("mt-0.5 block truncate text-[10.5px]",ce?"text-red-600 dark:text-red-400":"text-[hsl(var(--deck-ink-faint))]"),children:ft?e("taskHome.setup.model.loading"):ce||e(qn?"taskHome.setup.model.ready":"taskHome.setup.model.required")})]}),!ft&&(!qn||ce)&&c.jsxs("button",{type:"button","data-model-setup-trigger":!0,onClick:()=>{ce?Fe(Ne):K("models")},className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] hover:border-[hsl(var(--deck-accent)/0.55)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[ce?c.jsx(lo,{className:"w-3 h-3"}):c.jsx(ju,{className:"w-3 h-3"}),e(ce?"taskHome.setup.model.retry":"taskHome.setup.model.action")]})]})]})]}),c.jsx("div",{className:"px-3 pt-3 pb-3",children:c.jsx(N_,{variant:"task",draft:(Se==null?void 0:Se.key)===Oe?Se.content:void 0,draftKey:Oe,placeholder:e("taskHome.composer.placeholder"),onSend:async S=>{try{return await _t(S),Ee(void 0),!0}catch{return!1}},disabled:s,submitDisabled:!an,shellSubmitDisabled:!an,workspacePath:Ne},Oe)})]}),$==="offline"&&c.jsxs("div",{role:"alert",className:"flex flex-wrap gap-3 items-center px-3 py-2 mt-4 text-amber-900 rounded-md border border-amber-300/70 bg-amber-50/80 dark:border-amber-800/70 dark:bg-amber-950/35 dark:text-amber-200",children:[c.jsx(Iu,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"min-w-0 flex-1 text-[12px]",children:e("taskHome.feed.offlineDescription")}),c.jsxs("button",{type:"button",onClick:()=>void T().catch(()=>{}),className:"inline-flex min-h-8 items-center gap-1.5 rounded-md border border-amber-400/70 bg-white/60 px-2.5 font-mono text-[10.5px] font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-700 dark:bg-amber-950/50 dark:hover:bg-amber-900/50",children:[c.jsx(lo,{className:"w-3 h-3"}),e("taskHome.feed.retry")]})]}),l&&c.jsxs("div",{role:"alert",className:"flex justify-between items-center px-3 py-2 mt-4 font-mono text-xs text-red-700 rounded-md border border-red-200 bg-red-50/80 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:[c.jsx("span",{children:l}),c.jsx("button",{type:"button",onClick:C,className:"underline",children:e("taskHome.error.dismiss")})]}),c.jsx(M_,{sessions:Ge,catalogLoadState:Q,cancellingTaskKeys:j,retryingTaskKeys:A,unreadTaskKeys:N,onSelect:S=>{b(pe(S))},onCancel:S=>{y(pe(S)).catch(()=>{})},onRetry:S=>{k(pe(S)).catch(()=>{})}}),c.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(Bf,{className:"w-3 h-3"}),c.jsx("span",{className:"font-mono uppercase tracking-[0.14em]",children:e("taskHome.footer.note")})]}),c.jsx(ky,{open:Pe,onOpenChange:U})]})})}const Yc="blade.sessions.last",Ji="session",Xc="project",Zc="workspace";function L_(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return typeof t.sessionId=="string"&&t.sessionId.trim()&&typeof t.projectPath=="string"&&t.projectPath.trim()?{sessionId:t.sessionId,projectPath:t.projectPath}:null}function U_(e){var o,i,a;const t=new URLSearchParams(e),n=((o=t.get(Ji))==null?void 0:o.trim())||null,r=((i=t.get(Xc))==null?void 0:i.trim())||null,s=((a=t.get(Zc))==null?void 0:a.trim())||null;return{sessionRef:n&&(s||r)?{sessionId:n,projectPath:s||r}:null,projectPath:r,hasSessionParam:t.has(Ji)}}function B_(e=typeof localStorage>"u"?null:localStorage){if(!e)return null;try{const t=e.getItem(Yc);return t?L_(JSON.parse(t)):null}catch{return null}}function H_(e,t,n={}){const r=n.href??(typeof window>"u"?"http://localhost/":window.location.href),s=new URL(r),o=n.displayProjectPath??(e==null?void 0:e.projectPath)??t,i=(e==null?void 0:e.projectPath)??null;e?s.searchParams.set(Ji,e.sessionId):s.searchParams.delete(Ji),o?s.searchParams.set(Xc,o):s.searchParams.delete(Xc),i&&o&&i!==o?s.searchParams.set(Zc,i):s.searchParams.delete(Zc);const a=n.storage===void 0?typeof localStorage>"u"?null:localStorage:n.storage;try{e?a==null||a.setItem(Yc,JSON.stringify(e)):a==null||a.removeItem(Yc)}catch{}const l=`${s.pathname}${s.search}${s.hash}`,d=n.replaceState??(typeof window>"u"?void 0:m=>window.history.replaceState(null,"",m));return d==null||d(l),l}const q_=w.lazy(()=>Io(()=>import("./ChatView-DG6MMrFK.js"),__vite__mapDeps([9,1,3,2])).then(e=>({default:e.ChatView})));function z_(){const e=Ft(),[t,n]=w.useState(!1),r=L(A=>A.subscribeToTaskEvents),s=L(A=>A.unsubscribeFromTaskEvents),o=L(A=>A.currentSessionRef),i=L(A=>A.isTemporarySession),a=L(A=>A.loadTaskWorkspaceInfo),l=L(A=>A.loadBoundProjects),d=L(A=>A.loadSessions),m=L(A=>A.selectSession),p=L(A=>A.selectProject),g=L(A=>A.startTemporarySession),x=L(A=>A.setError),b=L(A=>A.sessions),y=L(A=>A.selectedProjectPath),j=Pt(A=>A.loadModels),k=vo(A=>A.loadSettings);return w.useEffect(()=>(r().catch(A=>{console.error("Failed to subscribe to task events",A)}),s),[r,s]),w.useEffect(()=>{let A=!1;return(async()=>{var X;d(),k(),j();const $=U_(window.location.search),Q=B_(),T=$.hasSessionParam?$.sessionRef:$.projectPath?null:Q,C=Promise.all([a(),l()]),O=!T&&!$.projectPath;if(O&&(g(),n(!0)),await C,A)return;const R=L.getState(),K=$.projectPath?(X=R.boundProjects.find(P=>P.path===$.projectPath&&P.available))==null?void 0:X.path:null;if(K&&p(K),!(T&&(await m(T),A))){if(!T||!oe(L.getState().currentSessionRef,T)){const P=T?L.getState().error:null;g(),P&&x(P)}O||n(!0)}})(),()=>{A=!0}},[l,j,d,k,a,p,m,x,g]),w.useEffect(()=>{if(!t)return;const A=o?eu(b,o):void 0;H_(o,y,{displayProjectPath:A?fi(A,y):y})},[o,t,y,b]),c.jsxs(c.Fragment,{children:[c.jsx(p_,{}),c.jsx(m_,{children:t?!o||i?c.jsx(__,{}):c.jsx(w.Suspense,{fallback:c.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")}),children:c.jsx(q_,{})}):c.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")})})]})}Zy.createRoot(document.getElementById("root")).render(c.jsx(oo.StrictMode,{children:c.jsx(z_,{})}));export{Pt as A,ou as B,N_ as C,ol as D,I5 as E,vo as F,D5 as G,iu as H,ho as I,fi as J,dy as K,qc as L,He as M,Vc as N,Y_ as O,Gn as P,cf as Q,br as R,su as S,Q_ as T,Io as _,L as a,kr as b,pe as c,ze as d,Yi as e,il as f,Xi as g,Zi as h,Xf as i,W as j,re as k,JD as l,Zn as m,Fa as n,Pi as o,v0 as p,eu as q,p2 as r,oe as s,sy as t,Ft as u,vf as v,pr as w,by as x,Vn as y,Mn as z};
32
+ `);if((q||Te)&&bs.historyIndex!==-1){const Et=bs.getNext();Et!==null&&(v.preventDefault(),C.current=Et,$(Et),cn(b,{content:Et,attachments:O.current}),requestAnimationFrame(()=>{Y.current&&Y.current.setSelectionRange(Et.length,Et.length)}))}}},[Xs,bi,Jt,Qt,za,Ka,qa,b,N,bs]),zy=w.useCallback(v=>{const V=v.target.value;C.current=V,$(V),ke(v.target.selectionStart),cn(b,{content:V,attachments:O.current})},[b]),hu=w.useCallback(v=>{const V=v.target;ke(V.selectionStart)},[]);w.useEffect(()=>{Y.current&&(Y.current.style.height="inherit",Y.current.style.height=`${Math.min(Y.current.scrollHeight,200)}px`)},[N]);const Ga=fc.find(v=>v.value===_a)??fc[1],Ky=k(Ga.labelKey),Gy=Ga.icon,Vy=!!N.trim()||Q.length>0,bu=Q.length>=zr,Wy=Qc(Q),Va=Sn||(hi?Ys:null),ku=Va?null:qn,Wa=!!n||Oe,Jy=Wa||bu||!dr,Zs=dr?bu?k("chat.input.attachment.countLimit",{count:zr}):k("chat.input.attachment.add"):Ys,Qy=()=>{Wa||(ft(Zs),!dr&&!o&&zn.some(v=>{var V;return(V=v.input)==null?void 0:V.includes("image")})&&Fe(!0))};return c.jsxs("div",{className:m==="task"?"bg-transparent":"py-2.5 border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))]",children:[c.jsxs("div",{className:m==="task"?"w-full":"px-4 w-full md:px-6",children:[c.jsxs("div",{className:`relative border rounded-lg bg-[hsl(var(--deck-surface))] transition-all duration-200 flex flex-col ${m==="task"?`min-h-[148px] shadow-[0_18px_60px_-24px_hsl(var(--deck-accent)/0.4)] focus-within:ring-1 ${an?"border-amber-400/70 focus-within:border-amber-500 focus-within:ring-amber-400/25":"border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-accent)/0.6)] focus-within:ring-[hsl(var(--deck-accent)/0.25)]"}`:`min-h-[56px] shadow-sm focus-within:ring-1 ${an?"border-amber-400/70 focus-within:border-amber-500 focus-within:ring-amber-400/25":"border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-border-strong))] focus-within:ring-[hsl(var(--deck-border-strong))]"}`}`,children:[c.jsx(Tf,{type:"command",suggestions:Jt.suggestions,selectedIndex:Jt.selectedIndex,loading:Jt.loading,onSelect:za,onHover:Jt.setSelectedIndex,visible:Xs}),c.jsx(Tf,{type:"file",suggestions:Qt.suggestions,selectedIndex:Qt.selectedIndex,loading:Qt.loading,onSelect:Ka,onHover:Qt.setSelectedIndex,visible:bi&&!Xs}),c.jsx(Jc,{ref:Y,"data-blade-composer":!0,value:N,onChange:zy,onKeyDown:qy,onPaste:Hy,onSelect:hu,onClick:hu,placeholder:y??k(o?"chat.input.placeholder.steering":"chat.input.placeholder.default"),className:`flex-1 w-full resize-none border-0 bg-transparent px-4 focus-visible:ring-0 focus-visible:ring-offset-0 focus:outline-none text-[#111827] dark:text-zinc-300 placeholder:text-[#9CA3AF] dark:placeholder:text-zinc-600 ${m==="task"?"min-h-[84px] py-4 text-[15px]":"py-2.5 text-[14px]"}`,disabled:n||Oe,"aria-busy":Oe}),an&&c.jsx("div",{className:"px-4 pb-2 font-mono text-[11px] text-amber-600 dark:text-amber-400",children:"$ user shell · runs in this Session workspace"}),o&&c.jsx("div",{className:"px-4 pb-2 text-[11px] font-mono text-amber-600 dark:text-amber-400",children:a>0&&l==="next_turn"?k("chat.input.followUp.queued",{count:a}):a>0?k("chat.input.steering.queued",{count:a}):c.jsxs(c.Fragment,{children:[k("chat.input.steering.status"),k("chat.input.steering.enterHint")]})}),d>0&&c.jsx("div",{className:"px-4 pb-2 text-[11px] font-mono text-cyan-600 dark:text-cyan-400",children:d===1?k("chat.input.steering.recoveredOne",{count:d}):k("chat.input.steering.recoveredMany",{count:d})}),Va&&c.jsxs("div",{role:"alert",className:"mx-4 mb-2 flex min-h-8 items-center gap-2 rounded-md border border-red-200 bg-red-50 px-2.5 py-1.5 text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:[c.jsx(As,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0",children:Va}),Sn&&c.jsx("button",{type:"button","aria-label":k("chat.error.dismiss"),onClick:()=>{Xe(null),_t.current=null},className:"flex justify-center items-center w-6 h-6 text-red-500 rounded shrink-0 hover:bg-red-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 dark:hover:bg-red-950",children:c.jsx(co,{className:"w-3 h-3"})})]}),ku&&c.jsxs("div",{role:"status","aria-live":"polite",className:"mx-4 mb-2 flex min-h-8 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-2.5 py-1.5 text-[11px] text-[hsl(var(--deck-ink-muted))]",children:[c.jsx(IS,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"flex-1 min-w-0",children:ku}),c.jsx("button",{type:"button","aria-label":k("chat.notice.dismiss"),onClick:()=>ft(null),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(co,{className:"w-3 h-3"})})]}),Q.length>0&&c.jsxs("div",{className:"px-4 pb-2",children:[c.jsx("div",{className:"mb-1.5 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:k("chat.input.attachment.usage",{count:Q.length,limit:zr,used:mc(Wy),budget:mc(po)})}),c.jsx("div",{className:"flex flex-wrap gap-2",children:Q.map(v=>c.jsxs("div",{title:v.name,className:"relative overflow-hidden rounded-md border border-[#E5E7EB] bg-[#F9FAFB] dark:border-zinc-800 dark:bg-zinc-900",children:[c.jsx("img",{src:v.dataUrl,alt:v.name,className:"object-cover w-20 h-20"}),c.jsx("button",{type:"button","aria-label":`${k("chat.input.attachment.remove")} ${v.name}`,title:`${k("chat.input.attachment.remove")} ${v.name}`,onClick:()=>Uy(v.id),className:"flex absolute top-1 right-1 justify-center items-center w-6 h-6 text-white rounded transition-colors bg-black/75 hover:bg-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white",children:c.jsx(co,{className:"w-3 h-3"})})]},v.id))})]}),c.jsxs("div",{className:"flex justify-between items-center px-3 py-2 mt-auto",children:[c.jsxs("div",{className:"flex gap-2 items-center",children:[Jy?c.jsx("button",{type:"button",disabled:Wa,"aria-disabled":"true","aria-label":Zs,title:Zs,onClick:Qy,className:"flex h-8 w-8 cursor-help items-center justify-center rounded-md text-[#9CA3AF] opacity-55 transition-colors hover:bg-[hsl(var(--deck-surface-2))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed dark:text-zinc-500",children:c.jsx(vu,{className:"w-4 h-4"})}):c.jsxs("label",{title:Zs,className:"relative flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[#9CA3AF] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-within:ring-1 focus-within:ring-[hsl(var(--deck-accent))] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-300",children:[c.jsx("input",{ref:De,type:"file",accept:"image/*",multiple:!0,"aria-label":Zs,className:"absolute inset-0 z-10 w-full h-full opacity-0 cursor-pointer",onChange:By}),c.jsx(vu,{className:"w-4 h-4"})]}),c.jsxs(Gn,{open:ce,onOpenChange:v=>{!o&&!Oe&&Fe(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,title:k(o?"chat.input.model.locked":"chat.input.model.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 text-xs text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[pu,c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsx(Mn,{className:"w-64 p-2 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700",align:"start",children:c.jsx("div",{className:"overflow-y-auto max-h-72",children:zn.length===0?c.jsx("div",{className:"text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-2",children:k("chat.input.model.empty")}):Object.entries(zn.reduce((v,V)=>{const q=V.provider||"unknown";return v[q]||(v[q]=[]),v[q].push(V),v},{})).map(([v,V])=>c.jsxs("div",{className:"mb-2",children:[c.jsx("div",{className:"text-xs text-[#6B7280] dark:text-zinc-500 px-2 py-1 capitalize",children:v.replace(/-/g," ")}),V.map(q=>{var Te;return c.jsx("button",{className:`w-full text-left px-2 py-1.5 text-sm rounded hover:bg-[#E5E7EB] dark:hover:bg-zinc-800 transition-colors ${q.id===hs?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,onClick:()=>{if(ft(null),Ce){uu(q.id),Fe(!1);return}Iy(q.id,j??void 0).then(()=>Fe(!1)).catch(()=>{})},children:c.jsxs("span",{className:"flex gap-2 items-center min-w-0",children:[c.jsx("span",{className:"flex-1 min-w-0 truncate",children:q.displayName||q.model}),((Te=q.input)==null?void 0:Te.includes("image"))&&c.jsx("span",{className:"shrink-0 rounded bg-[hsl(var(--deck-accent-soft))] px-1.5 py-0.5 font-mono text-[8.5px] uppercase tracking-[0.08em] text-[hsl(var(--deck-accent))]",children:k("chat.input.model.vision")})]})},q.id)})]},v))})})]}),Fy&&c.jsxs(Gn,{open:F,onOpenChange:v=>{!o&&!Oe&&me(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.effort.change"),title:k(o?"chat.input.effort.locked":"chat.input.effort.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[k("chat.input.effort.label",{effort:Dr}),c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.effort.heading")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:fu.map(v=>c.jsxs("button",{type:"button","aria-label":k("chat.input.effort.option",{effort:v}),onClick:()=>{La(v),me(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${Dr===v?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[c.jsx("span",{className:"capitalize",children:v}),v==="auto"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.effort.autoHint")})]},v))})]})]}),Dy&&c.jsxs(Gn,{open:Se,onOpenChange:v=>{!o&&!Oe&&Ee(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.serviceTier.change"),title:k(o?"chat.input.serviceTier.locked":"chat.input.serviceTier.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[k("chat.input.serviceTier.label",{tier:_r}),c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.serviceTier.heading")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:Ry.map(v=>c.jsxs("button",{type:"button","aria-label":k("chat.input.serviceTier.option",{tier:v}),onClick:()=>{Ua(v),Ee(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${_r===v?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[c.jsx("span",{className:"capitalize",children:v}),v==="fast"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.serviceTier.fastHint")}),v==="flex"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.serviceTier.flexHint")})]},v))})]})]}),_y&&c.jsxs(Gn,{open:Pe,onOpenChange:v=>{!o&&!Oe&&U(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.responseVerbosity.change"),title:k(o?"chat.input.responseVerbosity.locked":"chat.input.responseVerbosity.change"),className:"flex cursor-pointer items-center gap-1 rounded px-2 py-1 font-mono text-[11px] text-[#6B7280] transition-colors hover:bg-[#E5E7EB] hover:text-[#111827] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200",children:[k("chat.input.responseVerbosity.label",{verbosity:Lr}),c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-52 border border-[#E5E7EB] bg-white p-1 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsx("div",{className:"px-2 py-1 font-mono text-[9px] uppercase tracking-[0.12em] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.responseVerbosity.heading")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:My.map(v=>c.jsxs("button",{type:"button","aria-label":k("chat.input.responseVerbosity.option",{verbosity:v}),onClick:()=>{Ba(v),U(!1)},className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-left font-mono text-[11px] transition-colors hover:bg-[#E5E7EB] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] dark:hover:bg-zinc-800 ${Lr===v?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,children:[c.jsx("span",{className:"capitalize",children:v}),v==="auto"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.responseVerbosity.autoHint")})]},v))})]})]}),c.jsxs(Gn,{open:P,onOpenChange:v=>{!o&&!Oe&&B(v)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||Oe,"aria-label":k("chat.input.outputSchema.change"),title:k(o?"chat.input.outputSchema.locked":"chat.input.outputSchema.change"),className:`flex h-7 items-center gap-1 rounded px-1.5 font-mono text-[10.5px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-not-allowed disabled:opacity-55 ${R.trim()?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"text-[#6B7280] hover:bg-[#E5E7EB] hover:text-[#111827] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200"}`,children:[c.jsx(CS,{className:"h-3.5 w-3.5"}),R.trim()&&"JSON"]})}),c.jsxs(Mn,{className:"w-[min(440px,calc(100vw-24px))] border border-[#E5E7EB] bg-white p-0 dark:border-zinc-700 dark:bg-zinc-900",align:"start",children:[c.jsxs("div",{className:"border-b border-[#E5E7EB] px-3 py-2.5 dark:border-zinc-800",children:[c.jsx("div",{className:"font-mono text-[11px] font-semibold text-[#111827] dark:text-zinc-100",children:k("chat.input.outputSchema.title")}),c.jsx("div",{className:"mt-0.5 text-[10.5px] leading-4 text-[#6B7280] dark:text-zinc-500",children:k("chat.input.outputSchema.description")})]}),c.jsxs("div",{className:"p-3",children:[c.jsx(Jc,{value:R,onChange:v=>{const V=v.target.value;X.current=V,K(V),fe(null),cn(b,{content:C.current,attachments:O.current,outputSchema:V})},spellCheck:!1,"aria-label":k("chat.input.outputSchema.editor"),"aria-invalid":!!M,placeholder:k("chat.input.outputSchema.placeholder"),className:"min-h-[180px] resize-y border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] font-mono text-[11px] leading-5 focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]"}),M&&c.jsxs("div",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-[10.5px] text-red-600 dark:text-red-400",children:[c.jsx(As,{className:"h-3.5 w-3.5"}),M]}),c.jsxs("div",{className:"mt-2.5 flex items-center justify-between gap-2",children:[c.jsx("button",{type:"button",onClick:()=>{const v=JSON.stringify({type:"object",properties:{summary:{type:"string"}},required:["summary"],additionalProperties:!1},null,2);X.current=v,K(v),fe(null),cn(b,{content:C.current,attachments:O.current,outputSchema:v})},className:"rounded px-2 py-1 font-mono text-[10.5px] text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))]",children:k("chat.input.outputSchema.example")}),c.jsx("button",{type:"button",onClick:()=>{X.current="",K(""),fe(null),cn(b,{content:C.current,attachments:O.current,outputSchema:""})},className:"rounded px-2 py-1 font-mono text-[10.5px] text-[#6B7280] hover:bg-[#F3F4F6] dark:text-zinc-400 dark:hover:bg-zinc-800",children:k("chat.input.outputSchema.clear")})]})]})]})]}),c.jsxs(Gn,{open:Z,onOpenChange:_,children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{className:`flex items-center gap-1.5 rounded px-2 py-1 text-xs transition-colors ${Ga.tone==="danger"?"text-amber-600 hover:bg-amber-500/10 dark:text-amber-400":"text-[#6B7280] hover:bg-[#E5E7EB] hover:text-[#111827] dark:text-zinc-500 dark:hover:bg-zinc-800/50 dark:hover:text-zinc-200"}`,children:[c.jsx(Gy,{className:"h-3.5 w-3.5"}),Ky,c.jsx(Ss,{className:"w-3 h-3"})]})}),c.jsxs(Mn,{className:"w-72 p-1.5 bg-white dark:bg-zinc-900 border border-[#E5E7EB] dark:border-zinc-700",align:"start",children:[c.jsx("div",{className:"px-2 pb-1.5 pt-1 text-[11px] font-medium text-[#9CA3AF] dark:text-zinc-500",children:k("chat.input.mode.aria")}),c.jsx("div",{className:"flex flex-col gap-0.5",children:fc.map(v=>{const V=v.icon,q=_a===v.value,Te=v.tone==="danger";return c.jsxs("button",{type:"button","aria-pressed":q,className:`flex w-full items-start gap-2.5 rounded-md px-2 py-2 text-left transition-colors ${q?"bg-[#F3F4F6] dark:bg-zinc-800/70":"hover:bg-[#F3F4F6] dark:hover:bg-zinc-800/50"}`,onClick:()=>{v.value===hr.YOLO&&_a!==hr.YOLO?(_(!1),Ne(!0)):(au(v.value),_(!1))},children:[c.jsx(V,{className:`mt-0.5 h-4 w-4 shrink-0 ${Te?"text-amber-500":q?"text-[#111827] dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:`block text-[13px] font-medium leading-tight ${Te?"text-amber-600 dark:text-amber-400":"text-[#111827] dark:text-zinc-100"}`,children:k(v.labelKey)}),c.jsx("span",{className:"mt-0.5 block text-[11px] leading-snug text-[#6B7280] dark:text-zinc-500",children:k(v.descriptionKey)})]}),q&&c.jsx(_f,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"})]},v.value)})})]})]})]}),c.jsxs("div",{className:"flex gap-2 items-center",children:[o&&c.jsx(br,{size:"icon",onClick:()=>{t==null||t()},disabled:i,title:k(i?"chat.input.action.stopping":"chat.input.action.stop"),"aria-label":k(i?"chat.input.action.stopping":"chat.input.action.stop"),className:"w-8 h-8 text-white bg-red-500 hover:bg-red-600",children:i?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(tl,{className:"w-3 h-3"})}),c.jsx(br,{size:"icon",onClick:qa,disabled:!Vy||n||Rn||hi||Oe||Ly,title:k(Oe?"chat.input.action.submitting":o?"chat.input.action.steer":"chat.input.action.send"),"aria-label":k(Oe?"chat.input.action.submitting":o?"chat.input.action.steer":"chat.input.action.send"),className:"h-8 w-8 bg-[#111827] text-white hover:bg-[#0F172A] disabled:bg-[#E5E7EB] disabled:text-[#9CA3AF] dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white dark:disabled:bg-zinc-800 dark:disabled:text-zinc-600",children:Oe?c.jsx(lt,{className:"w-4 h-4 animate-spin"}):c.jsx(jS,{className:"w-4 h-4"})})]})]})]}),m==="chat"&&c.jsx("div",{className:"text-center text-xs text-[#6B7280] dark:text-zinc-600 mt-3 font-mono",children:k("chat.footer.disclaimer")})]}),c.jsx(ol,{open:Ge,onOpenChange:Ne,children:c.jsx(Yi,{className:"gap-0 rounded-xl border border-zinc-200 bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b] sm:max-w-[400px]","aria-describedby":"yolo-confirm-desc",hideCloseButton:!0,children:c.jsxs("div",{className:"flex flex-col gap-4 p-5",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-amber-100 dark:bg-amber-950/40",children:c.jsx(qf,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"})}),c.jsx(Xi,{className:"font-mono text-sm font-semibold",children:k("chat.input.mode.yolo.confirm.title")})]}),c.jsx(Zi,{id:"yolo-confirm-desc",className:"text-[13px] leading-relaxed text-zinc-600 dark:text-zinc-400",children:k("chat.input.mode.yolo.confirm.desc")}),c.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[c.jsx("button",{type:"button",onClick:()=>Ne(!1),className:"h-8 rounded-md px-3 font-mono text-[12px] font-medium text-zinc-600 transition-colors hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:k("chat.input.mode.yolo.confirm.cancel")}),c.jsx("button",{type:"button",onClick:()=>{au(hr.YOLO),Ne(!1)},className:"h-8 rounded-md bg-amber-600 px-3 font-mono text-[12px] font-semibold text-white transition-colors hover:bg-amber-700",children:k("chat.input.mode.yolo.confirm.accept")})]})]})})})]})}const O_={running:{dot:"bg-blue-500 shadow-[0_0_5px_rgba(59,130,246,0.7)] animate-pulse",labelKey:"recent.status.running",text:"text-blue-700 dark:text-blue-400"},queued:{dot:"bg-amber-400",labelKey:"recent.status.queued",text:"text-amber-700 dark:text-amber-400"},interrupted:{dot:"bg-orange-500",labelKey:"recent.status.paused",text:"text-orange-700 dark:text-orange-400"},failed:{dot:"bg-red-500",labelKey:"recent.status.failed",text:"text-red-700 dark:text-red-400"},cancelled:{dot:"bg-zinc-400",labelKey:"recent.status.cancelled",text:"text-zinc-500"},completed:{dot:"bg-[hsl(var(--deck-accent))]",labelKey:"recent.status.done",text:"text-[hsl(var(--deck-accent))]"}};function $_(e,t){if(!e)return"";const n=new Date(e);if(Number.isNaN(n.getTime()))return"";const r=Date.now()-n.getTime(),s=Math.floor(r/6e4);if(s<1)return t("recent.time.justNow");if(s<60)return t("recent.time.minutes",{n:s});const o=Math.floor(s/60);if(o<24)return t("recent.time.hours",{n:o});const i=Math.floor(o/24);return t("recent.time.days",{n:i})}function R_(e){return e.split("/").filter(Boolean).at(-1)||e}function M_({sessions:e,onSelect:t,cancellingTaskKeys:n,retryingTaskKeys:r,unreadTaskKeys:s,onCancel:o,onRetry:i,catalogLoadState:a="ready",className:l}){const d=Ft(),m=[...e].sort(iu).slice(0,4),p=a==="loading"||a==="hydrating";return m.length===0?!p&&a!=="error"?null:c.jsxs("div",{role:a==="error"?"alert":"status",className:W("mt-7 flex items-center gap-2 rounded-md border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface))]/50 px-3 py-2 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",l),children:[p?c.jsx(lt,{className:"h-3 w-3 animate-spin text-[hsl(var(--deck-accent))]"}):c.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-amber-500"}),d(p?"sidebar.catalog.syncing":"sidebar.catalog.incomplete")]}):c.jsxs("div",{className:W("mt-7",l),children:[c.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[c.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:d("taskHome.recent.title")}),c.jsx("span",{className:"font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:d(p?"taskHome.recent.partial":a==="error"?"taskHome.recent.incomplete":"taskHome.recent.total",{count:e.length})})]}),c.jsx("div",{className:"grid grid-cols-1 gap-1 sm:grid-cols-2",children:m.map(g=>{const x=O_[g.taskStatus],b=g.pendingInteraction?g.pendingInteraction.type==="question"?"interaction.badge.question":g.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission":null,y=R_(g.taskSourceProjectPath||g.projectPath),j=ho(g,d),k=ze(pe(g)),A=g.taskStatus==="running"||g.taskStatus==="queued",N=n.includes(k),$=r.includes(k),Q=!!g.taskRetryAvailable&&(g.taskStatus==="failed"||g.taskStatus==="interrupted"||g.taskStatus==="cancelled"),T=s.includes(k),C=ru(g,d);return c.jsxs("div",{className:W("group flex items-center gap-3 rounded-md border border-transparent px-3 py-1.5 text-left transition-colors","hover:border-[hsl(var(--deck-border))] hover:bg-[hsl(var(--deck-surface))]"),children:[c.jsxs("button",{type:"button",onClick:()=>t(g),className:"flex min-w-0 flex-1 items-center gap-3 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx("span",{className:W("h-1.5 w-1.5 shrink-0 rounded-full",b?"animate-pulse bg-amber-500 shadow-[0_0_5px_rgba(245,158,11,0.75)]":x.dot)}),c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsxs("span",{className:"flex items-center gap-1.5 text-[12.5px] text-[hsl(var(--deck-ink))]",children:[c.jsx("span",{className:"truncate",children:j}),T&&c.jsx("span",{title:d("taskSwitcher.new"),className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.75)]"}),g.taskRetriedFrom&&c.jsx("span",{title:`${d("session.retriedFrom")} ${g.taskRetriedFrom.sessionId.slice(0,6)}`,className:"shrink-0 font-mono text-[8.5px] text-[hsl(var(--deck-accent))]",children:d("session.retryShort")})]}),c.jsxs("span",{className:"mt-0.5 flex items-center gap-1.5 truncate font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx("span",{className:"truncate",children:y}),c.jsx("span",{className:"opacity-40",children:"·"}),c.jsx("span",{className:W("shrink-0",b?"text-amber-700 dark:text-amber-400":x.text),children:d(b??x.labelKey)}),c.jsx("span",{className:"opacity-40",children:"·"}),c.jsx("span",{className:"shrink-0",children:$_(g.lastMessageTime||g.firstMessageTime,d)})]}),C&&c.jsx("span",{title:C,className:"mt-0.5 block truncate font-mono text-[9.5px] text-red-600 dark:text-red-400",children:C})]}),c.jsx(TS,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100"})]}),A&&c.jsx("button",{type:"button","aria-label":d(N?"session.action.stopping":"session.action.stop",{title:j}),disabled:N,onClick:()=>o(g),className:"rounded p-1.5 text-red-500 transition-colors hover:bg-red-500/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60",children:N?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(tl,{className:"h-3.5 w-3.5"})}),Q&&c.jsx("button",{type:"button","aria-label":d($?"session.action.retrying":"session.action.retry",{title:j}),disabled:$,onClick:()=>i(g),className:"rounded p-1.5 text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-60",children:$?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Qi,{className:"h-3.5 w-3.5"})})]},k)})})]})}function F_({index:e,title:t,description:n,icon:r,hint:s,onClick:o}){const i=String(e+1).padStart(2,"0"),a=`⌘${e+1}`;return c.jsxs("button",{type:"button",onClick:o,className:W("group relative flex min-h-[100px] flex-col justify-between overflow-hidden rounded-lg border p-3.5 text-left transition","border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]","hover:-translate-y-[1px] hover:border-[hsl(var(--deck-accent)/0.55)] hover:shadow-[0_10px_28px_-14px_hsl(var(--deck-accent)/0.35)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--deck-accent))] focus-visible:ring-offset-2 focus-visible:ring-offset-[hsl(var(--deck-canvas))]","dark:bg-[hsl(var(--deck-surface))] dark:hover:shadow-[0_10px_28px_-14px_hsl(var(--deck-accent)/0.55)]"),children:[c.jsx("span",{"aria-hidden":"true",className:W("pointer-events-none absolute right-3 top-3 h-2 w-2","border-r border-t border-[hsl(var(--deck-border-strong))]","transition-colors group-hover:border-[hsl(var(--deck-accent))]")}),c.jsxs("div",{className:"flex items-start justify-between",children:[c.jsx("span",{className:W("inline-flex h-8 w-8 items-center justify-center rounded-md border transition-colors","border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))]","group-hover:border-[hsl(var(--deck-accent)/0.5)] group-hover:bg-[hsl(var(--deck-accent-soft))]"),children:c.jsx(r,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))] transition-colors group-hover:text-[hsl(var(--deck-accent))]"})}),c.jsx("span",{className:"font-mono text-[10px] tracking-[0.16em] text-[hsl(var(--deck-ink-faint))]",children:i})]}),c.jsxs("div",{children:[c.jsx("div",{className:"text-[13px] font-semibold text-[hsl(var(--deck-ink))]",children:t}),c.jsx("div",{className:"mt-1 line-clamp-2 text-[11.5px] leading-[1.45] text-[hsl(var(--deck-ink-muted))]",children:n}),c.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[c.jsx("span",{className:"truncate font-mono text-[10px] text-[hsl(var(--deck-ink-faint))] opacity-0 transition-opacity group-hover:opacity-100",children:s}),c.jsx("span",{className:"deck-kbd shrink-0 opacity-0 transition-opacity group-hover:opacity-100",children:a})]})]})]})}const pc=[{key:"explore",titleKey:"taskHome.template.explore.title",descriptionKey:"taskHome.template.explore.description",icon:rl,prompt:"Explore this codebase and explain ",hintKey:"taskHome.template.explore.hint"},{key:"build",titleKey:"taskHome.template.build.title",descriptionKey:"taskHome.template.build.description",icon:AS,prompt:"Build a production-ready ",hintKey:"taskHome.template.build.hint"},{key:"review",titleKey:"taskHome.template.review.title",descriptionKey:"taskHome.template.review.description",icon:ES,prompt:"/review uncommitted",hintKey:"taskHome.template.review.hint"},{key:"fix",titleKey:"taskHome.template.fix.title",descriptionKey:"taskHome.template.fix.description",icon:PS,prompt:"Investigate and fix ",hintKey:"taskHome.template.fix.hint"}];function D_(e,t){return t?t.split("/").filter(Boolean).at(-1)||t:e("taskHome.hero.projectFallback")}function __(){const e=Ft(),{taskWorkspaceInfo:t,isTaskWorkspaceLoading:n,taskWorkspaceError:r,isDispatchingTask:s,sessions:o,boundProjects:i,selectedProjectPath:a,error:l,selectProject:d,dispatchTask:m,startCodeReview:p,sendMessage:g,startTemporarySession:x,selectSession:b,cancelTask:y,cancellingTaskKeys:j,retryTask:k,retryingTaskKeys:A,unreadTaskKeys:N,taskEventConnectionState:$,catalogLoadState:Q,reconnectTaskEvents:T,clearError:C,loadTaskWorkspaceInfo:O,loadBoundProjects:R}=L(),K=kr(S=>S.openSettings),X=kr(S=>S.isSettingsOpen),P=Pt(S=>S.currentMode),B=Pt(S=>S.currentModelId),M=Pt(S=>S.configuredModels),fe=Pt(S=>S.isLoading),ve=Pt(S=>S.hasLoaded),ke=Pt(S=>S.loadedWorkspacePath),ce=Pt(S=>S.error),Fe=Pt(S=>S.loadModels),[F,me]=w.useState("worktree"),[Se,Ee]=w.useState(),[Pe,U]=w.useState(!1),Z=e($==="connected"?"taskHome.eyebrow":$==="reconnecting"?"taskHome.feed.reconnecting":$==="offline"?"taskHome.feed.offline":"taskHome.feed.connecting"),_=w.useMemo(()=>i.find(S=>S.path===a)??i.find(S=>S.isCurrent),[i,a]),Ge=w.useMemo(()=>r2(o,a,(t==null?void 0:t.cwd)??null),[a,o,t==null?void 0:t.cwd]),Ne=(_!=null&&_.available?_.path:void 0)??(t==null?void 0:t.cwd),Oe=`task:${Ne??"unavailable"}`;w.useEffect(()=>{!X&&Ne&&(!ve||ke!==Ne)&&Fe(Ne)},[X,Fe,ke,ve,Ne]);const on=!(_!=null&&_.available)&&n,Sn=_!=null&&_.available?null:r,Xe=!!(Ne&&!on&&!Sn),qn=!!(B&&M.some(S=>S.id===B)),ft=!ve||fe,an=Xe&&qn&&!ft&&ce===null,Rn=w.useMemo(()=>({project:D_(e,(_==null?void 0:_.path)??(t==null?void 0:t.cwd)),branch:(_==null?void 0:_.gitBranch)??(t==null?void 0:t.gitBranch)??e("taskHome.context.branchFallback")}),[_,t,e]),_t=w.useCallback(async S=>{const Y=S.content.trim();if(Y==="/review"||Y.startsWith("/review ")){if(S.attachments.length>0)throw new Error(e("taskHome.review.attachmentsUnsupported"));if(S.outputSchema)throw new Error(e("taskHome.review.outputSchemaUnsupported"));const De=Y.split(/\s+/),mt=De[1]||"uncommitted";if(mt!=="uncommitted"&&mt!=="base"&&mt!=="commit"||mt==="uncommitted"&&De.length!==2&&De.length!==1||(mt==="base"||mt==="commit")&&De.length!==3)throw new Error(e("taskHome.review.usage"));await p({projectPath:Ne,kind:mt,...De[2]?{ref:De[2]}:{},modelId:S.modelId??B??void 0});return}if(S.content.trimStart().startsWith("!")){x(Ne),await g({content:S.content,attachments:[]});return}await m({prompt:S.content,projectPath:Ne,isolation:F,permissionMode:P,modelId:S.modelId??B??void 0,reasoningEffort:S.reasoningEffort,serviceTier:S.serviceTier,responseVerbosity:S.responseVerbosity,communicationStyle:S.communicationStyle,...S.outputSchema?{outputSchema:S.outputSchema}:{},attachments:S.attachments.map(De=>({type:"image",content:De.dataUrl,mimeType:De.mimeType,name:De.name}))})},[P,B,m,F,g,p,x,Ne,e]);return w.useEffect(()=>{const S=Y=>{if(!(Y.metaKey||Y.ctrlKey))return;const De=Number.parseInt(Y.key,10);if(Number.isNaN(De)||De<1||De>pc.length)return;const mt=pc[De-1];mt&&(Y.preventDefault(),Ee({key:Oe,content:mt.prompt}))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[Oe]),c.jsx("main",{className:"deck-canvas relative flex-1 overflow-y-auto text-[hsl(var(--deck-ink))]",children:c.jsxs("div",{className:"mx-auto flex min-h-full w-full max-w-[960px] flex-col px-6 py-8 md:px-8 md:py-10",children:[c.jsxs("div",{className:"flex gap-4 items-start mb-6",children:[c.jsx(ou,{size:36,className:"hidden mt-1 sm:inline-flex"}),c.jsxs("div",{className:"flex-1",children:[c.jsxs("div",{className:W("deck-eyebrow flex items-center gap-2",$==="offline"?"text-amber-700 dark:text-amber-400":"text-[hsl(var(--deck-accent))]"),children:[$==="offline"?c.jsx(Iu,{className:"w-3 h-3"}):c.jsx("span",{className:"deck-pulse-dot"}),Z]}),c.jsxs("h1",{className:"mt-2.5 max-w-3xl text-balance text-[clamp(28px,3vw,34px)] font-medium leading-[1.12] tracking-[-0.028em] text-[hsl(var(--deck-ink))]",children:[e("taskHome.hero.prefix")," ",c.jsx("span",{className:"whitespace-nowrap font-mono text-[0.82em] text-[hsl(var(--deck-accent))]",children:Rn.project}),c.jsx("span",{className:"text-[hsl(var(--deck-ink-muted))]",children:"?"})]}),c.jsx("p",{className:"mt-2 max-w-[46rem] text-[13px] leading-[1.55] text-[hsl(var(--deck-ink-muted))]",children:e("taskHome.hero.subtitle")})]})]}),c.jsxs("div",{className:"mb-4",children:[c.jsxs("div",{className:"flex justify-between items-center mb-2",children:[c.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.templates.title")}),c.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(Hf,{className:"w-3 h-3"}),c.jsx("span",{children:e("taskHome.templates.hint")})]})]}),c.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4",children:pc.map((S,Y)=>c.jsx(F_,{index:Y,title:e(S.titleKey),description:e(S.descriptionKey),icon:S.icon,hint:e(S.hintKey),onClick:()=>Ee({key:Oe,content:S.prompt})},S.key))})]}),c.jsxs("div",{className:"rounded-xl border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] shadow-[0_28px_80px_-32px_hsl(var(--deck-accent)/0.28),0_2px_0_hsl(var(--deck-hairline))]",children:[c.jsxs("div",{className:"flex items-center gap-0 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface-2))]/50",children:[c.jsxs("div",{className:"flex flex-1 items-center min-w-0",children:[c.jsxs(Gn,{children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button","aria-label":e("taskHome.context.projectSelect"),disabled:i.length===0,className:"group flex h-9 min-w-0 items-center gap-2 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11.5px] text-[hsl(var(--deck-ink))] transition-colors hover:bg-[hsl(var(--deck-surface))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))] disabled:opacity-50",children:[c.jsx(uo,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"font-medium truncate",children:(_==null?void 0:_.name)??Rn.project}),c.jsx(Ss,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-ink-faint))] transition-transform group-data-[state=open]:rotate-180"})]})}),c.jsx(Mn,{align:"start",sideOffset:4,className:"w-56 rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-1 shadow-xl",children:c.jsxs("div",{className:"flex flex-col",children:[i.map(S=>c.jsxs("button",{type:"button",disabled:!S.available,onClick:()=>{d(S.path)},className:W("flex items-center gap-2 rounded-md px-2.5 py-1.5 text-left font-mono text-[12px] transition-colors",S.path===a?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink))]",!S.available&&"opacity-40"),children:[c.jsx(uo,{className:"w-3 h-3 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0 truncate",children:S.name}),S.path===a&&c.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-accent))]"})]},S.path)),i.length===0&&c.jsx("span",{className:"px-2.5 py-2 text-center font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.setup.workspace.empty")})]})})]}),c.jsxs("button",{type:"button","aria-pressed":F==="worktree",onClick:()=>me(S=>S==="worktree"?"local":"worktree"),className:W("flex h-9 shrink-0 items-center gap-1.5 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11px] transition-colors",F==="worktree"?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),title:e("taskHome.context.isolationToggleTitle"),children:[F==="worktree"?c.jsx(NS,{className:"w-3 h-3"}):c.jsx(OS,{className:"w-3 h-3"}),c.jsx("span",{className:"hidden sm:inline",children:e(F==="worktree"?"taskHome.context.isolation.worktree":"taskHome.context.isolation.local")})]}),c.jsxs("span",{className:"flex h-9 shrink-0 items-center gap-1.5 border-r border-[hsl(var(--deck-hairline))] px-3 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:[c.jsx(el,{className:"w-3 h-3"}),c.jsx("span",{className:"hidden sm:inline",children:Rn.branch})]})]}),c.jsxs("div",{className:"flex gap-2 items-center px-3 shrink-0",children:[(t==null?void 0:t.taskAdmission)&&c.jsx(ly,{inFlight:t.taskAdmission.inFlight,queued:t.taskAdmission.queued,maxConcurrent:t.taskAdmission.maxConcurrent,compact:!0}),s&&c.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-accent))]",children:[c.jsx(lt,{className:"w-3 h-3 animate-spin"}),c.jsx("span",{className:"hidden sm:inline",children:e("taskHome.context.preparing")})]})]})]}),!an&&c.jsxs("section",{"aria-label":e("taskHome.setup.aria"),className:"border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))] px-3 py-3",children:[c.jsxs("div",{className:"mb-2.5",children:[c.jsx("h2",{className:"font-mono text-[11px] font-semibold uppercase tracking-[0.12em] text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.title")}),c.jsx("p",{className:"mt-0.5 text-[11px] text-[hsl(var(--deck-ink-faint))]",children:e("taskHome.setup.description")})]}),c.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2.5",children:[c.jsx("span",{className:W("flex justify-center items-center w-7 h-7 rounded-md border shrink-0",Xe?"text-emerald-700 bg-emerald-50 border-emerald-300/70 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":Sn?"text-red-700 bg-red-50 border-red-300/70 dark:border-red-900/70 dark:bg-red-950/40 dark:text-red-300":"text-amber-700 bg-amber-50 border-amber-300/70 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300"),children:on?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):Xe?c.jsx(Cu,{className:"h-3.5 w-3.5"}):Sn?c.jsx(As,{className:"h-3.5 w-3.5"}):c.jsx(uo,{className:"h-3.5 w-3.5"})}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"block font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.workspace.title")}),c.jsx("span",{className:"mt-0.5 block truncate text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:on?e("taskHome.setup.workspace.loading"):Sn||(Xe?e("taskHome.setup.workspace.ready",{project:Rn.project}):e("taskHome.setup.workspace.required"))})]}),!Xe&&c.jsxs("div",{className:"flex gap-1 items-center shrink-0",children:[Sn&&c.jsx("button",{type:"button",onClick:()=>{Promise.all([O(),R()])},"aria-label":e("taskHome.setup.workspace.retry"),title:e("taskHome.setup.workspace.retry"),className:"flex h-8 w-8 items-center justify-center rounded-md text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-canvas))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:c.jsx(lo,{className:"h-3.5 w-3.5"})}),c.jsxs("button",{type:"button","data-project-setup-trigger":!0,onClick:()=>U(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] hover:border-[hsl(var(--deck-accent)/0.55)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[c.jsx(Oi,{className:"w-3 h-3"}),e("taskHome.setup.workspace.action")]})]})]}),c.jsxs("div",{className:"flex min-w-0 items-center gap-2.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-2.5",children:[c.jsx("span",{className:W("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",qn&&!ce?"border-emerald-300/70 bg-emerald-50 text-emerald-700 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":ce?"border-red-300/70 bg-red-50 text-red-700 dark:border-red-900/70 dark:bg-red-950/40 dark:text-red-300":"border-amber-300/70 bg-amber-50 text-amber-700 dark:border-amber-800/70 dark:bg-amber-950/40 dark:text-amber-300"),children:ft?c.jsx(lt,{className:"h-3.5 w-3.5 animate-spin"}):qn&&!ce?c.jsx(Cu,{className:"h-3.5 w-3.5"}):ce?c.jsx(As,{className:"h-3.5 w-3.5"}):c.jsx(ju,{className:"h-3.5 w-3.5"})}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"block font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:e("taskHome.setup.model.title")}),c.jsx("span",{title:ce??void 0,className:W("mt-0.5 block truncate text-[10.5px]",ce?"text-red-600 dark:text-red-400":"text-[hsl(var(--deck-ink-faint))]"),children:ft?e("taskHome.setup.model.loading"):ce||e(qn?"taskHome.setup.model.ready":"taskHome.setup.model.required")})]}),!ft&&(!qn||ce)&&c.jsxs("button",{type:"button","data-model-setup-trigger":!0,onClick:()=>{ce?Fe(Ne):K("models")},className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] hover:border-[hsl(var(--deck-accent)/0.55)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[ce?c.jsx(lo,{className:"w-3 h-3"}):c.jsx(ju,{className:"w-3 h-3"}),e(ce?"taskHome.setup.model.retry":"taskHome.setup.model.action")]})]})]})]}),c.jsx("div",{className:"px-3 pt-3 pb-3",children:c.jsx(N_,{variant:"task",draft:(Se==null?void 0:Se.key)===Oe?Se.content:void 0,draftKey:Oe,placeholder:e("taskHome.composer.placeholder"),onSend:async S=>{try{return await _t(S),Ee(void 0),!0}catch{return!1}},disabled:s,submitDisabled:!an,shellSubmitDisabled:!an,workspacePath:Ne},Oe)})]}),$==="offline"&&c.jsxs("div",{role:"alert",className:"flex flex-wrap gap-3 items-center px-3 py-2 mt-4 text-amber-900 rounded-md border border-amber-300/70 bg-amber-50/80 dark:border-amber-800/70 dark:bg-amber-950/35 dark:text-amber-200",children:[c.jsx(Iu,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"min-w-0 flex-1 text-[12px]",children:e("taskHome.feed.offlineDescription")}),c.jsxs("button",{type:"button",onClick:()=>void T().catch(()=>{}),className:"inline-flex min-h-8 items-center gap-1.5 rounded-md border border-amber-400/70 bg-white/60 px-2.5 font-mono text-[10.5px] font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-700 dark:bg-amber-950/50 dark:hover:bg-amber-900/50",children:[c.jsx(lo,{className:"w-3 h-3"}),e("taskHome.feed.retry")]})]}),l&&c.jsxs("div",{role:"alert",className:"flex justify-between items-center px-3 py-2 mt-4 font-mono text-xs text-red-700 rounded-md border border-red-200 bg-red-50/80 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:[c.jsx("span",{children:l}),c.jsx("button",{type:"button",onClick:C,className:"underline",children:e("taskHome.error.dismiss")})]}),c.jsx(M_,{sessions:Ge,catalogLoadState:Q,cancellingTaskKeys:j,retryingTaskKeys:A,unreadTaskKeys:N,onSelect:S=>{b(pe(S))},onCancel:S=>{y(pe(S)).catch(()=>{})},onRetry:S=>{k(pe(S)).catch(()=>{})}}),c.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[c.jsx(Bf,{className:"w-3 h-3"}),c.jsx("span",{className:"font-mono uppercase tracking-[0.14em]",children:e("taskHome.footer.note")})]}),c.jsx(ky,{open:Pe,onOpenChange:U})]})})}const Yc="blade.sessions.last",Ji="session",Xc="project",Zc="workspace";function L_(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return typeof t.sessionId=="string"&&t.sessionId.trim()&&typeof t.projectPath=="string"&&t.projectPath.trim()?{sessionId:t.sessionId,projectPath:t.projectPath}:null}function U_(e){var o,i,a;const t=new URLSearchParams(e),n=((o=t.get(Ji))==null?void 0:o.trim())||null,r=((i=t.get(Xc))==null?void 0:i.trim())||null,s=((a=t.get(Zc))==null?void 0:a.trim())||null;return{sessionRef:n&&(s||r)?{sessionId:n,projectPath:s||r}:null,projectPath:r,hasSessionParam:t.has(Ji)}}function B_(e=typeof localStorage>"u"?null:localStorage){if(!e)return null;try{const t=e.getItem(Yc);return t?L_(JSON.parse(t)):null}catch{return null}}function H_(e,t,n={}){const r=n.href??(typeof window>"u"?"http://localhost/":window.location.href),s=new URL(r),o=n.displayProjectPath??(e==null?void 0:e.projectPath)??t,i=(e==null?void 0:e.projectPath)??null;e?s.searchParams.set(Ji,e.sessionId):s.searchParams.delete(Ji),o?s.searchParams.set(Xc,o):s.searchParams.delete(Xc),i&&o&&i!==o?s.searchParams.set(Zc,i):s.searchParams.delete(Zc);const a=n.storage===void 0?typeof localStorage>"u"?null:localStorage:n.storage;try{e?a==null||a.setItem(Yc,JSON.stringify(e)):a==null||a.removeItem(Yc)}catch{}const l=`${s.pathname}${s.search}${s.hash}`,d=n.replaceState??(typeof window>"u"?void 0:m=>window.history.replaceState(null,"",m));return d==null||d(l),l}const q_=w.lazy(()=>Io(()=>import("./ChatView-ucu62nNl.js"),__vite__mapDeps([9,1,3,2])).then(e=>({default:e.ChatView})));function z_(){const e=Ft(),[t,n]=w.useState(!1),r=L(A=>A.subscribeToTaskEvents),s=L(A=>A.unsubscribeFromTaskEvents),o=L(A=>A.currentSessionRef),i=L(A=>A.isTemporarySession),a=L(A=>A.loadTaskWorkspaceInfo),l=L(A=>A.loadBoundProjects),d=L(A=>A.loadSessions),m=L(A=>A.selectSession),p=L(A=>A.selectProject),g=L(A=>A.startTemporarySession),x=L(A=>A.setError),b=L(A=>A.sessions),y=L(A=>A.selectedProjectPath),j=Pt(A=>A.loadModels),k=vo(A=>A.loadSettings);return w.useEffect(()=>(r().catch(A=>{console.error("Failed to subscribe to task events",A)}),s),[r,s]),w.useEffect(()=>{let A=!1;return(async()=>{var X;d(),k(),j();const $=U_(window.location.search),Q=B_(),T=$.hasSessionParam?$.sessionRef:$.projectPath?null:Q,C=Promise.all([a(),l()]),O=!T&&!$.projectPath;if(O&&(g(),n(!0)),await C,A)return;const R=L.getState(),K=$.projectPath?(X=R.boundProjects.find(P=>P.path===$.projectPath&&P.available))==null?void 0:X.path:null;if(K&&p(K),!(T&&(await m(T),A))){if(!T||!oe(L.getState().currentSessionRef,T)){const P=T?L.getState().error:null;g(),P&&x(P)}O||n(!0)}})(),()=>{A=!0}},[l,j,d,k,a,p,m,x,g]),w.useEffect(()=>{if(!t)return;const A=o?eu(b,o):void 0;H_(o,y,{displayProjectPath:A?fi(A,y):y})},[o,t,y,b]),c.jsxs(c.Fragment,{children:[c.jsx(p_,{}),c.jsx(m_,{children:t?!o||i?c.jsx(__,{}):c.jsx(w.Suspense,{fallback:c.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")}),children:c.jsx(q_,{})}):c.jsx("div",{className:"flex h-full items-center justify-center font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:e("app.restoring")})})]})}Zy.createRoot(document.getElementById("root")).render(c.jsx(oo.StrictMode,{children:c.jsx(z_,{})}));export{Pt as A,ou as B,N_ as C,ol as D,I5 as E,vo as F,D5 as G,iu as H,ho as I,fi as J,dy as K,qc as L,He as M,Vc as N,Y_ as O,Gn as P,cf as Q,br as R,su as S,Q_ as T,Io as _,L as a,kr as b,pe as c,ze as d,Yi as e,il as f,Xi as g,Zi as h,Xf as i,W as j,re as k,JD as l,Zn as m,Fa as n,Pi as o,v0 as p,eu as q,p2 as r,oe as s,sy as t,Ft as u,vf as v,pr as w,by as x,Vn as y,Mn as z};