blade-code 0.10.7 → 0.10.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blade.js +2 -2
- package/dist/chunk-1w6azndv.js +1 -0
- package/dist/chunk-2gwaqpge.js +1 -0
- package/dist/chunk-2pjd4cys.js +1 -0
- package/dist/{chunk-vafn0spm.js → chunk-2thg3fq1.js} +1 -1
- package/dist/chunk-2zn5en0w.js +1 -0
- package/dist/{chunk-1v7hpr34.js → chunk-33ave20b.js} +1 -1
- package/dist/chunk-3w1z6fwm.js +1 -0
- package/dist/chunk-43x4qbvt.js +1 -0
- package/dist/{chunk-e9ckf8e7.js → chunk-4h9ff923.js} +1 -1
- package/dist/chunk-52csdk21.js +3 -0
- package/dist/{chunk-ahxc3n3g.js → chunk-66hb7kxm.js} +2 -2
- package/dist/chunk-6j8wgp2s.js +2 -0
- package/dist/chunk-6vsszvgg.js +2 -0
- package/dist/chunk-7evtr0yr.js +10 -0
- package/dist/{chunk-tp9zk241.js → chunk-7hbw6q6d.js} +1 -1
- package/dist/chunk-7zsyejr1.js +22 -0
- package/dist/{chunk-x3780wpy.js → chunk-8gcg2z3y.js} +16 -16
- package/dist/{chunk-p3ahf1fh.js → chunk-8gcvpmwk.js} +1 -1
- package/dist/{chunk-w01sec4f.js → chunk-8gnfj89a.js} +2 -2
- package/dist/{chunk-7a200q5g.js → chunk-8h0yxh6y.js} +2 -2
- package/dist/chunk-8sfycn3y.js +194 -0
- package/dist/{chunk-847e0sk9.js → chunk-954vmnrn.js} +1 -1
- package/dist/chunk-a8h3fymk.js +100 -0
- package/dist/chunk-b5szbtmp.js +5 -0
- package/dist/chunk-bxm2hq0m.js +1 -0
- package/dist/chunk-c8da4b3d.js +1 -0
- package/dist/{chunk-tc83e1b0.js → chunk-cbpqcdga.js} +1 -1
- package/dist/{chunk-qycwavck.js → chunk-cf8e7e92.js} +2 -2
- package/dist/{chunk-kqpwz9b7.js → chunk-d0g4t8fw.js} +2 -2
- package/dist/{chunk-1sw9z975.js → chunk-eq2qj9ja.js} +1 -1
- package/dist/{chunk-p0j8994h.js → chunk-fj8v7pep.js} +1 -1
- package/dist/{chunk-tcc3v4n2.js → chunk-fxpq9nh6.js} +1 -1
- package/dist/chunk-g00wj2we.js +4 -0
- package/dist/{chunk-3fdyzgpv.js → chunk-h28ptrrt.js} +1 -1
- package/dist/{chunk-qk2z6gag.js → chunk-h421wzbm.js} +2 -2
- package/dist/{chunk-4hhkbyja.js → chunk-j4tttsaz.js} +2 -2
- package/dist/{chunk-wrbm6rch.js → chunk-kagpk2x5.js} +2 -2
- package/dist/chunk-kvnwhwx3.js +1 -0
- package/dist/{chunk-mt4328yf.js → chunk-m2xrx1je.js} +1 -1
- package/dist/{chunk-g3wgzyhx.js → chunk-nhc49pan.js} +48 -48
- package/dist/{chunk-jpy61wna.js → chunk-nymm525r.js} +1 -1
- package/dist/{chunk-rz9yh6e4.js → chunk-nz57y1ad.js} +3 -3
- package/dist/{chunk-wmdgb5pz.js → chunk-p2m56new.js} +2 -2
- package/dist/{chunk-43j2f1b5.js → chunk-pv9sw79c.js} +1 -1
- package/dist/chunk-qgp08qmz.js +6 -0
- package/dist/{chunk-7pkrwh10.js → chunk-r7tsa2zv.js} +1 -1
- package/dist/{chunk-zjf1z27e.js → chunk-rkvfsx8e.js} +1 -1
- package/dist/{chunk-y573s5r8.js → chunk-rxqft6td.js} +2 -2
- package/dist/{chunk-rn908m3v.js → chunk-s9aj3p11.js} +2 -2
- package/dist/{chunk-0z7q89w7.js → chunk-senkwdh6.js} +1 -1
- package/dist/chunk-v1c58sm6.js +1 -0
- package/dist/{chunk-m86ekqp0.js → chunk-v8pq6qmv.js} +2 -2
- package/dist/chunk-van4ysq6.js +1466 -0
- package/dist/chunk-vgp8m9fg.js +2 -0
- package/dist/{chunk-ne7zdjrh.js → chunk-vsg8f0e6.js} +1 -1
- package/dist/{chunk-0n04bmta.js → chunk-w0nscjd2.js} +2 -2
- package/dist/chunk-w26jhcj9.js +1 -0
- package/dist/{chunk-qqwgb9ja.js → chunk-wmnszjmv.js} +2 -2
- package/dist/chunk-x6wgh726.js +1 -0
- package/dist/{chunk-yyvx1avz.js → chunk-xa05phpw.js} +3 -3
- package/dist/{chunk-0xm8hn2h.js → chunk-xmcsn7y0.js} +2 -2
- package/dist/{chunk-az4b6106.js → chunk-y4c3wwpa.js} +1 -1
- package/dist/{chunk-vcq624qv.js → chunk-yfs9tq3y.js} +2 -2
- package/dist/chunk-ymzcxryf.js +1 -0
- package/dist/{chunk-akev4wsz.js → chunk-zknv3d6y.js} +1 -1
- package/dist/chunk-zp4x2mwj.js +1 -0
- package/dist/chunk-zvk3g177.js +9 -0
- package/dist/web/assets/ChatView-Fqy97qw9.js +7 -0
- package/dist/web/assets/{CodeBlockHighlighter-CC4e9nFc.js → CodeBlockHighlighter-EgdsVoMQ.js} +1 -1
- package/dist/web/assets/{FilePreview-C3HEoLYS.js → FilePreview-xicd9-Sl.js} +1 -1
- package/dist/web/assets/{MarkdownRenderer-COycrGUX.js → MarkdownRenderer-DBSjC_z3.js} +18 -18
- package/dist/web/assets/SettingsModal-Bkh5rMAJ.js +5 -0
- package/dist/web/assets/TaskSwitcher-DXcj0iJ_.js +1 -0
- package/dist/web/assets/{TerminalPanel-DqQ-7CTG.js → TerminalPanel-DWVY-Elm.js} +1 -1
- package/dist/web/assets/index-Bi5ijAQP.css +1 -0
- package/dist/web/assets/index-CxEh32hc.js +32 -0
- package/dist/web/assets/{vendor-icons-D_AkWmWB.js → vendor-icons-Cv18Q6rW.js} +72 -67
- package/dist/web/assets/{vendor-radix-DBy9B2DN.js → vendor-radix-DXRuAJHH.js} +1 -1
- package/dist/web/index.html +4 -4
- package/package.json +3 -1
- package/dist/chunk-4rhssb85.js +0 -2
- package/dist/chunk-598egka3.js +0 -22
- package/dist/chunk-5ak9tw83.js +0 -100
- package/dist/chunk-738pkjf8.js +0 -1
- package/dist/chunk-7xfmzvxp.js +0 -1
- package/dist/chunk-867rz2ss.js +0 -1
- package/dist/chunk-a3e97syg.js +0 -3
- package/dist/chunk-f7854pbx.js +0 -187
- package/dist/chunk-fwt0kje3.js +0 -1
- package/dist/chunk-g1q27q6q.js +0 -2
- package/dist/chunk-g4snq0dx.js +0 -1
- package/dist/chunk-ggm04adj.js +0 -1
- package/dist/chunk-hpytxsge.js +0 -1
- package/dist/chunk-htr91q9c.js +0 -1
- package/dist/chunk-hwcp940f.js +0 -1
- package/dist/chunk-j5ysjbyr.js +0 -10
- package/dist/chunk-m8k1mv0j.js +0 -4
- package/dist/chunk-pt659n0v.js +0 -1466
- package/dist/chunk-q1gfeadm.js +0 -1
- package/dist/chunk-rk1w5pry.js +0 -2
- package/dist/chunk-rz2ftt6h.js +0 -5
- package/dist/chunk-tzh4ahry.js +0 -6
- package/dist/chunk-v0rn831t.js +0 -1
- package/dist/chunk-vynsgc2g.js +0 -1
- package/dist/chunk-w0ena7fe.js +0 -9
- package/dist/chunk-ydwjttdz.js +0 -1
- package/dist/chunk-z9fsh3kn.js +0 -1
- package/dist/web/assets/ChatView-BYfHmxKJ.js +0 -7
- package/dist/web/assets/McpModal-CDgr9kVq.js +0 -5
- package/dist/web/assets/SettingsModal-CvdVIbeG.js +0 -1
- package/dist/web/assets/SkillsModal-lSX1ZKTu.js +0 -1
- package/dist/web/assets/TaskSwitcher-peKi9KvN.js +0 -1
- package/dist/web/assets/index-BF5HEN_f.js +0 -32
- package/dist/web/assets/index-BrkTYxtS.css +0 -1
- package/dist/web/assets/useRequest-BvqVDnKl.js +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SettingsModal-Bkh5rMAJ.js","assets/vendor-react-DG5dkZ_t.js","assets/vendor-radix-DXRuAJHH.js","assets/vendor-icons-Cv18Q6rW.js","assets/TaskSwitcher-DXcj0iJ_.js","assets/FilePreview-xicd9-Sl.js","assets/TerminalPanel-DWVY-Elm.js","assets/vendor-xterm-DuYZoU4T.js","assets/vendor-xterm-9CEnUXvW.css","assets/ChatView-Fqy97qw9.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Ky=Object.defineProperty;var Gy=(e,t,n)=>t in e?Ky(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var qa=(e,t,n)=>Gy(e,typeof t!="symbol"?t+"":t,n);import{r as v,j as c,c as Xs,d as Vy}from"./vendor-react-DG5dkZ_t.js";import{S as Wy,O as Sf,P as Jy,C as vf,a as Qy,T as wf,D as If,R as Yy,b as Cf,V as Xy,c as Zy,d as jf,e as e0,f as t0,g as Tf,h as n0,i as r0}from"./vendor-radix-DXRuAJHH.js";import{X as to,H as gd,L as ct,F as s0,R as Hi,A as Af,a as no,D as Ef,b as o0,c as wi,d as i0,e as ro,G as Gc,T as Pf,C as Nf,f as Is,S as Vc,M as a0,g as c0,P as l0,h as $f,i as Wc,j as Rf,k as Jc,l as u0,m as d0,n as f0,o as Of,p as m0,q as p0,r as Mf,s as hd,t as g0,u as h0,v as Ff,w as b0,I as k0,x as bd,y as ks,B as x0,z as y0,E as S0,W as kd,J as v0,K as w0,N as I0,O as C0,Q as j0,U as xd,V as yd}from"./vendor-icons-Cv18Q6rW.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 T0="modulepreload",A0=function(e){return"/"+e},Sd={},bo=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=A0(l),l in Sd)return;Sd[l]=!0;const u=l.endsWith(".css"),m=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${m}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":T0,u||(p.as="script"),p.crossOrigin="",p.href=l,a&&p.setAttribute("nonce",a),document.head.appendChild(p),u)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 Df(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=Df(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function _f(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Df(e))&&(r&&(r+=" "),r+=t);return r}const vd=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,wd=_f,E0=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return wd(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(u=>{const m=n==null?void 0:n[u],p=o==null?void 0:o[u];if(m===null)return null;const g=vd(m)||vd(p);return s[u][g]}),a=n&&Object.entries(n).reduce((u,m)=>{let[p,g]=m;return g===void 0||(u[p]=g),u},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,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})?[...u,p,g]:u},[]);return wd(e,i,l,n==null?void 0:n.class,n==null?void 0:n.className)},Qc="-",P0=e=>{const t=$0(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(Qc);return a[0]===""&&a.length!==1&&a.shift(),Lf(a,t)||N0(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},Lf=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?Lf(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const o=e.join(Qc);return(i=t.validators.find(({validator:a})=>a(o)))==null?void 0:i.classGroupId},Id=/^\[(.+)\]$/,N0=e=>{if(Id.test(e)){const t=Id.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},$0=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return O0(Object.entries(e.classGroups),n).forEach(([o,i])=>{ac(i,r,o,t)}),r},ac=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const o=s===""?t:Cd(t,s);o.classGroupId=n;return}if(typeof s=="function"){if(R0(s)){ac(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([o,i])=>{ac(i,Cd(t,o),n,r)})})},Cd=(e,t)=>{let n=e;return t.split(Qc).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},R0=e=>e.isThemeGetter,O0=(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,M0=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)}}},Uf="!",F0=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],o=t.length,i=a=>{const l=[];let u=0,m=0,p;for(let j=0;j<a.length;j++){let k=a[j];if(u===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==="["?u++:k==="]"&&u--}const g=l.length===0?a:a.substring(m),x=g.startsWith(Uf),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},D0=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},_0=e=>({cache:M0(e.cacheSize),parseClassName:F0(e),...P0(e)}),L0=/\s+/,U0=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,o=[],i=e.trim().split(L0);let a="";for(let l=i.length-1;l>=0;l-=1){const u=i[l],{modifiers:m,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:x}=n(u);let b=!!x,y=r(b?g.substring(0,x):g);if(!y){if(!b){a=u+(a.length>0?" "+a:a);continue}if(y=r(g),!y){a=u+(a.length>0?" "+a:a);continue}b=!1}const j=D0(m).join(":"),k=p?j+Uf:j,A=k+y;if(o.includes(A))continue;o.push(A);const N=s(y,b);for(let R=0;R<N.length;++R){const J=N[R];o.push(k+J)}a=u+(a.length>0?" "+a:a)}return a};function B0(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Bf(t))&&(r&&(r+=" "),r+=n);return r}const Bf=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Bf(e[r]))&&(n&&(n+=" "),n+=t);return n};function H0(e,...t){let n,r,s,o=i;function i(l){const u=t.reduce((m,p)=>p(m),e());return n=_0(u),r=n.cache.get,s=n.cache.set,o=a,a(l)}function a(l){const u=r(l);if(u)return u;const m=U0(l,n);return s(l,m),m}return function(){return o(B0.apply(null,arguments))}}const We=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Hf=/^\[(?:([a-z-]+):)?(.+)\]$/i,q0=/^\d+\/\d+$/,z0=new Set(["px","full","screen"]),K0=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,G0=/\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$/,V0=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,W0=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,J0=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Kn=e=>vs(e)||z0.has(e)||q0.test(e),ur=e=>js(e,"length",rS),vs=e=>!!e&&!Number.isNaN(Number(e)),za=e=>js(e,"number",vs),Vs=e=>!!e&&Number.isInteger(Number(e)),Q0=e=>e.endsWith("%")&&vs(e.slice(0,-1)),ce=e=>Hf.test(e),dr=e=>K0.test(e),Y0=new Set(["length","size","percentage"]),X0=e=>js(e,Y0,qf),Z0=e=>js(e,"position",qf),eS=new Set(["image","url"]),tS=e=>js(e,eS,oS),nS=e=>js(e,"",sS),Ws=()=>!0,js=(e,t,n)=>{const r=Hf.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},rS=e=>G0.test(e)&&!V0.test(e),qf=()=>!1,sS=e=>W0.test(e),oS=e=>J0.test(e),iS=()=>{const e=We("colors"),t=We("spacing"),n=We("blur"),r=We("brightness"),s=We("borderColor"),o=We("borderRadius"),i=We("borderSpacing"),a=We("borderWidth"),l=We("contrast"),u=We("grayscale"),m=We("hueRotate"),p=We("invert"),g=We("gap"),x=We("gradientColorStops"),b=We("gradientColorStopPositions"),y=We("inset"),j=We("margin"),k=We("opacity"),A=We("padding"),N=We("saturate"),R=We("scale"),J=We("sepia"),T=We("skew"),C=We("space"),$=We("translate"),O=()=>["auto","contain","none"],K=()=>["auto","hidden","clip","visible","scroll"],Y=()=>["auto",ce,t],P=()=>[ce,t],B=()=>["",Kn,ur],M=()=>["auto",vs,ce],de=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],we=()=>["solid","dashed","dotted","double","none"],be=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>["start","end","center","between","around","evenly","stretch"],Fe=()=>["","0",ce],F=()=>["auto","avoid","all","avoid-page","page","left","right","column"],fe=()=>[vs,ce];return{cacheSize:500,separator:":",theme:{colors:[Ws],spacing:[Kn,ur],blur:["none","",dr,ce],brightness:fe(),borderColor:[e],borderRadius:["none","","full",dr,ce],borderSpacing:P(),borderWidth:B(),contrast:fe(),grayscale:Fe(),hueRotate:fe(),invert:Fe(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[Q0,ur],inset:Y(),margin:Y(),opacity:fe(),padding:P(),saturate:fe(),scale:fe(),sepia:Fe(),skew:fe(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",ce]}],container:["container"],columns:[{columns:[dr]}],"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:[...de(),ce]}],overflow:[{overflow:K()}],"overflow-x":[{"overflow-x":K()}],"overflow-y":[{"overflow-y":K()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],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",Vs,ce]}],basis:[{basis:Y()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ce]}],grow:[{grow:Fe()}],shrink:[{shrink:Fe()}],order:[{order:["first","last","none",Vs,ce]}],"grid-cols":[{"grid-cols":[Ws]}],"col-start-end":[{col:["auto",{span:["full",Vs,ce]},ce]}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":[Ws]}],"row-start-end":[{row:["auto",{span:[Vs,ce]},ce]}],"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",ce]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ce]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...ae()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ae(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ae(),"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",ce,t]}],"min-w":[{"min-w":[ce,t,"min","max","fit"]}],"max-w":[{"max-w":[ce,t,"none","full","min","max","fit","prose",{screen:[dr]},dr]}],h:[{h:[ce,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ce,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ce,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ce,t,"auto","min","max","fit"]}],"font-size":[{text:["base",dr,ur]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",za]}],"font-family":[{font:[Ws]}],"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",ce]}],"line-clamp":[{"line-clamp":["none",vs,za]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Kn,ce]}],"list-image":[{"list-image":["none",ce]}],"list-style-type":[{list:["none","disc","decimal",ce]}],"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:[...we(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Kn,ur]}],"underline-offset":[{"underline-offset":["auto",Kn,ce]}],"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",ce]}],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",ce]}],"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:[...de(),Z0]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",X0]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},tS]}],"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:[...we(),"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:we()}],"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:["",...we()]}],"outline-offset":[{"outline-offset":[Kn,ce]}],"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",dr,nS]}],"shadow-color":[{shadow:[Ws]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...be(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":be()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",dr,ce]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[p]}],saturate:[{saturate:[N]}],sepia:[{sepia:[J]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"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":[J]}],"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",ce]}],duration:[{duration:fe()}],ease:[{ease:["linear","in","out","in-out",ce]}],delay:[{delay:fe()}],animate:[{animate:["none","spin","ping","pulse","bounce",ce]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[Vs,ce]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"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",ce]}],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",ce]}],"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",ce]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Kn,ur,za]}],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"]}}},aS=H0(iS);function W(...e){return aS(_f(e))}const cS=E0("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"}}),hr=v.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},o)=>{const i=r?Wy:"button";return c.jsx(i,{className:W(cS({variant:t,size:n,className:e})),ref:o,...s})});hr.displayName="Button";const Yc=Yy,lS=Jy,zf=v.forwardRef(({className:e,...t},n)=>c.jsx(Sf,{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}));zf.displayName=Sf.displayName;const qi=v.forwardRef(({className:e,children:t,hideCloseButton:n,...r},s)=>c.jsxs(lS,{children:[c.jsx(zf,{}),c.jsxs(vf,{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(Qy,{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(to,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));qi.displayName=vf.displayName;const Xc=({className:e,...t})=>c.jsx("div",{className:W("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Xc.displayName="DialogHeader";const Kf=({className:e,...t})=>c.jsx("div",{className:W("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Kf.displayName="DialogFooter";const zi=v.forwardRef(({className:e,...t},n)=>c.jsx(wf,{ref:n,className:W("text-lg font-semibold leading-none tracking-tight",e),...t}));zi.displayName=wf.displayName;const Ki=v.forwardRef(({className:e,...t},n)=>c.jsx(If,{ref:n,className:W("text-sm text-muted-foreground",e),...t}));Ki.displayName=If.displayName;const uS={"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.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"},dS={"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.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":"安装技能失败"},fS=["en","zh"],Ka={en:uS,zh:dS},Gf="blade-ui-locale",Zc=typeof window<"u"&&typeof document<"u";function mS(){var e,t;if(Zc){try{const r=(e=window.localStorage)==null?void 0:e.getItem(Gf);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 Cs=mS();const cc=new Set;function pS(){for(const e of cc)e()}function gS(e){var t;if(e!==Cs){if(Cs=e,Zc){try{(t=window.localStorage)==null||t.setItem(Gf,e)}catch{}document!=null&&document.documentElement&&(document.documentElement.lang=e==="zh"?"zh-CN":"en")}pS()}}function Vf(e){return cc.add(e),()=>cc.delete(e)}function hS(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>{const s=t[r];return s==null?n:String(s)}):e}function zt(e,t){const r=(Ka[Cs]??Ka.en)[e]??Ka.en[e];return hS(r,t)}function Mt(){return v.useSyncExternalStore(Vf,()=>Cs,()=>"en"),zt}function bS(){return{locale:v.useSyncExternalStore(Vf,()=>Cs,()=>"en"),setLocale:gS}}Zc&&(document!=null&&document.documentElement)&&(document.documentElement.lang=Cs==="zh"?"zh-CN":"en");function pt(e,t){return{...e,...t}}function Lr(e,t,n){return e>=t&&e<=n}function kS(e){return e===8205}function xS(e){return Lr(e,55296,56319)}function jd(e){return Lr(e,127462,127487)}function Wf(e){return Lr(e,65024,65039)}function Jf(e){return Lr(e,768,879)||Lr(e,6832,6911)||Lr(e,7616,7679)||Lr(e,65056,65071)}function hi(e){return e>65535?2:1}function Td(e,t){for(;t<e.length;){const n=e.codePointAt(t);if(Jf(n)||Wf(n))t+=hi(n);else break}return t}function el(e,t){const n=e.codePointAt(t);let r=t+hi(n);for(r=Td(e,r);r<e.length-1&&e[r]==="";){const s=e.codePointAt(r+1);r+=1+hi(s),r=Td(e,r)}return jd(n)&&r<e.length&&jd(e.codePointAt(r))&&(r+=hi(e.codePointAt(r))),r}function Qf(e){return xS(e)||Jf(e)||Wf(e)||kS(e)}function yS(e){let t=0,n=0;for(;n<e.length;)n=el(e,n),t++;return t}function SS(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=el(e,r),n++,n>=t)return!0;return!1}function vS(e,t){let n=0,r=0;for(;r<e.length;)if(r=el(e,r),n++,n>t)return!1;return!0}function wS(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Qf(e.charCodeAt(n)))return SS(e,t);if(n++,n>=t)return!0}return!1}function IS(e,t){let n=0;for(;n<e.length;){if(Qf(e.charCodeAt(n)))return vS(e,t);if(n++,n>t)return!1}return!0}function H(e){return Array.isArray(e)}function et(e){return h(typeof e,"bigint")}function gt(e){return h(typeof e,"boolean")}function Gi(e){if(Re(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 tl(e){return Number.isInteger(e)}function Vt(e){return h(e,null)}function xe(e){return Number.isFinite(e)}function fn(e){return ne(e)&&!H(e)}function ne(e){return h(typeof e,"object")&&!Vt(e)}function oe(e){return h(typeof e,"string")}function nl(e){return h(typeof e,"symbol")}function Re(e){return h(e,void 0)}function h(e,t){return e===t}function Jr(e,t){return e>t}function ko(e,t){return e<t}function nr(e,t){return e<=t}function Ts(e,t){return e>=t}function Yf(e,t){if(et(e)||et(t))return BigInt(e)%BigInt(t)===0n;const n=1e-10;if(!xe(e)||tl(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 Xf(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 As(e){return et(e)||gt(e)||Vt(e)||xe(e)||oe(e)||Re(e)}function CS(e){return yS(e)}function Zf(e,t){return IS(e,t)}function em(e,t){return wS(e,t)}function lt(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function Ct(e,t,n){let r=!0;for(let s=t;s<e.length;s++)n(e[s],s)||(r=!1);return r}function Es(e,t){for(let n=0;n<e.length;n++)if(t(e[n],n))return!0;return!1}function tm(e,t){let n=!1;for(let r=0;r<e.length;r++)t(e[r],r)&&(n=!0);return n}function rl(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 sl(e){return D(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function tt(e){return Object.entries(e)}function D(e){return Object.getOwnPropertyNames(e)}function ol(e){return Object.getOwnPropertySymbols(e)}function il(e){return Object.values(e)}function jS(e,t){if(!ne(t))return!1;const n=D(e);return h(n.length,D(t).length)&&n.every(r=>Qr(e[r],t[r]))}function TS(e,t){return H(t)&&h(e.length,t.length)&&e.every((n,r)=>Qr(e[r],t[r]))}function Qr(e,t){return H(e)?TS(e,t):ne(e)?jS(e,t):h(e,t)}const Ii=Object.freeze(Object.defineProperty({__proto__:null,Counted:rl,Entries:tt,EntriesRegExp:sl,Every:lt,EveryAll:Ct,GraphemeCount:CS,HasPropertyKey:E,IsArray:H,IsBigInt:et,IsBoolean:gt,IsClassInstance:Xf,IsConstructor:Gi,IsDeepEqual:Qr,IsEqual:h,IsFunction:In,IsGreaterEqualThan:Ts,IsGreaterThan:Jr,IsInteger:tl,IsLessEqualThan:nr,IsLessThan:ko,IsMaxLength:Zf,IsMinLength:em,IsMultipleOf:Yf,IsNull:Vt,IsNumber:xe,IsObject:ne,IsObjectNotArray:fn,IsString:oe,IsSymbol:nl,IsUndefined:Re,IsUnsafePropertyKey:Jn,IsValueLike:As,Keys:D,ShiftLeft:Ie,Some:Es,SomeAll:tm,Symbols:ol,Values:il},Symbol.toStringTag,{value:"Module"})),AS=/^[\p{ID_Start}_$][\p{ID_Continue}_$\u200C\u200D]*$/u;function ES(e){return AS.test(e)}function St(e,t){return`(${e} && ${t})`}function He(e,t){return`(${e} || ${t})`}function Pt(e){return`!(${e})`}function Ci(e){return`Array.isArray(${e})`}function nm(e){return`typeof ${e} === "bigint"`}function PS(e){return`typeof ${e} === "boolean"`}function NS(e){return`Number.isInteger(${e})`}function $S(e){return`${e} === null`}function rm(e){return`Number.isFinite(${e})`}function sm(e){return St(om(e),Pt(Ci(e)))}function om(e){return`typeof ${e} === "object" && ${e} !== null`}function im(e){return`typeof ${e} === "string"`}function RS(e){return`typeof ${e} === "symbol"`}function lc(e){return`${e} === undefined`}function OS(e){return`typeof ${e} === "function"`}function MS(e){return`Guard.IsConstructor(${e})`}function Gt(e,t){return`${e} === ${t}`}function am(e,t){return`${e} > ${t}`}function al(e,t){return`${e} < ${t}`}function Yr(e,t){return`${e} <= ${t}`}function xo(e,t){return`${e} >= ${t}`}function FS(e,t){return`Guard.IsMinLength(${e}, ${t})`}function DS(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 _S(e,t,n){return`${e}.some((${t[0]}, ${t[1]}) => ${n})`}function LS(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 Vi(e,t,n){return`${e}.reduce((result, ${t[0]}, ${t[1]}) => (${n}) ? ++result : result, 0)`}function cm(e){return`Object.entries(${e})`}function Xr(e){return`Object.getOwnPropertyNames(${e})`}function qr(e,t){return h(t,'"__proto__"')||h(t,'"constructor"')?`Object.prototype.hasOwnProperty.call(${e}, ${t})`:`${t} in ${e}`}function lm(e,t){return`Guard.IsDeepEqual(${e}, ${t})`}function US(e){return`[${e.join(", ")}]`}function kr(e,t){return`((${e.join(", ")}) => ${t})`}function ze(e,t){return`${e}(${t.join(", ")})`}function cl(e,t){return`new ${e}(${t.join(", ")})`}function le(e,t){return`${e}${ES(t)?`.${t}`:`[${z(t)}]`}`}function z(e){if(!As(e))throw Error("Unsupported Constant");return oe(e)?JSON.stringify(e):`${e}`}function BS(e,t,n){return`(${e} ? ${t} : ${n})`}function Wi(e){return`{ ${e.join("; ")}; }`}function Qn(e,t){return`const ${e} = ${t}`}function um(e,t){return`if(${e}) { ${t} }`}function Ji(e){return`return ${e}`}function wt(e){return h(e.length,0)?"true":e.reduce((t,n)=>St(t,n))}function ll(e){return h(e.length,0)?"false":e.reduce((t,n)=>He(t,n))}function HS(e,t){return`Guard.IsMultipleOf(${e}, ${t})`}function qS(e){return e instanceof Boolean}function zS(e){return e instanceof Number}function KS(e){return e instanceof String}function yo(e){return globalThis.ArrayBuffer.isView(e)}function dm(e){return e instanceof globalThis.RegExp}function fm(e){return e instanceof globalThis.Date}function mm(e){return e instanceof globalThis.Set}function pm(e){return e instanceof globalThis.Map}function GS(e){return E(e,"~kind")||E(e,"~unsafe")}function VS(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:zr(s.value)})}return t}function WS(e){const t={};for(const n of D(e))Jn(n)||(t[n]=zr(e[n]));for(const n of ol(e))t[n]=zr(e[n]);return t}function JS(e){return Xf(e)?e:GS(e)?VS(e):WS(e)}function QS(e){return e.map(t=>zr(t))}function YS(e){return e.slice()}function XS(e){return new RegExp(e.source,e.flags)}function ZS(e){return new Map(zr([...e.entries()]))}function ev(e){return new Set(zr([...e.values()]))}function zr(e){return yo(e)?YS(e):dm(e)?XS(e):pm(e)?ZS(e):mm(e)?ev(e):H(e)?QS(e):ne(e)?JS(e):e}function ul(e){return zr(e)}const tv={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function So(){return tv}function nv(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 rv(e,t){return{...e,...t}}function he(e,t,n={}){const r=rv(t,n);return nv(r,e)}function Pn(e,t){const n={},r=Object.getOwnPropertyDescriptors(ul(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=So(),s=ul(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 Se(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 ws(e){return Se(e,"Deferred")}function sv(e){return ue(e,{"~readonly":!0},{})}function dl(e,t){return ue(sv(e),{},t)}function ov(e,t,n,r){const s=G(e,t,n);return dl(s,r)}function iv(e){return ue(e,{"~optional":!0},{})}function fl(e,t){return ue(iv(e),{},t)}function av(e,t,n,r){const s=G(e,t,n);return fl(s,r)}function Ir(e,t){return he({"~kind":"Array"},{type:"array",items:e},t)}function ut(e){return Se(e,"Array")}function ml(e){return Pn(e,["~kind","type","items"])}function vo(e,t,n={}){return he({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function mn(e){return Se(e,"Constructor")}function cv(e){return Pn(e,["~kind","type","parameters","instanceType"])}function wo(e,t,n={}){return he({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function pn(e){return Se(e,"Function")}function lv(e){return Pn(e,["~kind","type","parameters","returnType"])}function un(e,t){return he({"~kind":"Ref"},{$ref:e},t)}function bt(e){return Se(e,"Ref")}function Io(e,t){return he({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function pl(e){return Se(e,"Generic")}function gl(e){return he({"~kind":"Any"},{},e)}function Nn(e){return Se(e,"Any")}const uv="(?!)";function jt(e){return he({"~kind":"Never"},{not:{}},e)}function Ps(e){return Se(e,"Never")}function Zn(e,t={}){return je("AddOptional",[e],t)}function ji(e,t={}){return fl(e,t)}function dv(e){return ji(e)}function Xt(e){return Yt(e)&&E(e,"~optional")}function fv(e){return D(e).filter(t=>!Xt(e[t]))}function gm(e){return D(e)}function hm(e){return il(e)}function Ae(e,t={}){const n=fv(e),r=n.length>0?{required:n}:{};return he({"~kind":"Object"},{type:"object",...r,properties:e},t)}function Le(e){return Se(e,"Object")}function mv(e){return Pn(e,["~kind","type","properties","required"])}function Ut(e){return he({"~kind":"Unknown"},{},e)}function Cn(e){return Se(e,"Unknown")}function Co(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 Bt(e){return Se(e,"Cyclic")}function pv(e){return ue(e,{"~unsafe":null},{})}function bm(e){return fn(e)&&E(e,"~unsafe")&&Vt(e["~unsafe"])}function at(e,t){var n;return((n=t[e.length])==null?void 0:n.call(t,...e))??(()=>{throw Error("Invalid Arguments")})()}function uc(...e){const[t,n]=at(e,{2:(r,s)=>[r,s,s],1:r=>[r,Ut(),Ut()]});return he({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Zt(e){return Se(e,"Infer")}function Ti(e,t,n,r={}){return he({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function gn(e){return Se(e,"Dependent")}function gv(e){return Pn(e,["~kind","if","then","else"])}function hv(e){return fn(e)}function bv(e){return D(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function kv(e){return oe(e)||xe(e)}function xv(e,t){const n=hv(e)?bv(e):e;return he({"~kind":"Enum"},{enum:n},t)}function hn(e){return Se(e,"Enum")}function Fn(e,t={}){return he({"~kind":"Intersect"},{allOf:e},t)}function Ue(e){return Se(e,"Intersect")}function yv(e){return Pn(e,["~kind","allOf"])}let Ga;function Sv(){try{return xm("null")(),!0}catch{return!1}}function km(){return Re(Ga)&&(Ga=Sv()),Ga&&So().useAcceleration}function xm(...e){return new globalThis.Function(...e)}function Nt(){throw new Error("Unreachable")}function vv(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 wv(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 ys=BigInt("14695981039346656037");const[Iv,Cv]=[BigInt("1099511628211"),BigInt("18446744073709551616")],jv=Array.from({length:256}).map((e,t)=>BigInt(t)),ym=new Float64Array(1),Sm=new DataView(ym.buffer),vm=new Uint8Array(ym.buffer);function kt(e){ys=ys^jv[e],ys=ys*Iv%Cv}function Tv(e){kt($t.Array);for(const t of e)xr(t)}function Av(e){kt($t.BigInt),Sm.setBigInt64(0,e);for(const t of vm)kt(t)}function Ad(e){kt($t.Boolean),kt(e?1:0)}function Ev(e){kt($t.Constructor),xr(e.toString())}function Pv(e){kt($t.Date),xr(e.getTime())}function Nv(e){kt($t.Function),xr(e.toString())}function $v(e){kt($t.Null)}function Ed(e){kt($t.Number),Sm.setFloat64(0,e,!0);for(const t of vm)kt(t)}function Rv(e){kt($t.Object);for(const t of vv(e).sort())xr(t),xr(e[t])}function Ov(e){kt($t.RegExp),dc(e.toString())}const Mv=new TextEncoder;function dc(e){kt($t.String);for(const t of Mv.encode(e))kt(t)}function Fv(e){kt($t.Symbol),xr(e.toString())}function Dv(e){kt($t.TypeArray);const t=new Uint8Array(e.buffer);for(let n=0;n<t.length;n++)kt(t[n])}function _v(e){return kt($t.Undefined)}function xr(e){return yo(e)?Dv(e):fm(e)?Pv(e):dm(e)?Ov(e):qS(e)?Ad(e.valueOf()):KS(e)?dc(e.valueOf()):zS(e)?Ed(e.valueOf()):wv(e)?Ed(e):H(e)?Tv(e):gt(e)?Ad(e):et(e)?Av(e):Gi(e)?Ev(e):Vt(e)?$v():ne(e)?Rv(e):oe(e)?dc(e):nl(e)?Fv(e):Re(e)?_v():In(e)?Nv(e):Nt()}function wm(e){return ys=BigInt("14695981039346656037"),xr(e),ys}function Qi(e){return wm(e).toString(16).padStart(16,"0")}const Lv=Object.freeze(Object.defineProperty({__proto__:null,Hash:Qi,HashCode:wm},Symbol.toStringTag,{value:"Module"}));function Uv(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 Bv=Uv;function Hv(){return Bv}class Im{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 Cm{constructor(t){this.type=t}Decode(t){return new Im(this.type,t)}}function hl(e){return new Cm(e)}function qv(e,t){return hl(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function zv(e,t){return hl(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 Kv(e){return su(e)}function Ai(e){return Yt(e)&&E(e,"~immutable")}function er(e,t={}){return je("AddReadonly",[e],t)}function Ei(e,t={}){return dl(e,t)}function Gv(e){return Ei(e)}function Pi(e){return Yt(e)&&E(e,"~readonly")}function Vv(e,t){const n=bl(e)?[...e["~refine"],t]:[t];return ue(e,{"~refine":n},{})}function Wv(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[s,o,()=>"Refine Error"]});return Vv(t,{check:n,error:r})}function Jv(e){return fn(e)&&E(e,"check")&&E(e,"error")&&In(e.check)&&In(e.error)}function bl(e){return Yt(e)&&E(e,"~refine")&&H(e["~refine"])&<(e["~refine"],0,t=>Jv(t))}const Qv="-?(?:0|[1-9][0-9]*)n";function kl(e){return he({"~kind":"BigInt"},{type:"bigint"},e)}function Zr(e){return Se(e,"BigInt")}function jm(e){return he({"~kind":"Boolean"},{type:"boolean"},e)}function Cr(e){return Se(e,"Boolean")}function fc(e){return he({"~kind":"Identifier"},{name:e})}function Yv(e){return Se(e,"Identifier")}const Tm="-?(?:0|[1-9][0-9]*)";function Yi(e){return he({"~kind":"Integer"},{type:"integer"},e)}function _n(e){return Se(e,"Integer")}class Xv extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}}function Zv(e){return et(e)?"bigint":gt(e)?"boolean":xe(e)?"number":oe(e)?"string":(()=>{throw new Xv(e)})()}function Me(e,t){return he({"~kind":"Literal"},{type:Zv(e),const:e},t)}function Am(e){return et(e)||gt(e)||xe(e)||oe(e)}function ew(e){return Ve(e)&&et(e.const)}function tw(e){return Ve(e)&>(e.const)}function Em(e){return Ve(e)&&xe(e.const)}function Pm(e){return Ve(e)&&oe(e.const)}function Ve(e){return Se(e,"Literal")}function xl(e){return he({"~kind":"Null"},{type:"null"},e)}function jo(e){return Se(e,"Null")}const Nm="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function yr(e){return he({"~kind":"Number"},{type:"number"},e)}function nn(e){return Se(e,"Number")}function yl(e){return he({"~kind":"Symbol"},{type:"symbol"},e)}function To(e){return Se(e,"Symbol")}function Ao(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[s,o,o],1:s=>[s,Ut(),Ut()]});return he({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function nw(e){return Se(e,"Parameter")}const $m=".*";function Ln(e){return he({"~kind":"String"},{type:"string"},e)}function $n(e){return Se(e,"String")}function Ge(e,t={}){return he({"~kind":"Union"},{anyOf:e},t)}function ie(e){return Se(e,"Union")}function rw(e){return Pn(e,["~kind","anyOf"])}function Rm(e){const t=UT(e);return h(t.length,2)?t[0]:[]}function sw(e){return!0}function Om(e){return Ie(e,(t,n)=>ow(t)?Om(n):!1,()=>!0)}function Mm(e){return h(e.length,0)?!1:Om(e)}function ow(e){return ie(e)?Mm(e.anyOf):Ve(e)?sw(e.const):!1}function Fm(e){return Mm(e)}function Dm(e){return he({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function _m(e,t,n=[]){return Ie(e,(r,s)=>_m(s,t,[...n,`${r}${t}`]),()=>n)}function iw(e,t){return h(e.length,0)?[`${t}`]:_m(e,t)}function Lm(e,t,n=[]){return Ie(t,(r,s)=>Lm(e,s,[...n,...Um(e,r)]),()=>n)}function Um(e,t){return ie(t)?Lm(e,t.anyOf):Ve(t)?iw(e,t.const):Nt()}function Bm(e,t){return Ie(t,(n,r)=>Bm(Um(e,n),r),()=>e)}function aw(e){return e.map(t=>Me(t))}function cw(e){const t=Bm([],e),n=aw(t);return Ge(n)}function lw(e){return h(e.length,0)?Nt():h(e.length,1)&&Ve(e[0])?e[0]:cw(e)}function Hm(e){const t=Rm(e);return h(t.length,0)?Ln():Fm(t)?lw(t):Dm(e)}function Sl(e){const t=Hm(e);return qt(t)?Ln():t}function Sr(e,t){const n="object",r={[e]:t};return he({"~kind":"Record"},{type:n,patternProperties:r})}function uw(e){return Sr(Gr,e)}function dw(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 rt(e){return Se(e,"Tuple")}function fw(e){return Pn(e,["~kind","type","items","minItems","additionalItems"])}function mw(e){return Pn(e,["~readonly"])}function qm(e,t){return ue(mw(e),{},t)}function pw(e,t,n,r){const s=G(e,t,n);return qm(s,r)}function gw(e,t={}){return je("RemoveReadonly",[e],t)}function hw(e,t={}){return qm(e,t)}function bw(e){return Pn(e,["~optional"])}function zm(e,t){return ue(bw(e),{},t)}function kw(e,t,n,r){const s=G(e,t,n);return zm(s,r)}function xw(e,t={}){return je("RemoveOptional",[e],t)}function Km(e,t={}){return zm(e,t)}function Gm(e){return e.reduceRight((n,r,s)=>({[s]:r,...n}),{})}function yw(e){const t=Gm(e.items);return Ae(t)}function Sw(e,t){return Pi(e)?!!Pi(t):!1}function vw(e,t){return Xt(e)?!!Xt(t):!1}function ww(e,t){const n=Sw(e,t),r=vw(e,t),s=rn([e,t]),o=hw(Km(s));return n&&r?Ei(ji(o)):n&&!r?Ei(o):!n&&r?ji(o):o}function Iw(e,t,n){return n in e?n in t?ww(e[n],t[n]):e[n]:n in t?t[n]:jt()}function Cw(e,t){return[...new Set([...D(t),...D(e)])].reduce((r,s)=>({...r,[s]:Iw(e,t,s)}),{})}function Pd(e){return Le(e)?e.properties:rt(e)?Gm(e.items):Nt()}function jw(e,t){const n=Pd(e),r=Pd(t),s=Cw(n,r);return Ae(s)}function Tw(e,t){const n=aa(e,t);return h(n,Kl)?e:h(n,Gl)||h(n,zl)?t:jt()}function Nd(e){return Le(e)||rt(e)}function Aw(e,t){const n=ie(e),r=ie(t);return n||r}function Ew(e,t){const n=Kr(e),r=Kr(t),s=Aw(n,r),o=Nd(n),i=Nd(r);return s?rn([n,r]):o&&i?jw(n,r):o&&!i?n:!o&&i?r:Tw(n,r)}function Vm(e,t,n=[]){return Ie(t,(r,s)=>Vm(e,s,[...n,Ew(e,r)]),()=>h(n.length,0)?[e]:n)}function Wm(e,t,n=[]){return Ie(e,(r,s)=>Wm(s,t,[...n,...Ni([r],t)]),()=>n)}function Ni(e,t=[]){return Ie(e,(n,r)=>ie(n)?Ni(r,Wm(n.anyOf,t)):Ni(r,Vm(n,t)),()=>t)}function Pw(e,t){const n=tr({},e,t);return Kt(n)?[]:[e]}function Nw(e,t){return e.reduce((n,r)=>[...n,...Pw(r,t)],[])}function Jm(e,t){const n=Kr(e),r=ie(n)?n.anyOf:[n],s=Nw(r,t);return sr(s)}function Ns(e,t,n){const r=Fn([e,t]),s=Jm(n,e);return sr([r,s])}function jr(e){const t=e.map(n=>Me(n));return sr(t)}function rn(e){const t=Ni(e),n=mg(t);return $s(n)}function rr(e){const t=Sl(e);return Kr(t)}function sr(e){const t=mg(e);return $s(t)}function Kr(e){return gn(e)?Ns(e.if,e.then,e.else):hn(e)?jr(e.enum):Ue(e)?rn(e.allOf):qt(e)?rr(e.pattern):ie(e)?sr(e.anyOf):e}function $s(e){return h(e.length,1)?e[0]:h(e.length,0)?jt():Ge(e)}function $w(e,t){const n=jr(e);return Zi(n,t)}function Rw(e,t){return Sr(Eo,t)}function Ow(e,t){const n=rn(e);return Zi(n,t)}function Mw(e,t){return oe(e)||xe(e)?Ae({[e]:t}):h(e,!1)?Ae({false:t}):h(e,!0)?Ae({true:t}):Ae({})}function Fw(e,t){return Sr(ea,t)}function Dw(e,t){return E(e,"pattern")&&(oe(e.pattern)||e.pattern instanceof RegExp)?Sr(e.pattern.toString(),t):Sr(Gr,t)}function _w(e,t){const n=Rm(e);return Fm(n)?Zi(rr(e),t):Sr(e,t)}function Lw(e){return ie(e)?Xi(e.anyOf):[e]}function Xi(e){return e.reduce((t,n)=>[...t,...Lw(n)],[])}function Uw(e){return e.some(t=>$n(t)||nn(t)||_n(t))}function Bw(e,t){return h(Uw(e),!0)?Sr(Gr,t):void 0}function Hw(e,t){return e.reduce((n,r)=>Ve(r)&&(oe(r.const)||xe(r.const))?{...n,[r.const]:t}:n,{})}function qw(e,t){const n=Hw(e,t);return Ae(n)}function zw(e,t){const n=Xi(e),r=Bw(n,t);return Yt(r)?r:qw(n,t)}function Zi(e,t){return Nn(e)?uw(t):Cr(e)?dw(t):hn(e)?$w(e.enum,t):_n(e)?Rw(e,t):Ue(e)?Ow(e.allOf,t):Ve(e)?Mw(e.const,t):nn(e)?Fw(e,t):ie(e)?zw(e.anyOf,t):$n(e)?Dw(e,t):qt(e)?_w(e.pattern,t):Ae({})}function Qm(e,t,n){return Qe([e])?ue(Zi(e,t),{},n):Ym(e,t,n)}function Kw(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return Qm(o,i,s)}const Eo=`^${Tm}$`,ea=`^${Nm}$`,Gr=`^${$m}$`;function Ym(e,t,n={}){return je("Record",[e,t],n)}function vl(e,t,n={}){return Qm(e,t,n)}function Gw(e,t){return Sr(e,t)}function mc(e){return h(e,Gr)?Ln():h(e,Eo)?Yi():h(e,ea)?yr():Hm(e)}function kn(e){return D(e.patternProperties)[0]}function ta(e){const t=kn(e);return mc(t)}function Ht(e){return e.patternProperties[kn(e)]}function Tt(e){return Se(e,"Record")}function na(e){return he({"~kind":"Rest"},{type:"rest",items:e},{})}function ra(e){return Se(e,"Rest")}function Xm(e){return he({"~kind":"This"},{$ref:"#"},e)}function Zm(e){return Se(e,"This")}function wl(e){return he({"~kind":"Undefined"},{type:"undefined"},e)}function Rs(e){return Se(e,"Undefined")}function ep(e){return he({"~kind":"Void"},{type:"void"},e)}function es(e){return Se(e,"Void")}function Vw(e,t){return h(e,"Array")?Ir(t[0]):h(e,"Capitalize")?kg(t[0]):h(e,"ConstructorParameters")?Ag(t[0]):h(e,"Evaluate")?UN(t[0]):h(e,"Exclude")?Pg(t[0],t[1]):h(e,"Extract")?Ng(t[0],t[1]):h(e,"Index")?Yl(t[0],t[1]):h(e,"InstanceType")?_g(t[0]):h(e,"Lowercase")?xg(t[0]):h(e,"NonNullable")?qg(t[0]):h(e,"Omit")?Kg(t[0],t[1]):h(e,"Parameters")?Wg(t[0]):h(e,"Partial")?Qg(t[0]):h(e,"Pick")?Xg(t[0],t[1]):h(e,"Readonly")?eh(t[0]):h(e,"KeyOf")?tu(t[0]):h(e,"Record")?Ym(t[0],t[1]):h(e,"Required")?rh(t[0]):h(e,"ReturnType")?oh(t[0]):h(e,"Uncapitalize")?yg(t[0]):h(e,"Uppercase")?Sg(t[0]):wc(un(e),t)}function ts(){throw Error("Unreachable")}function tp(e,t=[]){return Ie(e,(n,r)=>tp(r,[...t,n[1]]),()=>t)}function or(e){return h(e.length,3)?[e[0],...tp(e[1])]:[]}function Ww(e){return Ao(e[0],e[2],e[4])}function Jw(e){return Ao(e[0],e[2],e[2])}function Qw(e){return Ao(e[0],Ut(),e[2])}function Yw(e){return Ao(e,Ut(),Ut())}function Xw(e){return or(e)}function Zw(e){return e[1]}function eI(e){return or(e)}function tI(e){return e[1]}function nI(e){return Vw(e[0],e[1])}function rI(e){return null}function sI(e){return Ln()}function oI(e){return yr()}function iI(e){return jm()}function aI(e){return wl()}function cI(e){return xl()}function lI(e){return Yi()}function uI(e){return kl()}function dI(e){return Ut()}function fI(e){return gl()}function mI(e){return Ae({})}function pI(e){return jt()}function gI(e){return yl()}function hI(e){return ep()}function bI(e){return Xm()}function kI(e){return Me(BigInt(e))}function xI(e){return Me(h(e,"true"))}function yI(e){return Me(parseFloat(e))}function SI(e){return Me(e)}function vI(e){return e[1]}function wI(e){return Me(e)}function II(e){return h(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function CI(e){return e[1]}function jI(e){return Xp(e)}function TI(e){return h(e.length,6)?Ti(e[1],e[3],e[5]):Ti(e[1],e[3],Ut())}function AI(e){return e.length>0}function EI(e){return e.reduce((t,n)=>h(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function PI(e){return h(e.length,6)?[e[1],e[3],e[5]]:[]}function NI(e){return H(e)&&h(e.length,3)?e[1]:e}function $I(e){return h(e.length,2)?e[1]:[]}function $d(e,t){return t.reduce((n,r)=>{const s=r;return h(s.length,1)?Yl(n,s[0]):h(s.length,0)?Ir(n):ts()},e)}function Rd(e,t){return h(t.length,3)?jg(e,t[0],t[1],t[2]):e}function RI(e,t){return H(t)&&h(t.length,0)?e:ah(e,t)}function OI(e){const[t,n,r,s,o]=e;return RI(Rd(t?tu($d(n,r)):$d(n,r),s),o)}function Il(e,t){return h(t.length,3)?(()=>{const[n,r,s]=t,o=Il(r,s);if(h(n,"&"))return Ue(o)?Fn([e,...o.allOf]):Fn([e,o]);if(h(n,"|"))return ie(o)?Ge([e,...o.anyOf]):Ge([e,o]);ts()})():e}function MI(e){const[t,n]=e;return Il(t,n)}function FI(e){const[t,n]=e;return Il(t,n)}function DI(e){return LN(e[1])}function _I(e){return e[1]}function LI(e){return Io(e[0],e[2])}function UI(e){return h(e.length,4)?uc(e[1],e[3]):h(e.length,2)?uc(e[1],Ut()):ts()}function BI(e){return`${e}`}function HI(e){return _n(e[3])?Eo:nn(e[3])?ea:To(e[3])||$n(e[3])?Gr:ts()}function qI(e){return e.length>0}function zI(e){return e.length>0}function KI(e){const[t,n,r,s,o]=e;return{[n]:t&&r?er(Zn(o)):t&&!r?er(o):!t&&r?Zn(o):o}}function GI(e){return or(e)}function np(e){return e.reduce((t,n)=>E(n,Eo)||E(n,ea)||E(n,Gr)?[t[0],pt(t[1],n)]:[pt(t[0],n),t[1]],[{},{}])}function VI(e){return np(e[1])}function WI(e){const[t,n]=e,r=h(D(n).length,0)?{}:{patternProperties:n};return Ae(t,r)}function JI(e){return h(e.length,5)?er(Zn(e[4])):h(e.length,3)?e[2]:h(e.length,4)?h(e[2],"readonly")?er(e[3]):Zn(e[3]):ts()}function QI(e){if(!H(e)||!h(e.length,3))return e;const[t,n,r]=e;return t&&r?er(Zn(n)):t&&!r?er(n):!t&&r?Zn(n):n}function YI(e){return h(e.length,2)?na(e[1]):h(e.length,1)?e[0]:ts()}function XI(e){return or(e)}function ZI(e){return bn(e[1])}function eC(e){return er(Zn(e[4]))}function tC(e){return er(e[3])}function nC(e){return Zn(e[3])}function rC(e){return e[2]}function sC(e){return h(e.length,2)?na(e[1]):h(e.length,1)?e[0]:ts()}function oC(e){return or(e)}function iC(e){return wo(e[1],e[4])}function aC(e){return vo(e[2],e[5])}function Od(e,t){return h(e,"remove")?gw(t):h(e,"add")?er(t):t}function cC(e){return h(e.length,2)&&h(e[0],"-")?"remove":h(e.length,2)&&h(e[0],"+")||h(e.length,1)?"add":"none"}function Md(e,t){return h(e,"remove")?xw(t):h(e,"add")?Zn(t):t}function lC(e){return h(e.length,2)&&h(e[0],"-")?"remove":h(e.length,2)&&h(e[0],"+")||h(e.length,1)?"add":"none"}function uC(e){return h(e.length,2)?[e[1]]:[]}function dC(e){return H(e[6])&&h(e[6].length,1)?Ic(fc(e[3]),e[5],e[6][0],Od(e[1],Md(e[8],e[10]))):Ic(fc(e[3]),e[5],un(e[3]),Od(e[1],Md(e[8],e[10])))}function fC(e){return un(e)}function mC(e){return BigInt(e)}function pC(e){return parseFloat(e)}function gC(e){return h(e,"true")}function hC(e){return null}function bC(e){return{[e[0]]:e[2]}}function kC(e){return or(e)}function xC(e){return e.reduce((t,n)=>pt(t,n),{})}function yC(e){return xC(e[1])}function SC(e){return or(e)}function vC(e){return e[1]}function wC(e){return kl()}function IC(e){return Ln()}function CC(e){return yr()}function jC(e){return Yi()}function TC(e){return jt()}function AC(e){return Me(e)}function EC(e){return Ge(e[1])}function PC(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function NC(e){return[e[0],...e[1]]}function $C(e){return e[1]}function RC(e){return or(e)}function OC(e){return h(e.length,2)?e[1]:[]}function MC(e){const t=e[2],n=e[3],[r,s]=e[4],o=h(D(s).length,0)?{}:{patternProperties:s};return{[e[1]]:Io(t,Hl(n,r,o))}}function FC(e){const t=e[2],[n,r]=e[3],s=h(D(r).length,0)?{}:{patternProperties:r};return{[e[1]]:Hl(t,n,s)}}function DC(e){return{[e[1]]:Io(e[2],e[4])}}function _C(e){return{[e[1]]:e[3]}}function LC(e){return null}function UC(e){return or(e)}function BC(e){return e[1]}function HC(e){const[t,n]=[e[0],e[1]];return BN(pt(t,np(n)[0]))}function Cl(e){return h(e.length,2)}function Oe(e,t,n){return Cl(e)?t(e[0],e[1]):n()}function qC(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=qC(e[n],t);if(Cl(r))return r}return[]}function pc(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}const zC=[...pc(97,122),...pc(65,90)],rp="0",sp=pc(49,57),jl=[rp,...sp],KC=" ",Tl=`
|
|
3
|
+
`,Po="_",Al=".",GC="$",op="-",ip="//",ap="/*",VC="*/";function cp(e){const t=e.indexOf(VC);return h(t,-1)?"":e.slice(t+2)}function lp(e){const t=e.indexOf(Tl);return h(t,-1)?"":e.slice(t)}function WC(e){return e.replace(/^[ \t\r\f\v]+/,"")}function gc(e){const t=WC(e);return t.startsWith(ap)?gc(cp(t.slice(2))):t.startsWith(ip)?gc(lp(t.slice(2))):t}function jn(e){const t=e.trimStart();return t.startsWith(ap)?jn(cp(t.slice(2))):t.startsWith(ip)?jn(lp(t.slice(2))):t}function up(e,t){return Oe(Rt([e],t),(n,r)=>[n,r],()=>["",t])}function JC(e,t){return e.includes(t)}function $i(e,t,n,r=""){return Oe(Rt(e,n),(s,o)=>JC(t,s)?$i(e,t,o,r):$i(e,t,o,`${r}${s}`),()=>[r,n])}function QC(e){return Rt(sp,e)}const YC=[...jl,Po];function XC(e){return $i(YC,[Po],e)}function ZC(e){return Oe(Rt([rp],e),(t,n)=>[t,n],()=>Oe(QC(e),(t,n)=>Oe(XC(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[]))}function dp(e){return ZC(jn(e))}function ej(e){return up(op,e)}function tj(e){return Oe(ej(e),(t,n)=>Oe(dp(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function nj(e){return tj(jn(e))}function rj(e){return Oe(nj(e),(t,n)=>Oe(Rt(["n"],n),(r,s)=>[`${t}`,s],()=>[]),()=>[])}function fp(e){return rj(e)}function Va(e,t){return Rt([e],t)}function I(e,t){return h(e,"")?["",t]:e.startsWith(Tl)?Va(e,gc(t)):e.startsWith(KC)?Va(e,t):Va(e,jn(t))}const mp=[...zC,Po,GC];function sj(e){return Rt(mp,e)}const oj=[...mp,...jl];function pp(e,t=""){return Oe(Rt(oj,e),(n,r)=>pp(r,`${t}${n}`),()=>[t,e])}function ij(e){return Oe(sj(e),(t,n)=>Oe(pp(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function Ze(e){return ij(jn(e))}const aj=[...jl,Po];function cj(e){return Cl(Rt([Al],e))}function gp(e){return Oe($i(aj,[Po],e),(t,n)=>h(t,"")?[]:[t,n],()=>[])}function lj(e){return Oe(Rt([Al],e),(t,n)=>Oe(gp(n),(r,s)=>[`0${t}${r}`,s],()=>[]),()=>[])}function uj(e){return Oe(dp(e),(t,n)=>Oe(Rt([Al],n),(r,s)=>Oe(gp(s),(o,i)=>[`${t}${r}${o}`,i],()=>[`${t}`,s]),()=>[`${t}`,n]),()=>[])}function dj(e){return cj(e)?lj(e):uj(e)}function fj(e){return dj(jn(e))}function mj(e){return up(op,e)}function pj(e){return Oe(mj(e),(t,n)=>Oe(fj(n),(r,s)=>[`${t}${r}`,s],()=>[]),()=>[])}function El(e){return pj(jn(e))}function gj(e){return h(e,"")?[]:[e.slice(0,1),e.slice(1)]}function hp(e,t){return Ie(e,(n,r)=>t.startsWith(n)?!0:hp(r,t),()=>!1)}function No(e,t,n=""){return Oe(gj(t),(r,s)=>hp(e,t)?[n,t]:No(e,s,`${n}${r}`),()=>[])}function hj(e,t,n){return Oe(Rt([e],n),(r,s)=>Oe(No([t],s),(o,i)=>Oe(Rt([t],i),(a,l)=>[`${o}`,l],()=>[]),()=>[]),()=>[])}function bj(e,t,n){return Oe(Rt([e],n),(r,s)=>Oe(No([Tl,t],s),(o,i)=>Oe(Rt([t],i),(a,l)=>[`${o}`,l],()=>[]),()=>[]),()=>[])}function kj(e,t,n,r){return n?hj(e,t,jn(r)):bj(e,t,jn(r))}function xj(e,t){return Rt(e,t)}function yj(e,t){return kj(e,e,!1,t)}function Sj(e,t){return Oe(xj(e,t),(n,r)=>yj(n,`${n}${r}`),()=>[])}function Pl(e,t){return Sj(e,jn(t))}function vj(e,t){return Oe(No(e,t),(n,r)=>h(n,"")?[]:[n,r],()=>[])}const d=(e,t,n=()=>[])=>e.length===2?t(e):n(),wj=e=>d(d(Ze(e),([t,n])=>d(I("extends",n),([r,s])=>d(ge(s),([o,i])=>d(I("=",i),([a,l])=>d(ge(l),([u,m])=>[[t,r,o,a,u],m]))))),([t,n])=>[Ww(t),n]),Ij=e=>d(d(Ze(e),([t,n])=>d(I("extends",n),([r,s])=>d(ge(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[Jw(t),n]),Cj=e=>d(d(Ze(e),([t,n])=>d(I("=",n),([r,s])=>d(ge(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[Qw(t),n]),jj=e=>d(Ze(e),([t,n])=>[Yw(t),n]),bp=e=>d(d(wj(e),([t,n])=>[t,n],()=>d(Ij(e),([t,n])=>[t,n],()=>d(Cj(e),([t,n])=>[t,n],()=>d(jj(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),kp=(e,t=[])=>d(d(I(",",e),([n,r])=>d(bp(r),([s,o])=>[[n,s],o])),([n,r])=>kp(r,[...t,n]),()=>[t,e]),Tj=e=>d(d(d(bp(e),([t,n])=>d(kp(n),([r,s])=>d(d(I(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Xw(t),n]),Nl=e=>d(d(I("<",e),([t,n])=>d(Tj(n),([r,s])=>d(I(">",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[Zw(t),n]),xp=(e,t=[])=>d(d(I(",",e),([n,r])=>d(ge(r),([s,o])=>[[n,s],o])),([n,r])=>xp(r,[...t,n]),()=>[t,e]),Aj=e=>d(d(d(ge(e),([t,n])=>d(xp(n),([r,s])=>d(d(I(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[eI(t),n]),Ej=e=>d(d(I("<",e),([t,n])=>d(Aj(n),([r,s])=>d(I(">",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[tI(t),n]),Pj=e=>d(d(Ze(e),([t,n])=>d(Ej(n),([r,s])=>[[t,r],s])),([t,n])=>[nI(t),n]),yp=e=>d(d(d(I(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[rI(),n]),Sp=e=>d(I("string",e),([t,n])=>[sI(),n]),vp=e=>d(I("number",e),([t,n])=>[oI(),n]),Nj=e=>d(I("boolean",e),([t,n])=>[iI(),n]),$j=e=>d(I("undefined",e),([t,n])=>[aI(),n]),Rj=e=>d(I("null",e),([t,n])=>[cI(),n]),wp=e=>d(I("integer",e),([t,n])=>[lI(),n]),Oj=e=>d(I("bigint",e),([t,n])=>[uI(),n]),Mj=e=>d(I("unknown",e),([t,n])=>[dI(),n]),Fj=e=>d(I("any",e),([t,n])=>[fI(),n]),Dj=e=>d(I("object",e),([t,n])=>[mI(),n]),_j=e=>d(I("never",e),([t,n])=>[pI(),n]),Ip=e=>d(I("symbol",e),([t,n])=>[gI(),n]),Lj=e=>d(I("void",e),([t,n])=>[hI(),n]),Uj=e=>d(I("this",e),([t,n])=>[bI(),n]),Bj=e=>d(d(I("${",e),([t,n])=>d(ge(n),([r,s])=>d(I("}",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[vI(t),n]),Wa=e=>d(No(["${","`"],e),([t,n])=>[wI(t),n]),Cp=e=>d(d(d(Wa(e),([t,n])=>d(Bj(n),([r,s])=>d(Cp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d(d(Wa(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d(d(Wa(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[II(t),n]),jp=e=>d(d(I("`",e),([t,n])=>d(Cp(n),([r,s])=>d(I("`",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[CI(t),n]),Hj=e=>d(jp(e),([t,n])=>[jI(t),n]),qj=e=>d(d(d(I("if",e),([t,n])=>d(ge(n),([r,s])=>d(I("then",s),([o,i])=>d(ge(i),([a,l])=>d(I("else",l),([u,m])=>d(ge(m),([p,g])=>[[t,r,o,a,u,p],g])))))),([t,n])=>[t,n],()=>d(d(I("if",e),([t,n])=>d(ge(n),([r,s])=>d(I("then",s),([o,i])=>d(ge(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[t,n],()=>[])),([t,n])=>[TI(t),n]),zj=e=>d(fp(e),([t,n])=>[kI(t),n]),Kj=e=>d(d(I("true",e),([t,n])=>[t,n],()=>d(I("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[xI(t),n]),Gj=e=>d(El(e),([t,n])=>[yI(t),n]),Vj=e=>d(Pl(["'",'"'],e),([t,n])=>[SI(t),n]),Wj=e=>d(d(d(I("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[AI(t),n]),Tp=(e,t=[])=>d(d(d(I("[",e),([n,r])=>d(ge(r),([s,o])=>d(I("]",o),([i,a])=>[[n,s,i],a]))),([n,r])=>[n,r],()=>d(d(I("[",e),([n,r])=>d(I("]",r),([s,o])=>[[n,s],o])),([n,r])=>[n,r],()=>[])),([n,r])=>Tp(r,[...t,n]),()=>[t,e]),Jj=e=>d(Tp(e),([t,n])=>[EI(t),n]),Qj=e=>d(d(d(I("extends",e),([t,n])=>d(ge(n),([r,s])=>d(I("?",s),([o,i])=>d(ge(i),([a,l])=>d(I(":",l),([u,m])=>d(ge(m),([p,g])=>[[t,r,o,a,u,p],g])))))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[PI(t),n]),Yj=e=>d(d(d(I("(",e),([t,n])=>d(ge(n),([r,s])=>d(I(")",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d(Sp(e),([t,n])=>[t,n],()=>d(vp(e),([t,n])=>[t,n],()=>d(Nj(e),([t,n])=>[t,n],()=>d($j(e),([t,n])=>[t,n],()=>d(Rj(e),([t,n])=>[t,n],()=>d(wp(e),([t,n])=>[t,n],()=>d(Oj(e),([t,n])=>[t,n],()=>d(Mj(e),([t,n])=>[t,n],()=>d(Fj(e),([t,n])=>[t,n],()=>d(Dj(e),([t,n])=>[t,n],()=>d(_j(e),([t,n])=>[t,n],()=>d(Ip(e),([t,n])=>[t,n],()=>d(Lj(e),([t,n])=>[t,n],()=>d(Uj(e),([t,n])=>[t,n],()=>d(zj(e),([t,n])=>[t,n],()=>d(Kj(e),([t,n])=>[t,n],()=>d(Gj(e),([t,n])=>[t,n],()=>d(Vj(e),([t,n])=>[t,n],()=>d(Hj(e),([t,n])=>[t,n],()=>d(qj(e),([t,n])=>[t,n],()=>d(cT(e),([t,n])=>[t,n],()=>d(dT(e),([t,n])=>[t,n],()=>d(bT(e),([t,n])=>[t,n],()=>d(hT(e),([t,n])=>[t,n],()=>d(ST(e),([t,n])=>[t,n],()=>d(Pj(e),([t,n])=>[t,n],()=>d(vT(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[NI(t),n]),Xj=e=>d(d(d(I("with",e),([t,n])=>d(zp(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[$I(t),n]),Ap=e=>d(d(Wj(e),([t,n])=>d(Yj(n),([r,s])=>d(Jj(s),([o,i])=>d(Qj(i),([a,l])=>d(Xj(l),([u,m])=>[[t,r,o,a,u],m]))))),([t,n])=>[OI(t),n]),Ep=e=>d(d(d(I("&",e),([t,n])=>d(Ap(n),([r,s])=>d(Ep(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Pp=e=>d(d(Ap(e),([t,n])=>d(Ep(n),([r,s])=>[[t,r],s])),([t,n])=>[MI(t),n]),Np=e=>d(d(d(I("|",e),([t,n])=>d(Pp(n),([r,s])=>d(Np(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),sa=e=>d(d(Pp(e),([t,n])=>d(Np(n),([r,s])=>[[t,r],s])),([t,n])=>[FI(t),n]),Zj=e=>d(d(I("readonly",e),([t,n])=>d(sa(n),([r,s])=>[[t,r],s])),([t,n])=>[DI(t),n]),eT=e=>d(d(I("|",e),([t,n])=>d(sa(n),([r,s])=>[[t,r],s])),([t,n])=>[_I(t),n]),tT=e=>d(d(Nl(e),([t,n])=>d(I("=",n),([r,s])=>d(ge(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[LI(t),n]),nT=e=>d(d(d(I("infer",e),([t,n])=>d(Ze(n),([r,s])=>d(I("extends",s),([o,i])=>d(sa(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[t,n],()=>d(d(I("infer",e),([t,n])=>d(Ze(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>[])),([t,n])=>[UI(t),n]),ge=e=>d(d(nT(e),([t,n])=>[t,n],()=>d(eT(e),([t,n])=>[t,n],()=>d(Zj(e),([t,n])=>[t,n],()=>d(sa(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),rT=e=>d(El(e),([t,n])=>[BI(t),n]),sT=e=>d(Ze(e),([t,n])=>[t,n]),oT=e=>d(Pl(["'",'"'],e),([t,n])=>[t,n]),iT=e=>d(d(I("[",e),([t,n])=>d(Ze(n),([r,s])=>d(I(":",s),([o,i])=>d(d(wp(i),([a,l])=>[a,l],()=>d(vp(i),([a,l])=>[a,l],()=>d(Sp(i),([a,l])=>[a,l],()=>d(Ip(i),([a,l])=>[a,l],()=>[])))),([a,l])=>d(I("]",l),([u,m])=>[[t,r,o,a,u],m]))))),([t,n])=>[HI(t),n]),$p=e=>d(d(rT(e),([t,n])=>[t,n],()=>d(sT(e),([t,n])=>[t,n],()=>d(oT(e),([t,n])=>[t,n],()=>d(iT(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Rp=e=>d(d(d(I("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[qI(t),n]),Op=e=>d(d(d(I("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[zI(t),n]),Mp=e=>d(d(Rp(e),([t,n])=>d($p(n),([r,s])=>d(Op(s),([o,i])=>d(I(":",i),([a,l])=>d(ge(l),([u,m])=>[[t,r,o,a,u],m]))))),([t,n])=>[KI(t),n]),oa=e=>d(d(d(I(",",e),([t,n])=>d(I(`
|
|
4
|
+
`,n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(I(";",e),([t,n])=>d(I(`
|
|
5
|
+
`,n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(I(",",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d(d(I(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d(d(I(`
|
|
6
|
+
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),Fp=(e,t=[])=>d(d(oa(e),([n,r])=>d(Mp(r),([s,o])=>[[n,s],o])),([n,r])=>Fp(r,[...t,n]),()=>[t,e]),aT=e=>d(d(d(Mp(e),([t,n])=>d(Fp(n),([r,s])=>d(d(oa(s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[GI(t),n]),$l=e=>d(d(I("{",e),([t,n])=>d(aT(n),([r,s])=>d(I("}",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[VI(t),n]),cT=e=>d($l(e),([t,n])=>[WI(t),n]),lT=e=>d(d(d(Ze(e),([t,n])=>d(I("?",n),([r,s])=>d(I(":",s),([o,i])=>d(I("readonly",i),([a,l])=>d(ge(l),([u,m])=>[[t,r,o,a,u],m]))))),([t,n])=>[t,n],()=>d(d(Ze(e),([t,n])=>d(I(":",n),([r,s])=>d(I("readonly",s),([o,i])=>d(ge(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[t,n],()=>d(d(Ze(e),([t,n])=>d(I("?",n),([r,s])=>d(I(":",s),([o,i])=>d(ge(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[t,n],()=>d(d(Ze(e),([t,n])=>d(I(":",n),([r,s])=>d(ge(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[JI(t),n]),Fd=e=>d(d(lT(e),([t,n])=>[t,n],()=>d(d(Rp(e),([t,n])=>d(ge(n),([r,s])=>d(Op(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>[])),([t,n])=>[QI(t),n]),Dp=e=>d(d(d(I("...",e),([t,n])=>d(Fd(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(Fd(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[YI(t),n]),_p=(e,t=[])=>d(d(I(",",e),([n,r])=>d(Dp(r),([s,o])=>[[n,s],o])),([n,r])=>_p(r,[...t,n]),()=>[t,e]),uT=e=>d(d(d(Dp(e),([t,n])=>d(_p(n),([r,s])=>d(d(I(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[XI(t),n]),dT=e=>d(d(I("[",e),([t,n])=>d(uT(n),([r,s])=>d(I("]",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[ZI(t),n]),fT=e=>d(d(Ze(e),([t,n])=>d(I("?",n),([r,s])=>d(I(":",s),([o,i])=>d(I("readonly",i),([a,l])=>d(ge(l),([u,m])=>[[t,r,o,a,u],m]))))),([t,n])=>[eC(t),n]),mT=e=>d(d(Ze(e),([t,n])=>d(I(":",n),([r,s])=>d(I("readonly",s),([o,i])=>d(ge(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[tC(t),n]),pT=e=>d(d(Ze(e),([t,n])=>d(I("?",n),([r,s])=>d(I(":",s),([o,i])=>d(ge(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[nC(t),n]),gT=e=>d(d(Ze(e),([t,n])=>d(I(":",n),([r,s])=>d(ge(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[rC(t),n]),Dd=e=>d(d(fT(e),([t,n])=>[t,n],()=>d(mT(e),([t,n])=>[t,n],()=>d(pT(e),([t,n])=>[t,n],()=>d(gT(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Lp=e=>d(d(d(I("...",e),([t,n])=>d(Dd(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(Dd(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[sC(t),n]),Up=(e,t=[])=>d(d(I(",",e),([n,r])=>d(Lp(r),([s,o])=>[[n,s],o])),([n,r])=>Up(r,[...t,n]),()=>[t,e]),Bp=e=>d(d(d(Lp(e),([t,n])=>d(Up(n),([r,s])=>d(d(I(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[oC(t),n]),hT=e=>d(d(I("(",e),([t,n])=>d(Bp(n),([r,s])=>d(I(")",s),([o,i])=>d(I("=>",i),([a,l])=>d(ge(l),([u,m])=>[[t,r,o,a,u],m]))))),([t,n])=>[iC(t),n]),bT=e=>d(d(I("new",e),([t,n])=>d(I("(",n),([r,s])=>d(Bp(s),([o,i])=>d(I(")",i),([a,l])=>d(I("=>",l),([u,m])=>d(ge(m),([p,g])=>[[t,r,o,a,u,p],g])))))),([t,n])=>[aC(t),n]),kT=e=>d(d(d(I("+",e),([t,n])=>d(I("readonly",n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(I("-",e),([t,n])=>d(I("readonly",n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(I("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[cC(t),n]),xT=e=>d(d(d(I("+",e),([t,n])=>d(I("?",n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(I("-",e),([t,n])=>d(I("?",n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(I("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[lC(t),n]),yT=e=>d(d(d(I("as",e),([t,n])=>d(ge(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[uC(t),n]),ST=e=>d(d(I("{",e),([t,n])=>d(kT(n),([r,s])=>d(I("[",s),([o,i])=>d(Ze(i),([a,l])=>d(I("in",l),([u,m])=>d(ge(m),([p,g])=>d(yT(g),([x,b])=>d(I("]",b),([y,j])=>d(xT(j),([k,A])=>d(I(":",A),([N,R])=>d(ge(R),([J,T])=>d(yp(T),([C,$])=>d(I("}",$),([O,K])=>[[t,r,o,a,u,p,x,y,k,N,J,C,O],K]))))))))))))),([t,n])=>[dC(t),n]),vT=e=>d(Ze(e),([t,n])=>[fC(t),n]),wT=e=>d(fp(e),([t,n])=>[mC(t),n]),IT=e=>d(El(e),([t,n])=>[pC(t),n]),CT=e=>d(d(I("true",e),([t,n])=>[t,n],()=>d(I("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[gC(t),n]),jT=e=>d(Pl(['"',"'"],e),([t,n])=>[t,n]),TT=e=>d(I("null",e),([t,n])=>[hC(),n]),AT=e=>d(I("undefined",e),([t,n])=>[void 0,n]),Hp=e=>d(d($p(e),([t,n])=>d(I(":",n),([r,s])=>d(Rl(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[bC(t),n]),qp=(e,t=[])=>d(d(oa(e),([n,r])=>d(Hp(r),([s,o])=>[[n,s],o])),([n,r])=>qp(r,[...t,n]),()=>[t,e]),ET=e=>d(d(d(Hp(e),([t,n])=>d(qp(n),([r,s])=>d(d(oa(s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[kC(t),n]),zp=e=>d(d(I("{",e),([t,n])=>d(ET(n),([r,s])=>d(I("}",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[yC(t),n]),Kp=(e,t=[])=>d(d(I(",",e),([n,r])=>d(Rl(r),([s,o])=>[[n,s],o])),([n,r])=>Kp(r,[...t,n]),()=>[t,e]),PT=e=>d(d(d(Rl(e),([t,n])=>d(Kp(n),([r,s])=>d(d(I(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[SC(t),n]),NT=e=>d(d(I("[",e),([t,n])=>d(PT(n),([r,s])=>d(I("]",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[vC(t),n]),Rl=e=>d(d(wT(e),([t,n])=>[t,n],()=>d(IT(e),([t,n])=>[t,n],()=>d(CT(e),([t,n])=>[t,n],()=>d(jT(e),([t,n])=>[t,n],()=>d(TT(e),([t,n])=>[t,n],()=>d(AT(e),([t,n])=>[t,n],()=>d(zp(e),([t,n])=>[t,n],()=>d(NT(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),$T=e=>d(I("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[wC(),n]),RT=e=>d(I(".*",e),([t,n])=>[IC(),n]),OT=e=>d(I("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[CC(),n]),MT=e=>d(I("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[jC(),n]),FT=e=>d(I("(?!)",e),([t,n])=>[TC(),n]),DT=e=>d(vj(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[AC(t),n]),_T=e=>d(d($T(e),([t,n])=>[t,n],()=>d(RT(e),([t,n])=>[t,n],()=>d(OT(e),([t,n])=>[t,n],()=>d(MT(e),([t,n])=>[t,n],()=>d(FT(e),([t,n])=>[t,n],()=>d(LT(e),([t,n])=>[t,n],()=>d(DT(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),LT=e=>d(d(I("(",e),([t,n])=>d(Ol(n),([r,s])=>d(I(")",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[EC(t),n]),Gp=e=>d(d(d(hc(e),([t,n])=>d(I("|",n),([r,s])=>d(Gp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d(d(hc(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[PC(t),n]),hc=e=>d(d(_T(e),([t,n])=>d(Ol(n),([r,s])=>[[t,r],s])),([t,n])=>[NC(t),n]),Ol=e=>d(d(Gp(e),([t,n])=>[t,n],()=>d(hc(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),UT=e=>d(d(I("^",e),([t,n])=>d(Ol(n),([r,s])=>d(I("$",s),([o,i])=>[[t,r,o],i]))),([t,n])=>[$C(t),n]),Vp=(e,t=[])=>d(d(I(",",e),([n,r])=>d(ge(r),([s,o])=>[[n,s],o])),([n,r])=>Vp(r,[...t,n]),()=>[t,e]),BT=e=>d(d(d(ge(e),([t,n])=>d(Vp(n),([r,s])=>d(d(I(",",s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[RC(t),n]),Wp=e=>d(d(d(I("extends",e),([t,n])=>d(BT(n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[OC(t),n]),HT=e=>d(d(I("interface",e),([t,n])=>d(Ze(n),([r,s])=>d(Nl(s),([o,i])=>d(Wp(i),([a,l])=>d($l(l),([u,m])=>[[t,r,o,a,u],m]))))),([t,n])=>[MC(t),n]),qT=e=>d(d(I("interface",e),([t,n])=>d(Ze(n),([r,s])=>d(Wp(s),([o,i])=>d($l(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[FC(t),n]),zT=e=>d(d(I("type",e),([t,n])=>d(Ze(n),([r,s])=>d(Nl(s),([o,i])=>d(I("=",i),([a,l])=>d(ge(l),([u,m])=>[[t,r,o,a,u],m]))))),([t,n])=>[DC(t),n]),KT=e=>d(d(I("type",e),([t,n])=>d(Ze(n),([r,s])=>d(I("=",s),([o,i])=>d(ge(i),([a,l])=>[[t,r,o,a],l])))),([t,n])=>[_C(t),n]),GT=e=>d(d(d(I("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[LC(),n]),Jp=e=>d(d(d(I(";",e),([t,n])=>d(I(`
|
|
7
|
+
`,n),([r,s])=>[[t,r],s])),([t,n])=>[t,n],()=>d(d(I(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>d(d(I(`
|
|
8
|
+
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),Qp=(e,t=[])=>d(d(Jp(e),([n,r])=>d(Ml(r),([s,o])=>[[n,s],o])),([n,r])=>Qp(r,[...t,n]),()=>[t,e]),VT=e=>d(d(d(Ml(e),([t,n])=>d(Qp(n),([r,s])=>d(d(Jp(s),([o,i])=>[[o],i],()=>[[],s]),([o,i])=>[[t,r,o],i]))),([t,n])=>[t,n],()=>d([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[UC(t),n]),Ml=e=>d(d(GT(e),([t,n])=>d(d(HT(n),([r,s])=>[r,s],()=>d(qT(n),([r,s])=>[r,s],()=>d(zT(n),([r,s])=>[r,s],()=>d(KT(n),([r,s])=>[r,s],()=>[])))),([r,s])=>d(yp(s),([o,i])=>[[t,r,o],i]))),([t,n])=>[BC(t),n]),WT=e=>d(d(Ml(e),([t,n])=>d(VT(n),([r,s])=>[[t,r],s])),([t,n])=>[HC(t),n]),JT=e=>d(d(WT(e),([t,n])=>[t,n],()=>d(tT(e),([t,n])=>[t,n],()=>d(ge(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function QT(e){const t=jp(`\`${e}\``);return h(t.length,2)?t[0]:Nt()}function YT(e){return e.join("|")}function XT(e){return e.slice(1,e.length-1)}function ZT(e,t,n){return Tr(t,`${n}${e}`)}function eA(e,t){return Tr(e,`${t}${Qv}`)}function tA(e,t){return Tr(e,`${t}${Tm}`)}function nA(e,t){return Tr(e,`${t}${Nm}`)}function rA(e,t){return $o(Ge([Me("false"),Me("true")]),e,t)}function sA(e,t){return Tr(e,`${t}${$m}`)}function oA(e,t,n){return Tr(t,`${n}${XT(e)}`)}function iA(e,t,n){const r=Fl(e,{});return $o(r,t,n)}function aA(e,t,n){const r=jr(e);return $o(r,t,n)}function Yp(e,t,n,r=[]){return Ie(e,(s,o)=>Yp(o,t,n,[...r,$o(s,[],"")]),()=>Tr(t,`${n}(${YT(r)})`))}function $o(e,t,n){return hn(e)?aA(e.enum,t,n):_n(e)?tA(t,n):Ve(e)?ZT(e.const,t,n):Zr(e)?eA(t,n):Cr(e)?rA(t,n):nn(e)?nA(t,n):$n(e)?sA(t,n):qt(e)?oA(e.pattern,t,n):dA(e)?iA(e.parameters[0],t,n):ie(e)?Yp(e.anyOf,t,n):uv}function Tr(e,t){return Ie(e,(n,r)=>$o(n,r,t),()=>t)}function cA(e){return`^${Tr(e,"")}$`}function lA(e){const t=cA(e);return Dm(t)}function Fl(e,t){return Qe(e)?ue(lA(e),{},t):Xp(e,t)}function uA(e,t,n,r){const s=Wn(e,t,n);return Fl(s,r)}function Xp(e,t={}){return je("TemplateLiteral",[e],t)}function dA(e){return Yt(e)&&E(e,"action")&&h(e.action,"TemplateLiteral")}function Zp(e){return Fl(e,{})}function fA(e){const t=QT(e);return Zp(t)}function mA(e,t={}){const n=oe(e)?fA(e):Zp(e);return ue(n,{},t)}function qt(e){return Se(e,"TemplateLiteral")}function eg(e){return he({"~kind":"ExtendsUnion"},{inferred:e})}function Dl(e){return ne(e)&&E(e,"~kind")&&E(e,"inferred")&&h(e["~kind"],"ExtendsUnion")&&ne(e.inferred)}function ee(e){return he({"~kind":"ExtendsTrue"},{inferred:e})}function _l(e){return ne(e)&&E(e,"~kind")&&E(e,"inferred")&&h(e["~kind"],"ExtendsTrue")&&ne(e.inferred)}function ke(){return he({"~kind":"ExtendsFalse"},{})}function bc(e){return ne(e)&&E(e,"~kind")&&h(e["~kind"],"ExtendsFalse")}function Kt(e){return Dl(e)||_l(e)}function yt(e,t,n){return Kt(e)?t(e.inferred):n()}const pA=Object.freeze(Object.defineProperty({__proto__:null,ExtendsFalse:ke,ExtendsTrue:ee,ExtendsUnion:eg,IsExtendsFalse:bc,IsExtendsTrue:_l,IsExtendsTrueLike:Kt,IsExtendsUnion:Dl,Match:yt},Symbol.toStringTag,{value:"Module"}));function gA(e,t,n,r){return yt(Je(e,n,r),s=>ee(pt(pt(e,s),{[t]:n})),()=>ke())}function hA(e,t){return ee(e)}function bA(e,t,n,r,s){return yt(Je(e,t,n),o=>yt(Je(o,t,r),i=>ee(i),()=>ke()),()=>yt(Je(e,t,s),o=>ee(o),()=>ke()))}function kA(e,t,n){const r=jr(n);return Je(e,t,r)}function tg(e,t,n){return Ie(n,(r,s)=>yt(Je(e,t,r),o=>tg(o,t,s),()=>ke()),()=>ee(e))}function xA(e,t,n){const r=rr(n);return Je(e,t,r)}function ng(e,t,n){return Ie(n,(r,s)=>yt(Je(e,t,r),o=>ee(o),()=>ng(e,t,s)),()=>ke())}function xt(e,t,n){return Nn(n)?hA(e):gn(n)?bA(e,t,n.if,n.then,n.else):hn(n)?kA(e,t,n.enum):Zt(n)?gA(e,n.name,t,n.extends):Ue(n)?tg(e,t,n.allOf):qt(n)?xA(e,t,n.pattern):ie(n)?ng(e,t,n.anyOf):Cn(n)?ee(e):ke()}function yA(e,t,n){return Zt(n)?xt(e,t,n):Nn(n)||Cn(n)?ee(e):eg(e)}function SA(e,t){const n=Ai(e),r=Ai(t);return n&&r||!n&&r?!0:!(n&&!r)}function vA(e,t,n,r){return ut(r)?SA(t,r)?Je(e,n,r.items):ke():xt(e,t,r)}function wA(e,t,n){return Zr(n)?ee(e):xt(e,t,n)}function IA(e,t,n){return Cr(n)?ee(e):xt(e,t,n)}function CA(e,t,n,r,s){const o=Zt(r)?t:r,i=Zt(r)?r:t,a=Xt(t),l=Xt(r);return!a&&l?ke():yt(Je(e,o,i),u=>Ll(u,n,s),()=>ke())}function jA(e,t,n,r){return Ie(r,(s,o)=>CA(e,t,n,s,o),()=>Xt(t)?ee(e):ke())}function TA(e,t,n){return Ie(t,(r,s)=>jA(e,r,s,n),()=>ee(e))}function Ll(e,t,n){return TA(e,t,n)}function rg(e,t,n){return es(n)?ee(e):Je(e,t,n)}function AA(e,t,n,r){return Nn(r)||Cn(r)?ee(e):mn(r)?yt(Ll(e,t,r.parameters),s=>rg(s,n,r.instanceType),()=>ke()):ke()}function EA(e,t,n,r,s){return yt(Je(e,t,s),()=>Je(e,n,s),()=>Je(e,r,s))}function PA(e,t,n){const r=jr(t);return Je(e,r,n)}function NA(e,t,n,r){return Nn(r)||Cn(r)?ee(e):pn(r)?yt(Ll(e,t,r.parameters),s=>rg(s,n,r.returnType),()=>ke()):ke()}function $A(e,t,n){return _n(n)||nn(n)?ee(e):xt(e,t,n)}function RA(e,t,n){const r=rn(t);return Je(e,r,n)}function ia(e,t,n){return t===n?ee(e):ke()}function OA(e,t,n){return Ve(n)?ia(e,t,n.const):Zr(n)?ee(e):xt(e,Me(t),n)}function MA(e,t,n){return Ve(n)?ia(e,t,n.const):Cr(n)?ee(e):xt(e,Me(t),n)}function FA(e,t,n){return Ve(n)?ia(e,t,n.const):nn(n)?ee(e):xt(e,Me(t),n)}function DA(e,t,n){return Ve(n)?ia(e,t,n.const):$n(n)?ee(e):xt(e,Me(t),n)}function _A(e,t,n){return et(t.const)?OA(e,t.const,n):gt(t.const)?MA(e,t.const,n):xe(t.const)?FA(e,t.const,n):oe(t.const)?DA(e,t.const,n):Nt()}function LA(e,t,n){return Zt(n)?xt(e,t,n):ee(e)}function UA(e,t,n){return jo(n)?ee(e):xt(e,t,n)}function BA(e,t,n){return nn(n)?ee(e):xt(e,t,n)}function HA(e,t,n){return Xt(t)?Xt(n)?ee(e):ke():ee(e)}function qA(e,t,n){return Zt(n)&&Ps(n.extends)?ke():yt(Je(e,t,n),r=>HA(r,t,n),()=>ke())}function zA(e,t){return e.reduce((n,r)=>r in t&&Kt(t[r])?{...n,...t[r].inferred}:Nt(),{})}function KA(e,t,n){const r={};for(const i of D(n))r[i]=i in t?qA({},t[i],n[i]):Xt(n[i])?Zt(n[i])?ee(pt(e,{[n[i].name]:n[i].extends})):ee(e):ke();const s=il(r).every(i=>Kt(i)),o=s?zA(D(r),r):{};return s?ee(o):ke()}function GA(e,t,n){const r=KA(e,t,n);return Kt(r)?ee(pt(e,r.inferred)):ke()}function VA(e,t,n){return GA(e,t,n)}function WA(e,t){return D(t).reduce((n,r)=>({...n,[r]:E(e,r)?ie(n[r])?Ge([...n[r].anyOf,t[r]]):Ge([e[r],t[r]]):t[r]}),e)}function sg(e,t,n,r){return Ie(t,(s,o)=>yt(Je({},e[s],n),i=>sg(e,o,n,WA(r,i)),()=>ke()),()=>ee(r))}function JA(e,t,n,r){const s=D(t);return sg(t,s,r,e)}function QA(e,t,n){return Tt(n)?JA(e,t,kn(n),Ht(n)):Le(n)?VA(e,t,n.properties):xt(e,Ae(t),n)}function YA(e,t){return h(D(t).length,0)?ee(e):ke()}function XA(e,t,n,r,s){return Je(e,n,s)}function ZA(e,t,n,r){return Tt(r)?XA(e,mc(t),n,mc(kn(r)),Ht(r)):Le(r)?YA(e,r.properties):Nn(r)||Cn(r)?ee(e):ke()}function eE(e,t,n){return $n(n)?ee(e):xt(e,t,n)}function tE(e,t,n){return To(n)?ee(e):xt(e,t,n)}function nE(e,t,n){const r=rr(t);return Je(e,r,n)}function kc(e,t){return he({"~kind":"Inferrable"},{name:e,type:t},{})}function Ul(e){return ne(e)&&E(e,"~kind")&&E(e,"name")&&E(e,"type")&&h(e["~kind"],"Inferrable")&&oe(e.name)&&ne(e.type)}function og(e){return ra(e)?Zt(e.items)?ut(e.items.extends)?kc(e.items.name,e.items.extends.items):Cn(e.items.extends)?kc(e.items.name,e.items.extends):void 0:Nt():void 0}function ig(e){return Zt(e)?kc(e.name,e.extends):void 0}function Bl(e,t,n=[]){return Ie(e,(r,s)=>yt(Je({},r,t),()=>Bl(s,t,[...n,r]),()=>{}),()=>n)}function rE(e,t,n,r){const s=Bl(n,r);return H(s)?ee(pt(e,{[t]:bn(s)})):ke()}function ag(e,t,n,r){const s=Bl(n,r);return H(s)?ee(pt(e,{[t]:Ge(s)})):ke()}function sE(e){return[...e].reverse()}function xc(e,t){return t?sE(e):e}function oE(e){const t=e.length>0?e[0]:void 0,n=Yt(t)?og(t):void 0;return Yt(n)}function iE(e,t,n,r,s,o){return yt(Je(e,n,s),i=>cg(i,t,r,o),()=>ke())}function aE(e,t,n,r,s){const o=og(r);return Ul(o)?rE(e,o.name,xc(n,t),o.type):Ie(n,(i,a)=>iE(e,t,i,a,r,s),()=>ke())}function cE(e,t,n,r){return Ie(r,(s,o)=>aE(e,t,n,s,o),()=>h(n.length,0)?ee(e):ke())}function cg(e,t,n,r){return cE(e,t,n,r)}function lE(e,t,n){const r=Do(e,Ot([],[]),n),s=oE(r);return cg(e,s,xc(t,s),xc(r,s))}function lg(e,t,n){const r=ig(n);return Ul(r)?ag(e,r.name,t,r.type):Ie(t,(s,o)=>yt(Je(e,s,n),i=>lg(i,o,n),()=>ke()),()=>ee(e))}function uE(e,t,n){const r=Do(e,Ot([],[]),t);return rt(n)?lE(e,r,n.items):ut(n)?lg(e,r,n.items):xt(e,bn(r),n)}function dE(e,t,n){return es(n)||Rs(n)?ee(e):xt(e,t,n)}function ug(e,t,n){return Ie(n,(r,s)=>yt(Je(e,t,r),o=>ee(o),()=>ug(e,t,s)),()=>ke())}function yc(e,t,n){return Ie(t,(r,s)=>yt(ug(e,r,n),o=>yc(o,s,n),()=>ke()),()=>ee(e))}function fE(e,t,n){const r=ig(n);return Ul(r)?ag(e,r.name,t,r.type):ie(n)?yc(e,t,n.anyOf):yc(e,t,[n])}function mE(e,t,n){return Zt(n)?xt(e,t,n):Nn(n)||Cn(n)?ee(e):ke()}function pE(e,t,n){return es(n)?ee(e):xt(e,t,n)}function Je(e,t,n){return Nn(t)?yA(e,t,n):ut(t)?vA(e,t,t.items,n):Zr(t)?wA(e,t,n):Cr(t)?IA(e,t,n):mn(t)?AA(e,t.parameters,t.instanceType,n):gn(t)?EA(e,t.if,t.then,t.else,n):hn(t)?PA(e,t.enum,n):pn(t)?NA(e,t.parameters,t.returnType,n):_n(t)?$A(e,t,n):Ue(t)?RA(e,t.allOf,n):Ve(t)?_A(e,t,n):Ps(t)?LA(e,t,n):jo(t)?UA(e,t,n):nn(t)?BA(e,t,n):Le(t)?QA(e,t.properties,n):Tt(t)?ZA(e,kn(t),Ht(t),n):$n(t)?eE(e,t,n):To(t)?tE(e,t,n):qt(t)?nE(e,t.pattern,n):rt(t)?uE(e,t.items,n):Rs(t)?dE(e,t,n):ie(t)?fE(e,t.anyOf,n):Cn(t)?mE(e,t,n):es(t)?pE(e,t,n):ke()}function gE(e,t){return rn([...e,Ae(t)])}function dg(e,t,n){return Qe(e)?ue(gE(e,t),{},n):Hl(e,t,n)}function hE(e,t,n,r,s){const o=Wn(e,t,n),i=nu(e,t,r);return dg(o,i,s)}function Hl(e,t,n={}){return je("Interface",[e,t],n)}function ql(e){return Yt(e)&&E(e,"action")&&h(e.action,"Interface")}function bE(e,t,n={}){return dg(e,t,n)}function kE(e,t,n){return e.includes(n)?!0:lo([...e,n],t,t[n])}function _d(e,t,n){const r=hm(n);return _r(e,t,r)}function _r(e,t,n){return Ie(n,(r,s)=>lo(e,t,r)?!0:_r(e,t,s),()=>!1)}function lo(e,t,n){return bt(n)?kE(e,t,n.$ref):ut(n)?lo(e,t,n.items):mn(n)?_r(e,t,[...n.parameters,n.instanceType]):pn(n)?_r(e,t,[...n.parameters,n.returnType]):ql(n)?_d(e,t,n.parameters[1]):Ue(n)?_r(e,t,n.allOf):Le(n)?_d(e,t,n.properties):ie(n)?_r(e,t,n.anyOf):rt(n)?_r(e,t,n.items):Tt(n)?lo(e,t,Ht(n)):!1}function xE(e,t,n){return lo(e,t,n)}function yE(e,t){return t.reduce((n,r)=>xE([r],e,e[r])?[...n,r]:n,[])}function SE(e){const t=gm(e);return yE(e,t)}function vE(e,t,n){return n.includes(t)?n:t in e?uo(e,e[t],[...n,t]):Nt()}function Ld(e,t,n){const r=hm(t);return xs(e,r,n)}function xs(e,t,n){return t.reduce((r,s)=>uo(e,s,r),n)}function uo(e,t,n){return bt(t)?vE(e,t.$ref,n):ut(t)?uo(e,t.items,n):mn(t)?xs(e,[...t.parameters,t.instanceType],n):pn(t)?xs(e,[...t.parameters,t.returnType],n):ql(t)?Ld(e,t.parameters[1],n):Ue(t)?xs(e,t.allOf,n):Le(t)?Ld(e,t.properties,n):ie(t)?xs(e,t.anyOf,n):rt(t)?xs(e,t.items,n):Tt(t)?uo(e,Ht(t),n):n}function wE(e,t,n){return uo(e,n,[t])}function IE(e){return gl()}function CE(e){return D(e).reduce((t,n)=>({...t,[n]:Ur(e[n])}),{})}function Js(e){return e.reduce((t,n)=>[...t,Ur(n)],[])}function Ur(e){return bt(e)?IE(e.$ref):ut(e)?Ir(Ur(e.items),ml(e)):mn(e)?vo(Js(e.parameters),Ur(e.instanceType)):pn(e)?wo(Js(e.parameters),Ur(e.returnType)):Ue(e)?Fn(Js(e.allOf)):Le(e)?Ae(CE(e.properties)):Tt(e)?vl(ta(e),Ur(Ht(e))):ie(e)?Ge(Js(e.anyOf)):rt(e)?bn(Js(e.items)):e}function jE(e,t){return t in e?Ur(e[t]):Ut()}function TE(e){return jE(e.$defs,e.$ref)}function AE(e,t,n){const r=Wn(e,Ot([],[]),t),s=nu({},Ot([],[]),n);return rn([...r,Ae(s)])}function EE(e,t){return D(e).filter(r=>t.includes(r)).reduce((r,s)=>{const o=e[s],i=ql(o)?AE(e,o.parameters[0],o.parameters[1]):o;return{...r,[s]:i}},{})}function PE(e,t,n){const r=wE(e,t,n),s=EE(e,r);return Co(s,t)}function fg(e,t){return t in e?bt(e[t])?fg(e,e[t].$ref):e[t]:jt()}function Ro(e,t){return fg(e,t)}function Ud(e){return Bt(e)?TE(e):bm(e)?Ut():e}function tr(e,t,n){const r=Ud(t),s=Ud(n);return Je(e,r,s)}const zl="equal",NE="disjoint",Kl="left-inside",Gl="right-inside";function aa(e,t){const n=[Cn(e)?ke():tr({},e,t),Cn(e)?ee({}):tr({},t,e)];return Kt(n[0])&&Kt(n[1])?zl:Kt(n[0])&&bc(n[1])?Kl:bc(n[0])&&Kt(n[1])?Gl:NE}function $E(e,t){return t.filter(n=>aa(e,n)!==Gl)}function RE(e,t){const n=t.some(r=>{const s=aa(e,r);return h(s,Kl)||h(s,zl)});return h(n,!1)}function OE(e,t){const n=Kr(e);return Nn(n)?[n]:RE(n,t)?[...$E(n,t),n]:t}function ME(e){return e.reduce((t,n)=>Le(n)?[...t,n]:Ps(n)?t:OE(n,t),[])}function mg(e){const t=ME(e);return Xi(t)}function pg(e,t){return ue(Kr(e),{},t)}function FE(e,t,n,r){const s=G(e,t,n);return pg(s,r)}function Zs(e,t=[]){return ws(e)&&h(e.action,"Conditional")?bt(e.parameters[0])?Zs(e.parameters[2],Zs(e.parameters[3],[...t,e.parameters[0].$ref])):Zs(e.parameters[2],Zs(e.parameters[3],t)):ws(e)&&h(e.action,"Mapped")&&ws(e.parameters[1])&&h(e.parameters[1].action,"KeyOf")&&bt(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function DE(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function gg(e,t,n=[]){return Ie(e,(r,s)=>Ie(t,(o,i)=>gg(s,i,[...n,[o,r]]),()=>n),()=>n)}function _E(e){return qt(e)?rr(e.pattern):hn(e)?jr(e.enum):e}function LE(e){const t=_E(e);return ie(t)?[...t.anyOf]:[t]}function UE(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function Bd(e,t){return t.reduce((n,r)=>[...n,...UE(e,r)],[])}function Hd(e){return e.reduce((t,n)=>h(n[0],!0)?Bd(t,LE(n[1])):Bd(t,[n[1]]),[[]])}function BE(e,t,n){const r=Zs(n),s=DE(e,r),o=gg(t,s);return ws(n)&&h(n.action,"Conditional")||ws(n)&&h(n.action,"Mapped")?Hd(o):[t]}function HE(){return["(not-resolvable)",jt()]}function qE(){return["(not-generic)",jt()]}function zE(e,t,n){return[e,Io(t,n)]}function KE(e,t,n){return t in e?hg(e,t,e[t]):HE()}function hg(e,t,n,r){return pl(n)?zE(t,n.parameters,n.expression):bt(n)?KE(e,n.$ref):qE()}function GE(e,t,n){return hg(e,"(anonymous)",t)}function VE(e,t,n){if(Zt(t)||Wl(t)||Kt(tr({},t,n)))return;const r={parameter:e,expect:n,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function qd(e,t,n,r,s){const o=G(e,t,s);return VE(n,o,r),pt(e,{[n]:o})}function WE(e,t,n,r,s){const o=G(e,t,n.extends),i=G(e,t,n.equals);return Ie(s,(a,l)=>Sc(qd(e,t,n.name,o,a),t,r,l),()=>Sc(qd(e,t,n.name,o,i),t,r,[]))}function Sc(e,t,n,r){return Ie(n,(s,o)=>WE(e,t,s,o,r),()=>e)}function JE(e,t,n,r){return Sc(e,t,n,r)}let vc=0,Vl=0;function QE(){if(!ko(Vl,So().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function YE(){QE(),Vl++,vc++}function XE(){vc--,h(vc,0)&&(Vl=0)}function ZE(e){return Jr(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function eP(e,t){return h(ZE(e),t)}function tP(e,t,n,r,s,o){YE();try{const i=JE(e,t,r,o),a=G(i,Ot([...t.callstack,n.$ref],t.visited),s);return G(i,Ot([],[]),a)}finally{XE()}}function nP(e,t,n,r,s,o){return o.reduce((i,a)=>{const l=tP(e,t,n,r,s,a);return[...i,l]},[])}function rP(e,t,n,r,s,o){const i=BE(r,o,s),a=nP(e,t,n,r,s,i);return h(a.length,1)?a[0]:sr(a)}function bg(e,t,n,r){const s=Wn(e,t,r),o=GE(e,n),i=o[0],a=o[1];return pl(a)?eP(t,i)?wc(un(i),s):rP(e,t,un(i),a.parameters,a.expression,s):wc(n,s)}function wc(e,t){return he({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function sP(e,t){return bg({},Ot([],[]),e,t)}function Wl(e){return Se(e,"Call")}function oP(e){return Pn(e,["~immutable"])}function iP(e,t){return ue(oP(e),{},t)}function aP(e,t,n,r){const s=G(e,t,n);return iP(s,r)}function cP(e,t){return e(t)}function lP(e,t){return oe(t)?Me(cP(e,t)):Me(t)}function uP(e,t){const n=rr(t);return Os(e,n)}function dP(e,t){const n=t.map(r=>Os(e,r));return Ge(n)}function Os(e,t){return Ve(t)?lP(e,t.const):qt(t)?uP(e,t.pattern):ie(t)?dP(e,t.anyOf):t}function kg(e,t={}){return je("Capitalize",[e],t)}function fP(e,t={}){return vg(e,t)}function xg(e,t={}){return je("Lowercase",[e],t)}function mP(e,t={}){return wg(e,t)}function yg(e,t={}){return je("Uncapitalize",[e],t)}function pP(e,t={}){return Ig(e,t)}function Sg(e,t={}){return je("Uppercase",[e],t)}function gP(e,t={}){return Cg(e,t)}const hP=e=>e[0].toUpperCase()+e.slice(1),bP=e=>e.toLowerCase(),kP=e=>e[0].toLowerCase()+e.slice(1),xP=e=>e.toUpperCase();function vg(e,t){return Qe([e])?ue(Os(hP,e),{},t):kg(e,t)}function wg(e,t){return Qe([e])?ue(Os(bP,e),{},t):xg(e,t)}function Ig(e,t){return Qe([e])?ue(Os(kP,e),{},t):yg(e,t)}function Cg(e,t){return Qe([e])?ue(Os(xP,e),{},t):Sg(e,t)}function yP(e,t,n,r){const s=G(e,t,n);return vg(s,r)}function SP(e,t,n,r){const s=G(e,t,n);return wg(s,r)}function vP(e,t,n,r){const s=G(e,t,n);return Ig(s,r)}function wP(e,t,n,r){const s=G(e,t,n);return Cg(s,r)}function jg(e,t,n,r,s={}){return je("Conditional",[e,t,n,r],s)}function IP(e,t,n,r,s={}){return Tg({},Ot([],[]),e,t,n,r,s)}function CP(e,t,n,r,s,o){const i=tr(e,n,r);return Dl(i)?Ge([G(i.inferred,t,s),G(e,t,o)]):_l(i)?G(i.inferred,t,s):G(e,t,o)}function Tg(e,t,n,r,s,o,i){return Qe([n,r])?ue(CP(e,t,n,r,s,o),{},i):jg(n,r,s,o,i)}function jP(e,t,n,r,s,o,i){const a=G(e,t,n),l=G(e,t,r);return Tg(e,t,a,l,s,o,i)}function Ag(e,t={}){return je("ConstructorParameters",[e],t)}function TP(e,t={}){return Eg(e,t)}function AP(e){const t=mn(e)?e.parameters:[],n=Do({},Ot([],[]),t);return bn(n)}function Eg(e,t){return Qe([e])?ue(AP(e),{},t):Ag(e,t)}function EP(e,t,n,r){const s=G(e,t,n);return Eg(s,r)}function Pg(e,t,n={}){return je("Exclude",[e,t],n)}function PP(e,t,n={}){return Jl(e,t,n)}function Jl(e,t,n){return Qe([e,t])?ue(Jm(e,t),{},n):Pg(e,t,n)}function NP(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return Jl(o,i,s)}function Ng(e,t,n={}){return je("Extract",[e,t],n)}function $P(e,t,n={}){return $g(e,t,n)}function RP(e,t){const n=tr({},e,t);return Kt(n)?[e]:[]}function OP(e,t){return e.reduce((n,r)=>[...n,...RP(r,t)],[])}function MP(e,t){const n=Kr(e),r=ie(n)?n.anyOf:[n],s=OP(r,t);return sr(s)}function $g(e,t,n){return Qe([e,t])?ue(MP(e,t),{},n):Ng(e,t,n)}function FP(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return $g(o,i,s)}function DP(e){return e.reduce((t,n)=>Am(n)?[...t,Me(n)]:t,[])}function Ql(e){const t=DP(e);return Ge(t)}function Yl(e,t,n={}){return je("Index",[e,t],n)}function _P(e,t,n={}){const r=H(t)?Ql(t):t;return Dg(e,r,n)}function LP(e,t){const n=Ro(e,t);return ns(n)}function UP(e,t,n){const r=Ns(e,t,n);return ns(r)}function BP(e,t){const n=D(e).filter(m=>!E(t,m)),r=D(t).filter(m=>!E(e,m)),s=D(e).filter(m=>E(t,m)),o=n.reduce((m,p)=>({...m,[p]:e[p]}),{}),i=r.reduce((m,p)=>({...m,[p]:t[p]}),{}),a=s.reduce((m,p)=>({...m,[p]:rn([e[p],t[p]])}),{}),l=pt(o,i);return pt(l,a)}function HP(e){return e.reduce((t,n)=>BP(t,ns(n)),{})}function qP(e){const t=yw(bn(e));return ns(t)}function zP(e,t){return D(e).filter(s=>s in t).reduce((s,o)=>({...s,[o]:sr([e[o],t[o]])}),{})}function Rg(e,t){return Ie(e,(n,r)=>Rg(r,zP(t,ns(n))),()=>t)}function KP(e){return Ie(e,(t,n)=>Rg(n,ns(t)),()=>Nt())}function ns(e){return Bt(e)?LP(e.$defs,e.$ref):gn(e)?UP(e.if,e.then,e.else):Ue(e)?HP(e.allOf):ie(e)?KP(e.anyOf):rt(e)?qP(e.items):Le(e)?e.properties:{}}function Xl(e){const t=ns(e);return Ae(t)}const GP=new RegExp("^(?:0|[1-9][0-9]*)$");function Zl(e){const t=`${e}`;return GP.test(t)?parseInt(t):e}function VP(e){return Me(Zl(e))}function zd(e){return e.map(t=>Og(t))}function Og(e){return Ue(e)?Fn(zd(e.allOf)):ie(e)?Ge(zd(e.anyOf)):Ve(e)?VP(e.const):e}function WP(e,t){const n=Og(t),r=tr({},n,yr());return Kt(r)?e:Ve(t)&&h(t.const,"length")?yr():jt()}function JP(e,t){const n=Ro(e,t);return rs(n)}function QP(e,t,n){const r=Ns(e,t,n);return rs(r)}function YP(e){const t=jr(e);return rs(t)}function XP(e){const t=rn(e);return rs(t)}function ZP(e){return[`${e}`]}function e1(e){const t=rr(e);return rs(t)}function t1(e){return e.reduce((t,n)=>[...t,...rs(n)],[])}function rs(e){return Bt(e)?JP(e.$defs,e.$ref):gn(e)?QP(e.if,e.then,e.else):hn(e)?YP(e.enum):Ue(e)?XP(e.allOf):Ve(e)?ZP(e.const):qt(e)?e1(e.pattern):ie(e)?t1(e.anyOf):[]}function eu(e){return rs(e)}function Qs(e,t){return t.map(n=>so(e,n))}function so(e,t){return ut(t)?Ir(so(e,t.items)):mn(t)?vo(Qs(e,t.parameters),so(e,t.instanceType)):pn(t)?wo(Qs(e,t.parameters),so(e,t.returnType)):rt(t)?bn(Qs(e,t.items)):ie(t)?Ge(Qs(e,t.anyOf)):Ue(t)?Fn(Qs(e,t.allOf)):Zm(t)?Ae(e):t}function n1(e,t){return so(e,t)}function r1(e,t){const n=t in e?e[t]:jt();return n1(e,n)}function Mg(e,t){return t.reduce((n,r)=>[...n,r1(e,r)],[])}function s1(e,t){const n=eu(t),r=Mg(e,n);return sr(r)}const o1=new RegExp(Eo);function i1(e){return e.filter(n=>o1.test(n))}function a1(e){const t=gm(e),n=i1(t),r=Mg(e,n);return sr(r)}function c1(e,t){return nn(t)?a1(e):s1(e,t)}function l1(e){return Me(Zl(e))}function Kd(e){return e.map(t=>Fg(t))}function Fg(e){return Ue(e)?Fn(Kd(e.allOf)):ie(e)?Ge(Kd(e.anyOf)):Ve(e)?l1(e.const):e}function u1(e,t){return e.reduceRight((n,r,s)=>{const o=tr({},Me(s),t);return Kt(o)?[r,...n]:n},[])}function d1(e,t){const n=Fg(t),r=u1(e,n);return $s(r)}function f1(e){return $s(e)}function m1(e,t){return Ve(t)&&h(t.const,"length")?Me(e.length):nn(t)||_n(t)?f1(e):d1(e,t)}function p1(e,t){return ut(e)?WP(e.items,t):Le(e)?c1(e.properties,t):rt(e)?m1(e.items,t):jt()}function g1(e){return Bt(e)||gn(e)||Ue(e)||ie(e)?Xl(e):e}function Dg(e,t,n){return Qe([e,t])?ue(p1(g1(e),t),{},n):Yl(e,t,n)}function h1(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return Dg(o,i,s)}function _g(e,t={}){return je("InstanceType",[e],t)}function b1(e,t={}){return Lg(e,t)}function k1(e){return mn(e)?e.instanceType:jt()}function Lg(e,t){return Qe([e])?ue(k1(e),{},t):_g(e,t)}function x1(e,t,n,r={}){const s=G(e,t,n);return Lg(s,r)}function tu(e,t={}){return je("KeyOf",[e],t)}function y1(e,t={}){return Ug(e,t)}function S1(){return Ge([yr(),Ln(),yl()])}function v1(e){return yr()}function w1(e){return e.reduce((n,r)=>Am(r)?[...n,Me(Zl(r))]:Nt(),[])}function I1(e){const t=D(e),n=w1(t);return $s(n)}function C1(e){return ta(e)}function j1(e){const t=e.map((n,r)=>Me(r));return $s(t)}function T1(e){return Nn(e)?S1():ut(e)?v1(e.items):Le(e)?I1(e.properties):Tt(e)?C1(e):rt(e)?j1(e.items):jt()}function A1(e){return Bt(e)||gn(e)||Ue(e)||ie(e)?Xl(e):e}function Ug(e,t){return Qe([e])?ue(T1(A1(e)),{},t):tu(e,t)}function E1(e,t,n,r){const s=G(e,t,n);return Ug(s,r)}function Ic(e,t,n,r,s={}){return je("Mapped",[e,t,n,r],s)}function P1(e,t,n,r,s={}){return Bg({},Ot([],[]),e,t,n,r,s)}function N1(e){const t=rr(e);return ca(t)}function $1(e){return e.reduce((t,n)=>[...t,...ca(n)],[])}function R1(e){const t=jr(e);return ca(t)}function O1(e){return xe(e)?[Me(`${e}`)]:[Me(e)]}function ca(e){return hn(e)?R1(e.enum):Ve(e)?O1(e.const):qt(e)?N1(e.pattern):ie(e)?$1(e.anyOf):[e]}function M1(e){return ca(e)}function F1(e){return qt(e)?rr(e.pattern):e}function D1(e,t,n,r,s,o){const i=pt(e,{[n.name]:r}),a=G(i,t,s),l=F1(a),u=G(i,t,o);return Em(l)||Pm(l)?{[l.const]:u}:{}}function _1(e,t,n,r,s,o){return r.reduce((i,a)=>[...i,D1(e,t,n,a,s,o)],[])}function L1(e){return e.reduce((t,n)=>[...t,Ae(n)],[])}function U1(e,t,n,r,s,o){const i=M1(r),a=_1(e,t,n,i,s,o),l=L1(a);return rn(l)}function Bg(e,t,n,r,s,o,i){return Qe([r])?ue(U1(e,t,n,r,s,o),{},i):Ic(n,r,s,o,i)}function B1(e,t,n,r,s,o,i){const a=G(e,t,r);return Bg(e,t,n,a,s,o,i)}function H1(e,t,n){const r=pt(e,t);return D(t).filter(o=>n.includes(o)).reduce((o,i)=>({...o,[i]:PE(r,i,t[i])}),{})}function q1(e,t,n){const r=pt(e,t);return D(t).filter(o=>!n.includes(o)).reduce((o,i)=>({...o,[i]:G(r,Ot([],[]),t[i])}),{})}function z1(e,t,n){const r=SE(t),s=H1(e,t,r),o=q1(e,t,r),i={...s,...o};return ue(i,{},n)}function Hg(e,t,n,r){return z1(e,n,r)}function qg(e,t={}){return je("NonNullable",[e],t)}function K1(e,t={}){return zg(e,t)}function G1(e){const t=Ge([xl(),wl()]);return Jl(e,t,{})}function zg(e,t){return Qe([e])?ue(G1(e),{},t):qg(e,t)}function V1(e,t,n,r){const s=G(e,t,n);return zg(s,r)}function Kg(e,t,n={}){return je("Omit",[e,t],n)}function W1(e,t,n={}){const r=H(t)?Ql(t):t;return Vg(e,r,n)}function Gg(e){const t=Xl(e);return Le(t)?t.properties:Nt()}function J1(e,t){return D(e).reduce((r,s)=>t.includes(s)?r:{...r,[s]:e[s]},{})}function Q1(e,t){const n=Gg(e),r=eu(t),s=J1(n,r);return Ae(s)}function Vg(e,t,n){return Qe([e,t])?ue(Q1(e,t),{},n):Kg(e,t,n)}function Y1(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return Vg(o,i,s)}function Wg(e,t={}){return je("Parameters",[e],t)}function X1(e,t={}){return Jg(e,t)}function Z1(e){const t=pn(e)?e.parameters:[],n=Do({},Ot([],[]),t);return bn(n)}function Jg(e,t){return Qe([e])?ue(Z1(e),{},t):Wg(e,t)}function eN(e,t,n,r){const s=G(e,t,n);return Jg(s,r)}function Qg(e,t={}){return je("Partial",[e],t)}function tN(e,t={}){return Yg(e,t)}function nN(e,t){const n=Ro(e,t),r=Oo(n);return Co(pt(e,{[t]:r}),t)}function rN(e,t,n){const r=Ns(e,t,n);return Oo(r)}function sN(e){const t=rn(e);return Oo(t)}function oN(e){const t=e.map(n=>Oo(n));return Ge(t)}function iN(e){const t=D(e).reduce((r,s)=>({...r,[s]:ji(e[s])}),{});return Ae(t)}function Oo(e){return Bt(e)?nN(e.$defs,e.$ref):gn(e)?rN(e.if,e.then,e.else):Ue(e)?sN(e.allOf):ie(e)?oN(e.anyOf):Le(e)?iN(e.properties):Ae({})}function Yg(e,t){return Qe([e])?ue(Oo(e),{},t):Qg(e,t)}function aN(e,t,n,r){const s=G(e,t,n);return Yg(s,r)}function Xg(e,t,n={}){return je("Pick",[e,t],n)}function cN(e,t,n={}){const r=H(t)?Ql(t):t;return Zg(e,r,n)}function lN(e,t){return D(e).reduce((r,s)=>t.includes(s)?pt(r,{[s]:e[s]}):r,{})}function uN(e,t){const n=Gg(e),r=eu(t),s=lN(n,r);return Ae(s)}function Zg(e,t,n){return Qe([e,t])?ue(uN(e,t),{},n):Xg(e,t,n)}function dN(e,t,n,r,s){const o=G(e,t,n),i=G(e,t,r);return Zg(o,i,s)}function eh(e,t={}){return je("ReadonlyObject",[e],t)}function th(e,t={}){return nh(e,t)}const fN=th;function mN(e){return su(Ir(e))}function pN(e,t){const n=Ro(e,t),r=Mo(n);return Co(pt(e,{[t]:r}),t)}function gN(e,t,n){const r=Ns(e,t,n);return Mo(r)}function hN(e){const t=rn(e);return Mo(t)}function bN(e){const t=D(e).reduce((r,s)=>({...r,[s]:Ei(e[s])}),{});return Ae(t)}function kN(e){return su(bn(e))}function xN(e){const t=e.map(n=>Mo(n));return Ge(t)}function Mo(e){return ut(e)?mN(e.items):Bt(e)?pN(e.$defs,e.$ref):gn(e)?gN(e.if,e.then,e.else):Ue(e)?hN(e.allOf):Le(e)?bN(e.properties):rt(e)?kN(e.items):ie(e)?xN(e.anyOf):e}function nh(e,t){return Qe([e])?ue(Mo(e),{},t):eh(e)}function yN(e,t,n,r){const s=G(e,t,n);return nh(s,r)}function SN(e,t,n,r){return t.visited.includes(r)?n:r in e?G(e,Ot(t.callstack,[...t.visited,r]),e[r]):n}function vN(e,t){const n=Ro(e,t),r=Fo(n);return Co(pt(e,{[t]:r}),t)}function wN(e,t,n){const r=Ns(e,t,n);return Fo(r)}function IN(e){const t=rn(e);return Fo(t)}function CN(e){const t=e.map(n=>Fo(n));return Ge(t)}function jN(e){const t=D(e).reduce((r,s)=>({...r,[s]:Km(e[s])}),{});return Ae(t)}function Fo(e){return Bt(e)?vN(e.$defs,e.$ref):gn(e)?wN(e.if,e.then,e.else):Ue(e)?IN(e.allOf):ie(e)?CN(e.anyOf):Le(e)?jN(e.properties):Ae({})}function rh(e,t={}){return je("Required",[e],t)}function TN(e,t={}){return sh(e,t)}function sh(e,t){return Qe([e])?ue(Fo(e),{},t):rh(e,t)}function AN(e,t,n,r){const s=G(e,t,n);return sh(s,r)}function oh(e,t={}){return je("ReturnType",[e],t)}function EN(e,t={}){return ih(e,t)}function PN(e){return pn(e)?e.returnType:jt()}function ih(e,t){return Qe([e])?ue(PN(e),{},t):oh(e,t)}function NN(e,t,n,r={}){const s=G(e,t,n);return ih(s,r)}function ah(e,t){return je("With",[e,t],{})}function ch(e,t){return lh(e,t)}function lh(e,t){return Qe([e])?ue(e,{},t):ah(e,t)}function $N(e,t,n,r){const s=G(e,t,n);return lh(s,r)}function RN(e){return ra(e)?rt(e.items)?uh(e.items.items):Zt(e.items)?[e]:bt(e.items)?[e]:[jt()]:[e]}function uh(e){return e.reduce((n,r)=>[...n,...RN(r)],[])}function Ot(e,t){return{callstack:e,visited:t}}function Qe(e){return Ie(e,(t,n)=>bt(t)?!1:Qe(n),()=>!0)}function nu(e,t,n){return D(n).reduce((r,s)=>({...r,[s]:G(e,t,n[s])}),{})}function Do(e,t,n){const r=Wn(e,t,n);return uh(r)}function Wn(e,t,n){return n.map(r=>G(e,t,r))}function ON(e,t){const n=Xt(e)?fl(t,{}):t,r=Pi(e)?dl(n,{}):n;return Ai(e)?ru(r,{}):r}function MN(e,t,n,r,s){return h(n,"AddImmutable")?_N(e,t,r[0],s):h(n,"RemoveImmutable")?aP(e,t,r[0],s):h(n,"AddReadonly")?ov(e,t,r[0],s):h(n,"RemoveReadonly")?pw(e,t,r[0],s):h(n,"AddOptional")?av(e,t,r[0],s):h(n,"RemoveOptional")?kw(e,t,r[0],s):h(n,"Capitalize")?yP(e,t,r[0],s):h(n,"Conditional")?jP(e,t,r[0],r[1],r[2],r[3],s):h(n,"ConstructorParameters")?EP(e,t,r[0],s):h(n,"Evaluate")?FE(e,t,r[0],s):h(n,"Exclude")?NP(e,t,r[0],r[1],s):h(n,"Extract")?FP(e,t,r[0],r[1],s):h(n,"Index")?h1(e,t,r[0],r[1],s):h(n,"InstanceType")?x1(e,t,r[0],s):h(n,"Interface")?hE(e,t,r[0],r[1],s):h(n,"KeyOf")?E1(e,t,r[0],s):h(n,"Lowercase")?SP(e,t,r[0],s):h(n,"Mapped")?B1(e,t,r[0],r[1],r[2],r[3],s):h(n,"Module")?Hg(e,t,r[0],s):h(n,"NonNullable")?V1(e,t,r[0],s):h(n,"Pick")?dN(e,t,r[0],r[1],s):h(n,"Parameters")?eN(e,t,r[0],s):h(n,"Partial")?aN(e,t,r[0],s):h(n,"Omit")?Y1(e,t,r[0],r[1],s):h(n,"ReadonlyObject")?yN(e,t,r[0],s):h(n,"Record")?Kw(e,t,r[0],r[1],s):h(n,"Required")?AN(e,t,r[0],s):h(n,"ReturnType")?NN(e,t,r[0],s):h(n,"TemplateLiteral")?uA(e,t,r[0],s):h(n,"Uncapitalize")?vP(e,t,r[0],s):h(n,"Uppercase")?wP(e,t,r[0],s):h(n,"With")?$N(e,t,r[0],r[1]):je(n,r,s)}function FN(e,t,n){const r=bt(n)?SN(e,t,n,n.$ref):ut(n)?Ir(G(e,t,n.items),ml(n)):Wl(n)?bg(e,t,n.target,n.arguments):mn(n)?vo(Wn(e,t,n.parameters),G(e,t,n.instanceType),cv(n)):pn(n)?wo(Wn(e,t,n.parameters),G(e,t,n.returnType),lv(n)):gn(n)?Ti(G(e,t,n.if),G(e,t,n.then),G(e,t,n.else),gv(n)):Ue(n)?Fn(Wn(e,t,n.allOf),yv(n)):Le(n)?Ae(nu(e,t,n.properties),mv(n)):Tt(n)?Gw(kn(n),G(e,t,Ht(n))):ra(n)?na(G(e,t,n.items)):rt(n)?bn(Do(e,t,n.items),fw(n)):ie(n)?Ge(Wn(e,t,n.anyOf),rw(n)):n;return ON(n,r)}function G(e,t,n){return ws(n)?MN(e,t,n.action,n.parameters,n.options):FN(e,t,n)}function Ms(e,t){return G(e,Ot([],[]),t)}function DN(e){return ue(e,{"~immutable":!0},{})}function ru(e,t){return ue(DN(e),{},t)}function _N(e,t,n,r){const s=G(e,t,n);return ru(s,r)}function LN(e,t={}){return je("AddImmutable",[e],t)}function su(e,t={}){return ru(e,t)}function UN(e,t={}){return je("Evaluate",[e],t)}function Un(e,t={}){return pg(e,t)}function BN(e,t={}){return je("Module",[e],t)}function HN(e,t={}){return Hg({},Ot([],[]),e,t)}function qN(e,t){const n=aa(e,t);return h(n,"right-inside")||h(n,"disjoint")?1:0}function dh(e,t,n=[]){return Ie(t,(r,s)=>h(qN(e,r),1)?dh(e,s,[...n,r]):[...n,e,...t],()=>[...n,e])}function fh(e,t=[]){return Ie(e,(n,r)=>fh(r,dh(n,t)),()=>t)}function zN(e){return fh(e)}function KN(...e){const[t,n,r]=at(e,{2:(i,a)=>oe(i)?[{},i,a]:[i,a,{}],3:(i,a,l)=>[i,a,l],1:i=>[{},i,{}]}),s=JT(n),o=H(s)&&h(s.length,2)?G(t,Ot([],[]),s[0]):jt();return ue(o,{},r)}const f=Object.freeze(Object.defineProperty({__proto__:null,Any:gl,Array:Ir,BigInt:kl,Boolean:jm,Call:sP,Capitalize:fP,Codec:hl,Conditional:IP,Constructor:vo,ConstructorParameters:TP,Cyclic:Co,Decode:qv,DecodeBuilder:Cm,Dependent:Ti,Encode:zv,EncodeBuilder:Im,Enum:xv,Evaluate:Un,Exclude:PP,Extends:tr,ExtendsResult:pA,Extract:$P,Function:wo,Generic:Io,Identifier:fc,Immutable:Kv,Index:_P,Infer:uc,InstanceType:b1,Instantiate:Ms,Integer:Yi,Interface:bE,Intersect:Fn,IsAny:Nn,IsArray:ut,IsBigInt:Zr,IsBoolean:Cr,IsCall:Wl,IsCodec:en,IsConstructor:mn,IsCyclic:Bt,IsDependent:gn,IsEnum:hn,IsEnumValue:kv,IsFunction:pn,IsGeneric:pl,IsIdentifier:Yv,IsImmutable:Ai,IsInfer:Zt,IsInteger:_n,IsIntersect:Ue,IsKind:Se,IsLiteral:Ve,IsNever:Ps,IsNull:jo,IsNumber:nn,IsObject:Le,IsOptional:Xt,IsParameter:nw,IsReadonly:Pi,IsRecord:Tt,IsRef:bt,IsRefine:bl,IsRest:ra,IsSchema:Yt,IsString:$n,IsSymbol:To,IsTemplateLiteral:qt,IsThis:Zm,IsTuple:rt,IsUndefined:Rs,IsUnion:ie,IsUnknown:Cn,IsUnsafe:bm,IsVoid:es,KeyOf:y1,Literal:Me,Lowercase:mP,Mapped:P1,Module:HN,Never:jt,NonNullable:K1,Null:xl,Number:yr,Object:Ae,Omit:W1,Optional:dv,Parameter:Ao,Parameters:X1,Partial:tN,Pick:cN,Readonly:Gv,ReadonlyObject:th,ReadonlyType:fN,Record:vl,RecordKey:ta,RecordPattern:kn,RecordValue:Ht,Ref:un,Refine:Wv,Required:TN,Rest:na,ReturnType:EN,Script:KN,String:Ln,Symbol:yl,TemplateLiteral:mA,This:Xm,Tuple:bn,Uncapitalize:pP,Undefined:wl,Union:Ge,Unknown:Ut,Unsafe:pv,Uppercase:gP,Void:ep,With:ch},Symbol.toStringTag,{value:"Module"}));function la(e){return E(e,"~refine")&&H(e["~refine"])&<(e["~refine"],0,t=>ne(t)&&E(t,"check")&&E(t,"error")&&In(t.check)&&In(t.error))}function tn(e){return ne(e)&&!H(e)}function _o(e){return gt(e)}function _e(e){return tn(e)||_o(e)}function Lo(e){return E(e,"additionalItems")&&_e(e.additionalItems)}function ir(e){return E(e,"additionalProperties")&&_e(e.additionalProperties)}function ua(e){return E(e,"allOf")&&H(e.allOf)&&e.allOf.every(t=>_e(t))}function Ri(e){return E(e,"$anchor")&&oe(e.$anchor)}function da(e){return E(e,"anyOf")&&H(e.anyOf)&&e.anyOf.every(t=>_e(t))}function fa(e){return E(e,"const")}function ss(e){return E(e,"contains")&&_e(e.contains)}function GN(e){return E(e,"contentEncoding")&&oe(e.contentEncoding)}function VN(e){return E(e,"contentMediaType")&&oe(e.contentMediaType)}function Ar(e){return E(e,"default")}function WN(e){return E(e,"$defs")&&ne(e.$defs)&&Object.values(e.$defs).every(t=>_e(t))}function Uo(e){return E(e,"dependencies")&&ne(e.dependencies)&&Object.values(e.dependencies).every(t=>_e(t)||H(t)&&t.every(n=>oe(n)))}function Bo(e){return E(e,"dependentRequired")&&ne(e.dependentRequired)&&Object.values(e.dependentRequired).every(t=>H(t)&&t.every(n=>oe(n)))}function Ho(e){return E(e,"dependentSchemas")&&ne(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>_e(t))}function Vr(e){return E(e,"$dynamicAnchor")&&oe(e.$dynamicAnchor)}function ma(e){return E(e,"$dynamicRef")&&oe(e.$dynamicRef)}function pa(e){return E(e,"else")&&_e(e.else)}function ga(e){return E(e,"enum")&&H(e.enum)}function qo(e){return E(e,"exclusiveMaximum")&&(xe(e.exclusiveMaximum)||et(e.exclusiveMaximum))}function Er(e){return E(e,"exclusiveMinimum")&&(xe(e.exclusiveMinimum)||et(e.exclusiveMinimum))}function Fs(e){return E(e,"format")&&oe(e.format)}function vr(e){return E(e,"$id")&&oe(e.$id)}function ha(e){return E(e,"if")&&_e(e.if)}function Pr(e){return E(e,"items")&&(_e(e.items)||H(e.items)&&e.items.every(t=>_e(t)))}function ba(e){return Pr(e)&&H(e.items)}function JN(e){return Pr(e)&&!H(e.items)}function zo(e){return E(e,"maximum")&&(xe(e.maximum)||et(e.maximum))}function Ko(e){return E(e,"maxContains")&&xe(e.maxContains)}function Ds(e){return E(e,"maxItems")&&xe(e.maxItems)}function Go(e){return E(e,"maxLength")&&xe(e.maxLength)}function Vo(e){return E(e,"maxProperties")&&xe(e.maxProperties)}function Nr(e){return E(e,"minimum")&&(xe(e.minimum)||et(e.minimum))}function os(e){return E(e,"minContains")&&xe(e.minContains)}function is(e){return E(e,"minItems")&&xe(e.minItems)}function _s(e){return E(e,"minLength")&&xe(e.minLength)}function Ls(e){return E(e,"minProperties")&&xe(e.minProperties)}function Wo(e){return E(e,"multipleOf")&&(xe(e.multipleOf)||et(e.multipleOf))}function ka(e){return E(e,"not")&&_e(e.not)}function xa(e){return E(e,"oneOf")&&H(e.oneOf)&&e.oneOf.every(t=>_e(t))}function Us(e){return E(e,"pattern")&&(oe(e.pattern)||e.pattern instanceof RegExp)}function as(e){return E(e,"patternProperties")&&ne(e.patternProperties)&&Object.values(e.patternProperties).every(t=>_e(t))}function ar(e){return E(e,"prefixItems")&&H(e.prefixItems)&&e.prefixItems.every(t=>_e(t))}function cs(e){return E(e,"properties")&&ne(e.properties)&&Object.values(e.properties).every(t=>_e(t))}function Jo(e){return E(e,"propertyNames")&&(ne(e.propertyNames)||_e(e.propertyNames))}function mh(e){return E(e,"$recursiveAnchor")&>(e.$recursiveAnchor)}function bi(e){return mh(e)&&h(e.$recursiveAnchor,!0)}function ya(e){return E(e,"$recursiveRef")&&oe(e.$recursiveRef)}function Sa(e){return E(e,"$ref")&&oe(e.$ref)}function cr(e){return E(e,"required")&&H(e.required)&&e.required.every(t=>oe(t))}function va(e){return E(e,"then")&&_e(e.then)}function Qo(e){return E(e,"type")&&(oe(e.type)||H(e.type)&&e.type.every(t=>oe(t)))}function wr(e){return E(e,"uniqueItems")&>(e.uniqueItems)}function Bs(e){return E(e,"unevaluatedItems")&&_e(e.unevaluatedItems)}function Hs(e){return E(e,"unevaluatedProperties")&&_e(e.unevaluatedProperties)}function QN(e){return Bs(e)||Hs(e)||Es(D(e),t=>Oi(e[t]))}function YN(e){return Es(e,t=>Oi(t))}function Oi(e){return H(e)?YN(e):ne(e)?QN(e):!1}function ph(e,t){return Oi(t)||Es(D(e),n=>Oi(e[n]))}class gh{constructor(t){this.hasUnevaluated=t}UseUnevaluated(){return this.hasUnevaluated}Push(){return ze(le("context","Push"),[])}Pop(){return ze(le("context","Pop"),[])}AddIndex(t){return ze(le("context","AddIndex"),[t])}AddKey(t){return ze(le("context","AddKey"),[t])}Merge(t){return ze(le("context","Merge"),[t])}}class Bn{constructor(){const t=new Set,n=new Set;this.stack=[{indices:t,keys:n}]}Push(){const t=new Set,n=new Set;return this.stack.push({indices:t,keys:n}),!0}Pop(){return this.stack.pop(),!0}AddIndex(t){return this.GetIndices().add(t),!0}AddKey(t){return this.GetKeys().add(t),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(t){for(const n of t)n.GetIndices().forEach(r=>this.GetIndices().add(r)),n.GetKeys().forEach(r=>this.GetKeys().add(r));return!0}}class ou extends Bn{constructor(t){super(),this.callback=t}AddError(t){return this.callback(t),!1}}class Hn extends ou{constructor(){super(t=>this.errors.push(t)),this.errors=[]}AddError(t){return this.errors.push(t),!1}GetErrors(){return this.errors}}const Mi={identifier:"External",variables:[]};function ls(e){const t=`External[${Mi.variables.length}]`;return Mi.variables.push(e),t}function hh(){Mi.variables=[]}function bh(){return{...Mi}}function kh(e,t,n,r){const s=ls(n["~refine"].map(o=>o));return Dn(s,z(0),["refinement","_"],ze(le("refinement","check"),[r]))}function xh(e,t,n,r){return lt(n["~refine"],0,(s,o)=>s.check(r))}function yh(e,t,n,r,s,o){return Ct(s["~refine"],0,(i,a)=>i.check(o)||t.AddError({keyword:"~refine",schemaPath:n,instancePath:r,params:{index:a,message:i.error(o)}}))}let XN=0;function it(){return`var_${XN++}`}function iu(e){return Pr(e)&&H(e.items)}function ZN(e,t,n,r){const[s,o]=[it(),it()],i=Rn(e,t,n.additionalItems,s),a=al(o,z(n.items.length)),l=t.AddIndex(o);return Dn(r,z(0),[s,o],He(a,St(i,l)))}function e$(e,t,n,r){const[s,o]=[it(),it()],i=Rn(e,t,n.additionalItems,s),a=al(o,z(n.items.length));return Dn(r,z(0),[s,o],He(a,i))}function Sh(e,t,n,r){return iu(n)?t.UseUnevaluated()?ZN(e,t,n,r):e$(e,t,n,r):z(!0)}function vh(e,t,n,r){return iu(n)?lt(r,0,(o,i)=>ko(i,n.items.length)||$r(e,t,n.additionalItems,o)&&t.AddIndex(i)):!0}function wh(e,t,n,r,s,o){return iu(s)?lt(o,0,(a,l)=>{const u=`${n}/additionalItems`,m=`${r}/${l}`;return ko(l,s.items.length)||Rr(e,t,u,m,s.additionalItems,a)&&t.AddIndex(l)}):!0}function t$(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function au(e){const t=[];return as(e)&&t.push(...D(e.patternProperties)),cs(e)&&t.push(...D(e.properties).map(t$)),h(t.length,0)?"(?!)":`(${t.join("|")})`}function Ih(e,t,n){return cr(t)&&cs(t)&&!as(t)&&h(t.additionalProperties,!1)&&h(D(t.properties).length,t.required.length)}function Ch(e,t,n){return Gt(le(ze(le("Object","getOwnPropertyNames"),[n]),"length"),z(t.required.length))}function jh(e,t,n,r){const[s,o]=[it(),it()],i=ls(new RegExp(au(n))),a=Rn(e,t,n.additionalProperties,`${r}[${s}]`),l=ze(le(i,"test"),[s]),u=t.AddKey(s),m=t.UseUnevaluated()?He(l,St(a,u)):He(l,a);return Dn(Xr(r),z(0),[s,o],m)}function Th(e,t,n,r){return Ih(t,n)?Ch(t,n,r):jh(e,t,n,r)}function Ah(e,t,n,r){const s=new RegExp(au(n));return lt(D(r),0,(i,a)=>s.test(i)||$r(e,t,n.additionalProperties,r[i])&&t.AddKey(i))}function Eh(e,t,n,r,s,o){const i=new RegExp(au(s)),a=[];return Ct(D(o),0,(u,m)=>{const p=`${n}/additionalProperties`,g=`${r}/${u}`,x=new Hn,b=i.test(u)||Rr(e,x,p,g,s.additionalProperties,o[u])&&t.AddKey(u);return b||a.push(u),b})||t.AddError({keyword:"additionalProperties",schemaPath:n,instancePath:r,params:{additionalProperties:a}})}function Yo(e,t,n,r,s){const o=Qn("results","[]"),i=n.map((m,p)=>Qn(`context_${p}`,cl("CheckContext",[]))),a=n.map((m,p)=>Qn(`condition_${p}`,ze(kr(["context"],st(e,t,m,r)),[`context_${p}`]))),l=n.map((m,p)=>um(`condition_${p}`,ze(le("results","push"),[`context_${p}`]))),u=Ji(St(s,t.Merge("results")));return ze(kr([],Wi([o,...i,...a,...l,u])),[])}function n$(e,t,n,r){return Yo(e,t,n.allOf,r,Gt(le("results","length"),z(n.allOf.length)))}function r$(e,t,n,r){return wt(n.allOf.map(s=>st(e,t,s,r)))}function Ph(e,t,n,r){return t.UseUnevaluated()?n$(e,t,n,r):r$(e,t,n,r)}function Nh(e,t,n,r){const s=n.allOf.reduce((o,i)=>{const a=new Bn;return ot(e,a,i,r)?[...o,a]:o},[]);return h(s.length,n.allOf.length)&&t.Merge(s)}function $h(e,t,n,r,s,o){const i=[],a=s.allOf.reduce((u,m,p)=>{const g=`${n}/allOf/${p}`,x=new Hn,b=It(e,x,g,r,m,o);return b||i.push(x),b?[...u,x]:u},[]),l=h(a.length,s.allOf.length)&&t.Merge(a);return l||i.forEach(u=>u.GetErrors().forEach(m=>t.AddError(m))),l}function s$(e,t,n,r){return Yo(e,t,n.anyOf,r,am(le("results","length"),z(0)))}function o$(e,t,n,r){return ll(n.anyOf.map(s=>st(e,t,s,r)))}function Rh(e,t,n,r){return t.UseUnevaluated()?s$(e,t,n,r):o$(e,t,n,r)}function Oh(e,t,n,r){const s=n.anyOf.reduce((o,i)=>{const a=new Bn;return ot(e,a,i,r)?[...o,a]:o},[]);return Jr(s.length,0)&&t.Merge(s)}function Mh(e,t,n,r,s,o){const i=[],a=s.anyOf.reduce((u,m,p)=>{const g=new Hn,x=`${n}/anyOf/${p}`,b=It(e,g,x,r,m,o);return b||i.push(g),b?[...u,g]:u},[]),l=Jr(a.length,0)&&t.Merge(a);return l||i.forEach(u=>u.GetErrors().forEach(m=>t.AddError(m))),l||t.AddError({keyword:"anyOf",schemaPath:n,instancePath:r,params:{}})}function Fh(e,t,n,r){return z(!!n)}function cu(e,t,n,r){return n}function Dh(e,t,n,r,s,o){return cu(e,t,s)||t.AddError({keyword:"boolean",schemaPath:n,instancePath:r,params:{}})}function _h(e,t,n,r){return As(n.const)?Gt(r,z(n.const)):lm(r,ls(n.const))}function lu(e,t,n,r){return As(n.const)?h(r,n.const):Qr(r,n.const)}function Lh(e,t,n,r,s,o){return lu(e,t,s,o)||t.AddError({keyword:"const",schemaPath:n,instancePath:r,params:{allowedValue:s.const}})}function Uh(e){return!(os(e)&&h(e.minContains,0))}function i$(e,t,n,r){const[s,o]=[it(),it()],i=Pt(Gt(le(r,"length"),z(0))),a=LS(r,[s,o],St(st(e,t,n.contains,s),t.AddIndex(o)));return St(i,a)}function a$(e,t,n,r){const[s]=[it()],o=Pt(Gt(le(r,"length"),z(0))),i=_S(r,[s,"_"],st(e,t,n.contains,s));return St(o,i)}function Bh(e,t,n,r){return Uh(n)?t.UseUnevaluated()?i$(e,t,n,r):a$(e,t,n,r):z(!0)}function uu(e,t,n,r){return Uh(n)?!h(r.length,0)&&tm(r,(s,o)=>ot(e,t,n.contains,s)&&t.AddIndex(o)):!0}function Hh(e,t,n,r,s,o){return uu(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:1}})}function qh(e,t,n,r){const s=Gt(le(Xr(r),"length"),z(0)),o=wt(tt(n.dependencies).map(([i,a])=>{const l=Pt(qr(r,z(i))),u=st(e,t,a,r),m=p=>wt(p.map(g=>qr(r,z(g))));return He(l,H(a)?m(a):u)}));return He(s,o)}function zh(e,t,n,r){const s=h(D(r).length,0),o=lt(tt(n.dependencies),0,([i,a])=>!E(r,i)||(H(a)?a.every(l=>E(r,l)):ot(e,t,a,r)));return s||o}function Kh(e,t,n,r,s,o){const i=h(D(o).length,0),a=Ct(tt(s.dependencies),0,([l,u])=>{const m=`${n}/dependencies/${l}`;return!E(o,l)||(H(u)?u.every(p=>E(o,p)||t.AddError({keyword:"dependencies",schemaPath:n,instancePath:r,params:{property:l,dependencies:u}})):It(e,t,m,r,u,o))});return i||a}function Gh(e,t,n,r){const s=Gt(le(Xr(r),"length"),z(0)),o=wt(tt(n.dependentRequired).map(([i,a])=>{const l=Pt(qr(r,z(i))),u=wt(a.map(m=>qr(r,z(m))));return He(l,u)}));return He(s,o)}function Vh(e,t,n,r){const s=h(D(r).length,0),o=lt(tt(n.dependentRequired),0,([i,a])=>!E(r,i)||a.every(l=>E(r,l)));return s||o}function Wh(e,t,n,r,s,o){const i=h(D(o).length,0),a=Ct(tt(s.dependentRequired),0,([l,u])=>!E(o,l)||Ct(u,0,m=>E(o,m)||t.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:r,params:{property:l,dependencies:u}})));return i||a}function Jh(e,t,n,r){const s=Gt(le(Xr(r),"length"),z(0)),o=wt(tt(n.dependentSchemas).map(([i,a])=>{const l=Pt(qr(r,z(i))),u=st(e,t,a,r);return He(l,u)}));return He(s,o)}function Qh(e,t,n,r){const s=h(D(r).length,0),o=lt(tt(n.dependentSchemas),0,([i,a])=>!E(r,i)||ot(e,t,a,r));return s||o}function Yh(e,t,n,r,s,o){const i=h(D(o).length,0),a=Ct(tt(s.dependentSchemas),0,([l,u])=>{const m=`${n}/dependentSchemas/${l}`;return!E(o,l)||It(e,t,m,r,u,o)});return i||a}function c$(e,t,n,r){const s=e.DynamicRef(n)??!1;return qs(e,t,s,r)}function l$(e,t,n,r){const s=e.DynamicRef(n)??!1;return _e(s)&&ot(e,t,s,r)}function u$(e,t,n,r,s,o){const i=e.DynamicRef(s)??!1;return _e(i)&&It(e,t,"#",r,i,o)}function Xh(e,t,n,r){return ll(n.enum.map(s=>{if(As(s))return Gt(r,z(s));const o=ls(s);return lm(r,o)}))}function du(e,t,n,r){return Es(n.enum,s=>As(s)?h(r,s):Qr(r,s))}function Zh(e,t,n,r,s,o){return du(e,t,s,o)||t.AddError({keyword:"enum",schemaPath:n,instancePath:r,params:{allowedValues:s.enum}})}function eb(e,t,n,r){return al(r,z(n.exclusiveMaximum))}function fu(e,t,n,r){return ko(r,n.exclusiveMaximum)}function tb(e,t,n,r,s,o){return fu(e,t,s,o)||t.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:r,params:{comparison:"<",limit:s.exclusiveMaximum}})}function nb(e,t,n,r){return am(r,z(n.exclusiveMinimum))}function mu(e,t,n,r){return Jr(r,n.exclusiveMinimum)}function rb(e,t,n,r,s,o){return mu(e,t,s,o)||t.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:r,params:{comparison:">",limit:s.exclusiveMinimum}})}const d$=[0,31,28,31,30,31,30,31,31,30,31,30,31],f$=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function m$(e){return e%4===0&&(e%100!==0||e%400===0)}function pu(e){const t=f$.exec(e);if(!t)return!1;const n=+t[1],r=+t[2],s=+t[3];return r>=1&&r<=12&&s>=1&&s<=(r===2&&m$(n)?29:d$[r])}const p$=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function gu(e,t=!0){const n=p$.exec(e);if(!n)return!1;const r=+n[1],s=+n[2],o=+n[3],i=n[4]==="-"?-1:1,a=+(n[5]||0),l=+(n[6]||0);if(a>23||l>59||t&&!n[4]&&e.toLowerCase().indexOf("z")===-1)return!1;if(r<=23&&s<=59&&o<60)return!0;const u=s-l*i,m=r-a*i-(u<0?1:0);return(m===23||m===-1)&&(u===59||u===-1)&&o<61}function sb(e,t=!0){const n=e.split(/T/i);return n.length===2&&pu(n[0])&&gu(n[1],t)}const g$=/^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;function ob(e){return g$.test(e)}const h$=/^(?!.*\.\.)[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i;function ib(e){return h$.test(e)}const Br=36,ki=1,Cc=26,b$=38,k$=700,x$=72,y$=128;function S$(e,t,n){e=n?Math.floor(e/k$):e>>1,e+=Math.floor(e/t);let r=0;for(;e>(Br-ki)*Cc>>1;)e=Math.floor(e/(Br-ki)),r+=Br;return r+Math.floor((Br-ki+1)*e/(e+b$))}function v$(e){const t=[];let n=y$,r=0,s=x$;const o=e.lastIndexOf("-");if(o>0)for(let a=0;a<o;a++){const l=e.charCodeAt(a);if(l>=128)throw new Error("Invalid punycode: non-basic before delimiter");t.push(l)}let i=o<0?0:o+1;for(;i<e.length;){const a=r;let l=1,u=Br;for(;;){if(i>=e.length)throw new Error("Invalid punycode: unexpected end of input");const p=e.charCodeAt(i++);let g;if(p>=97&&p<=122)g=p-97;else if(p>=48&&p<=57)g=p-48+26;else if(p>=65&&p<=90)Nt();else throw new Error("Invalid punycode: bad digit character");r+=g*l;const x=u<=s?ki:u>=s+Cc?Cc:u-s;if(g<x)break;l*=Br-x,u+=Br}const m=t.length+1;s=S$(r-a,m,a===0),n+=Math.floor(r/m),r%=m,t.splice(r,0,n),r++}return globalThis.String.fromCodePoint(...t)}function w$(e){return new RegExp("\\p{Mn}","u").test(String.fromCodePoint(e))}function I$(e){return new RegExp("\\p{Mc}","u").test(String.fromCodePoint(e))}function C$(e){return new RegExp("\\p{Me}","u").test(String.fromCodePoint(e))}function j$(e){return w$(e)||I$(e)||C$(e)}const T$=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347]),A$=new Set([2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,6980,7082,7083,43456,69702,69759,69817,69939,69940,70080,70197,70477,70722,70850,71103,71231,71350,72767,73028,73029]);function E$(e){return new RegExp("\\p{Script=Greek}","u").test(String.fromCodePoint(e))}function P$(e){return new RegExp("\\p{Script=Hebrew}","u").test(String.fromCodePoint(e))}function N$(e){return new RegExp("\\p{Script=Hiragana}","u").test(String.fromCodePoint(e))}function $$(e){return new RegExp("\\p{Script=Katakana}","u").test(String.fromCodePoint(e))}function R$(e){return new RegExp("\\p{Script=Han}","u").test(String.fromCodePoint(e))}function O$(e){return e>=1632&&e<=1641}function M$(e){return e>=1776&&e<=1785}function Gd(e){return A$.has(e)}function ab(e){if(e.length===0)return Nt();const t=[...e].map(i=>i.codePointAt(0)),n=t.length;if(t[0]===45||t[n-1]===45||n>=4&&t[2]===45&&t[3]===45||j$(t[0]))return!1;let r=!1,s=!1,o=!1;for(let i=0;i<n;i++){const a=t[i];if(T$.has(a))return!1;(N$(a)||$$(a)||R$(a))&&(r=!0),O$(a)&&(s=!0),M$(a)&&(o=!0);const l=t[i-1],u=t[i+1];switch(a){case 183:if(l!==108||u!==108)return!1;break;case 885:if(u===void 0||!E$(u))return!1;break;case 1523:case 1524:if(l===void 0||!P$(l))return!1;break;case 8204:if(l===void 0||l<128&&!Gd(l))return!1;break;case 8205:if(l===void 0||!Gd(l))return!1;break}}return!(e.includes("・")&&!r||s&&o)}function F$(e){if(e.charCodeAt(0)===45||e.charCodeAt(e.length-1)===45||e.length>=4&&e.charCodeAt(2)===45&&e.charCodeAt(3)===45)return!1;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45))return!1}return!0}function cb(e){return e.toLowerCase().startsWith("xn--")}function lb(e){try{const t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;const r=v$(t);return r?ab(r):!1}catch{return!1}}function D$(e){return e.length===0||e.length>63?!1:cb(e)?lb(e):ab(e)}function _$(e){return e.length===0||e.length>63?!1:cb(e)?lb(e):F$(e)}function ub(e){if(e.length===0||e.length>253||e.charCodeAt(e.length-1)===46)return!1;for(const t of e.split("."))if(!_$(t))return!1;return!0}const L$=/^(?!.*\.\.)[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+(?:\.[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+)*@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?)*$/iu;function db(e){return L$.test(e)}function fb(e){if(e.length===0||e.includes(" "))return!1;const t=e.normalize("NFC").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".");if(t.length>253)return!1;for(const n of t.split("."))if(!D$(n))return!1;return!0}function mb(e,t,n){let r=0,s=0,o=0,i=0;for(let a=t;a<n;a++){const l=e.charCodeAt(a);if(l===46){if(o===0||s>255||i===48&&o>1)return!1;r++,s=0,o=0,i=0}else if(l>=48&&l<=57)o===0&&(i=l),s=s*10+(l-48),o++;else return!1}return r===3&&o>0&&s<=255&&!(i===48&&o>1)}function pb(e){return mb(e,0,e.length)}function U$(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function gb(e){const t=e.length;if(t===0)return!1;let n=0,r=!1,s=0;if(e.charCodeAt(0)===58&&e.charCodeAt(1)===58){if(t===2)return!0;r=!0,s=2}for(;s<t;){let o=0;const i=s;for(;s<t&&U$(e.charCodeAt(s));)s++,o++;if(o===0)return!1;const a=e.charCodeAt(s);if(a===46){if(!mb(e,i,t))return!1;n+=2,s=t;break}if(o>4)return!1;if(n++,s===t)break;if(a!==58)return!1;if(s++,e.charCodeAt(s)===58){if(r||e.charCodeAt(s+1)===58)return!1;if(r=!0,s++,s===t)break}}return r?n<=7:n===8}function Vd(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function hb(e){if(e.includes(" ")||e.includes("\\")||/[\x00-\x1F\x7F]/.test(e)||/%(?![0-9a-fA-F]{2})/.test(e))return!1;if(e==="")return!0;const t=e.indexOf(":");return t>0&&/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e.substring(0,t))?Vd(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&t===-1?!1:Vd(e)}function bb(e){try{return new URL(e),!0}catch{return!1}}const B$=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function kb(e){return B$.test(e)}const H$=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function xb(e){return H$.test(e)}function yb(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}const q$=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function Sb(e){return q$.test(e)}const z$=/^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;function vb(e){return z$.test(e)}const K$=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;function wb(e){return K$.test(e)}function Ib(e){return e>=97&&e<=122||e>=65&&e<=90}function Cb(e){return Ib(e)||e>=48&&e<=57}function fi(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function G$(e){return Cb(e)||e===43||e===45||e===46}function jc(e){return Cb(e)||e===45||e===46||e===95||e===126}function Tc(e){return e===33||e===36||e===38||e===39||e===40||e===41||e===42||e===43||e===44||e===59||e===61}function V$(e){return jc(e)||Tc(e)||e===58||e===64}function jb(e){const t=e.length;if(t===0||!Ib(e.charCodeAt(0)))return!1;let n=1;for(;n<t;){const r=e.charCodeAt(n);if(r===58)break;if(!G$(r))return!1;n++}if(e.charCodeAt(n)!==58)return!1;if(n++,e.charCodeAt(n)===47&&e.charCodeAt(n+1)===47){n+=2;const r=n;let s=-1;for(let o=n;o<t;o++){const i=e.charCodeAt(o);if(i===64){s=o;break}if(i===47||i===63||i===35)break}if(s!==-1){for(let o=r;o<s;o++){const i=e.charCodeAt(o);if(i===91||i===93)return!1;if(i===37){if(o+2>=s||!fi(e.charCodeAt(o+1))||!fi(e.charCodeAt(o+2)))return!1;o+=2}else if(!jc(i)&&!Tc(i)&&i!==58)return!1}n=s+1}if(e.charCodeAt(n)===91){for(n++;n<t&&e.charCodeAt(n)!==93;)n++;if(e.charCodeAt(n)!==93)return!1;n++}else for(;n<t;){const o=e.charCodeAt(n);if(o===47||o===63||o===35||o===58)break;if(o<128&&!jc(o)&&!Tc(o))return!1;n++}if(e.charCodeAt(n)===58)for(n++;n<t;){const o=e.charCodeAt(n);if(o===47||o===63||o===35)break;if(o<48||o>57)return!1;n++}}for(;n<t;){const r=e.charCodeAt(n);if(r===37){if(n+2>=t||!fi(e.charCodeAt(n+1))||!fi(e.charCodeAt(n+2)))return!1;n+=2}else{if(r>127)return!1;if(!(V$(r)||r===47||r===63||r===35))return!1}n++}return!0}const W$=/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;function Tb(e){return W$.test(e)}const J$=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function Ab(e){return J$.test(e)}const Be=new Map;function Eb(){Be.clear()}function Q$(){return[...Be.entries()]}function Y$(e,t){Be.set(e,t)}function X$(e){return Be.has(e)}function Z$(e){return Be.get(e)}function Pb(e,t){var n;return((n=Be.get(e))==null?void 0:n(t))??!0}function Nb(){Eb(),Be.set("date-time",sb),Be.set("date",pu),Be.set("duration",ob),Be.set("email",ib),Be.set("hostname",ub),Be.set("idn-email",db),Be.set("idn-hostname",fb),Be.set("ipv4",pb),Be.set("ipv6",gb),Be.set("iri-reference",hb),Be.set("iri",bb),Be.set("json-pointer-uri-fragment",kb),Be.set("json-pointer",xb),Be.set("regex",yb),Be.set("relative-json-pointer",Sb),Be.set("time",gu),Be.set("uri-reference",vb),Be.set("uri-template",wb),Be.set("uri",jb),Be.set("url",Tb),Be.set("uuid",Ab)}Nb();const eR=Object.freeze(Object.defineProperty({__proto__:null,Clear:Eb,Entries:Q$,Get:Z$,Has:X$,IsDate:pu,IsDateTime:sb,IsDuration:ob,IsEmail:ib,IsHostname:ub,IsIPv4:pb,IsIPv6:gb,IsIdnEmail:db,IsIdnHostname:fb,IsIri:bb,IsIriReference:hb,IsJsonPointer:xb,IsJsonPointerUriFragment:kb,IsRegex:yb,IsRelativeJsonPointer:Sb,IsTime:gu,IsUri:jb,IsUriReference:vb,IsUriTemplate:wb,IsUrl:Tb,IsUuid:Ab,Reset:Nb,Set:Y$,Test:Pb},Symbol.toStringTag,{value:"Module"}));function $b(e,t,n,r){return ze(le("Format","Test"),[z(n.format),r])}function hu(e,t,n,r){return Pb(n.format,r)}function Rb(e,t,n,r,s,o){return hu(e,t,s,o)||t.AddError({keyword:"format",schemaPath:n,instancePath:r,params:{format:s.format}})}function Ob(e,t,n,r){const s=va(n)?n.then:!0,o=pa(n)?n.else:!0;return BS(st(e,t,n.if,r),st(e,t,s,r),st(e,t,o,r))}function Mb(e,t,n,r){const s=va(n)?n.then:!0,o=pa(n)?n.else:!0;return ot(e,t,n.if,r)?ot(e,t,s,r):ot(e,t,o,r)}function Fb(e,t,n,r,s,o){const i=va(s)?s.then:!0,a=pa(s)?s.else:!0,l=new Hn,u=It(e,l,`${n}/if`,r,s.if,o)?It(e,l,`${n}/then`,r,i,o)||t.AddError({keyword:"if",schemaPath:n,instancePath:r,params:{failingKeyword:"then"}}):It(e,t,`${n}/else`,r,a,o)||t.AddError({keyword:"if",schemaPath:n,instancePath:r,params:{failingKeyword:"else"}});return u&&t.Merge([l]),u}function tR(e,t,n,r){return wt(n.items.map((s,o)=>{const i=Yr(le(r,"length"),z(o)),a=Rn(e,t,s,`${r}[${o}]`),l=t.AddIndex(z(o));return He(i,St(a,l))}))}function nR(e,t,n,r){return wt(n.items.map((s,o)=>{const i=Yr(le(r,"length"),z(o)),a=Rn(e,t,s,`${r}[${o}]`);return He(i,a)}))}function rR(e,t,n,r){return t.UseUnevaluated()?tR(e,t,n,r):nR(e,t,n,r)}function sR(e,t,n,r){return lt(n.items,0,(s,o)=>nr(r.length,o)||$r(e,t,s,r[o])&&t.AddIndex(o))}function oR(e,t,n,r,s,o){return Ct(s.items,0,(i,a)=>{const l=`${n}/items/${a}`,u=`${r}/${a}`;return nr(o.length,a)||Rr(e,t,l,u,i,o[a])&&t.AddIndex(a)})}function iR(e,t,n,r){const s=ar(n)?n.prefixItems.length:0,o=Rn(e,t,n.items,"element"),i=t.AddIndex("index");return Dn(r,z(s),["element","index"],St(o,i))}function aR(e,t,n,r){const s=ar(n)?n.prefixItems.length:0,o=Rn(e,t,n.items,"element");return Dn(r,z(s),["element","index"],o)}function cR(e,t,n,r){return t.UseUnevaluated()?iR(e,t,n,r):aR(e,t,n,r)}function lR(e,t,n,r){const s=ar(n)?n.prefixItems.length:0;return lt(r,s,(o,i)=>$r(e,t,n.items,o)&&t.AddIndex(i))}function uR(e,t,n,r,s,o){const i=ar(s)?s.prefixItems.length:0;return Ct(o,i,(a,l)=>{const u=`${n}/items`,m=`${r}/${l}`;return Rr(e,t,u,m,s.items,a)&&t.AddIndex(l)})}function Db(e,t,n,r){return ba(n)?rR(e,t,n,r):cR(e,t,n,r)}function _b(e,t,n,r){return ba(n)?sR(e,t,n,r):lR(e,t,n,r)}function Lb(e,t,n,r,s,o){return ba(s)?oR(e,t,n,r,s,o):uR(e,t,n,r,s,o)}function Ub(e){return ss(e)}function Bb(e,t,n,r){if(!Ub(n))return z(!0);const[s]=[it()],o=Vi(r,[s,"_"],st(e,t,n.contains,s));return Yr(o,z(n.maxContains))}function bu(e,t,n,r){if(!Ub(n))return!0;const s=rl(r,o=>ot(e,t,n.contains,o));return nr(s,n.maxContains)}function Hb(e,t,n,r,s,o){const i=os(s)?s.minContains:1;return bu(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:i,maxContains:s.maxContains}})}function qb(e,t,n,r){return Yr(r,z(n.maximum))}function ku(e,t,n,r){return nr(r,n.maximum)}function zb(e,t,n,r,s,o){return ku(e,t,s,o)||t.AddError({keyword:"maximum",schemaPath:n,instancePath:r,params:{comparison:"<=",limit:s.maximum}})}function Kb(e,t,n,r){return Yr(le(r,"length"),z(n.maxItems))}function xu(e,t,n,r){return nr(r.length,n.maxItems)}function Gb(e,t,n,r,s,o){return xu(e,t,s,o)||t.AddError({keyword:"maxItems",schemaPath:n,instancePath:r,params:{limit:s.maxItems}})}function Vb(e,t,n,r){return DS(r,z(n.maxLength))}function yu(e,t,n,r){return Zf(r,n.maxLength)}function Wb(e,t,n,r,s,o){return yu(e,t,s,o)||t.AddError({keyword:"maxLength",schemaPath:n,instancePath:r,params:{limit:s.maxLength}})}function Jb(e,t,n,r){return Yr(le(Xr(r),"length"),z(n.maxProperties))}function Su(e,t,n,r){return nr(D(r).length,n.maxProperties)}function Qb(e,t,n,r,s,o){return Su(e,t,s,o)||t.AddError({keyword:"maxProperties",schemaPath:n,instancePath:r,params:{limit:s.maxProperties}})}function Yb(e){return ss(e)}function dR(e,t,n,r){const[s,o]=[it(),it()],i=Vi(r,[s,o],St(st(e,t,n.contains,s),t.AddIndex(o)));return xo(i,z(n.minContains))}function fR(e,t,n,r){const[s]=[it()],o=Vi(r,[s,"_"],st(e,t,n.contains,s));return xo(o,z(n.minContains))}function Xb(e,t,n,r){return Yb(n)?t.UseUnevaluated()?dR(e,t,n,r):fR(e,t,n,r):z(!0)}function vu(e,t,n,r){if(!Yb(n))return!0;const s=rl(r,(o,i)=>ot(e,t,n.contains,o)&&t.AddIndex(i));return Ts(s,n.minContains)}function Zb(e,t,n,r,s,o){return vu(e,t,s,o)||t.AddError({keyword:"contains",schemaPath:n,instancePath:r,params:{minContains:s.minContains}})}function ek(e,t,n,r){return xo(r,z(n.minimum))}function wu(e,t,n,r){return Ts(r,n.minimum)}function tk(e,t,n,r,s,o){return wu(e,t,s,o)||t.AddError({keyword:"minimum",schemaPath:n,instancePath:r,params:{comparison:">=",limit:s.minimum}})}function nk(e,t,n,r){return xo(le(r,"length"),z(n.minItems))}function Iu(e,t,n,r){return Ts(r.length,n.minItems)}function rk(e,t,n,r,s,o){return Iu(e,t,s,o)||t.AddError({keyword:"minItems",schemaPath:n,instancePath:r,params:{limit:s.minItems}})}function sk(e,t,n,r){return FS(r,z(n.minLength))}function Cu(e,t,n,r){return em(r,n.minLength)}function ok(e,t,n,r,s,o){return Cu(e,t,s,o)||t.AddError({keyword:"minLength",schemaPath:n,instancePath:r,params:{limit:s.minLength}})}function ik(e,t,n,r){return xo(le(Xr(r),"length"),z(n.minProperties))}function ju(e,t,n,r){return Ts(D(r).length,n.minProperties)}function ak(e,t,n,r,s,o){return ju(e,t,s,o)||t.AddError({keyword:"minProperties",schemaPath:n,instancePath:r,params:{limit:s.minProperties}})}function ck(e,t,n,r){return HS(r,z(n.multipleOf))}function Tu(e,t,n,r){return Yf(r,n.multipleOf)}function lk(e,t,n,r,s,o){return Tu(e,t,s,o)||t.AddError({keyword:"multipleOf",schemaPath:n,instancePath:r,params:{multipleOf:s.multipleOf}})}function mR(e,t,n,r){return Yo(e,t,[n.not],r,Pt(Gt(le("results","length"),z(1))))}function pR(e,t,n,r){return Pt(st(e,t,n.not,r))}function uk(e,t,n,r){return t.UseUnevaluated()?mR(e,t,n,r):pR(e,t,n,r)}function Au(e,t,n,r){const s=new Bn;return!ot(e,s,n.not,r)&&t.Merge([s])}function dk(e,t,n,r,s,o){return Au(e,t,s,o)||t.AddError({keyword:"not",schemaPath:n,instancePath:r,params:{}})}function gR(e,t,n,r){return Yo(e,t,n.oneOf,r,Gt(le("results","length"),z(1)))}function hR(e,t,n,r){const[s]=[it()],o=US(n.oneOf.map(a=>st(e,t,a,r))),i=Vi(o,[s,"_"],Gt(s,z(!0)));return Gt(i,z(1))}function fk(e,t,n,r){return t.UseUnevaluated()?gR(e,t,n,r):hR(e,t,n,r)}function mk(e,t,n,r){const s=n.oneOf.reduce((o,i)=>{const a=new Bn;return ot(e,a,i,r)?[...o,a]:o},[]);return h(s.length,1)&&t.Merge(s)}function pk(e,t,n,r,s,o){const i=[],a=[],l=s.oneOf.reduce((m,p,g)=>{const x=new Hn,b=`${n}/oneOf/${g}`,y=It(e,x,b,r,p,o);return y&&a.push(g),y||i.push(x),y?[...m,x]:m},[]),u=h(l.length,1)&&t.Merge(l);return!u&&h(a.length,0)&&i.forEach(m=>m.GetErrors().forEach(p=>t.AddError(p))),u||t.AddError({keyword:"oneOf",schemaPath:n,instancePath:r,params:{passingSchemas:a}})}function gk(e,t,n,r){const s=ls(oe(n.pattern)?new RegExp(n.pattern,"u"):n.pattern);return ze(le(s,"test"),[r])}function Eu(e,t,n,r){return(oe(n.pattern)?new RegExp(n.pattern,"u"):n.pattern).test(r)}function hk(e,t,n,r,s,o){return Eu(e,t,s,o)||t.AddError({keyword:"pattern",schemaPath:n,instancePath:r,params:{pattern:s.pattern}})}function bk(e,t,n,r){return wt(tt(n.patternProperties).map(([s,o])=>{const[i,a]=[it(),it()],l=ls(new RegExp(s,"u")),u=Pt(ze(le(l,"test"),[i])),m=Rn(e,t,o,a),p=t.AddKey(i),g=t.UseUnevaluated()?He(u,St(m,p)):He(u,m);return Dn(cm(r),z(0),[`[${i}, ${a}]`,"_"],g)}))}function kk(e,t,n,r){return lt(tt(n.patternProperties),0,([s,o])=>{const i=new RegExp(s,"u");return lt(tt(r),0,([a,l])=>!i.test(a)||$r(e,t,o,l)&&t.AddKey(a))})}function xk(e,t,n,r,s,o){return Ct(tt(s.patternProperties),0,([i,a])=>{const l=`${n}/patternProperties/${i}`,u=new RegExp(i,"u");return Ct(tt(o),0,([m,p])=>{const g=`${r}/${m}`;return!u.test(m)||Rr(e,t,l,g,a,p)&&t.AddKey(m)})})}function yk(e,t,n,r){return wt(n.prefixItems.map((s,o)=>{const i=Yr(le(r,"length"),z(o)),a=Rn(e,t,s,`${r}[${o}]`),l=t.AddIndex(z(o)),u=t.UseUnevaluated()?St(a,l):a;return He(i,u)}))}function Sk(e,t,n,r){return h(r.length,0)||lt(n.prefixItems,0,(s,o)=>nr(r.length,o)||$r(e,t,s,r[o])&&t.AddIndex(o))}function vk(e,t,n,r,s,o){return h(o.length,0)||Ct(s.prefixItems,0,(i,a)=>{const l=`${n}/prefixItems/${a}`,u=`${r}/${a}`;return nr(o.length,a)||Rr(e,t,l,u,i,o[a])&&t.AddIndex(a)})}function Pu(e,t){return e.includes(t)||So().exactOptionalPropertyTypes}function bR(e,t){return lc(le(e,t))}function wk(e,t){return Re(e[t])}function Ik(e,t,n,r){const s=cr(n)?n.required:[],o=tt(n.properties).map(([i,a])=>{const l=Pt(qr(r,z(i))),u=Rn(e,t,a,le(r,i)),m=t.AddKey(z(i)),p=t.UseUnevaluated()?St(u,m):u,g=s.includes(i)?p:He(l,p);return Pu(s,i)?g:He(bR(r,i),g)});return wt(o)}function Ck(e,t,n,r){const s=cr(n)?n.required:[];return lt(tt(n.properties),0,([i,a])=>{const l=!E(r,i)||$r(e,t,a,r[i])&&t.AddKey(i);return Pu(s,i)?l:wk(r,i)||l})}function jk(e,t,n,r,s,o){const i=cr(s)?s.required:[];return Ct(tt(s.properties),0,([l,u])=>{const m=`${n}/properties/${l}`,p=`${r}/${l}`,g=()=>!E(o,l)||Rr(e,t,m,p,u,o[l])&&t.AddKey(l);return Pu(i,l)?g():wk(o,l)||g()})}function Tk(e,t,n,r){const[s,o]=[it(),it()];return Dn(Xr(r),z(0),[s,o],st(e,t,n.propertyNames,s))}function Ak(e,t,n,r){return lt(D(r),0,(s,o)=>ot(e,t,n.propertyNames,s))}function Ek(e,t,n,r,s,o){const i=[];return Ct(D(o),0,(l,u)=>{const m=`${r}/${l}`,p=`${n}/propertyNames`,g=new Hn,x=It(e,g,p,m,s.propertyNames,l);return x||i.push(l),x})||t.AddError({keyword:"propertyNames",schemaPath:n,instancePath:r,params:{propertyNames:i}})}function Pk(e,t,n,r){const s=e.RecursiveRef(n)??!1;return qs(e,t,s,r)}function Nk(e,t,n,r){const s=e.RecursiveRef(n)??!1;return _e(s)&&ot(e,t,s,r)}function $k(e,t,n,r,s,o){const i=e.RecursiveRef(s)??!1;return _e(i)&&It(e,t,"#",r,i,o)}function kR(e,t,n,r){const s=kr(["context","value"],qs(e,t,n,"value")),o=kr(["context","value"],Wi([Qn("nextContext",cl("CheckContext",[])),Qn("result",ze(s,["nextContext","value"])),um("result",t.Merge("[nextContext]")),Ji("result")]));return ze(o,["context",r])}function xR(e,t,n,r){return qs(e,t,n,r)}function Rk(e,t,n,r){const s=e.Ref(n)??!1;return t.UseUnevaluated()?kR(e,t,s,r):xR(e,t,s,r)}function Ok(e,t,n,r){const s=e.Ref(n)??!1,o=new Bn,i=_e(s)&&ot(e,o,s,r);return i&&t.Merge([o]),i}function Mk(e,t,n,r,s,o){const i=e.Ref(s)??!1,a=new Hn,l=_e(i)&&It(e,a,"#",r,i,o);return l&&t.Merge([a]),l||a.GetErrors().forEach(u=>t.AddError(u)),l}function Fk(e,t,n,r){return wt(n.required.map(s=>qr(r,z(s))))}function Dk(e,t,n,r){return lt(n.required,0,s=>E(r,s))}function _k(e,t,n,r,s,o){const i=[];return Ct(s.required,0,l=>{const u=E(o,l);return u||i.push(l),u})||t.AddError({keyword:"required",schemaPath:n,instancePath:r,params:{requiredProperties:i}})}function Lk(e,t,n,r){return h(n,"object")?sm(r):h(n,"array")?Ci(r):h(n,"boolean")?PS(r):h(n,"integer")?NS(r):h(n,"number")?rm(r):h(n,"null")?$S(r):h(n,"string")?im(r):h(n,"bigint")?nm(r):h(n,"constructor")?MS(r):h(n,"function")?OS(r):h(n,"symbol")?RS(r):h(n,"undefined")||h(n,"void")?lc(r):z(!0)}function Nu(e,t,n,r,s){return h(n,"object")?fn(s):h(n,"array")?H(s):h(n,"boolean")?gt(s):h(n,"integer")?tl(s):h(n,"number")?xe(s):h(n,"null")?Vt(s):h(n,"string")?oe(s):h(n,"bigint")?et(s):h(n,"constructor")?Gi(s):h(n,"function")?In(s):h(n,"symbol")?nl(s):h(n,"undefined")||h(n,"void")?Re(s):!0}function yR(e,t,n,r){return ll(n.map(s=>Lk(e,t,s,r)))}function Uk(e,t,n,r,s){return Es(n,o=>Nu(e,t,o,r,s))}function Bk(e,t,n,r){return H(n.type)?yR(e,t,n.type,r):Lk(e,t,n.type,r)}function Hk(e,t,n,r){return H(n.type)?Uk(e,t,n.type,n,r):Nu(e,t,n.type,n,r)}function qk(e,t,n,r,s,o){return(H(s.type)?Uk(e,t,s.type,s,o):Nu(e,t,s.type,s,o))||t.AddError({keyword:"type",schemaPath:n,instancePath:r,params:{type:s.type}})}function zk(e,t,n,r){const[s,o]=[it(),it()],i=ze(le("context","GetIndices"),[]),a=ze(le("indices","has"),[s]),l=st(e,t,n.unevaluatedItems,o),u=ze(le("context","AddIndex"),[s]),m=Dn(r,z(0),[o,s],St(He(a,l),u));return ze(kr(["context"],Wi([Qn("indices",i),Ji(m)])),["context"])}function Kk(e,t,n,r){const s=t.GetIndices();return lt(r,0,(o,i)=>(s.has(i)||ot(e,t,n.unevaluatedItems,o))&&t.AddIndex(i))}function Gk(e,t,n,r,s,o){const i=t.GetIndices(),a=[];return Ct(o,0,(u,m)=>{const p=new Hn,g=(i.has(m)||It(e,p,n,r,s.unevaluatedItems,u))&&t.AddIndex(m);return g||a.push(m),g})||t.AddError({keyword:"unevaluatedItems",schemaPath:n,instancePath:r,params:{unevaluatedItems:a}})}function Vk(e,t,n,r){const[s,o]=[it(),it()],i=ze(le("context","GetKeys"),[]),a=ze(le("keys","has"),[s]),l=ze(le("context","AddKey"),[s]),u=st(e,t,n.unevaluatedProperties,o),m=Dn(cm(r),z(0),[`[${s}, ${o}]`,"_"],He(a,St(u,l)));return ze(kr(["context"],Wi([Qn("keys",i),Ji(m)])),["context"])}function Wk(e,t,n,r){const s=t.GetKeys();return lt(tt(r),0,([o,i])=>s.has(o)||ot(e,t,n.unevaluatedProperties,i)&&t.AddKey(o))}function Jk(e,t,n,r,s,o){const i=t.GetKeys(),a=[];return Ct(tt(o),0,([u,m])=>{const p=new Hn,g=i.has(u)||It(e,p,n,r,s.unevaluatedProperties,m)&&t.AddKey(u);return g||a.push(u),g})||t.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:r,params:{unevaluatedProperties:a}})}function $u(e){return!h(e.uniqueItems,!1)}function Qk(e,t,n,r){if(!$u(n))return z(!0);const s=le(cl("Set",[ze(le(r,"map"),[le("Hashing","Hash")])]),"size"),o=le(r,"length");return Gt(s,o)}function Yk(e,t,n,r){if(!$u(n))return!0;const s=new Set(r.map(Qi)).size,o=r.length;return h(s,o)}function Xk(e,t,n,r,s,o){if(!$u(s))return!0;const i=new Set,a=o.reduce((u,m,p)=>{const g=Qi(m);return i.has(g)?[...u,p]:(i.add(g),u)},[]);return h(a.length,0)||t.AddError({keyword:"uniqueItems",schemaPath:n,instancePath:r,params:{duplicateItems:a}})}function fo(e,t){return Qo(e)&&(H(e.type)&&Jr(e.type.length,0)&<(e.type,0,n=>h(n,t))||h(e.type,t))}function SR(e){return fo(e,"object")}function vR(e){return tn(e)&&(ir(e)||Uo(e)||Bo(e)||Ho(e)||cs(e)||as(e)||Jo(e)||Ls(e)||Vo(e)||cr(e)||Hs(e))}function wR(e){return fo(e,"array")}function IR(e){return tn(e)&&(Lo(e)||Pr(e)||ss(e)||Ko(e)||Ds(e)||os(e)||is(e)||ar(e)||Bs(e)||wr(e))}function CR(e){return fo(e,"string")}function jR(e){return tn(e)&&(_s(e)||Go(e)||Fs(e)||Us(e))}function TR(e){return fo(e,"number")||fo(e,"bigint")}function AR(e){return tn(e)&&(Nr(e)||zo(e)||qo(e)||Er(e)||Wo(e))}function Rn(e,t,n,r){return t.UseUnevaluated()?St(St(t.Push(),st(e,t,n,r)),t.Pop()):st(e,t,n,r)}function st(e,t,n,r){e.Push(n);const s=[];if(_o(n))return Fh(e,t,n);if(Qo(n)&&s.push(Bk(e,t,n,r)),vR(n)){const i=[];cr(n)&&i.push(Fk(e,t,n,r)),ir(n)&&i.push(Th(e,t,n,r)),Uo(n)&&i.push(qh(e,t,n,r)),Bo(n)&&i.push(Gh(e,t,n,r)),Ho(n)&&i.push(Jh(e,t,n,r)),as(n)&&i.push(bk(e,t,n,r)),cs(n)&&i.push(Ik(e,t,n,r)),Jo(n)&&i.push(Tk(e,t,n,r)),Ls(n)&&i.push(ik(e,t,n,r)),Vo(n)&&i.push(Jb(e,t,n,r));const a=wt(i),l=He(Pt(sm(r)),a);s.push(SR(n)?a:l)}if(IR(n)){const i=[];Lo(n)&&i.push(Sh(e,t,n,r)),ss(n)&&i.push(Bh(e,t,n,r)),Pr(n)&&i.push(Db(e,t,n,r)),Ko(n)&&i.push(Bb(e,t,n,r)),Ds(n)&&i.push(Kb(e,t,n,r)),os(n)&&i.push(Xb(e,t,n,r)),is(n)&&i.push(nk(e,t,n,r)),ar(n)&&i.push(yk(e,t,n,r)),wr(n)&&i.push(Qk(e,t,n,r));const a=wt(i),l=He(Pt(Ci(r)),a);s.push(wR(n)?a:l)}if(jR(n)){const i=[];Go(n)&&i.push(Vb(e,t,n,r)),_s(n)&&i.push(sk(e,t,n,r)),Fs(n)&&i.push($b(e,t,n,r)),Us(n)&&i.push(gk(e,t,n,r));const a=wt(i),l=He(Pt(im(r)),a);s.push(CR(n)?a:l)}if(AR(n)){const i=[];qo(n)&&i.push(eb(e,t,n,r)),Er(n)&&i.push(nb(e,t,n,r)),zo(n)&&i.push(qb(e,t,n,r)),Nr(n)&&i.push(ek(e,t,n,r)),Wo(n)&&i.push(ck(e,t,n,r));const a=wt(i),l=He(Pt(He(rm(r),nm(r))),a);s.push(TR(n)?a:l)}Sa(n)&&s.push(Rk(e,t,n,r)),ya(n)&&s.push(Pk(e,t,n,r)),ma(n)&&s.push(c$(e,t,n,r)),fa(n)&&s.push(_h(e,t,n,r)),ga(n)&&s.push(Xh(e,t,n,r)),ha(n)&&s.push(Ob(e,t,n,r)),ka(n)&&s.push(uk(e,t,n,r)),ua(n)&&s.push(Ph(e,t,n,r)),da(n)&&s.push(Rh(e,t,n,r)),xa(n)&&s.push(fk(e,t,n,r)),Bs(n)&&s.push(He(Pt(Ci(r)),zk(e,t,n,r))),Hs(n)&&s.push(He(Pt(om(r)),Vk(e,t,n,r))),la(n)&&s.push(kh(e,t,n,r));const o=wt(s);return e.Pop(n),o}function $r(e,t,n,r){return t.Push()&&ot(e,t,n,r)&&t.Pop()}function ot(e,t,n,r){e.Push(n);const s=_o(n)?cu(e,t,n):(!Qo(n)||Hk(e,t,n,r))&&(!(ne(r)&&!H(r))||(!cr(n)||Dk(e,t,n,r))&&(!ir(n)||Ah(e,t,n,r))&&(!Uo(n)||zh(e,t,n,r))&&(!Bo(n)||Vh(e,t,n,r))&&(!Ho(n)||Qh(e,t,n,r))&&(!as(n)||kk(e,t,n,r))&&(!cs(n)||Ck(e,t,n,r))&&(!Jo(n)||Ak(e,t,n,r))&&(!Ls(n)||ju(e,t,n,r))&&(!Vo(n)||Su(e,t,n,r)))&&(!H(r)||(!Lo(n)||vh(e,t,n,r))&&(!ss(n)||uu(e,t,n,r))&&(!Pr(n)||_b(e,t,n,r))&&(!Ko(n)||bu(e,t,n,r))&&(!Ds(n)||xu(e,t,n,r))&&(!os(n)||vu(e,t,n,r))&&(!is(n)||Iu(e,t,n,r))&&(!ar(n)||Sk(e,t,n,r))&&(!wr(n)||Yk(e,t,n,r)))&&(!oe(r)||(!Go(n)||yu(e,t,n,r))&&(!_s(n)||Cu(e,t,n,r))&&(!Fs(n)||hu(e,t,n,r))&&(!Us(n)||Eu(e,t,n,r)))&&(!(xe(r)||et(r))||(!qo(n)||fu(e,t,n,r))&&(!Er(n)||mu(e,t,n,r))&&(!zo(n)||ku(e,t,n,r))&&(!Nr(n)||wu(e,t,n,r))&&(!Wo(n)||Tu(e,t,n,r)))&&(!Sa(n)||Ok(e,t,n,r))&&(!ya(n)||Nk(e,t,n,r))&&(!ma(n)||l$(e,t,n,r))&&(!fa(n)||lu(e,t,n,r))&&(!ga(n)||du(e,t,n,r))&&(!ha(n)||Mb(e,t,n,r))&&(!ka(n)||Au(e,t,n,r))&&(!ua(n)||Nh(e,t,n,r))&&(!da(n)||Oh(e,t,n,r))&&(!xa(n)||mk(e,t,n,r))&&(!Bs(n)||!H(r)||Kk(e,t,n,r))&&(!Hs(n)||!ne(r)||Wk(e,t,n,r))&&(!la(n)||xh(e,t,n,r));return e.Pop(n),s}function Rr(e,t,n,r,s,o){return t.Push()&&It(e,t,n,r,s,o)&&t.Pop()}function It(e,t,n,r,s,o){e.Push(s);const i=_o(s)?Dh(e,t,n,r,s):!!(+(!Qo(s)||qk(e,t,n,r,s,o))&+(!(ne(o)&&!H(o))||!!(+(!cr(s)||_k(e,t,n,r,s,o))&+(!ir(s)||Eh(e,t,n,r,s,o))&+(!Uo(s)||Kh(e,t,n,r,s,o))&+(!Bo(s)||Wh(e,t,n,r,s,o))&+(!Ho(s)||Yh(e,t,n,r,s,o))&+(!as(s)||xk(e,t,n,r,s,o))&+(!cs(s)||jk(e,t,n,r,s,o))&+(!Jo(s)||Ek(e,t,n,r,s,o))&+(!Ls(s)||ak(e,t,n,r,s,o))&+(!Vo(s)||Qb(e,t,n,r,s,o))))&+(!H(o)||!!(+(!Lo(s)||wh(e,t,n,r,s,o))&+(!ss(s)||Hh(e,t,n,r,s,o))&+(!Pr(s)||Lb(e,t,n,r,s,o))&+(!Ko(s)||Hb(e,t,n,r,s,o))&+(!Ds(s)||Gb(e,t,n,r,s,o))&+(!os(s)||Zb(e,t,n,r,s,o))&+(!is(s)||rk(e,t,n,r,s,o))&+(!ar(s)||vk(e,t,n,r,s,o))&+(!wr(s)||Xk(e,t,n,r,s,o))))&+(!oe(o)||!!(+(!Go(s)||Wb(e,t,n,r,s,o))&+(!_s(s)||ok(e,t,n,r,s,o))&+(!Fs(s)||Rb(e,t,n,r,s,o))&+(!Us(s)||hk(e,t,n,r,s,o))))&+(!(xe(o)||et(o))||!!(+(!qo(s)||tb(e,t,n,r,s,o))&+(!Er(s)||rb(e,t,n,r,s,o))&+(!zo(s)||zb(e,t,n,r,s,o))&+(!Nr(s)||tk(e,t,n,r,s,o))&+(!Wo(s)||lk(e,t,n,r,s,o))))&+(!Sa(s)||Mk(e,t,n,r,s,o))&+(!ya(s)||$k(e,t,n,r,s,o))&+(!ma(s)||u$(e,t,n,r,s,o))&+(!fa(s)||Lh(e,t,n,r,s,o))&+(!ga(s)||Zh(e,t,n,r,s,o))&+(!ha(s)||Fb(e,t,n,r,s,o))&+(!ka(s)||dk(e,t,n,r,s,o))&+(!ua(s)||$h(e,t,n,r,s,o))&+(!da(s)||Mh(e,t,n,r,s,o))&+(!xa(s)||pk(e,t,n,r,s,o))&+(!Bs(s)||!H(o)||Gk(e,t,n,r,s,o))&+(!Hs(s)||!ne(o)||Jk(e,t,n,r,s,o)))&&(!la(s)||yh(e,t,n,r,s,o));return e.Pop(s),i}const Zk=[0],xi=new Map,oo=new Map;function ER(){return`${Zk[0]++}`}function PR(e,t){xi.has(e)||xi.set(e,new Map);const n=xi.get(e);if(n.has(t))return n.get(t);const r=ER();return n.set(t,r),r}function NR(e,t,n,r){return e.UseUnevaluated()?ze(`check_${n}`,["context",r]):ze(`check_${n}`,[r])}function $R(e,t,n,r){const s=st(e,t,n,"value");return t.UseUnevaluated()?Qn(`check_${r}`,kr(["context","value"],s)):Qn(`check_${r}`,kr(["value"],s))}function ex(){Zk[0]=0,xi.clear(),oo.clear()}function tx(){return[...oo.values()]}function qs(e,t,n,r){const s=PR(n,e.BaseURL().href),o=NR(t,n,s,r);return oo.has(s)||(oo.set(s,""),oo.set(s,$R(e,t,n,s))),o}function nx(e){if(e.length===0)throw Error("Cannot set root")}function rx(e){if(!ne(e))throw Error("Cannot set value")}function RR(e){if(Jn(e))throw Error("Pointer contains unsafe property key")}function sx(e){for(const t of e)RR(t)}function OR(e){return/^(0|[1-9]\d*)$/.test(e)}function ox(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function MR(e,t){return ne(t)&&E(t,e)}function FR(e,t){return ne(t)&&!Jn(e)?t[e]:void 0}function Ru(e,t){return e.reduce((n,r)=>FR(r,n),t)}function Xo(e){if(h(e.length,0))return[];const t=e.split("/").map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"));return t.length>0&&t[0]===""?t.slice(1):t}function DR(e,t){let n=e;return Xo(t).every(r=>MR(r,n)?(n=n[r],!0):!1)}function ix(e,t){const n=Xo(t);return Ru(n,e)}function Ac(e,t,n){const r=Xo(t);nx(r),sx(r);const[s,o]=ox(r),i=Ru(s,e);return rx(i),i[o]=n,e}function ax(e,t){const n=Xo(t);nx(n),sx(n);const[r,s]=ox(n),o=Ru(r,e);return rx(o),H(o)&&OR(s)?o.splice(+s,1):delete o[s],e}const cx=Object.freeze(Object.defineProperty({__proto__:null,Delete:ax,Get:ix,Has:DR,Indices:Xo,Set:Ac},Symbol.toStringTag,{value:"Module"}));function _R(e,t,n){if(e.$id===n.hash)return e;const r=new URL(e.$id,t.href),s=new URL(n.href,t.href);if(h(r.pathname,s.pathname))return n.hash.startsWith("#")?lx(e,t,n):e}function LR(e,t,n){const r=new URL(`#${e.$anchor}`,t.href),s=new URL(n.href,t.href);return h(r.href,s.href)?e:void 0}function UR(e,t,n){const r=new URL(`#${e.$dynamicAnchor}`,t.href),s=new URL(n.href,t.href);return h(r.href,s.href)?e:void 0}function lx(e,t,n){if(n.href.endsWith("#"))return e;if(!n.hash.startsWith("#"))return;const r=decodeURIComponent(n.hash.slice(1));if(r.startsWith("/"))return ix(e,r)}function BR(e,t,n){if(vr(e)){const r=_R(e,t,n);if(!Re(r))return r}if(Ri(e)){const r=LR(e,t,n);if(!Re(r))return r}if(Vr(e)){const r=UR(e,t,n);if(!Re(r))return r}return lx(e,t,n)}function HR(e,t,n){return e.reduce((r,s)=>{const o=Ou(s,t,n);return Re(o)?r:o},void 0)}function qR(e,t,n){return D(e).reduce((r,s)=>{const o=Ou(e[s],t,n);return Re(o)?r:o},void 0)}function Ou(e,t,n){const r=tn(e)&&vr(e)?new URL(e.$id,t.href):t;if(tn(e)){const s=BR(e,r,n);if(!Re(s))return s}if(H(e))return HR(e,r,n);if(ne(e))return qR(e,r,n)}function Wr(e,t){const n=new URL("http://unknown/"),r=vr(e)?new URL(e.$id,n.href):n,s=new URL(t,r.href);return Ou(e,r,s)}function ux(e,t,n,r){const s=n.$dynamicRef.startsWith("#")?Wr(t,n.$dynamicRef):Wr(e,n.$dynamicRef);return Re(s)?void 0:!tn(s)||!Vr(s)||new URL(n.$dynamicRef,"http://unknown/").hash.startsWith("#/")?s:r.find(a=>a.$dynamicAnchor===s.$dynamicAnchor)??s}const zR=Object.freeze(Object.defineProperty({__proto__:null,DynamicRef:ux,Ref:Wr},Symbol.toStringTag,{value:"Module"}));var Ss=function(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)},pr,dx,fx,mx,px;class Zo{constructor(t,n){pr.add(this),this.context=t,this.schema=n,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((t,n)=>new URL(n.$id,t),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(t){tn(t)&&(vr(t)&&(this.ids.push(t),Ss(this,pr,"m",dx).call(this,t)),Ri(t)&&this.anchors.push(t),bi(t)&&this.recursiveAnchors.push(t),Vr(t)&&this.dynamicAnchors.push(t))}Pop(t){tn(t)&&(vr(t)&&(this.ids.pop(),Ss(this,pr,"m",fx).call(this,t)),Ri(t)&&this.anchors.pop(),bi(t)&&this.recursiveAnchors.pop(),Vr(t)&&this.dynamicAnchors.pop())}Ref(t){return Ss(this,pr,"m",mx).call(this,t)??Ss(this,pr,"m",px).call(this,t)}RecursiveRef(t){return bi(this.Base())?Wr(this.recursiveAnchors[0],t.$recursiveRef):Wr(this.Base(),t.$recursiveRef)}DynamicRef(t){const n=this.schema;return ux(n,this.Base(),t,this.dynamicAnchors)}}pr=new WeakSet,dx=function e(t,n=!0){if(!tn(t))return;const r=t;if(!(!n&&vr(r))){!n&&Vr(r)&&this.dynamicAnchors.push(r);for(const s of D(r))Ss(this,pr,"m",e).call(this,r[s],!1)}},fx=function e(t,n=!0){if(!tn(t))return;const r=t;if(!(!n&&vr(r))){!n&&Vr(r)&&this.dynamicAnchors.pop();for(const s of D(r))Ss(this,pr,"m",e).call(this,r[s],!1)}},mx=function(t){return E(this.context,t.$ref)?this.context[t.$ref]:void 0},px=function(t){const n=this.schema;return t.$ref.startsWith("#")?Wr(this.Base(),t.$ref):Wr(n,t.$ref)};function KR(e){const t=e.Functions().join(`;
|
|
9
|
+
`),n=e.UseUnevaluated()?["const context = new CheckContext({}, {})",`return ${e.Entry()}`]:[`return ${e.Entry()}`];return`${t}; return (value) => { ${n.join("; ")} }`}function GR(e,t){return xm("CheckContext","Guard","Format","Hashing",e.External().identifier,t)(Bn,Ii,eR,Lv,e.External().variables)}function VR(e){const t=new Zo(e.Context(),e.Schema()),n=new Bn;return r=>ot(t,n,e.Schema(),r)}function WR(e,t){return km()?GR(e,t):VR(e)}class gx{constructor(t,n,r){this.isAccelerated=t,this.code=n,this.check=r}IsAccelerated(){return this.isAccelerated}Code(){return this.code}Check(t){return this.check(t)}}class hx{constructor(t,n,r,s,o,i){this.context=t,this.schema=n,this.external=r,this.functions=s,this.entry=o,this.useUnevaluated=i}Context(){return this.context}Schema(){return this.schema}UseUnevaluated(){return this.useUnevaluated}External(){return this.external}Functions(){return this.functions}Entry(){return this.entry}Evaluate(){const t=KR(this),n=WR(this,t);return new gx(km(),t,n)}}function bx(...e){const[t,n]=at(e,{2:(l,u)=>[l,u],1:l=>[{},l]});hh(),ex();const r=new Zo(t,n),s=new gh(ph(t,n)),o=qs(r,s,n,"value"),i=tx(),a=bh();return new hx(t,n,a,i,o,s.UseUnevaluated())}function mo(...e){const[t,n,r]=at(e,{3:(m,p,g)=>[m,p,g],2:(m,p)=>[{},m,p]}),s=So(),o=Hv(),i=[],a=new Zo(t,n),l=new ou(m=>{if(!Ts(i.length,s.maxErrors))return i.push({...m,message:o(m)})});return[It(a,l,"#","",n,r),i]}function Mu(...e){const[t,n,r]=at(e,{3:(i,a,l)=>[i,a,l],2:(i,a)=>[{},i,a]}),s=new Zo(t,n),o=new Bn;return ot(s,o,n,r)}let Fu=class{constructor(t,n,r){this.schema=t,this.value=n,this.errors=r}};function JR(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});if(!Mu(t,n,r)){const[s,o]=mo(t,n,r);throw new Fu(n,r,o)}return r}class kx{constructor(t,n){this.buildResult=bx(t,n),this.evaluateResult=this.buildResult.Evaluate()}IsAccelerated(){return this.evaluateResult.IsAccelerated()}Schema(){return this.buildResult.Schema()}Check(t){return this.evaluateResult.Check(t)}Parse(t){if(this.evaluateResult.Check(t))return t;const[n,r]=mo(this.buildResult.Context(),this.buildResult.Schema(),t);throw new Fu(this.buildResult.Schema(),t,r)}Errors(t){return mo(this.buildResult.Context(),this.buildResult.Schema(),t)}}function QR(...e){const[t,n]=at(e,{2:(r,s)=>[r,s],1:r=>[{},r]});return new kx(t,n)}const YR=Object.freeze(Object.defineProperty({__proto__:null,AccumulatedErrorContext:Hn,Build:bx,BuildAdditionalItems:Sh,BuildAdditionalProperties:Th,BuildAdditionalPropertiesFast:Ch,BuildAdditionalPropertiesStandard:jh,BuildAllOf:Ph,BuildAnyOf:Rh,BuildConst:_h,BuildContains:Bh,BuildContext:gh,BuildDependencies:qh,BuildDependentRequired:Gh,BuildDependentSchemas:Jh,BuildEnum:Xh,BuildExclusiveMaximum:eb,BuildExclusiveMinimum:nb,BuildFormat:$b,BuildIf:Ob,BuildItems:Db,BuildMaxContains:Bb,BuildMaxItems:Kb,BuildMaxLength:Vb,BuildMaxProperties:Jb,BuildMaximum:qb,BuildMinContains:Xb,BuildMinItems:nk,BuildMinLength:sk,BuildMinProperties:ik,BuildMinimum:ek,BuildMultipleOf:ck,BuildNot:uk,BuildOneOf:fk,BuildPattern:gk,BuildPatternProperties:bk,BuildPrefixItems:yk,BuildProperties:Ik,BuildPropertyNames:Tk,BuildRecursiveRef:Pk,BuildRef:Rk,BuildRefine:kh,BuildRequired:Fk,BuildResult:hx,BuildSchema:st,BuildSchemaBoolean:Fh,BuildSchemaPushStack:Rn,BuildType:Bk,BuildUnevaluatedItems:zk,BuildUnevaluatedProperties:Vk,BuildUniqueItems:Qk,CanAdditionalPropertiesFast:Ih,Check:Mu,CheckAdditionalItems:vh,CheckAdditionalProperties:Ah,CheckAllOf:Nh,CheckAnyOf:Oh,CheckConst:lu,CheckContains:uu,CheckContext:Bn,CheckDependencies:zh,CheckDependentRequired:Vh,CheckDependentSchemas:Qh,CheckEnum:du,CheckExclusiveMaximum:fu,CheckExclusiveMinimum:mu,CheckFormat:hu,CheckIf:Mb,CheckItems:_b,CheckMaxContains:bu,CheckMaxItems:xu,CheckMaxLength:yu,CheckMaxProperties:Su,CheckMaximum:ku,CheckMinContains:vu,CheckMinItems:Iu,CheckMinLength:Cu,CheckMinProperties:ju,CheckMinimum:wu,CheckMultipleOf:Tu,CheckNot:Au,CheckOneOf:mk,CheckPattern:Eu,CheckPatternProperties:kk,CheckPrefixItems:Sk,CheckProperties:Ck,CheckPropertyNames:Ak,CheckRecursiveRef:Nk,CheckRef:Ok,CheckRefine:xh,CheckRequired:Dk,CheckSchema:ot,CheckSchemaBoolean:cu,CheckSchemaPushStack:$r,CheckType:Hk,CheckUnevaluatedItems:Kk,CheckUnevaluatedProperties:Wk,CheckUniqueItems:Yk,Compile:QR,CreateFunction:qs,CreateVariable:ls,ErrorAdditionalItems:wh,ErrorAdditionalProperties:Eh,ErrorAllOf:$h,ErrorAnyOf:Mh,ErrorConst:Lh,ErrorContains:Hh,ErrorContext:ou,ErrorDependencies:Kh,ErrorDependentRequired:Wh,ErrorDependentSchemas:Yh,ErrorEnum:Zh,ErrorExclusiveMaximum:tb,ErrorExclusiveMinimum:rb,ErrorFormat:Rb,ErrorIf:Fb,ErrorItems:Lb,ErrorMaxContains:Hb,ErrorMaxItems:Gb,ErrorMaxLength:Wb,ErrorMaxProperties:Qb,ErrorMaximum:zb,ErrorMinContains:Zb,ErrorMinItems:rk,ErrorMinLength:ok,ErrorMinProperties:ak,ErrorMinimum:tk,ErrorMultipleOf:lk,ErrorNot:dk,ErrorOneOf:pk,ErrorPattern:hk,ErrorPatternProperties:xk,ErrorPrefixItems:vk,ErrorProperties:jk,ErrorPropertyNames:Ek,ErrorRecursiveRef:$k,ErrorRef:Mk,ErrorRefine:yh,ErrorRequired:_k,ErrorSchema:It,ErrorSchemaBoolean:Dh,ErrorSchemaPushStack:Rr,ErrorType:qk,ErrorUnevaluatedItems:Gk,ErrorUnevaluatedProperties:Jk,ErrorUniqueItems:Xk,Errors:mo,EvaluateResult:gx,GetExternal:bh,GetFunctions:tx,HasUnevaluated:ph,IsAdditionalItems:Lo,IsAdditionalProperties:ir,IsAllOf:ua,IsAnchor:Ri,IsAnyOf:da,IsConst:fa,IsContains:ss,IsContentEncoding:GN,IsContentMediaType:VN,IsDefault:Ar,IsDefs:WN,IsDependencies:Uo,IsDependentRequired:Bo,IsDependentSchemas:Ho,IsDynamicAnchor:Vr,IsDynamicRef:ma,IsElse:pa,IsEnum:ga,IsExclusiveMaximum:qo,IsExclusiveMinimum:Er,IsFormat:Fs,IsId:vr,IsIf:ha,IsItems:Pr,IsItemsSized:ba,IsItemsUnsized:JN,IsMaxContains:Ko,IsMaxItems:Ds,IsMaxLength:Go,IsMaxProperties:Vo,IsMaximum:zo,IsMinContains:os,IsMinItems:is,IsMinLength:_s,IsMinProperties:Ls,IsMinimum:Nr,IsMultipleOf:Wo,IsNot:ka,IsOneOf:xa,IsPattern:Us,IsPatternProperties:as,IsPrefixItems:ar,IsProperties:cs,IsPropertyNames:Jo,IsRecursiveAnchor:mh,IsRecursiveAnchorTrue:bi,IsRecursiveRef:ya,IsRef:Sa,IsRefine:la,IsRequired:cr,IsSchema:_e,IsSchemaBoolean:_o,IsSchemaObject:tn,IsThen:va,IsType:Qo,IsUnevaluatedItems:Bs,IsUnevaluatedProperties:Hs,IsUniqueItems:wr,Parse:JR,ParseError:Fu,Pointer:cx,Reducer:Yo,ResetExternal:hh,ResetFunctions:ex,Resolve:zR,Stack:Zo,Validator:kx},Symbol.toStringTag,{value:"Module"}));function nt(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return Mu(t,n,r)}function ei(...e){const[t,n,r]=at(e,{3:(i,a,l)=>[i,a,l],2:(i,a)=>[{},i,a]}),[s,o]=mo(t,n,r);return o}class wa extends Error{constructor(t,n,r){super(t),Object.defineProperty(this,"cause",{value:{source:t,errors:r,value:n},writable:!1,configurable:!1,enumerable:!1})}}function xx(...e){const[t,n,r]=at(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});if(!nt(t,n,r))throw new wa("Assert",r,ei(t,n,r))}function XR(e,t,n){return H(n)?n.map(r=>Tn(e,t.items,r)):n}function ZR(e,t,n){return Tn({...e,...t.$defs},un(t.$ref),n)}function eO(e,t){const n=E(t,"unevaluatedProperties")?{additionalProperties:t.unevaluatedProperties}:{},r=Ms(e,t),s=Un(r);return Le(s)?ch(s,n):s}function tO(e,t,n){const r=eO(e,t);return Tn(e,r,n)}function yx(e){return E(e,"additionalProperties")?e.additionalProperties:void 0}function nO(e,t,n){if(!ne(n)||H(n))return n;const r=yx(t);for(const s of D(n)){if(E(t.properties,s)){n[s]=Tn(e,t.properties[s],n[s]);continue}if(gt(r)&&h(r,!0)||Yt(r)&&nt(e,r,n[s])){n[s]=Tn(e,r,n[s]);continue}delete n[s]}return n}function rO(e,t,n){if(!ne(n))return n;const r=yx(t),[s,o]=[new RegExp(kn(t)),Ht(t)];for(const i of D(n)){if(s.test(i)){n[i]=Tn(e,o,n[i]);continue}if(gt(r)&&h(r,!0)||Yt(r)&&nt(e,r,n[i])){n[i]=Tn(e,r,n[i]);continue}delete n[i]}return n}function sO(e,t,n){return E(e,t.$ref)?Tn(e,e[t.$ref],n):n}function oO(e,t,n){if(!H(n))return n;const r=Math.min(n.length,t.items.length);for(let s=0;s<r;s++)n[s]=Tn(e,t.items[s],n[s]);return Jr(n.length,r)?n.slice(0,r):n}function Lt(e){return ul(e)}function iO(e,t,n){for(const r of t.anyOf){const s=Tn(e,r,Lt(n));if(nt(e,r,s))return s}return n}function Tn(e,t,n){return ut(t)?XR(e,t,n):Bt(t)?ZR(e,t,n):Ue(t)?tO(e,t,n):Le(t)?nO(e,t,n):Tt(t)?rO(e,t,n):bt(t)?sO(e,t,n):rt(t)?oO(e,t,n):ie(t)?iO(e,t,n):n}function aO(e,t){for(const n of Ii.Keys(e))Ii.HasPropertyKey(t,n)||(t[n]=e[n]);return t}function cO(e){const t={};for(const n of Ii.Keys(e))t[n]=po(e[n]);return t}function lO(e){return Ec(zN(e))}function Ec(e){return e.map(t=>po(t))}function po(e){const t=ut(e)?Ir(po(e.items),ml(e)):Ue(e)?Fn(Ec(e.allOf)):ie(e)?Ge(lO(e.anyOf)):Le(e)?Ae(cO(e.properties)):Tt(e)?vl(ta(e),po(Ht(e))):rt(e)?bn(Ec(e.items)):e;return aO(e,t)}function Du(e){return po(e)}function ti(...e){const[t,n,r]=at(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]}),s=Du(n);return Tn(t,s,r)}function sn(e){return ne(e)&&E(e,"value")}function te(e){return{value:e}}function uO(e){return H(e)?te(e):te([e])}function dO(e){return h(e,!0)?te(BigInt(1)):te(BigInt(0))}const fO=/^-?(0|[1-9]\d*)n$/,mO=/^-?(0|[1-9]\d*)\.\d+$/,pO=/^-?(0|[1-9]\d*)$/;function gO(e){return fO.test(e)}function hO(e){return mO.test(e)}function bO(e){return pO.test(e)}function kO(e){const t=e.toLowerCase();return gO(e)?te(BigInt(e.slice(0,e.length-1))):hO(e)?te(BigInt(e.split(".")[0])):bO(e)?te(BigInt(e)):h(t,"false")?te(BigInt(0)):h(t,"true")?te(BigInt(1)):void 0}function _u(e){return et(e)?te(e):gt(e)?dO(e):xe(e)?te(BigInt(Math.trunc(e))):Vt(e)?te(BigInt(0)):oe(e)?kO(e):Re(e)?te(BigInt(0)):void 0}function xO(e){return h(e,BigInt(0))?te(!1):h(e,BigInt(1))?te(!0):void 0}function yO(e){return h(e,0)?te(!1):h(e,1)?te(!0):void 0}function SO(e){return h(e.toLowerCase(),"false")?te(!1):h(e.toLowerCase(),"true")?te(!0):h(e,"0")?te(!1):h(e,"1")?te(!0):void 0}function Sx(e){return et(e)?xO(e):gt(e)?te(e):xe(e)?yO(e):Vt(e)?te(!1):oe(e)?SO(e):Re(e)?te(!1):void 0}function vO(e){return h(e,BigInt(0))?te(null):void 0}function wO(e){return h(e,!1)?te(null):void 0}function IO(e){return h(e,0)?te(null):void 0}function CO(e){const t=e.toLowerCase();return h(t,"undefined")||h(t,"null")||h(e,"")||h(e,"0")?te(null):void 0}function jO(e){return et(e)?vO(e):gt(e)?wO(e):xe(e)?IO(e):Vt(e)?te(null):oe(e)?CO(e):Re(e)?te(null):void 0}const vx=BigInt(Number.MAX_SAFE_INTEGER),wx=BigInt(Number.MIN_SAFE_INTEGER);function TO(e){return e<=vx&&e>=wx?te(Number(e)):void 0}function AO(e){return te(e?1:0)}function EO(e){const t=+e;if(xe(t))return te(t);const n=e.toLowerCase();if(h(n,"false"))return te(0);if(h(n,"true"))return te(1);const r=_u(e);return sn(r)&&r.value<=vx&&r.value>=wx?te(Number(r.value)):void 0}function Lu(e){return et(e)?TO(e):gt(e)?AO(e):xe(e)?te(e):Vt(e)?te(0):oe(e)?EO(e):Re(e)?te(0):void 0}function Ix(e){return et(e)||gt(e)||xe(e)?te(e.toString()):Vt(e)?te("null"):oe(e)?te(e):Re(e)?te(""):void 0}function PO(e){return h(e,BigInt(0))?te(void 0):void 0}function NO(e){return h(e,!1)?te(void 0):void 0}function $O(e){return h(e,0)?te(void 0):void 0}function RO(e){const t=e.toLowerCase();return h(t,"undefined")||h(t,"null")||h(e,"")||h(e,"0")?te(void 0):void 0}function Cx(e){return et(e)?PO(e):gt(e)?NO(e):xe(e)?$O(e):Vt(e)?te(void 0):oe(e)?RO(e):Re(e)?te(e):void 0}function OO(e,t,n){return uO(n).value.map(s=>xn(e,t.items,s))}function MO(e,t,n){const r=_u(n);return sn(r)?r.value:n}function FO(e,t,n){const r=Sx(n);return sn(r)?r.value:n}function DO(e,t,n){return xn({...e,...t.$defs},un(t.$ref),n)}function _O(e,t,n){return xn(e,Un(t),n)}function LO(e,t,n){const r=Lu(n);return sn(r)?Math.trunc(r.value):n}function UO(e,t,n){const r=Ms(e,t),s=Un(r);return xn(e,s,n)}function BO(e,t,n){const r=_u(n);return sn(r)&&h(t.const,r.value)?r.value:n}function HO(e,t,n){const r=Sx(n);return sn(r)&&h(t.const,r.value)?r.value:n}function qO(e,t,n){const r=Lu(n);return sn(r)&&h(t.const,r.value)?r.value:n}function zO(e,t,n){const r=Ix(n);return sn(r)&&h(t.const,r.value)?r.value:n}function KO(e,t,n){return h(t.const,n)?n:ew(t)?BO(e,t,n):tw(t)?HO(e,t,n):Em(t)?qO(e,t,n):Pm(t)?zO(e,t,n):Nt()}function GO(e,t,n){const r=jO(n);return sn(r)?r.value:n}function VO(e,t,n){const r=Lu(n);return sn(r)?r.value:n}function jx(e,t,n,r){const s=D(r);for(const[o,i]of t)for(const a of s)o.test(a)||(r[a]=xn(e,n,r[a]));return r}function Uu(e,t,n){return Xt(e)&&Re(n[t])}function WO(e,t,n){const r=sl(t.properties),s=D(n);for(const[o,i]of r)for(const a of s)!o.test(a)||Uu(i,a,n)||(n[a]=xn(e,i,n[a]));return E(t,"additionalProperties")&&ne(t.additionalProperties)?jx(e,r,t.additionalProperties,n):n}function JO(e,t,n){return fn(n)?WO(e,t,n):n}function QO(e,t,n){const r=sl(t.patternProperties),s=D(n);for(const[o,i]of r)for(const a of s)o.test(a)&&(n[a]=xn(e,i,n[a]));return E(t,"additionalProperties")&&ne(t.additionalProperties)?jx(e,r,t.additionalProperties,n):n}function YO(e,t,n){return fn(n)?QO(e,t,n):n}function XO(e,t,n){return E(e,t.$ref)?xn(e,e[t.$ref],n):n}function ZO(e,t,n){const r=Ix(n);return sn(r)?r.value:n}function eM(e,t,n){return xn(e,Un(t),n)}function tM(e,t,n){if(!H(n))return n;for(let r=0;r<Math.min(t.items.length,n.length);r++)n[r]=xn(e,t.items[r],n[r]);return n}function nM(e,t,n){const r=Cx(n);return sn(r)?r.value:n}function rM(e,t,n){if(t.anyOf.some(i=>nt(e,i,n)))return n;const o=t.anyOf.map(i=>xn(e,i,Lt(n))).find(i=>nt(e,t,i));return Re(o)?n:o}function sM(e,t,n){const r=Cx(n);return sn(r)?void 0:n}function xn(e,t,n){return ut(t)?OO(e,t,n):Zr(t)?MO(e,t,n):Cr(t)?FO(e,t,n):Bt(t)?DO(e,t,n):hn(t)?_O(e,t,n):_n(t)?LO(e,t,n):Ue(t)?UO(e,t,n):Ve(t)?KO(e,t,n):jo(t)?GO(e,t,n):nn(t)?VO(e,t,n):Le(t)?JO(e,t,n):Tt(t)?YO(e,t,n):bt(t)?XO(e,t,n):$n(t)?ZO(e,t,n):qt(t)?eM(e,t,n):rt(t)?tM(e,t,n):Rs(t)?nM(e,t,n):ie(t)?rM(e,t,n):es(t)?sM(e,t,n):n}function Ia(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return xn(t,n,r)}function oM(e,t,n){if(!H(n))return n;for(let r=0;r<n.length;r++)n[r]=An(e,t.items,n[r]);return n}function iM(e,t,n){return An({...e,...t.$defs},un(t.$ref),n)}function aM(e,t){return Re(t)?In(e.default)?e.default():Lt(e.default):t}function cM(e,t,n){const r=Ms(e,t),s=Un(r);return An(e,s,n)}function lM(e,t,n){if(!ne(n))return n;const r=D(t.properties);for(const s of r){const o=An(e,t.properties[s],n[s]);Re(o)&&(Xt(t.properties[s])||!E(t.properties[s],"default"))||(n[s]=o)}if(!ir(t)||gt(t.additionalProperties))return n;for(const s of D(n))r.includes(s)||(n[s]=An(e,t.additionalProperties,n[s]));return n}function uM(e,t,n){if(!ne(n))return n;const[r,s]=[new RegExp(kn(t)),Ht(t)];for(const o of D(n))r.test(o)&&Ar(s)&&(n[o]=An(e,s,n[o]));if(!ir(t))return n;for(const o of D(n))r.test(o)||(n[o]=An(e,t.additionalProperties,n[o]));return n}function dM(e,t,n){return E(e,t.$ref)?An(e,e[t.$ref],n):n}function fM(e,t,n){if(!H(n))return n;const[r,s]=[t.items,Math.max(t.items.length,n.length)];for(let o=0;o<s;o++)o<r.length&&(n[o]=An(e,r[o],n[o]));return n}function mM(e,t,n){for(const r of t.anyOf){const s=An(e,r,Lt(n));if(nt(e,r,s))return s}return n}function An(e,t,n){const r=Ar(t)?aM(t,n):n;return ut(t)?oM(e,t,r):Bt(t)?iM(e,t,r):Ue(t)?cM(e,t,r):Le(t)?lM(e,t,r):Tt(t)?uM(e,t,r):bt(t)?dM(e,t,r):rt(t)?fM(e,t,r):ie(t)?mM(e,t,r):r}function Bu(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return An(t,n,r)}function Tx(e){return(...t)=>{const[n,r,s]=at(t,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});return e.reduce((o,i)=>i(n,r,o),s)}}function pM(e,t,n){return t["~codec"].decode(n)}function gM(e,t,n){return t["~codec"].encode(n)}function vt(e,t,n,r){return en(n)?h(e,"Decode")?pM(t,n,r):gM(t,n,r):r}function hM(e,t,n,r){if(!H(r))return r;for(let s=0;s<r.length;s++)r[s]=Ft(e,t,n.items,r[s]);return vt(e,t,n,r)}function bM(e,t,n,r){const s=vt(e,t,n,r);if(!H(s))return s;for(let o=0;o<s.length;o++)s[o]=Ft(e,t,n.items,s[o]);return s}function kM(e,t,n,r){return h(e,"Decode")?hM(e,t,n,r):bM(e,t,n,r)}function xM(e,t,n,r){return r=Ft(e,{...t,...n.$defs},un(n.$ref),r),vt(e,t,n,r)}function Ax(e){return e.reduce((t,n)=>({...t,...n}),{})}function Ex(e,t){for(const n of t)if(!Qr(e,n))return n;return e}function yM(e,t,n,r){if(h(n.allOf.length,0))return vt(e,t,n,r);const s=n.allOf.map(a=>Ft(e,t,a,ti(a,Lt(r)))),i=s.every(a=>ne(a))?Ax(s):Ex(r,s);return vt(e,t,n,i)}function SM(e,t,n,r){if(h(n.allOf.length,0))return vt(e,t,n,r);const s=vt(e,t,n,r),o=n.allOf.map(a=>Ft(e,t,a,ti(a,Lt(s))));return o.every(a=>ne(a))?Ax(o):Ex(s,o)}function vM(e,t,n,r){return h(e,"Decode")?yM(e,t,n,r):SM(e,t,n,r)}function wM(e,t,n,r){if(!fn(r))return r;for(const s of D(n.properties))!E(r,s)||Uu(n.properties[s],s,r)||(r[s]=Ft(e,t,n.properties[s],r[s]));return vt(e,t,n,r)}function IM(e,t,n,r){const s=vt(e,t,n,r);if(!fn(s))return s;for(const o of D(n.properties))!E(s,o)||Uu(n.properties[o],o,s)||(s[o]=Ft(e,t,n.properties[o],s[o]));return s}function CM(e,t,n,r){return h(e,"Decode")?wM(e,t,n,r):IM(e,t,n,r)}function jM(e,t,n,r){if(!fn(r))return r;const s=new RegExp(kn(n));for(const o of D(r))s.test(o)&&(r[o]=Ft(e,t,Ht(n),r[o]));return vt(e,t,n,r)}function TM(e,t,n,r){const s=vt(e,t,n,r);if(!fn(s))return s;const o=new RegExp(kn(n));for(const i of D(s))o.test(i)&&(s[i]=Ft(e,t,Ht(n),s[i]));return s}function AM(e,t,n,r){return h(e,"Decode")?jM(e,t,n,r):TM(e,t,n,r)}function Wd(e,t,n,r){return E(t,n.$ref)?Ft(e,t,t[n.$ref],r):r}function EM(e,t,n,r){return h(e,"Decode")?vt(e,t,n,Wd(e,t,n,r)):Wd(e,t,n,vt(e,t,n,r))}function PM(e,t,n,r){if(!H(r))return r;for(let s=0;s<Math.min(n.items.length,r.length);s++)r[s]=Ft(e,t,n.items[s],r[s]);return vt(e,t,n,r)}function NM(e,t,n,r){const s=vt(e,t,n,r);if(!H(s))return r;for(let o=0;o<Math.min(n.items.length,s.length);o++)s[o]=Ft(e,t,n.items[o],s[o]);return s}function $M(e,t,n,r){return h(e,"Decode")?PM(e,t,n,r):NM(e,t,n,r)}function RM(e,t,n,r){for(const s of n.anyOf){if(!nt(t,s,r))continue;const o=Ft(e,t,s,r);return vt(e,t,n,o)}return r}function OM(e,t,n,r){const s=vt(e,t,n,r);for(const o of n.anyOf){const i=Ft(e,t,o,Lt(s));if(nt(t,o,i))return i}return s}function MM(e,t,n,r){return h(e,"Decode")?RM(e,t,n,r):OM(e,t,n,r)}function Ft(e,t,n,r){return ut(n)?kM(e,t,n,r):Bt(n)?xM(e,t,n,r):Ue(n)?vM(e,t,n,r):Le(n)?CM(e,t,n,r):Tt(n)?AM(e,t,n,r):bt(n)?EM(e,t,n,r):rt(n)?$M(e,t,n,r):ie(n)?MM(e,t,n,r):vt(e,t,n,r)}class FM extends wa{constructor(t,n){super("Decode",t,n)}}function DM(e,t,n){if(!nt(e,t,n))throw new FM(n,ei(e,t,n));return n}function _M(e,t,n){const r=Du(t);return Ft("Decode",e,r,n)}const LM=Tx([(e,t,n)=>Lt(n),(e,t,n)=>Bu(e,t,n),(e,t,n)=>Ia(e,t,n),(e,t,n)=>ti(e,t,n),(e,t,n)=>DM(e,t,n),(e,t,n)=>_M(e,t,n)]);function UM(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return LM(t,n,r)}class BM extends wa{constructor(t,n){super("Encode",t,n)}}function HM(e,t,n){if(!nt(e,t,n))throw new BM(n,ei(e,t,n));return n}function qM(e,t,n){const r=Du(t);return Ft("Encode",e,r,n)}const zM=Tx([(e,t,n)=>Lt(n),(e,t,n)=>qM(e,t,n),(e,t,n)=>Bu(e,t,n),(e,t,n)=>Ia(e,t,n),(e,t,n)=>ti(e,t,n),(e,t,n)=>HM(e,t,n)]);function KM(...e){const[t,n,r]=at(e,{3:(s,o,i)=>[s,o,i],2:(s,o)=>[{},s,o]});return zM(t,n,r)}function GM(e,t){return en(t)||Or(e,t.items)}function VM(e,t){return en(t)||Px({...e,...t.$defs},un(t.$ref))}function WM(e,t){return en(t)||t.allOf.some(n=>Or(e,n))}function JM(e,t){return en(t)||D(t.properties).some(n=>Or(e,t.properties[n]))}function QM(e,t){return en(t)||Or(e,Ht(t))}function Px(e,t){return Pc.has(t.$ref)?!1:(Pc.add(t.$ref),en(t)||E(e,t.$ref)&&Or(e,e[t.$ref]))}function YM(e,t){return en(t)||t.items.some(n=>Or(e,n))}function XM(e,t){return en(t)||t.anyOf.some(n=>Or(e,n))}function Or(e,t){return ut(t)?GM(e,t):Bt(t)?VM(e,t):Ue(t)?WM(e,t):Le(t)?JM(e,t):Tt(t)?QM(e,t):bt(t)?Px(e,t):rt(t)?YM(e,t):ie(t)?XM(e,t):en(t)}const Pc=new Set;function ZM(...e){const[t,n]=at(e,{2:(r,s)=>[r,s],1:r=>[{},r]});return Pc.clear(),Or(t,n)}class ni extends Error{constructor(t,n){super(n),this.type=t}}function eF(e,t){return In(t.default)?t.default(t):ne(t.default)?Lt(t.default):t.default}function tF(e,t){if(wr(t)&&!Ar(t))throw new ni(t,"Arrays with uniqueItems constraints must specify a default annotation");const n=is(t)?t.minItems:0;return Array.from({length:n},()=>yn(e,t.items))}function nF(e,t){return Er(t)?BigInt(t.exclusiveMinimum)+BigInt(1):Nr(t)?BigInt(t.minimum):BigInt(0)}function rF(e,t){return!1}function sF(e,t){const n=yn(e,t.instanceType);return class{constructor(){Object.assign(this,n)}}}function oF(e,t){return yn({...e,...t.$defs},un(t.$ref))}function iF(e,t){return yn(e,Un(t))}function aF(e,t){const n=yn(e,t.returnType);return()=>n}function cF(e,t){return Er(t)&&xe(t.exclusiveMinimum)?t.exclusiveMinimum+1:Nr(t)?t.minimum:0}function lF(e,t){const n=Ms(e,t),r=Un(n);return yn(e,r)}function uF(e,t){return t.const}function dF(e,t){throw new ni(t,"Cannot create TNever types")}function fF(e,t){return null}function mF(e,t){return Er(t)&&xe(t.exclusiveMinimum)?t.exclusiveMinimum+1:Nr(t)?t.minimum:0}function pF(e,t){return(Re(t.required)?[]:t.required).reduce((r,s)=>({...r,[s]:yn(e,t.properties[s])}),{})}function gF(e,t){if(Ls(t)&&!Ar(t))throw new ni(t,"Record with the minProperties constraint must have a default annotation");return{}}function hF(e,t){return E(e,t.$ref)?yn(e,e[t.$ref]):(()=>{throw new ni(t,"Unable to deref Ref")})()}function bF(e,t){if((Us(t)||Fs(t))&&!Ar(t))throw Error("Strings with format or pattern constraints must specify default");const r=_s(t)?t.minLength:0;return"".padEnd(r)}function kF(e,t){return Symbol()}function xF(e,t){const n=Sl(t.pattern);if($n(n))throw new ni(t,"Unable to create TemplateLiteral due to infinite type expansion");return yn(e,n)}function yF(e,t){return Array.from({length:t.minItems},(n,r)=>yn(e,t.items[r]))}function SF(e,t){if(h(t.anyOf.length,0))throw Error("Unable to create Union with no variants");return yn(e,t.anyOf[0])}function yn(e,t){return Ar(t)?eF(e,t):ut(t)?tF(e,t):Zr(t)?nF(e,t):Cr(t)?rF():mn(t)?sF(e,t):Bt(t)?oF(e,t):hn(t)?iF(e,t):pn(t)?aF(e,t):_n(t)?cF(e,t):Ue(t)?lF(e,t):Ve(t)?uF(e,t):Ps(t)?dF(e,t):jo(t)?fF():nn(t)?mF(e,t):Le(t)?pF(e,t):Tt(t)?gF(e,t):bt(t)?hF(e,t):$n(t)?bF(e,t):To(t)?kF():qt(t)?xF(e,t):rt(t)?yF(e,t):Rs(t)?void 0:ie(t)?SF(e,t):es(t)?void 0:void 0}function En(...e){const[t,n]=at(e,{2:(r,s)=>[r,s],1:r=>[{},r]});return yn(t,n)}function Nx(e,t){return Qr(e,t)}function $x(e){return Qi(e)}class vF extends wa{constructor(t,n){super("Parse",t,n)}}function wF(...e){const[t,n,r]=at(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]});if(nt(t,n,r))return r;throw new vF(r,ei(t,n,r))}function Ca(e,t){return{type:"update",path:e,value:t}}function Rx(e,t){return{type:"insert",path:e,value:t}}function Ox(e){return{type:"delete",path:e}}function Jd(e){if(!(ne(e)&&h(ol(e).length,0)))throw new Error("Cannot create diffs for objects with symbols keys")}function*IF(e,t,n){if(!ne(n)||H(n))return yield Ca(e,n);Jd(t),Jd(n);const r=D(t),s=D(n);for(const o of s)E(t,o)||Jn(o)||(yield Rx(`${e}/${o}`,n[o]));for(const o of r)E(n,o)&&(Jn(o)||Nx(t,n)||(yield*ja(`${e}/${o}`,t[o],n[o])));for(const o of r)E(n,o)||Jn(o)||(yield Ox(`${e}/${o}`))}function*CF(e,t,n){if(!H(n))return yield Ca(e,n);for(let r=0;r<Math.min(t.length,n.length);r++)yield*ja(`${e}/${r}`,t[r],n[r]);for(let r=0;r<n.length;r++)r<t.length||(yield Rx(`${e}/${r}`,n[r]));for(let r=t.length-1;r>=0;r--)r<n.length||(yield Ox(`${e}/${r}`))}function*jF(e,t,n){const r=globalThis.Object.getPrototypeOf(t).constructor.name,s=globalThis.Object.getPrototypeOf(n).constructor.name;if(yo(n)&&h(t.length,n.length)&&h(r,s))for(let i=0;i<Math.min(t.length,n.length);i++)yield*ja(`${e}/${i}`,t[i],n[i]);else return yield Ca(e,n)}function*TF(e,t,n){t!==n&&(yield Ca(e,n))}function*ja(e,t,n){return yo(t)?yield*jF(e,t,n):H(t)?yield*CF(e,t,n):ne(t)?yield*IF(e,t,n):yield*TF(e,t,n)}function AF(e,t){return[...ja("",e,t)]}const EF=Ae({type:Me("insert"),path:Ln(),value:Ut()}),PF=Object({type:Me("update"),path:Ln(),value:Ut()}),NF=Ae({type:Me("delete"),path:Ln()});Ge([EF,PF,NF]);function $F(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function RF(e){return e.length===0}function OF(e,t){if($F(t))return Lt(t[0].value);if(RF(t))return Lt(e);const n=Lt(e);for(const r of t)switch(r.type){case"insert":{Ac(n,r.path,r.value);break}case"update":{Ac(n,r.path,r.value);break}case"delete":{ax(n,r.path);break}}return n}class Ta extends Error{constructor(t,n,r,s){super(s),this.context=t,this.type=n,this.value=r}}function MF(e){const[t,n]=[new Set,[]];for(const r of e){const s=$x(r);t.has(s)||(t.add(s),n.push(r))}return n}function FF(e,t,n){if(nt(e,t,n))return n;const r=H(n)?n:En(e,t),s=is(t)&&r.length<t.minItems?[...r,...Array.from({length:t.minItems-r.length},()=>En(e,t))]:r,i=(Ds(t)&&s.length>t.maxItems?s.slice(0,t.maxItems):s).map(l=>dn(e,t.items,l));if(!wr(t)||wr(t)&&!h(t.uniqueItems,!0))return i;const a=MF(i);if(!nt(e,t,a))throw new Ta(e,t,n,"Failed to repair Array due to uniqueItems constraint");return a}function DF(e,t,n){return dn(e,Un(t),n)}function _F(e,t,n){const r=Ms(e,t),s=Un(r);return dn(e,s,n)}function LF(e,t,n){if(nt(e,t,n))return n;if(!fn(n))return En(e,t);const r=new Set(Re(t.required)?[]:t.required),s={};for(const[i,a]of tt(t.properties))!r.has(i)&&Re(n[i])||(s[i]=i in n?dn(e,a,n[i]):En(e,a));const o=D(t.properties);if(ir(t)&&ne(t.additionalProperties))for(const i of D(n))o.includes(i)||(s[i]=dn(e,t.additionalProperties,n[i]));return s}function UF(e,t,n){if(nt(e,t,n))return n;if(Vt(n)||!ne(n)||H(n))return En(e,t);const r=new RegExp(kn(t)),s=Ht(t),o=new Set,i={};for(const[a,l]of tt(n))r.test(a)&&(i[a]=dn(e,s,l),o.add(a));if(ir(t))for(const a of D(n))o.has(a)||(i[a]=dn(e,t.additionalProperties,n[a]));return i}function BF(e,t,n){return E(e,t.$ref)?dn(e,e[t.$ref],n):(()=>{throw new Ta(e,t,n,"Unable to de-reference target type")})()}function HF(e,t,n){const r=Sl(t.pattern);return dn(e,r,n)}function qF(e,t,n){return nt(e,t,n)?n:H(n)?t.items.map((r,s)=>dn(e,r,n[s])):En(e,t)}function Mx(e,t,n){return bt(t)?E(e,t.$ref)?Mx(e,e[t.$ref]):(()=>{throw new Error("Unable to Deref target")})():t}function zF(e,t,n){if(!(Le(t)&&ne(n)))return 0;const r=D(n);return tt(t.properties).reduce((o,[i,a])=>{const l=Ve(a)&&h(a.const,n[i])?100:0,u=nt(e,a,n[i])?10:0,m=r.includes(i)?1:0;return o+(l+u+m)},0)}function KF(e,t,n){const r=t.anyOf.map(i=>Mx(e,i));let[s,o]=[r[0],0];for(const i of r){const a=zF(e,i,n);a>o&&(s=i,o=a)}return s}function GF(e,t,n){const r=Ge(Xi(t.anyOf)),s=KF(e,r,n);return dn(e,s,n)}function VF(e,t,n){return nt(e,t,n)?Lt(n):Ar(t)?En(e,t):GF(e,t,n)}function WF(e,t,n){if(nt(e,t,n))return n;const r=Ia(e,t,n);return nt(e,t,r)?r:En(e,t)}function JF(e,t,n){if(fm(n)||pm(n)||mm(n)||yo(n)||Gi(n)||In(n))throw new Ta(e,t,n,"Value is not repairable")}function QF(e,t,n){if(mn(t)||pn(t)||Ps(t))throw new Ta(e,t,n,"Type is not repairable")}function YF(e,t,n){return Re(n)&&!Rs(t)?En(e,t):n}function XF(e,t,n){return bl(t)?nt(e,t,n)?n:En(e,t):n}function dn(e,t,n){JF(e,t,n),QF(e,t,n);const r=YF(e,t,n),s=ut(t)?FF(e,t,r):hn(t)?DF(e,t,r):Ue(t)?_F(e,t,r):Le(t)?LF(e,t,r):Tt(t)?UF(e,t,r):bt(t)?BF(e,t,r):qt(t)?HF(e,t,r):rt(t)?qF(e,t,r):ie(t)?VF(e,t,r):WF(e,t,r);return XF(e,t,s)}function ZF(...e){const[t,n,r]=at(e,{3:(o,i,a)=>[o,i,a],2:(o,i)=>[{},o,i]}),s=dn(t,n,r);return xx(t,n,s),s}const Ja=Object.freeze(Object.defineProperty({__proto__:null,Assert:xx,Check:nt,Clean:ti,Clone:Lt,Convert:Ia,Create:En,Decode:UM,Default:Bu,Diff:AF,Encode:KM,Equal:Nx,Errors:ei,HasCodec:ZM,Hash:$x,Parse:wF,Patch:OF,Pointer:cx,Repair:ZF},Symbol.toStringTag,{value:"Module"}));class Qd extends Error{constructor(t){super(t.map(n=>`${n.path.length>0?n.path.join("."):"root"}: ${n.message}`).join("; ")),this.issues=t,this.name="SchemaValidationError"}}function eD(e){return e?e.split("/").slice(1).map(t=>t.replace(/~1/g,"/").replace(/~0/g,"~")).map(t=>/^(0|[1-9]\d*)$/.test(t)?Number(t):t):[]}function tD(e,t){let n=e;for(const r of t){if(n===null||typeof n!="object")return;n=n[r]}return n}function Yd(e,t){const[,n]=YR.Errors(e,t);return n.map(r=>{const s=eD(r.instancePath);return{code:r.keyword,path:s,message:r.message,value:tD(t,s)}})}function Fx(e,t){const n=Ja.Default(e,Ja.Clone(t)),r=Yd(e,n);if(r.length>0)return{success:!1,error:new Qd(r)};const s=Ja.Clean(e,n),o=Yd(e,s);return o.length>0?{success:!1,error:new Qd(o)}:{success:!0,data:s}}function fr(e,t){const n=Fx(e,t);if(!n.success)throw n.error;return n.data}function Z(e){return Object.defineProperties(e,{parse:{value:t=>fr(e,t),enumerable:!1},safeParse:{value:t=>Fx(e,t),enumerable:!1}}),e}function Fi(e,t){return f.Optional({...e,default:t})}function ve(e,t={}){return f.Unsafe({type:"string",enum:[...e],...t})}const Hr=20,io=5*1024*1024,nD=32e3,Aa=Z(ve(["default","autoEdit","yolo","plan"])),gr={DEFAULT:"default",AUTO_EDIT:"autoEdit",YOLO:"yolo",PLAN:"plan"},Hu=Z(ve(["user","assistant","system","tool"])),rD=Z(f.Union([f.Object({type:f.Literal("text"),text:f.String()}),f.Object({type:f.Literal("image_url"),image_url:f.Object({url:f.String()})})])),Dx=f.Union([f.String(),f.Array(rD)]);Z(f.Object({id:f.String(),role:Hu,content:Dx,timestamp:f.Number(),metadata:f.Optional(f.Record(f.String(),f.Unknown())),thinkingContent:f.Optional(f.String()),tool_call_id:f.Optional(f.String()),name:f.Optional(f.String()),tool_calls:f.Optional(f.Unknown())}));const sD=Z(ve(["queued","running","completed","failed","cancelled","interrupted"])),_x=Z(ve(["local","worktree"])),oD=Z(ve(["applied","discarded","conflicted"])),iD=Z(f.Object({status:oD,updatedAt:f.String(),sourceCommit:f.Optional(f.String()),changedFiles:f.Optional(f.Integer({minimum:0})),message:f.Optional(f.String())})),aD=Z(f.Object({changedFiles:f.Integer({minimum:0}),additions:f.Integer({minimum:0}),deletions:f.Integer({minimum:0}),commits:f.Integer({minimum:0})})),cD=Z(f.Object({path:f.String({minLength:1}),patch:f.String({maxLength:2*1024*1024}),additions:f.Integer({minimum:0}),deletions:f.Integer({minimum:0}),binary:f.Boolean(),truncated:f.Boolean()})),lD=Z(f.Object({sessionId:f.String(),projectPath:f.String(),baseCommit:f.String(),files:f.Array(cD,{maxItems:100}),truncated:f.Boolean()})),uD=f.Union([f.String(),f.Number(),f.Boolean(),f.Array(f.String())]),dD=Z(f.Object({name:f.String(),type:ve(["string","number","integer","boolean","select","multi-select"]),title:f.String(),description:f.Optional(f.String()),required:f.Boolean(),defaultValue:f.Optional(uD),options:f.Optional(f.Array(f.Object({value:f.String(),label:f.String()}))),format:f.Optional(ve(["date","uri","email","date-time"])),minimum:f.Optional(f.Number()),maximum:f.Optional(f.Number()),minLength:f.Optional(f.Number()),maxLength:f.Optional(f.Number()),minItems:f.Optional(f.Number()),maxItems:f.Optional(f.Number())}));Z(f.Object({serverName:f.String(),mode:ve(["form","url"]),message:f.String(),fields:f.Optional(f.Array(dD)),requestedSchema:f.Optional(f.Record(f.String(),f.Unknown())),url:f.Optional(f.String()),domain:f.Optional(f.String()),elicitationId:f.Optional(f.String())}));const fD=Z(f.Object({type:ve(["permission","question","elicitation"]),requestId:f.String()})),mD=Z(f.Object({code:ve(["authentication","permission","rate_limit","timeout","network","model_unavailable","context_limit","unsupported_input","runtime"]),message:f.String({minLength:1,maxLength:500}),retryable:f.Boolean()})),qu=Z(ve(["auto","off","minimal","low","medium","high","xhigh","max"])),zu=Z(ve(["auto","standard","fast","flex"])),Ku=Z(ve(["auto","low","medium","high"])),ri=Z(f.Union([ve(["auto","pragmatic","friendly","explanatory"]),f.String({minLength:7,maxLength:300,pattern:"^(?:(?:user|project):[a-z0-9][a-z0-9._-]{0,63}(?::[a-z0-9][a-z0-9._-]{0,63}){0,3}|plugin:[a-z0-9][a-z0-9._-]{0,63}:[a-z0-9][a-z0-9._-]{0,63}(?::[a-z0-9][a-z0-9._-]{0,63}){0,3})$"})])),Yn=Z(f.Object({sessionId:f.String(),projectPath:f.String(),title:f.Optional(f.String()),gitBranch:f.Optional(f.String()),rootId:f.String(),parentId:f.Optional(f.String()),relationType:f.Optional(ve(["subagent","fork"])),resumedFrom:f.Optional(f.String()),rootAgentId:f.Optional(f.String()),resumeDepth:f.Optional(f.Integer({minimum:0})),taskStatus:Fi(sD,"completed"),taskStatusReason:f.Optional(f.String()),taskFailure:f.Optional(mD),taskStartedAt:f.Optional(f.String()),taskCompletedAt:f.Optional(f.String()),taskPromptSummary:f.Optional(f.String()),taskModelId:f.Optional(f.String()),selectedModelId:f.Optional(f.String()),permissionMode:f.Optional(Aa),reasoningEffort:f.Optional(qu),serviceTier:f.Optional(zu),responseVerbosity:f.Optional(Ku),communicationStyle:f.Optional(ri),communicationStyleDigest:f.Optional(f.String({pattern:"^[a-f0-9]{64}$"})),projectInstructionsDigest:f.Optional(f.String({pattern:"^[a-f0-9]{64}$"})),taskRetryAvailable:f.Optional(f.Boolean()),taskRetriedFrom:f.Optional(f.Object({sessionId:f.String(),projectPath:f.String()})),taskDelivery:f.Optional(iD),taskIsolation:f.Optional(_x),taskSourceProjectPath:f.Optional(f.String()),taskWorktreePath:f.Optional(f.String()),taskWorktreeBranch:f.Optional(f.String()),taskBaseCommit:f.Optional(f.String()),taskDiffStat:f.Optional(aD),taskQueuePosition:f.Optional(f.Integer({minimum:1})),taskQueueDepth:f.Optional(f.Integer({minimum:0})),taskConcurrencyLimit:f.Optional(f.Integer({minimum:1})),archivedAt:f.Optional(f.String()),archivedBySessionId:f.Optional(f.String()),pendingInteraction:f.Optional(fD),messageCount:f.Number(),firstMessageTime:f.String(),lastMessageTime:f.String(),hasErrors:f.Boolean()})),pD=Z(f.Object({sessions:f.Array(Yn),nextCursor:f.Optional(f.String())})),gD=Z(f.Object({session:Yn,archivedSessionIds:f.Array(f.String())})),hD=Z(f.Object({session:Yn,restoredSessionIds:f.Array(f.String())}));Z(f.Object({version:f.Literal(1),sessionId:f.String(),goalId:f.String(),objective:f.String(),status:ve(["active","paused","blocked","usage_limited","budget_limited","complete"]),tokenBudget:f.Optional(f.Number()),tokensUsed:f.Number(),timeUsedSeconds:f.Number(),continuationCount:f.Number(),statusReason:f.Optional(f.String()),createdAt:f.String(),updatedAt:f.String()}));const Gu=Z(f.Object({role:Hu,content:Dx,metadata:f.Optional(f.Unknown()),reasoningContent:f.Optional(f.String()),thinkingContent:f.Optional(f.String()),tool_call_id:f.Optional(f.String()),name:f.Optional(f.String()),tool_calls:f.Optional(f.Unknown())})),bD=Z(f.Object({session:Yn,messages:f.Array(Gu)})),Lx=Z(ve(["conversation","code","both"])),Ux=Z(f.Object({messageId:f.String(),preview:f.String(),createdAt:f.String(),fileCount:f.Integer({minimum:0})}));Z(f.Object({targetMessageId:f.String({minLength:1}),mode:Fi(Lx,"conversation")}));const kD=Z(f.Object({checkpoint:Ux,mode:Lx,removedTurns:f.Integer({minimum:1}),restoredFiles:f.Array(f.String()),messages:f.Array(Gu)})),xD=ve(["running","completed","failed","cancelled"]),Nc=Z(f.Object({id:f.String(),subagentType:f.String(),description:f.String(),status:xD,rootAgentId:f.String(),resumedFrom:f.Optional(f.String()),resumeDepth:f.Integer({minimum:0}),createdAt:f.Number(),lastActiveAt:f.Number(),completedAt:f.Optional(f.Number()),result:f.Optional(f.Object({success:f.Boolean(),message:f.String(),error:f.Optional(f.String()),verificationCommands:f.Optional(f.Array(f.String())),verificationVerdict:f.Optional(ve(["pass","fail","partial"])),modifiedFiles:f.Optional(f.Array(f.String()))})),stats:f.Optional(f.Object({tokens:f.Optional(f.Number()),toolCalls:f.Optional(f.Number()),duration:f.Optional(f.Number())}))}));Z(f.Object({prompt:f.String({minLength:1,maxLength:32e3,pattern:"\\S"})}));const yD=Z(f.Object({source:Nc,session:Nc})),Bx=Z(f.Object({sessionId:f.String(),projectPath:f.String()})),Hx=Z(f.Object({path:f.String(),name:f.String(),gitBranch:f.Optional(f.String()),available:f.Boolean(),isCurrent:f.Boolean(),boundAt:f.String()})),SD=Z(f.Union([f.Object({cancelled:f.Literal(!0)}),f.Object({cancelled:f.Literal(!1),path:f.String({minLength:1})})])),Xd=Z(f.Object({type:f.String(),seq:f.Optional(f.Number()),properties:f.Record(f.String(),f.Unknown())})),qx=f.Object({type:ve(["file","image","url"]),path:f.Optional(f.String()),url:f.Optional(f.String()),content:f.Optional(f.String({maxLength:io})),mimeType:f.Optional(f.String()),name:f.Optional(f.String())}),zx=f.Record(f.String(),f.Unknown());Z(f.Object({prompt:f.String({minLength:1,maxLength:32e3,pattern:"\\S"}),title:f.Optional(f.String({minLength:1,maxLength:200})),projectPath:f.Optional(f.String()),modelId:f.Optional(f.String({minLength:1,maxLength:500})),reasoningEffort:f.Optional(qu),serviceTier:f.Optional(zu),responseVerbosity:f.Optional(Ku),communicationStyle:f.Optional(ri),isolation:Fi(_x,"worktree"),permissionMode:Fi(Aa,"default"),attachments:f.Optional(f.Array(qx,{maxItems:Hr})),outputSchema:f.Optional(zx)}));const Zd=Z(f.Object({session:Yn,runId:f.String(),messageId:f.String(),status:ve(["queued","running"]),queuePosition:f.Optional(f.Integer({minimum:1})),queueDepth:f.Optional(f.Integer({minimum:0})),maxConcurrentTasks:f.Optional(f.Integer({minimum:1}))}));Z(f.Object({action:ve(["apply","discard"])}));Z(f.Object({content:f.String({maxLength:nD}),projectPath:f.Optional(f.String()),modelId:f.Optional(f.String({minLength:1,maxLength:500})),reasoningEffort:f.Optional(qu),serviceTier:f.Optional(zu),responseVerbosity:f.Optional(Ku),communicationStyle:f.Optional(ri),permissionMode:f.Optional(Aa),attachments:f.Optional(f.Array(qx,{maxItems:Hr})),outputSchema:f.Optional(zx)}));const vD=ve(["completed","failed","aborted","timed_out","spawn_error"]),wD=Z(f.Object({version:f.Literal(1),command:f.String(),status:vD,exitCode:f.Union([f.Integer(),f.Null()]),durationMs:f.Number({minimum:0}),stdout:f.String(),stderr:f.String(),stdoutOmittedBytes:f.Integer({minimum:0}),stderrOmittedBytes:f.Integer({minimum:0}),binaryOutput:f.Boolean(),truncated:f.Boolean()}));Z(f.Object({command:f.String({minLength:1,maxLength:32*1024,pattern:"^(?![\\s\\S]*\\u0000)(?=[\\s\\S]*\\S)[\\s\\S]*$"}),projectPath:f.Optional(f.String())}));const ID=Z(f.Object({executionId:f.String(),messageId:f.String(),record:wD,auxiliary:f.Boolean(),delivery:f.Optional(ve(["current_turn","next_turn"])),queued:f.Optional(f.Integer({minimum:0}))}));Z(f.Object({projectPath:f.String(),kind:ve(["uncommitted","base","commit"]),ref:f.Optional(f.String({maxLength:200})),instructions:f.Optional(f.String({maxLength:4e3})),modelId:f.Optional(f.String({minLength:1,maxLength:200}))}));const CD=Z(f.Object({reviewId:f.String(),status:f.Literal("running")}));Z(f.Object({messageId:f.String(),role:Hu,content:f.String(),timestamp:f.String()}));Z(f.Object({approved:f.Boolean(),remember:f.Optional(f.Boolean()),scope:f.Optional(ve(["once","session","project"])),targetMode:f.Optional(Aa),feedback:f.Optional(f.String()),answers:f.Optional(f.Record(f.String(),f.Union([f.String(),f.Array(f.String())]))),elicitation:f.Optional(f.Object({action:ve(["accept","decline","cancel"]),content:f.Optional(f.Record(f.String(),f.Union([f.String({maxLength:4e3}),f.Number(),f.Boolean(),f.Array(f.String({maxLength:1e3}),{maxItems:100})]),{maxProperties:32}))}))}));const jD=Z(f.Object({id:ri,name:f.String({minLength:1,maxLength:80}),description:f.String({minLength:1,maxLength:256}),source:ve(["built-in","user","project","plugin"]),contentSha256:f.Optional(f.String({pattern:"^[a-f0-9]{64}$"}))}));Z(f.Object({id:f.String(),displayName:f.Optional(f.String()),provider:f.String(),model:f.String(),contextWindow:f.Optional(f.Number()),maxTokens:f.Optional(f.Number()),reasoning:f.Optional(f.Boolean()),supportedReasoningEfforts:f.Optional(f.Array(ve(["off","minimal","low","medium","high","xhigh","max"]))),supportedServiceTiers:f.Optional(f.Array(ve(["standard","fast","flex"]))),supportedResponseVerbosities:f.Optional(f.Array(ve(["low","medium","high"]))),communicationStyles:f.Optional(f.Array(jD,{maxItems:36})),input:f.Optional(f.Array(ve(["text","image"]))),overrides:f.Optional(f.Object({baseUrl:f.Optional(f.String()),temperature:f.Optional(f.Number()),maxOutputTokens:f.Optional(f.Number()),timeout:f.Optional(f.Number()),streamIdleTimeout:f.Optional(f.Number({minimum:1e3}))}))}));Z(ve(["vs-dark","vs-light","hc-black"]));const TD=Z(ve(["light","dark","system"])),AD=Z(f.Object({language:f.String(),theme:f.String(),uiTheme:TD,autoSaveSessions:f.Boolean(),notifyBuild:f.Boolean(),notifyErrors:f.Boolean(),notifySounds:f.Boolean(),privacyTelemetry:f.Boolean(),privacyCrash:f.Boolean(),communicationStyle:f.Optional(ri)}));Z(f.Partial(AD));async function mr(e,t){const n=await fetch(e,t),r=await n.json().catch(()=>{});if(!n.ok){const s=r,o=s!=null&&s.error&&typeof s.error=="object"&&!Array.isArray(s.error)?s.error:void 0,i=typeof(s==null?void 0:s.error)=="string"?s.error:typeof(o==null?void 0:o.message)=="string"?o.message:typeof(s==null?void 0:s.message)=="string"?s.message:n.statusText||`Request failed (${n.status})`;throw new Error(i)}return r}const pe="",ef=1e4,ED=f.Array(Yn),PD=f.Array(Hx),ND=f.Array(Gu),$D=f.Array(Ux),RD=f.Array(Nc),OD=f.Object({cwd:f.String(),gitBranch:f.Optional(f.String()),taskAdmission:f.Optional(f.Object({inFlight:f.Integer({minimum:0}),queued:f.Integer({minimum:0}),maxConcurrent:f.Integer({minimum:1}),maxQueued:f.Integer({minimum:1})}))}),MD=e=>Array.isArray(e)?e:e==null?"":typeof e=="string"?e:JSON.stringify(e),FD=()=>{const e=new Date,t=String(e.getFullYear()).slice(-2),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),s=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0");return`Session ${t}-${n}-${r} ${s}:${o}`};function DD(e){const t=Bx.parse(e);return`projectPath=${encodeURIComponent(t.projectPath)}`}function mt(e,t){const n=DD(t);return`${e}${e.includes("?")?"&":"?"}${n}`}function tf(e){return{"x-blade-directory":Bx.parse(e).projectPath}}const Qa=(e,t,n)=>({id:`history-${t}-${n}`,role:e.role,content:MD(e.content),timestamp:n,metadata:e.metadata&&typeof e.metadata=="object"?e.metadata:void 0,tool_call_id:e.tool_call_id,name:e.name,tool_calls:e.tool_calls,thinkingContent:e.thinkingContent??e.reasoningContent}),re={listProjects:async()=>{const e=await fetch(`${pe}/projects`);if(!e.ok)throw new Error("Failed to load projects");return fr(PD,await e.json())},bindProject:async e=>{var n;const t=await fetch(`${pe}/projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to bind project")}return Hx.parse(await t.json())},pickProjectDirectory:async()=>fr(SD,await mr(`${pe}/projects/pick`,{method:"POST"})),unbindProject:async e=>{if(!(await fetch(`${pe}/projects?path=${encodeURIComponent(e)}`,{method:"DELETE"})).ok)throw new Error("Failed to unbind project")},listSessions:async()=>{const e=await fetch(`${pe}/sessions`);if(!e.ok)throw new Error("Failed to load sessions");return fr(ED,await e.json())},listSessionPage:async(e,t=50,n=!1)=>{const r=new URLSearchParams({limit:String(t)});e&&r.set("cursor",e),n&&r.set("archived","true");const s=await fetch(`${pe}/sessions/catalog?${r.toString()}`);if(!s.ok)throw new Error("Failed to load session catalog");return pD.parse(await s.json())},getSession:async e=>Yn.parse(await mr(mt(`${pe}/sessions/${e.sessionId}`,e))),createSession:async(e,t)=>{const n=await fetch(`${pe}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e,title:t||FD()})});if(!n.ok)throw new Error("Failed to create session");return Yn.parse(await n.json())},startCodeReview:async(e,t)=>{var r,s;const n=await fetch(`${pe}/sessions/${e.sessionId}/review`,{method:"POST",headers:{"Content-Type":"application/json",...tf(e)},body:JSON.stringify({projectPath:e.projectPath,...t})});if(!n.ok){const o=await n.json().catch(()=>{}),i=((r=o==null?void 0:o.error)==null?void 0:r.code)==="CONFLICT"?zt("taskHome.review.conflict"):((s=o==null?void 0:o.error)==null?void 0:s.code)==="BAD_REQUEST"?zt("taskHome.review.invalidTarget"):zt("taskHome.review.startFailed");throw new Error(i)}return CD.parse(await n.json())},getWorkspaceInfo:async()=>fr(OD,await mr(`${pe}/global/info`)),createTask:async e=>{var n;const t=await fetch(`${pe}/tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to dispatch task")}return Zd.parse(await t.json())},retryTask:async e=>{var n;const t=await fetch(mt(`${pe}/tasks/${e.sessionId}/retry`,e),{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to retry task")}return Zd.parse(await t.json())},deliverTask:async(e,t)=>{var r;const n=await fetch(mt(`${pe}/tasks/${e.sessionId}/delivery`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:t})});if(!n.ok){const s=await n.json().catch(()=>{});throw new Error(((r=s==null?void 0:s.error)==null?void 0:r.message)||"Failed to deliver task changes")}return Yn.parse(await n.json())},getTaskDiff:async e=>{var n;const t=await fetch(mt(`${pe}/tasks/${e.sessionId}/diff`,e));if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to load task diff")}return lD.parse(await t.json())},deleteSession:async e=>{if(!(await fetch(mt(`${pe}/sessions/${e.sessionId}`,e),{method:"DELETE"})).ok)throw new Error("Failed to delete session")},archiveSession:async e=>gD.parse(await mr(mt(`${pe}/sessions/${e.sessionId}/archive`,e),{method:"POST"})),unarchiveSession:async e=>hD.parse(await mr(mt(`${pe}/sessions/${e.sessionId}/unarchive`,e),{method:"POST"})),exportSessionMarkdown:async(e,t=!1)=>{var u,m;const n=mt(`${pe}/sessions/${e.sessionId}/export`,e),r=t?`${n}&includeReasoning=true`:n,s=await fetch(r);if(!s.ok){const p=await s.json().catch(()=>{});throw new Error(((u=p==null?void 0:p.error)==null?void 0:u.message)||"Failed to export session")}const o=s.headers.get("content-disposition")??"",i=((m=/filename="([A-Za-z0-9._-]+)"/.exec(o))==null?void 0:m[1])??`blade-session-${e.sessionId.slice(0,12)}.md`,a=s.headers.get("x-blade-content-sha256")??"";if(!/^[a-f0-9]{64}$/.test(a))throw new Error("Session export is missing its integrity hash");const l=p=>{const g=s.headers.get(p);if(g===null)throw new Error(`Session export is missing its ${p} header`);const x=Number(g);if(!Number.isInteger(x)||x<0)throw new Error(`Session export has an invalid ${p} header`);return x};return{filename:i,markdown:await s.text(),contentSha256:a,messageCount:l("x-blade-export-messages"),activityCount:l("x-blade-export-activities"),redactionCount:l("x-blade-export-redactions")}},updateSession:async(e,t)=>{if(!(await fetch(`${pe}/sessions/${e.sessionId}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,projectPath:e.projectPath})})).ok)throw new Error("Failed to update session")},getMessages:async e=>{const t=await fetch(mt(`${pe}/sessions/${e.sessionId}/message`,e));if(!t.ok)throw new Error("Failed to load messages");const n=fr(ND,await t.json()),r=Date.now();return n.map((s,o)=>Qa(s,o,r))},sendMessage:async(e,t,n)=>{var s;const r=await fetch(`${pe}/sessions/${e.sessionId}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,permissionMode:n,projectPath:e.projectPath})});if(!r.ok){const o=await r.json().catch(()=>{}),i=((s=o==null?void 0:o.error)==null?void 0:s.message)??(o==null?void 0:o.reason);throw new Error(i||"Failed to send message")}return r.json()},executeUserShellCommand:async(e,t)=>ID.parse(await mr(`${pe}/sessions/${e.sessionId}/shell`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:t,projectPath:e.projectPath})})),abortSession:async e=>{var n;const t=await fetch(mt(`${pe}/sessions/${e.sessionId}/abort`,e),{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>{});throw new Error(((n=r==null?void 0:r.error)==null?void 0:n.message)||"Failed to stop task")}},getGoal:async e=>{const t=await fetch(mt(`${pe}/sessions/${e.sessionId}/goal`,e));if(!t.ok)throw new Error("Failed to load goal");return(await t.json()).goal},createGoal:async(e,t,n,r)=>{const s=await fetch(mt(`${pe}/sessions/${e.sessionId}/goal`,e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({objective:t,tokenBudget:n,permissionMode:r})});if(!s.ok)throw new Error("Failed to create goal");return s.json()},updateGoal:async(e,t)=>{const n=await fetch(mt(`${pe}/sessions/${e.sessionId}/goal`,e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error("Failed to update goal");return n.json()},clearGoal:async e=>{if(!(await fetch(mt(`${pe}/sessions/${e.sessionId}/goal`,e),{method:"DELETE"})).ok)throw new Error("Failed to clear goal")},listRewindCheckpoints:async e=>{const t=await fetch(mt(`${pe}/sessions/${e.sessionId}/rewind`,e));if(!t.ok)throw new Error("Failed to load rewind checkpoints");const n=await t.json();return fr($D,n.checkpoints)},rewindSession:async(e,t,n)=>{const r=await fetch(mt(`${pe}/sessions/${e.sessionId}/rewind`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetMessageId:t,mode:n})});if(!r.ok)throw new Error("Failed to rewind session");const s=kD.parse(await r.json()),o=Date.now();return{...s,messages:s.messages.map((i,a)=>Qa(i,a,o))}},listSubagents:async e=>{const t=await fetch(mt(`${pe}/sessions/${e.sessionId}/subagents`,e));if(!t.ok)throw new Error("Failed to load subagents");const n=await t.json();return fr(RD,n.subagents)},resumeSubagent:async(e,t,n)=>{const r=await fetch(mt(`${pe}/sessions/${e.sessionId}/subagents/${encodeURIComponent(t)}/resume`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:n})});if(!r.ok){const s=await r.json().catch(()=>{});throw new Error((s==null?void 0:s.message)||"Failed to resume subagent")}return yD.parse(await r.json())},forkSession:async e=>{const t=await fetch(`${pe}/sessions/${e.sessionId}/fork`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectPath:e.projectPath})});if(!t.ok)throw new Error("Failed to fork session");const n=bD.parse(await t.json()),r=Date.now();return{session:n.session,messages:n.messages.map((s,o)=>Qa(s,o,r))}},openEventSubscription:async(e,t,n)=>{const r=(n==null?void 0:n.maxRetries)??5,s=n==null?void 0:n.onConnectionChange,o=n==null?void 0:n.onConnectionStateChange;let i=null,a=0,l=null,u=Date.now(),m=null,p=null,g=!1,x=!1,b=0,y,j,k=!1;const A=new Promise((P,B)=>{y=P,j=B}),N=()=>{m&&(clearInterval(m),m=null)},R=()=>{p&&(clearTimeout(p),p=null)},J=()=>{i==null||i.close(),i=null},T=()=>{l&&(clearTimeout(l),l=null),N(),R(),J()},C=()=>{k||(k=!0,R(),y())},$=P=>{k||(k=!0,T(),j(P))},O=()=>{if(g||a>=r){a>=r&&(console.error(`SSE max retries (${r}) reached, giving up`),o==null||o("offline"));return}a++,o==null||o("reconnecting");const P=Math.min(1e3*Math.pow(2,a-1),3e4);console.log(`SSE reconnecting in ${P}ms (attempt ${a}/${r})`),l=setTimeout(()=>{Y().catch(B=>{console.error("SSE reconnect failed",B),s==null||s(!1),O()})},P)},K=()=>{a=0,u=Date.now(),s==null||s(!0),o==null||o("connected"),N(),m=setInterval(()=>{Date.now()-u>45e3&&(console.warn("SSE heartbeat timeout, reconnecting..."),N(),J(),s==null||s(!1),o==null||o("reconnecting"),O())},15e3),x||(x=!0,C())},Y=async()=>{if(g)return;J();const P=mt(`${pe}/sessions/${e.sessionId}/events`,e),B=b>0?`${P}${P.includes("?")?"&":"?"}lastEventId=${b}`:P;i=new EventSource(B),x||(R(),p=setTimeout(()=>{o==null||o("offline"),$(new Error("Timed out waiting for event subscription readiness"))},ef)),i.onmessage=M=>{try{const de=JSON.parse(M.data);typeof de.seq=="number"&&de.seq>b&&(b=de.seq);const we=Xd.parse(de);if(u=Date.now(),we.type==="connected"){we.properties.sessionId===e.sessionId&&we.properties.projectPath===e.projectPath&&(typeof we.properties.status=="string"&&t({type:"session.status",properties:we.properties}),K());return}if(we.type==="heartbeat")return;t(we)}catch(de){console.error("Failed to parse SSE event:",M.data,de)}},i.onerror=()=>{if(!g){if(N(),J(),!x){o==null||o("offline"),$(new Error("Failed to open event subscription"));return}console.error("SSE connection error"),s==null||s(!1),O()}}};return o==null||o("connecting"),Y().catch(P=>{o==null||o("offline"),$(P instanceof Error?P:new Error("Failed to open event subscription"))}),await A,()=>{g=!0,l&&(clearTimeout(l),l=null),T(),s==null||s(!1)}},openTaskEventSubscription:async(e,t)=>{const n=t==null?void 0:t.onConnectionChange,r=t==null?void 0:t.onConnectionStateChange,s=new EventSource(`${pe}/events`);let o=!1,i=!1,a,l,u;const m=new Promise((g,x)=>{l=g,u=x}),p=()=>{o||(o=!0,a!==void 0&&(clearTimeout(a),a=void 0),s.close(),n==null||n(!1),r==null||r("offline"))};return r==null||r("connecting"),a=setTimeout(()=>{i||o||(p(),u(new Error("Timed out waiting for global task events")))},ef),s.onmessage=g=>{try{const x=Xd.parse(JSON.parse(g.data));if(x.type==="connected"){i||(i=!0,a!==void 0&&(clearTimeout(a),a=void 0),l()),n==null||n(!0),r==null||r("connected");return}if(x.type==="heartbeat")return;e(x)}catch(x){console.error("Failed to parse global task event:",g.data,x)}},s.onerror=()=>{n==null||n(!1),r==null||r(i?"reconnecting":"offline"),!i&&!o&&(p(),u(new Error("Failed to open global task events")))},await m,p},respondPermission:async(e,t,n)=>{var o;const r=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),s=await fetch(`${pe}/permissions/${t}?${r.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!s.ok){const i=await s.json().catch(()=>{});throw new Error(((o=i==null?void 0:i.error)==null?void 0:o.message)||"Failed to respond to permission")}},respondToConfirmation:async(e,t,n)=>{if(!(await fetch(mt(`${pe}/sessions/${e.sessionId}/confirmation/${t}`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:n})})).ok)throw new Error("Failed to respond to confirmation")},respondToQuestion:async(e,t,n)=>{var o;const r=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),s=await fetch(`${pe}/permissions/${t}?${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:!0,answers:n})});if(!s.ok){const i=await s.json().catch(()=>{});throw new Error(((o=i==null?void 0:i.error)==null?void 0:o.message)||"Failed to respond to question")}},respondToElicitation:async(e,t,n)=>{var o;const r=new URLSearchParams({sessionId:e.sessionId,projectPath:e.projectPath}),s=await fetch(`${pe}/permissions/${t}?${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({approved:n.action==="accept",elicitation:n})});if(!s.ok){const i=await s.json().catch(()=>{});throw new Error(((o=i==null?void 0:i.error)==null?void 0:o.message)||"Failed to respond to MCP elicitation")}},getGitInfo:async e=>{const t=await fetch(`${pe}/suggestions/git-info`,{headers:tf(e)});if(!t.ok)throw new Error("Failed to get git info");return t.json()}},nf=e=>{let t;const n=new Set,r=(u,m)=>{const p=typeof u=="function"?u(t):u;if(!Object.is(p,t)){const g=t;t=m??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(x=>x(t,g))}},s=()=>t,a={setState:r,getState:s,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u))},l=t=e(r,s,a);return a},_D=e=>e?nf(e):nf,LD=e=>e;function UD(e,t=LD){const n=Xs.useSyncExternalStore(e.subscribe,Xs.useCallback(()=>t(e.getState()),[e,t]),Xs.useCallback(()=>t(e.getInitialState()),[e,t]));return Xs.useDebugValue(n),n}const rf=e=>{const t=_D(e),n=r=>UD(t,r);return Object.assign(n,t),n},Ea=e=>e?rf(e):rf;function _t(){return{timeline:[],textBefore:"",toolCalls:[],textAfter:"",thinkingContent:"",tasks:[],subagent:null,subagents:[],confirmation:null,question:null,elicitation:null}}function Xn(e){return e?e.subagents&&e.subagents.length>0?e.subagents:e.subagent?[e.subagent]:[]:[]}function go(e,t,n){const r=(n?t.find(s=>s.id===n||s.sessionId===n):void 0)??t[t.length-1]??null;return{...e,subagents:t,subagent:r}}function $c(e,t){const n=[...Xn(e)];let r=n.findIndex(i=>i.id===t.id||!!(i.sessionId&&t.sessionId&&i.sessionId===t.sessionId));if(r===-1&&t.sessionId&&(r=n.findIndex(i=>!i.sessionId&&i.status==="running"&&i.type===t.type&&i.description===t.description)),r===-1)return n.push(t),go(e,n,t.id);const s=n[r],o={...s,...t,id:s.id};return n[r]=o,go(e,n,o.id)}function Vu(e,t){return`${t}-${e.length}`}function Rc(e,t){if(!t)return e;const n=[...Pa(e)],r=n[n.length-1];return(r==null?void 0:r.type)==="text"?n[n.length-1]={...r,content:r.content+t}:n.push({id:Vu(n,"text"),type:"text",content:t}),{...e,timeline:n}}function Kx(e,t){if(!t)return e;const n=[...Pa(e)],r=n[n.length-1];return(r==null?void 0:r.type)==="thinking"?n[n.length-1]={...r,content:r.content+t}:n.push({id:Vu(n,"thinking"),type:"thinking",content:t}),{...e,timeline:n}}function Oc(e,t){const n=e.toolCalls.some(i=>i.toolCallId===t.toolCallId),r=n?e.toolCalls:[...e.toolCalls,t];if(n)return{...e,toolCalls:r};const s=[...Pa(e)],o=s[s.length-1];return(o==null?void 0:o.type)==="tool_group"?s[s.length-1]={...o,toolCallIds:[...o.toolCallIds,t.toolCallId]}:s.push({id:Vu(s,"tool_group"),type:"tool_group",toolCallIds:[t.toolCallId]}),{...e,timeline:s,toolCalls:r}}function Pa(e){if(e.timeline&&e.timeline.length>0)return e.timeline;const t=[];return e.thinkingContent&&t.push({id:"legacy-thinking",type:"thinking",content:e.thinkingContent}),e.textBefore&&t.push({id:"legacy-text-before",type:"text",content:e.textBefore}),e.toolCalls.length>0&&t.push({id:"legacy-tool-group",type:"tool_group",toolCallIds:e.toolCalls.map(n=>n.toolCallId)}),e.textAfter&&t.push({id:"legacy-text-after",type:"text",content:e.textAfter}),t}function BD(e){return Pa(e).filter(t=>t.type==="text").map(t=>t.content).filter(Boolean).join(`
|
|
10
|
+
|
|
11
|
+
`)}const HD=(e,t)=>({messages:[],setMessages:n=>e({messages:n}),addMessage:n=>e(r=>({messages:[...r.messages,n]})),updateMessage:(n,r)=>e(s=>({messages:s.messages.map(o=>o.id===n?{...o,...r}:o)})),appendDelta:(n,r,s)=>e(o=>({messages:o.messages.map(i=>{if(i.id!==n)return i;const a=i.agentContent||_t();return s==="before"?{...i,agentContent:{...Rc(a,r),textBefore:a.textBefore+r}}:{...i,agentContent:{...Rc(a,r),textAfter:a.textAfter+r}}})})),appendToolCall:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||_t();return{...o,agentContent:Oc(i,r)}})})),updateToolCall:(n,r,s)=>e(o=>({messages:o.messages.map(i=>{if(i.id!==n)return i;const a=i.agentContent;return a?{...i,agentContent:{...a,toolCalls:a.toolCalls.map(l=>l.toolCallId===r?{...l,...s}:l)}}:i})})),appendThinking:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||_t();return{...o,agentContent:{...Kx(i,r),thinkingContent:i.thinkingContent+r}}})})),setConfirmation:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||_t();return{...o,agentContent:{...i,confirmation:r}}})})),setQuestion:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||_t();return{...o,agentContent:{...i,question:r}}})})),setElicitation:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||_t();return{...o,agentContent:{...i,elicitation:r}}})})),setSubagent:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||_t();return{...o,agentContent:r?$c(i,r):go(i,[])}})})),updateSubagent:(n,r,s)=>e(o=>({messages:o.messages.map(i=>{if(i.id!==n)return i;const a=i.agentContent||_t(),l=[...Xn(a)],u=l.findIndex(g=>g.id===r||g.sessionId===r);if(u===-1)return i;const m=l[u],p=typeof s=="function"?s(m):s;return l[u]={...m,...p,id:m.id},{...i,agentContent:go(a,l,l[u].id)}})})),setTasks:(n,r)=>e(s=>({messages:s.messages.map(o=>{if(o.id!==n)return o;const i=o.agentContent||_t();return{...o,agentContent:{...i,tasks:r}}})})),replaceTemp:(n,r)=>e(s=>{const o=s.messages.findIndex(a=>a.content===n&&a.role==="user");if(o===-1)return s;const i=[...s.messages];return i[o]=r,{messages:i}})}),Ya=60,qD=[/<system-reminder>[\s\S]*?<\/system-reminder>/gi,/<file[^>]*>[\s\S]*?<\/file>/gi,/<hooks_context>[\s\S]*?<\/hooks_context>/gi,/<[^>]+>/g];function zD(e){let t=e;for(const l of qD)t=t.replace(l," ");t=t.replace(/^\s*\/[a-zA-Z][\w-]*\s+/,"");const n=t.replace(/\s+/g," ").trim();if(!n)return"";const r=n.match(/^(.+?)(?:[.!?]\s|[。!?](?=\S|$)|$)/);let s=r&&r[1].length>=6?r[1]:n;if(s=s.trim().replace(/[\s.。!!??,,;;::-]+$/,""),s.length<=Ya)return s;const o=s.slice(0,Ya),i=o.lastIndexOf(" ");return`${(i>Ya*.6?o.slice(0,i):o).trimEnd()}…`}const yi="/.blade/worktrees/",KD=/-[a-f0-9]{8,}$/i,GD=/^(.+?(?:test|config))-[a-z0-9]{6,}$/i;function VD(e){const t=e.indexOf(yi);if(t<0)return null;const n=e.slice(t+yi.length).split("/")[0];return n?`${e.slice(0,t+yi.length)}${n}`:null}function WD(e){if(!e.includes("/tmp/")&&!e.includes("/T/"))return null;const t=e.split("/"),n=t.at(-1),r=n==null?void 0:n.match(GD);return r!=null&&r[1]?(t[t.length-1]=r[1],t.join("/")):null}function Mc(e){const t=e.split("/").filter(Boolean).at(-1)||e;return e.includes(yi)?t.replace(KD,""):t}function si(e,t=null){const n=e.taskSourceProjectPath,r=WD(n||e.projectPath);if(r)return r;if(n)return n;const s=VD(e.projectPath);if(!s)return e.projectPath;const o=Mc(s);return t&&o===Mc(t)?t:s}function JD(e,t,n=null){return t?e.filter(r=>si(r,n)===t):e}const Fc=gr.AUTO_EDIT;let Xa=0;const Et=Ea((e,t)=>({currentModelId:null,currentMode:Fc,configuredModels:[],availableModels:[],isLoading:!1,hasLoaded:!1,loadedWorkspacePath:null,error:null,loadModels:async n=>{const r=n??null;if(t().isLoading&&t().loadedWorkspacePath===r)return;const s=++Xa;e({isLoading:!0,hasLoaded:!1,loadedWorkspacePath:r,error:null});try{const o=await mr("/models",n?{headers:{"x-blade-directory":n}}:void 0);if(s!==Xa||t().loadedWorkspacePath!==r)return;const i=o.current;e({currentModelId:(i==null?void 0:i.id)||null,configuredModels:o.configured||[],availableModels:o.available||[],isLoading:!1,hasLoaded:!0})}catch(o){if(s!==Xa||t().loadedWorkspacePath!==r)return;e({error:o instanceof Error?o.message:"Failed to load models",isLoading:!1,hasLoaded:!0})}},setCurrentModel:async(n,r)=>{if(e({error:null}),r){e({currentModelId:n});return}try{await mr("/configs",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:{currentModelId:n},options:{scope:"global"}})}),e({currentModelId:n})}catch(s){throw e({error:s instanceof Error?s.message:"Failed to set model"}),s}},setMode:n=>e({currentMode:n}),resetMode:()=>e({currentMode:Fc})})),Za="__temp__",eo={inputTokens:0,outputTokens:0,totalTokens:0,maxContextTokens:0,isDefaultMaxTokens:!0,totalInputTokens:0,totalOutputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,estimatedCostUsd:0};function me(e){return{sessionId:e.sessionId,projectPath:e.projectPath}}function qe(e){return JSON.stringify([e.projectPath,e.sessionId])}function se(e,t){return!e||!t?e===t:e.sessionId===t.sessionId&&e.projectPath===t.projectPath}function Wu(e,t){return e.find(n=>se(me(n),t))}function wn(e,t){const n=me(t),r=e.findIndex(o=>se(me(o),n));if(r===-1)return[...e,t];const s=[...e];return s[r]=t,s}function sf(e,t){return e.filter(n=>!se(me(n),t))}const Gx="blade.tasks.unread",Di="blade:open-session";function Vx(e){return e==="completed"||e==="failed"||e==="interrupted"}function QD(e,t,n){return!Vx(t)||n?!1:e!==t&&!(e==="completed"||e==="failed"||e==="interrupted"||e==="cancelled")}function YD(e=typeof localStorage>"u"?null:localStorage){if(!e)return[];try{const t=JSON.parse(e.getItem(Gx)??"[]");return Array.isArray(t)?[...new Set(t.filter(n=>typeof n=="string"))]:[]}catch{return[]}}function ao(e,t=typeof localStorage>"u"?null:localStorage){if(t)try{t.setItem(Gx,JSON.stringify([...new Set(e)]))}catch{}}function of(e,t){const n=new Set(t.map(r=>qe({sessionId:r.sessionId,projectPath:r.projectPath})));return e.filter(r=>n.has(r))}function af(e){if(typeof document>"u"||document.visibilityState!=="hidden"||typeof Notification>"u"||Notification.permission!=="granted")return!1;const t=new Notification(e.title,{body:e.body,icon:"/favicon.svg",tag:`blade-task-${qe(e.ref)}`});return t.onclick=()=>e.onOpen(e.ref),!0}function XD(e){if(typeof window>"u")return!1;const t=window.AudioContext??window.webkitAudioContext;if(!t)return!1;try{const n=new t,r=n.createOscillator(),s=n.createGain();return r.type="sine",r.frequency.value=e==="completed"?660:330,s.gain.setValueAtTime(1e-4,n.currentTime),s.gain.exponentialRampToValueAtTime(.045,n.currentTime+.015),s.gain.exponentialRampToValueAtTime(1e-4,n.currentTime+.18),r.connect(s),s.connect(n.destination),r.start(),r.stop(n.currentTime+.2),r.onended=()=>void n.close(),!0}catch{return!1}}const ZD=2166136261,e5=16777619;function Dc(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?`[${e.map(t=>Dc(t)).join(",")}]`:typeof e=="object"?`{${Object.entries(e).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>`${JSON.stringify(n)}:${Dc(r)}`).join(",")}}`:JSON.stringify(e)}function Wx(e){let t=ZD>>>0;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,e5);return(t>>>0).toString(16)}function Jx(e){return typeof e=="string"?e:Dc(e??{})}function Ju(e){return e==="completed"?"completed":e==="failed"?"failed":"running"}function _c({explicitId:e,messageId:t,toolName:n,argumentsValue:r,toolKind:s,output:o}){if(e)return e;const i=[t||"unknown-message",n||"Unknown",Jx(r),s||"",o||""].join("|");return`tool-${Wx(i)}`}function Na({explicitId:e,sessionId:t,messageId:n,agentType:r,description:s,summary:o}){if(e)return e;if(t)return t;const i=[n||"unknown-message",r||"subagent",s||"",o||""].join("|");return`subagent-${Wx(i)}`}const t5=(e,t)=>!t||typeof t!="object"?null:{id:Na({explicitId:typeof t.subagentId=="string"?t.subagentId:void 0,sessionId:t.childSessionId,messageId:e,agentType:t.agentType,description:t.description,summary:t.summary}),type:t.agentType||"subagent",description:t.description||t.summary||"",status:Ju(t.status),startTime:Date.now(),sessionId:t.childSessionId,resumedFrom:t.resumedFrom,rootAgentId:t.rootAgentId,resumeDepth:typeof t.resumeDepth=="number"?t.resumeDepth:void 0,verificationVerdict:t.verificationVerdict==="pass"||t.verificationVerdict==="fail"||t.verificationVerdict==="partial"?t.verificationVerdict:void 0},n5=(e,t)=>!t||typeof t!="object"?[]:(Array.isArray(t.subtaskRefs)?t.subtaskRefs:t.subtaskRef&&typeof t.subtaskRef=="object"?[t.subtaskRef]:[]).map(r=>t5(e,r)).filter(r=>r!==null);function Ys(e){return typeof e=="string"?e:e.filter(t=>t.type==="text").map(t=>t.text).join(`
|
|
12
|
+
`)}function Si(e){var r,s,o;const t=[];let n=null;for(const i of e)if(i.role!=="system"){if(i.role==="user")n&&(t.push(n),n=null),t.push({id:i.id,role:i.role,content:i.content,timestamp:i.timestamp||Date.now(),metadata:i.metadata});else if(i.role==="assistant"){n&&t.push(n);const a=i.metadata;let l=_t();i.thinkingContent&&(l=Kx(l,i.thinkingContent),l.thinkingContent=i.thinkingContent);const u=Ys(i.content);u&&(l=Rc(l,u),l.textBefore=u);const m=n5(i.id,a);if(i.tool_calls&&Array.isArray(i.tool_calls))for(const p of i.tool_calls){const g=((r=p.function)==null?void 0:r.name)||"Unknown",x=Jx((s=p.function)==null?void 0:s.arguments);if(g==="Task"){let y={};try{y=JSON.parse(x)}catch{}const j=typeof y.subagent_type=="string"?y.subagent_type:"subagent",k=typeof y.description=="string"?y.description:j;l=$c(l,{id:Na({explicitId:p.id,sessionId:typeof y.subagent_session_id=="string"?y.subagent_session_id:void 0,messageId:i.id,agentType:j,description:k}),type:j,description:k,status:"running",startTime:Date.now(),sessionId:typeof y.subagent_session_id=="string"?y.subagent_session_id:void 0,resumedFrom:typeof y.resume_from=="string"?y.resume_from:typeof y.resume=="string"?y.resume:void 0});continue}const b={toolCallId:_c({explicitId:p.id,messageId:i.id,toolName:g,argumentsValue:(o=p.function)==null?void 0:o.arguments}),toolName:g,arguments:x,status:"running",startTime:Date.now()};l=Oc(l,b)}for(const p of m)l=$c(l,p);n={id:i.id,role:"assistant",content:Ys(i.content),timestamp:i.timestamp||Date.now(),metadata:a,agentContent:l}}else if(i.role==="tool"&&n&&n.agentContent){const a=i,l=i.metadata,u=a.tool_call_id||(l==null?void 0:l.toolCallId),m=a.name||(l==null?void 0:l.toolName)||"Tool",p=l!=null&&l.metadata&&typeof l.metadata=="object"&&!Array.isArray(l.metadata)?l.metadata:void 0,g=l!=null&&l.independentVerification&&typeof l.independentVerification=="object"&&!Array.isArray(l.independentVerification)?l.independentVerification:void 0,x=typeof(l==null?void 0:l.error)=="string"&&l.error.length>0,b=Xn(n.agentContent),y=b.findIndex(k=>k.id===u);if(y>=0){const k=b[y],A=typeof(p==null?void 0:p.subagentStatus)=="string"?Ju(p.subagentStatus):x?"failed":"completed";b[y]={...k,sessionId:typeof(p==null?void 0:p.subagentSessionId)=="string"?p.subagentSessionId:k.sessionId,type:typeof(p==null?void 0:p.subagentType)=="string"?p.subagentType:k.type,status:A,resumedFrom:typeof(p==null?void 0:p.subagentResumedFrom)=="string"?p.subagentResumedFrom:k.resumedFrom,rootAgentId:typeof(p==null?void 0:p.subagentRootId)=="string"?p.subagentRootId:k.rootAgentId,resumeDepth:typeof(p==null?void 0:p.subagentResumeDepth)=="number"?p.subagentResumeDepth:k.resumeDepth,verificationVerdict:(p==null?void 0:p.verificationVerdict)==="pass"||(p==null?void 0:p.verificationVerdict)==="fail"||(p==null?void 0:p.verificationVerdict)==="partial"?p.verificationVerdict:(g==null?void 0:g.verificationVerdict)==="pass"||(g==null?void 0:g.verificationVerdict)==="fail"||(g==null?void 0:g.verificationVerdict)==="partial"?g.verificationVerdict:k.verificationVerdict},n.agentContent=go(n.agentContent,b,k.id);continue}const j=n.agentContent.toolCalls.find(k=>k.toolCallId===u);j?(j.output=Ys(i.content),j.status=x?"error":"success",j.metadata=p,j.summary=typeof(p==null?void 0:p.summary)=="string"?p.summary:j.summary,(!j.toolName||j.toolName==="Unknown")&&(j.toolName=m)):n.agentContent=Oc(n.agentContent,{toolCallId:_c({explicitId:u,messageId:n.id,toolName:m,output:Ys(i.content)}),toolName:m,output:Ys(i.content),status:x?"error":"success",startTime:Date.now(),metadata:p,summary:typeof(p==null?void 0:p.summary)=="string"?p.summary:void 0})}}return n&&t.push(n),t}const r5=e=>{var n;const t=[];e.content.trim()&&t.push({type:"text",text:e.content});for(const r of e.attachments??[])r.type==="image"&&t.push({type:"image_url",image_url:{url:r.content}});return t.length===0?e.content:t.length===1&&((n=t[0])==null?void 0:n.type)==="text"?t[0].text:t},mi=()=>({eventUnsubscribe:null,sessionEventConnectionState:"idle",isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1}),cf=()=>new Promise(e=>{globalThis.setTimeout(()=>{if(typeof window<"u"&&typeof window.requestIdleCallback=="function"){window.requestIdleCallback(()=>e(),{timeout:750});return}e()},350)}),s5=(e,t)=>{let n=0,r=0,s=0;const o=()=>(n+=1,n),i=l=>l===n,a=l=>{try{l()}catch(u){console.warn("Failed to clean up stale event subscription",u)}};return{sessions:[],archivedSessions:[],currentSessionId:null,currentSessionRef:null,forkingSessionRef:null,isTemporarySession:!1,isLoading:!1,catalogLoadState:"idle",catalogError:null,archivedCatalogLoadState:"idle",archivedCatalogError:null,error:null,errorContext:null,goal:null,setSessions:l=>e({sessions:l}),addSession:l=>e(u=>({sessions:wn(u.sessions,l)})),removeSession:l=>{const u=t();u.markTaskRead(l);const m=se(u.currentSessionRef,l),p=se(u.forkingSessionRef,l);(m||p)&&o(),m&&u.unsubscribeFromEvents(),e(g=>({sessions:sf(g.sessions,l),currentSessionId:m?null:g.currentSessionId,currentSessionRef:m?null:g.currentSessionRef,messages:m?[]:g.messages,goal:m?null:g.goal,forkingSessionRef:p?null:g.forkingSessionRef,...m?mi():{}}))},setCurrentSession:l=>{o(),e({currentSessionId:(l==null?void 0:l.sessionId)??null,currentSessionRef:l,isTemporarySession:!1})},setTemporarySession:l=>e({isTemporarySession:l}),setLoading:l=>e({isLoading:l}),setError:l=>e({error:l,errorContext:null}),getNavigationVersion:()=>n,clearError:()=>e({error:null,errorContext:null}),setGoal:l=>e({goal:l}),startTemporarySession:l=>{o(),t().unsubscribeFromEvents(),Et.getState().resetMode(),l&&t().selectProject(l),e({currentSessionId:Za,currentSessionRef:null,isTemporarySession:!0,forkingSessionRef:null,isLoading:!1,messages:[],goal:null,tokenUsage:{...eo},error:null,errorContext:null,...mi()})},loadSessions:async()=>{const l=++r,u=new Set(t().sessions.map(p=>qe(me(p)))),m=new Set;e({catalogLoadState:"loading",catalogError:null});try{let p,g=!0;do{const y=await re.listSessionPage(p);if(l!==r)return;for(const j of y.sessions)m.add(qe(me(j)));if(e(j=>{const k=new Set(y.sessions.map(N=>qe(me(N))));return{sessions:g?[...y.sessions,...j.sessions.filter(N=>!k.has(qe(me(N))))]:y.sessions.reduce((N,R)=>wn(N,R),j.sessions),catalogLoadState:y.nextCursor?"hydrating":"ready"}}),g=!1,p=y.nextCursor,p&&(await cf(),l!==r))return}while(p);if(l!==r)return;const x=t().sessions.filter(y=>{const j=qe(me(y));return m.has(j)||!u.has(j)}),b=of(t().unreadTaskKeys,x);ao(b),e({sessions:x,unreadTaskKeys:b,catalogLoadState:"ready",catalogError:null})}catch(p){if(l!==r)return;e({catalogLoadState:"error",catalogError:p.message})}},loadArchivedSessions:async()=>{const l=++s;e({archivedCatalogLoadState:"loading",archivedCatalogError:null});try{let u;const m=[];do{const p=await re.listSessionPage(u,50,!0);if(l!==s)return;for(const g of p.sessions){const x=m.findIndex(b=>se(me(b),me(g)));x===-1?m.push(g):m[x]=g}u=p.nextCursor,u&&(e({archivedCatalogLoadState:"hydrating"}),await cf())}while(u);if(l!==s)return;e({archivedSessions:m,archivedCatalogLoadState:"ready",archivedCatalogError:null})}catch(u){if(l!==s)return;e({archivedCatalogLoadState:"error",archivedCatalogError:u.message})}},selectSession:async l=>{var m;const u=o();e({isLoading:!0,error:null,errorContext:null,forkingSessionRef:null});try{const p=Wu(t().sessions,l),[g,x,b]=await Promise.all([re.getMessages(l),re.getGoal(l).catch(()=>null),p?Promise.resolve(p):re.getSession(l)]);if(!i(u))return;const y=Si(g),j=[];let k=!1;const A=await t().prepareEventSubscription(l,R=>{k?t().handleEvent(R):j.push(R)});if(!i(u)){a(A);return}const N=si(b,t().selectedProjectPath??((m=t().taskWorkspaceInfo)==null?void 0:m.cwd)??null);t().boundProjects.some(R=>R.available&&R.path===N)&&t().selectProject(N),Et.getState().setMode(b.permissionMode??Fc),e(R=>{var J;return{currentSessionId:l.sessionId,currentSessionRef:l,isTemporarySession:!1,messages:y,goal:x,isLoading:!1,tokenUsage:{...eo},isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,error:b.taskStatus==="failed"?((J=b.taskFailure)==null?void 0:J.message)??null:null,errorContext:b.taskStatus==="failed"&&b.taskFailure?{kind:"execution",sessionRef:l,failureCode:b.taskFailure.code}:null,sessions:wn(R.sessions,b)}}),t().markTaskRead(l),k=!0,t().replaceEventSubscription(A);for(const R of j)t().handleEvent(R)}catch(p){if(!i(u))return;e({error:p.message,errorContext:{kind:"navigation",sessionRef:l},isLoading:!1})}},archiveSession:async l=>{var u;try{const m=await re.archiveSession(l),p=new Set(m.archivedSessionIds),g=t(),x=((u=g.currentSessionRef)==null?void 0:u.projectPath)===l.projectPath&&p.has(g.currentSessionRef.sessionId);x&&(o(),g.unsubscribeFromEvents()),e(b=>{const y=b.sessions.filter(k=>k.projectPath!==l.projectPath||!p.has(k.sessionId)),j=of(b.unreadTaskKeys,y);return ao(j),{sessions:y,archivedSessions:wn(b.archivedSessions,m.session),unreadTaskKeys:j,currentSessionId:x?null:b.currentSessionId,currentSessionRef:x?null:b.currentSessionRef,messages:x?[]:b.messages,goal:x?null:b.goal,...x?mi():{}}}),await t().loadArchivedSessions()}catch(m){e({error:m.message,errorContext:{kind:"task_action",sessionRef:l}})}},unarchiveSession:async l=>{try{const u=await re.unarchiveSession(l),m=new Set(u.restoredSessionIds);e(p=>({archivedSessions:p.archivedSessions.filter(g=>g.projectPath!==l.projectPath||!m.has(g.sessionId)),sessions:wn(p.sessions,u.session)})),await Promise.all([t().loadSessions(),t().loadArchivedSessions()])}catch(u){e({error:u.message,errorContext:{kind:"task_action",sessionRef:l}})}},deleteSession:async l=>{const u=t(),m=se(u.currentSessionRef,l),p=se(u.forkingSessionRef,l),g=m||p?o():null,x=m?g:null;p&&e({forkingSessionRef:null});try{await re.deleteSession(l),t().markTaskRead(l);const b=t(),y=se(b.currentSessionRef,l)&&(x===null||i(x));y&&(o(),b.unsubscribeFromEvents()),e(j=>({sessions:sf(j.sessions,l),currentSessionId:y?null:j.currentSessionId,currentSessionRef:y?null:j.currentSessionRef,messages:y?[]:j.messages,goal:y?null:j.goal,...y?mi():{}}))}catch(b){if(x!==null&&(!i(x)||!se(t().currentSessionRef,l)))return;e({error:b.message})}},updateSession:async(l,u)=>{try{await re.updateSession(l,u),e(m=>({sessions:m.sessions.map(p=>p.sessionId===l.sessionId&&p.projectPath===l.projectPath?{...p,title:u}:p)}))}catch(m){e({error:m.message})}},forkSession:async l=>{const u=o(),m=me(l);e({forkingSessionRef:m,isLoading:!1,error:null});let p=null;try{const g=await re.forkSession(l),x=me(g.session),b=Si(g.messages);if(e(y=>({sessions:wn(y.sessions,g.session)})),!i(u))return;if(p=await t().prepareEventSubscription(x),!i(u)){a(p),p=null;return}e({currentSessionId:x.sessionId,currentSessionRef:x,isTemporarySession:!1,messages:b,goal:null,tokenUsage:{...eo},error:null,forkingSessionRef:null}),t().replaceEventSubscription(p),p=null}catch(g){if(p&&a(p),!i(u))return;e({error:g.message,forkingSessionRef:null})}},rewindSession:async(l,u)=>{const{currentSessionRef:m,isTemporarySession:p,isStreaming:g}=t();if(!m||p)return e({error:"No persisted session is available for rewind"}),!1;if(g)return e({error:"Stop the active run before rewinding"}),!1;const x=n;try{const b=await re.rewindSession(m,l,u);if(!i(x)||!se(t().currentSessionRef,m))return!1;const y=Si(b.messages);return e(j=>({messages:y,tokenUsage:{...eo},error:null,currentRunId:null,agentPhase:"idle",pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1,sessions:j.sessions.map(k=>k.sessionId===m.sessionId&&k.projectPath===m.projectPath?{...k,messageCount:y.length}:k)})),!0}catch(b){return!i(x)||!se(t().currentSessionRef,m)||e({error:b.message}),!1}},sendMessage:async l=>{var $,O,K,Y;const{currentSessionId:u,currentSessionRef:m,isTemporarySession:p,isStreaming:g,addSession:x,addMessage:b}=t(),y=n,j=m,k={isStreaming:g,agentPhase:t().agentPhase,currentRunId:t().currentRunId};let A=m,N=u,R=j,J=null,T=null;const C=()=>i(y)&&se(t().currentSessionRef,R);if(p||!N||N===Za)try{const P=zD(l.content),B=await re.createSession(t().selectedProjectPath??(($=t().taskWorkspaceInfo)==null?void 0:$.cwd)??void 0,P||void 0);if(x(B),!C())return!1;A=me(B),N=B.sessionId,e({currentSessionId:B.sessionId,currentSessionRef:A,isTemporarySession:!1}),R=A}catch(P){return C()&&e({error:P.message}),!1}if(!A||!N||N===Za)return C()&&e({error:"Failed to create session"}),!1;try{if(!g){if(J=await t().prepareEventSubscription(A),!C())return a(J),J=null,!1;t().replaceEventSubscription(J),J=null}if(!C())return!1;const P=l.content.trim();if(P.startsWith("!")){if((((O=l.attachments)==null?void 0:O.length)??0)>0)throw new Error("User shell commands do not accept image attachments");const Pe=P.slice(1).trim();if(!Pe)throw new Error("User shell command cannot be empty");g||e({isStreaming:!0,agentPhase:"running",error:null,errorContext:null});const U=await re.executeUserShellCommand(A,Pe);return C()?(U.auxiliary||e({isStreaming:!1,agentPhase:"idle"}),U.delivery&&e({pendingSteeringCount:U.queued??0,pendingInputDelivery:U.delivery==="current_turn"?"current_turn":"next_turn"}),!0):!1}if((((K=l.attachments)==null?void 0:K.length)??0)===0&&(P==="/goal"||P.startsWith("/goal "))){T=`goal-command-${Date.now()}`,b({id:T,role:"user",content:P,timestamp:Date.now()});const Pe=P.slice(5).trim().split(/\s+/).filter(Boolean),U=(Y=Pe[0])==null?void 0:Y.toLowerCase();if(!U||U==="status"){const _=await re.getGoal(A);return C()&&e({goal:_}),C()}if(U==="clear")return await re.clearGoal(A),C()&&e({goal:null}),C();let X;if(U==="pause")X=await re.updateGoal(A,{action:"pause"});else if(U==="resume")X=await re.updateGoal(A,{action:"resume"});else if(U==="edit"){const _=Pe.slice(1).join(" ").trim();if(!_)throw new Error("Usage: /goal edit <objective>");X=await re.updateGoal(A,{action:"edit",objective:_})}else{const _=Pe.lastIndexOf("--budget");let Ke;if(_>=0){const on=Pe[_+1];if(!on||!/^[1-9]\d*$/.test(on))throw new Error("--budget requires a positive integer");Ke=Number(on),Pe.splice(_,2)}const Ne=Pe.join(" ").trim();if(!Ne)throw new Error("Usage: /goal <objective>");const{currentMode:$e}=Et.getState();X=await re.createGoal(A,Ne,Ke,$e)}return C()?(e({goal:X.goal,...X.runId?{currentRunId:X.runId,isStreaming:!0,agentPhase:"running"}:{}}),!0):!1}T=`temp-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,b({id:T,role:"user",content:r5(l),timestamp:Date.now()}),e({isStreaming:!0,error:null,errorContext:null,recoveredSteeringCount:g?t().recoveredSteeringCount:0});const{currentMode:B,currentModelId:M}=Et.getState(),{modelId:de,...we}=l,be=de??M??void 0,ae=l.reasoningEffort,Fe=l.serviceTier,F=l.responseVerbosity,fe=l.communicationStyle,ye=be&&!g?{...we,modelId:be}:we,Ee=await re.sendMessage(A,ye,B);return C()?(e({currentRunId:Ee.runId,pendingSteeringCount:Ee.status==="steering_queued"||Ee.status==="follow_up_queued"?Math.max(0,Ee.queued??1):t().pendingSteeringCount,pendingInputDelivery:Ee.status==="steering_queued"?"current_turn":Ee.status==="follow_up_queued"?"next_turn":t().pendingInputDelivery,sessions:(be||ae||Fe||F||fe)&&!g?t().sessions.map(Pe=>Pe.sessionId===A.sessionId&&Pe.projectPath===A.projectPath?{...Pe,...be?{selectedModelId:be}:{},...ae?{reasoningEffort:ae}:{},...Fe?{serviceTier:Fe}:{},...F?{responseVerbosity:F}:{},...fe?{communicationStyle:fe}:{}}:Pe):t().sessions}),!0):!1}catch(P){return J&&a(J),C()?T&&!t().messages.some(B=>B.id===T)?!0:(e(B=>({error:P.message,errorContext:{kind:"submission",sessionRef:A},messages:T?B.messages.filter(M=>M.id!==T):B.messages,...k})),!1):!1}},abortSession:async()=>{const{currentSessionRef:l,isStopping:u}=t();if(!l||u)return!1;e({isStopping:!0,error:null,errorContext:null});try{return await re.abortSession(l),se(t().currentSessionRef,l)?(t().unsubscribeFromEvents(),e({isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1}),!0):!1}catch(m){return se(t().currentSessionRef,l)&&e({isStopping:!1,error:m instanceof Error?m.message:"Failed to stop task",errorContext:{kind:"task_action",sessionRef:l}}),!1}},pauseGoal:async()=>{const{currentSessionRef:l,isTemporarySession:u}=t();if(!l||u){e({error:"No persisted session is available for this goal"});return}try{const m=await re.updateGoal(l,{action:"pause"});if(!se(t().currentSessionRef,l))return;e({goal:m.goal,error:null})}catch(m){if(!se(t().currentSessionRef,l))return;e({error:m.message})}},resumeGoal:async()=>{const{currentSessionRef:l,isTemporarySession:u}=t();if(!l||u){e({error:"No persisted session is available for this goal"});return}try{const m=await re.updateGoal(l,{action:"resume"});if(!se(t().currentSessionRef,l))return;e({goal:m.goal,error:null,...m.runId?{currentRunId:m.runId,isStreaming:!0,agentPhase:"running"}:{}})}catch(m){if(!se(t().currentSessionRef,l))return;e({error:m.message})}},editGoal:async l=>{const{currentSessionRef:u,isTemporarySession:m}=t();if(!u||m){e({error:"No persisted session is available for this goal"});return}try{const p=await re.updateGoal(u,{action:"edit",objective:l});if(!se(t().currentSessionRef,u))return;e({goal:p.goal,error:null,...p.runId?{currentRunId:p.runId,isStreaming:!0,agentPhase:"running"}:{}})}catch(p){if(!se(t().currentSessionRef,u))return;e({error:p.message})}},clearGoal:async()=>{const{currentSessionRef:l,isTemporarySession:u}=t();if(!l||u){e({error:"No persisted session is available for this goal"});return}try{if(await re.clearGoal(l),!se(t().currentSessionRef,l))return;e({goal:null,error:null})}catch(m){if(!se(t().currentSessionRef,l))return;e({error:m.message})}}}},Qx={authentication:"task.failure.authentication",permission:"task.failure.permission",rate_limit:"task.failure.rateLimit",timeout:"task.failure.timeout",network:"task.failure.network",model_unavailable:"task.failure.modelUnavailable",context_limit:"task.failure.contextLimit",unsupported_input:"task.failure.unsupportedInput",runtime:"task.failure.runtime"},o5={authentication:!1,permission:!1,rate_limit:!0,timeout:!0,network:!0,model_unavailable:!0,context_limit:!1,unsupported_input:!1,runtime:!0};function Yx(e){if(typeof e=="string"&&Object.keys(Qx).includes(e))return e}function Xx(e){return Qx[e]}function i5(e){return o5[e]}const a5={flushTimeout:80};class c5{constructor(t){qa(this,"config");qa(this,"channels",new Map);this.config={...a5,...t}}append(t,n,r){let s=this.channels.get(t);s||(s={buffer:"",timer:null,flushFn:null},this.channels.set(t,s)),s.buffer+=n,s.flushFn=r,s.timer||(s.timer=setTimeout(()=>{this.flushChannel(t)},this.config.flushTimeout))}flushChannel(t){const n=this.channels.get(t);if(!n||!n.buffer)return;const r=n.buffer,s=n.flushFn;n.buffer="",n.timer&&(clearTimeout(n.timer),n.timer=null),s==null||s(r)}drainAll(){for(const[t]of this.channels)this.flushChannel(t);this.channels.clear()}drainAllExcept(t){for(const[n]of this.channels)n!==t&&this.flushChannel(n);for(const[n,r]of this.channels)n!==t&&!r.buffer&&this.channels.delete(n)}reset(){for(const[,t]of this.channels)t.timer&&clearTimeout(t.timer);this.channels.clear()}}const vn=new c5,ht=(e,t,n)=>{if(t)for(const r of e){const s=Xn(r.agentContent).find(o=>o.id===t||o.sessionId===t);if(s)return{messageId:r.id,subagent:s}}if(n){const r=e.find(i=>i.id===n),s=Xn(r==null?void 0:r.agentContent),o=s.find(i=>i.status==="running")??s[s.length-1];if(o)return{messageId:n,subagent:o}}for(const r of[...e].reverse()){const s=Xn(r.agentContent),o=s.find(i=>i.status==="running")??s[s.length-1];if(o)return{messageId:r.id,subagent:o}}},Wt=(e,t,n)=>{const{currentAssistantMessageId:r,messages:s,addMessage:o,startAgentResponse:i}=e();if(r&&!r.startsWith("call_")&&s.some(m=>m.id===r&&m.role==="assistant"))return r;if(n){const m=s.find(p=>p.id===n&&p.role==="assistant");if(m)return i(m.id),m.id}const a=s[s.length-1];if((a==null?void 0:a.role)==="assistant")return a.id;const l=n||`assistant-${Date.now()}`,u={id:l,role:"assistant",content:"",timestamp:Date.now(),agentContent:_t()};return o(u),i(l),t(m=>({messages:m.messages.map(p=>p.id===l?{...p,agentContent:{...p.agentContent||_t()}}:p)})),l},l5=(e,t,n)=>{const{currentSessionId:r,addMessage:s,startAgentResponse:o,messages:i,updateMessage:a}=t();if(e.sessionId!==r)return;const l=e.messageId,u=e.role||"assistant",m=i.find(g=>g.id===l),p={id:l,role:u,content:e.content||"",timestamp:Date.now(),agentContent:u==="assistant"?_t():void 0};m?a(l,{role:u,content:p.content,agentContent:u==="assistant"?{...m.agentContent||_t()}:void 0}):s(p),u==="assistant"&&o(l)},u5=(e,t,n)=>{const{currentSessionId:r,appendDelta:s,currentAssistantMessageId:o,hasToolCalls:i,addMessage:a,startAgentResponse:l}=t();if(e.sessionId!==r)return;const u=e.messageId,m=e.delta;if(!o){const g={id:u,role:"assistant",content:"",timestamp:Date.now(),agentContent:_t()};a(g),l(u),t().appendDelta(u,m,"before");return}s(o,m,i?"after":"before")},d5=(e,t)=>{const{currentSessionId:n,updateMessage:r,messages:s}=t();if(e.sessionId!==n)return;const o=e.messageId,i=s.find(a=>a.id===o);i!=null&&i.agentContent&&r(o,{content:BD(i.agentContent)})},f5=(e,t,n)=>{var l;const{currentSessionId:r}=t();if(e.sessionId!==r)return;const s=e.output;if(!s||typeof s!="object"||Array.isArray(s))return;const o=Wt(t,n,e.messageId);if(!o)return;const i=t().messages.find(u=>u.id===o);if(!i)return;const a=JSON.stringify(s,null,2);t().updateMessage(o,{content:a,metadata:{...i.metadata,structuredOutput:{output:s,schemaDigest:e.schemaDigest}},agentContent:i.agentContent?{...i.agentContent,textBefore:"",textAfter:"",timeline:(l=i.agentContent.timeline)==null?void 0:l.filter(u=>u.type!=="text")}:void 0})},m5=(e,t,n)=>{const{currentSessionId:r,appendThinking:s}=t();if(e.sessionId!==r)return;const o=Wt(t,n,e.messageId);o&&s(o,e.delta)},p5=()=>{},Zx=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s,setHasToolCalls:o,setSubagent:i}=t();if(e.sessionId!==r)return;const a=Wt(t,n,e.messageId||e.toolCallId);if(!a)return;o(!0);const l=e.toolName||"Unknown",u=e.arguments;let m,p="",g,x;if(l==="Task")try{const y=JSON.parse(u);m=y.subagent_type,p=y.description||y.query||m||"",g=y.subagent_session_id,x=y.resume_from||y.resume}catch{}if(m){i(a,{id:Na({explicitId:e.toolCallId,sessionId:g,messageId:a,agentType:m,description:p}),type:m,description:p,status:"running",startTime:Date.now(),sessionId:g,resumedFrom:x,output:"",thinking:""});return}const b={toolCallId:_c({explicitId:e.toolCallId,messageId:a,toolName:l,argumentsValue:u,toolKind:e.toolKind}),toolName:l,arguments:u,toolKind:e.toolKind,status:"running",startTime:Date.now()};s(a,b)},ey=(e,t)=>{const{currentSessionId:n,updateToolCall:r,messages:s}=t();if(e.sessionId!==n)return;const o=e.toolCallId;if(!o)return;const i=s.find(a=>{var l;return(l=a.agentContent)==null?void 0:l.toolCalls.some(u=>u.toolCallId===o)});i&&r(i.id,o,{summary:e.message,progress:typeof e.progress=="number"?e.progress:void 0,progressTotal:typeof e.total=="number"?e.total:void 0,progressMessage:e.message})},ty=(e,t,n)=>{var $;const{currentSessionId:r,updateToolCall:s,updateSubagent:o,messages:i}=t();if(e.sessionId!==r)return;const a=e.toolCallId;if(!a)return;const l=i.find(O=>{var K;return(K=O.agentContent)==null?void 0:K.toolCalls.some(Y=>Y.toolCallId===a)}),u=i.find(O=>Xn(O.agentContent).some(K=>K.id===a)),m=e.messageId||(l==null?void 0:l.id)||(u==null?void 0:u.id)||(($=[...i].reverse().find(O=>O.role==="assistant"))==null?void 0:$.id);if(!m)return;const p=e.output,g=e.summary||(p&&p.trim()?p.trim().split(`
|
|
13
|
+
`)[0].slice(0,120):e.success?"执行成功":"执行失败");s(m,a,{status:e.success?"success":"error",summary:g,output:p,metadata:e.metadata});const x=i.find(O=>O.id===m),b=Xn(x==null?void 0:x.agentContent).find(O=>O.id===a),y=e.metadata,j=y&&typeof y.subagentSessionId=="string"?y.subagentSessionId:void 0,k=y&&typeof y.subagentStatus=="string"?y.subagentStatus:void 0,A=y&&typeof y.subagentType=="string"?y.subagentType:void 0,N=y&&typeof y.subagentSummary=="string"?y.subagentSummary:void 0,R=y&&typeof y.subagentResumedFrom=="string"?y.subagentResumedFrom:void 0,J=y&&typeof y.subagentRootId=="string"?y.subagentRootId:void 0,T=y&&typeof y.subagentResumeDepth=="number"?y.subagentResumeDepth:void 0,C=(y==null?void 0:y.verificationVerdict)==="pass"||(y==null?void 0:y.verificationVerdict)==="fail"||(y==null?void 0:y.verificationVerdict)==="partial"?y.verificationVerdict:void 0;b&&o(m,b.id,{sessionId:b.sessionId||j,type:A||b.type,status:k?Ju(k):e.success?"completed":"failed",resumedFrom:R||b.resumedFrom,rootAgentId:J||b.rootAgentId,resumeDepth:T??b.resumeDepth,verificationVerdict:C??b.verificationVerdict}),j&&k&&n(O=>({messages:O.messages.map(K=>{if(K.id!==m)return K;const Y=K.metadata??{},P=Array.isArray(Y.subtaskRefs)?Y.subtaskRefs:[],B=P.findIndex(be=>be.childSessionId===j||be.subagentId===a),M=B>=0?P[B]:Y.subtaskRef??{},de={...M,subagentId:a,childSessionId:j,agentType:A||(typeof(M==null?void 0:M.agentType)=="string"?M.agentType:"subagent"),status:k,summary:N||(typeof(M==null?void 0:M.summary)=="string"?M.summary:""),resumedFrom:R||(typeof(M==null?void 0:M.resumedFrom)=="string"?M.resumedFrom:void 0),rootAgentId:J||(typeof(M==null?void 0:M.rootAgentId)=="string"?M.rootAgentId:j),resumeDepth:T??(typeof(M==null?void 0:M.resumeDepth)=="number"?M.resumeDepth:0),verificationVerdict:C||(typeof(M==null?void 0:M.verificationVerdict)=="string"?M.verificationVerdict:void 0)},we=[...P];return B>=0?we[B]=de:we.push(de),{...K,metadata:{...Y,subtaskRef:de,subtaskRefs:we}}})}))},g5=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=Wt(t,n,e.messageId||`mcp-catalog-${String(e.revision)}`);if(!o)return;const i=Array.isArray(e.added)?e.added.map(String):[],a=Array.isArray(e.removed)?e.removed.map(String):[],l=Array.isArray(e.updated)?e.updated.map(String):[],u=`MCP catalog r${String(e.revision)}: +${i.length} -${a.length} ~${l.length}`;s(o,{toolCallId:`mcp-catalog:${String(e.revision)}`,toolName:"MCP Catalog",arguments:JSON.stringify({serverName:e.serverName,added:i,removed:a,updated:l}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:u,output:[i.length>0?`Added: ${i.join(", ")}`:"",a.length>0?`Removed: ${a.join(", ")}`:"",l.length>0?`Updated: ${l.join(", ")}`:""].filter(Boolean).join(`
|
|
14
|
+
`)})},h5=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=Wt(t,n,e.messageId||`mcp-content-${String(e.revision)}`);if(!o)return;const i=Array.isArray(e.added)?e.added.map(String):[],a=Array.isArray(e.removed)?e.removed.map(String):[],l=Array.isArray(e.updated)?e.updated.map(String):[],u=`MCP ${String(e.contentKind)} r${String(e.revision)}: +${i.length} -${a.length} ~${l.length}`;s(o,{toolCallId:`mcp-content:${String(e.revision)}`,toolName:"MCP Content",arguments:JSON.stringify({serverName:e.serverName,contentKind:e.contentKind,added:i,removed:a,updated:l}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:u,output:[i.length>0?`Added: ${i.join(", ")}`:"",a.length>0?`Removed: ${a.join(", ")}`:"",l.length>0?`Updated: ${l.join(", ")}`:""].filter(Boolean).join(`
|
|
15
|
+
`)})},b5=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=Wt(t,n,e.messageId||`mcp-resource-${String(e.revision)}`);o&&s(o,{toolCallId:`mcp-resource:${String(e.revision)}`,toolName:"MCP Resource",arguments:JSON.stringify({serverName:e.serverName,uri:e.uri}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`MCP resource updated: ${String(e.uri)}`,output:`${String(e.serverName)} · revision ${String(e.revision)}`})},k5=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=Wt(t,n,e.messageId||`mcp-connection-${String(e.revision)}`);if(!o)return;const i=String(e.phase),a=`MCP ${String(e.serverName)} ${i}`+(i==="reconnecting"?` (${String(e.attempt)}/${String(e.maxAttempts)})`:"");s(o,{toolCallId:`mcp-connection:${String(e.revision)}`,toolName:"MCP Connection",arguments:JSON.stringify({serverName:e.serverName,phase:i,reason:e.reason,attempt:e.attempt,maxAttempts:e.maxAttempts}),toolKind:"readonly",status:i==="failed"?"error":"success",startTime:Date.now(),summary:a,output:[`Reason: ${String(e.reason)}`,e.error?`Error: ${String(e.error)}`:""].filter(Boolean).join(`
|
|
16
|
+
`)})},x5=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=Wt(t,n,e.messageId||`mcp-log-${String(e.revision)}`);if(!o)return;const i=String(e.level),a=typeof e.logger=="string"?e.logger:void 0,l=`MCP ${i} · ${String(e.serverName)}`+(a?` · ${a}`:"");s(o,{toolCallId:`mcp-log:${String(e.revision)}`,toolName:"MCP Log",arguments:JSON.stringify({serverName:e.serverName,level:i,logger:a}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:l,output:[String(e.message),`SHA-256: ${String(e.dataSha256)}`,e.truncated===!0?"Truncated":"",e.detailsOmitted===!0?"Details omitted by runtime policy":""].filter(Boolean).join(`
|
|
17
|
+
`)})},y5=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=String(e.serverName),i=String(e.action),a=Wt(t,n,e.messageId||`mcp-instructions-${String(e.revision)}-${o}`);if(!a)return;const l=`MCP instructions ${i}: ${o}`+(e.truncated===!0?" (truncated)":"");s(a,{toolCallId:`mcp-instructions:${String(e.revision)}:${o}:${i}`,toolName:"MCP Instructions",arguments:JSON.stringify({serverName:o,action:i,reason:e.reason}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:l,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(`
|
|
18
|
+
`)})},S5=(e,t,n)=>{var x,b;const{currentSessionId:r,appendToolCall:s,updateToolCall:o}=t();if(e.sessionId!==r)return;const i=String(e.taskId),a=String(e.status),l=`mcp-task:${i}`,u=Wt(t,n,e.messageId||`mcp-task-${i}`);if(!u)return;const m=`MCP task ${a}: ${i} · ${String(e.serverName)}/${String(e.toolName)}`,p={status:a==="failed"||a==="cancelled"?"error":a==="completed"?"success":"running",summary:m,output:[typeof e.statusMessage=="string"?e.statusMessage:"",e.hasResult===!0?"Result available via TaskOutput":"",typeof e.error=="string"?`Error: ${e.error}`:""].filter(Boolean).join(`
|
|
19
|
+
`)};if((b=(x=t().messages.find(y=>y.id===u))==null?void 0:x.agentContent)==null?void 0:b.toolCalls.some(y=>y.toolCallId===l)){o(u,l,p);return}s(u,{toolCallId:l,toolName:"MCP Task",arguments:JSON.stringify({taskId:i,serverName:e.serverName,toolName:e.toolName}),toolKind:"readonly",status:p.status,startTime:Number(e.createdAt)||Date.now(),summary:p.summary,output:p.output})},v5=(e,t,n)=>{const{currentSessionId:r,appendToolCall:s}=t();if(e.sessionId!==r)return;const o=Array.isArray(e.files)?e.files.filter(u=>!!u&&typeof u=="object"&&!Array.isArray(u)):[],i=Wt(t,n,e.messageId||`project-rules-${Date.now()}`);if(!i)return;const a=e.blockedWrite===!0,l=`Project rules loaded: ${o.length}`+(a?" (write retry required)":"");s(i,{toolCallId:`project-rules:${o.map(u=>String(u.id)).join(",")}`,toolName:"Project Rules",arguments:JSON.stringify({triggerPaths:e.triggerPaths,blockedWrite:a}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:l,output:o.map(u=>`${String(u.relativePath)} ${String(u.source)} SHA-256: ${String(u.contentSha256)}`).join(`
|
|
20
|
+
`)})},Qu=e=>`user-shell-${e}`,w5=(e,t,n)=>{const{currentSessionId:r,addMessage:s,messages:o,updateMessage:i}=t();if(e.sessionId!==r||typeof e.executionId!="string"||typeof e.command!="string")return;const a=Qu(e.executionId),l={id:a,role:"user",content:`! ${e.command}`,timestamp:Date.now(),metadata:{userShellExecution:{executionId:e.executionId,command:e.command,status:"running",output:""}}};o.some(u=>u.id===a)?i(a,l):s(l),e.auxiliary!==!0&&n({isStreaming:!0,agentPhase:"running",error:null,errorContext:null})},I5=(e,t)=>{var u;const{currentSessionId:n,messages:r,updateMessage:s}=t();if(e.sessionId!==n||typeof e.executionId!="string"||typeof e.chunk!="string")return;const o=Qu(e.executionId),i=r.find(m=>m.id===o);if(!i)return;const a=(u=i.metadata)!=null&&u.userShellExecution&&typeof i.metadata.userShellExecution=="object"?i.metadata.userShellExecution:{},l=`${typeof a.output=="string"?a.output:""}${e.chunk}`;s(o,{content:`! ${String(a.command??"")}
|
|
21
|
+
${l}`,metadata:{...i.metadata,userShellExecution:{...a,output:l,streamTruncated:e.streamTruncated===!0}}})},C5=(e,t,n)=>{const{currentSessionId:r,messages:s,addMessage:o,updateMessage:i}=t();if(e.sessionId!==r||typeof e.executionId!="string"||!e.record||typeof e.record!="object"||Array.isArray(e.record))return;const a=e.record,l=typeof a.command=="string"?a.command:"",u=typeof a.stdout=="string"?a.stdout:"",m=typeof a.stderr=="string"?a.stderr:"",p=[u,m?`stderr:
|
|
22
|
+
${m}`:""].filter(Boolean).join(`
|
|
23
|
+
`),g=Qu(e.executionId),x={role:"user",content:[`! ${l}`,p||"(no output)"].join(`
|
|
24
|
+
`),metadata:{userShellCommand:a}};s.some(b=>b.id===g)?i(g,x):o({id:g,...x,timestamp:Date.now()}),e.auxiliary!==!0&&n({isStreaming:!1,isStopping:!1,agentPhase:"idle"}),(e.delivery==="current_turn"||e.delivery==="next_turn")&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):0,pendingInputDelivery:e.delivery==="current_turn"?"current_turn":"next_turn"})},j5=(e,t)=>{const{currentSessionId:n,updateTokenUsage:r,setMaxContextTokens:s}=t();e.sessionId===n&&(r({inputTokens:e.inputTokens,outputTokens:e.outputTokens,totalTokens:e.totalTokens,cacheReadTokens:e.cacheReadTokens??0,cacheWriteTokens:e.cacheWriteTokens??0,costUsd:e.costUsd}),e.maxContextTokens&&s(e.maxContextTokens,!1))},T5=(e,t)=>{const{currentSessionId:n,setTasks:r,currentAssistantMessageId:s}=t();if(e.sessionId!==n||!s)return;const o=e.tasks||[];r(s,o)},A5=(e,t)=>{const{currentSessionId:n,setSubagent:r,currentAssistantMessageId:s}=t();if(e.sessionId!==n||!s)return;const o={id:Na({explicitId:e.subagentId,sessionId:e.subagentSessionId,messageId:s,agentType:e.type,description:e.description}),type:e.type||"unknown",description:e.description||"",status:"running",startTime:Date.now(),sessionId:e.subagentSessionId,resumedFrom:e.resumedFrom,rootAgentId:e.rootAgentId,resumeDepth:typeof e.resumeDepth=="number"?e.resumeDepth:void 0};r(s,o)},E5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.subagentSessionId,a=ht(s,i,r);a&&o(a.messageId,a.subagent.id,{sessionId:a.subagent.sessionId||i,currentTool:e.toolName})},P5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.delta;if(!i)return;const a=e.subagentSessionId,l=ht(s,a,r);l&&o(l.messageId,l.subagent.id,u=>({sessionId:u.sessionId||a,output:(u.output||"")+i}))},N5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.delta;if(!i)return;const a=e.subagentSessionId,l=ht(s,a,r);l&&o(l.messageId,l.subagent.id,u=>({sessionId:u.sessionId||a,thinking:(u.thinking||"")+i}))},$5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.subagentSessionId,a=ht(s,i,r);a&&o(a.messageId,a.subagent.id,{sessionId:a.subagent.sessionId||i,status:e.success?"completed":"failed",currentTool:void 0,verificationVerdict:e.verificationVerdict==="pass"||e.verificationVerdict==="fail"||e.verificationVerdict==="partial"?e.verificationVerdict:a.subagent.verificationVerdict})},R5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.toolCallId,a=e.toolName;if(!i||!a)return;const l=e.subagentSessionId,u=ht(s,l,r);if(!u)return;const m={toolCallId:i,toolName:a,arguments:e.arguments,toolKind:e.toolKind,status:"running",startTime:Date.now()};o(u.messageId,u.subagent.id,p=>{const g=p.toolCalls||[];return{sessionId:p.sessionId||l,currentTool:a,toolCalls:g.some(x=>x.toolCallId===i)?g:[...g,m]}})},O5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.toolCallId;if(!i)return;const a=e.toolName,l=e.subagentSessionId,u=ht(s,l,r);if(!u)return;const m=e.output,p=e.success===!0,g=p?"success":"error",x=e.summary||(m&&m.trim()?m.trim().split(`
|
|
25
|
+
`)[0].slice(0,120):p?"执行成功":"执行失败");o(u.messageId,u.subagent.id,b=>({sessionId:b.sessionId||l,currentTool:b.currentTool===a?void 0:b.currentTool,toolCalls:(b.toolCalls||[]).map(y=>y.toolCallId===i?{...y,status:g,summary:x,output:m,metadata:e.metadata}:y)}))},M5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=e.toolCallId;if(!i)return;const a=ht(s,e.subagentSessionId,r);a&&o(a.messageId,a.subagent.id,l=>({toolCalls:(l.toolCalls||[]).map(u=>u.toolCallId===i?{...u,summary:e.message,progress:typeof e.progress=="number"?e.progress:void 0,progressTotal:typeof e.total=="number"?e.total:void 0,progressMessage:e.message}:u)}))},F5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=ht(s,e.subagentSessionId,r);if(!i)return;const a=Array.isArray(e.added)?e.added.map(String):[],l=Array.isArray(e.removed)?e.removed.map(String):[],u=Array.isArray(e.updated)?e.updated.map(String):[],m=`mcp-catalog:${String(e.revision)}`;o(i.messageId,i.subagent.id,p=>({toolCalls:[...(p.toolCalls||[]).filter(g=>g.toolCallId!==m),{toolCallId:m,toolName:"MCP Catalog",arguments:JSON.stringify({serverName:e.serverName,added:a,removed:l,updated:u}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`MCP catalog r${String(e.revision)}: +${a.length} -${l.length} ~${u.length}`,output:[a.length>0?`Added: ${a.join(", ")}`:"",l.length>0?`Removed: ${l.join(", ")}`:"",u.length>0?`Updated: ${u.join(", ")}`:""].filter(Boolean).join(`
|
|
26
|
+
`)}]}))},D5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=ht(s,e.subagentSessionId,r);if(!i)return;const a=Array.isArray(e.added)?e.added.map(String):[],l=Array.isArray(e.removed)?e.removed.map(String):[],u=Array.isArray(e.updated)?e.updated.map(String):[],m=`mcp-content:${String(e.revision)}`;o(i.messageId,i.subagent.id,p=>({toolCalls:[...(p.toolCalls||[]).filter(g=>g.toolCallId!==m),{toolCallId:m,toolName:"MCP Content",arguments:JSON.stringify({serverName:e.serverName,contentKind:e.contentKind,added:a,removed:l,updated:u}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`MCP ${String(e.contentKind)} r${String(e.revision)}: +${a.length} -${l.length} ~${u.length}`}]}))},_5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=ht(s,e.subagentSessionId,r);if(!i)return;const a=`mcp-resource:${String(e.revision)}`;o(i.messageId,i.subagent.id,l=>({toolCalls:[...(l.toolCalls||[]).filter(u=>u.toolCallId!==a),{toolCallId:a,toolName:"MCP Resource",arguments:JSON.stringify({serverName:e.serverName,uri:e.uri}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`MCP resource updated: ${String(e.uri)}`}]}))},L5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=ht(s,e.subagentSessionId,r);if(!i)return;const a=String(e.phase),l=`mcp-connection:${String(e.revision)}`;o(i.messageId,i.subagent.id,u=>({toolCalls:[...(u.toolCalls||[]).filter(m=>m.toolCallId!==l),{toolCallId:l,toolName:"MCP Connection",arguments:JSON.stringify({serverName:e.serverName,phase:a,reason:e.reason,attempt:e.attempt,maxAttempts:e.maxAttempts}),toolKind:"readonly",status:a==="failed"?"error":"success",startTime:Date.now(),summary:`MCP ${String(e.serverName)} ${a}`+(a==="reconnecting"?` (${String(e.attempt)}/${String(e.maxAttempts)})`:""),output:e.error?`Error: ${String(e.error)}`:void 0}]}))},U5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=ht(s,e.subagentSessionId,r);if(!i)return;const a=String(e.level),l=typeof e.logger=="string"?e.logger:void 0,u=`mcp-log:${String(e.revision)}`;o(i.messageId,i.subagent.id,m=>({toolCalls:[...(m.toolCalls||[]).filter(p=>p.toolCallId!==u),{toolCallId:u,toolName:"MCP Log",arguments:JSON.stringify({serverName:e.serverName,level:a,logger:l}),toolKind:"readonly",status:"success",startTime:Date.now(),summary:`MCP ${a} · ${String(e.serverName)}`+(l?` · ${l}`:""),output:[String(e.message),`SHA-256: ${String(e.dataSha256)}`,e.truncated===!0?"Truncated":"",e.detailsOmitted===!0?"Details omitted by runtime policy":""].filter(Boolean).join(`
|
|
27
|
+
`)}]}))},B5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=ht(s,e.subagentSessionId,r);if(!i)return;const a=String(e.serverName),l=String(e.action),u=`mcp-instructions:${String(e.revision)}:${a}:${l}`;o(i.messageId,i.subagent.id,m=>({toolCalls:[...(m.toolCalls||[]).filter(p=>p.toolCallId!==u),{toolCallId:u,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
|
+
`)}]}))},H5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=ht(s,e.subagentSessionId,r);if(!i)return;const a=String(e.taskId),l=String(e.status),u=`mcp-task:${a}`;o(i.messageId,i.subagent.id,m=>({toolCalls:[...(m.toolCalls||[]).filter(p=>p.toolCallId!==u),{toolCallId:u,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
|
+
`)}]}))},q5=(e,t)=>{const{currentSessionId:n,currentAssistantMessageId:r,messages:s,updateSubagent:o}=t();if(e.sessionId!==n)return;const i=ht(s,e.subagentSessionId,r);if(!i)return;const a=Array.isArray(e.files)?e.files.filter(u=>!!u&&typeof u=="object"&&!Array.isArray(u)):[],l=`project-rules:${a.map(u=>String(u.id)).join(",")}`;o(i.messageId,i.subagent.id,u=>({toolCalls:[...(u.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
|
+
`)}]}))},z5=(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(u=>({agentPhase:"waiting_permission",isStreaming:!0,sessions:u.sessions.map(m=>m.sessionId===e.sessionId&&m.projectPath===e.projectPath?{...m,pendingInteraction:{type:"permission",requestId:o}}:m)}))},K5=(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,u=o.find(y=>{var j,k;return((k=(j=y.agentContent)==null?void 0:j.confirmation)==null?void 0:k.toolCallId)===l}),m=(x=u==null?void 0:u.agentContent)==null?void 0:x.confirmation;u&&(m==null?void 0:m.status)==="pending"&&i(u.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}:{}}})},G5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"running"})},V5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"compacting"})},W5=(e,t,n)=>{e.sessionId===t().currentSessionId&&(t().resetContextUsage(),n({agentPhase:"running"}))},J5=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({agentPhase:"switching_model"})},Q5=(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)})))},Y5=(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(u=>u.sessionId===e.sessionId&&u.projectPath===e.projectPath?{...u,pendingInteraction:{type:"elicitation",requestId:o}}:u)})))},X5=(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})}))},Z5=(e,t)=>{const{currentSessionId:n,endAgentResponse:r}=t();e.sessionId===n&&r()},e2=(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=Yx(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()},t2=(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})},n2=(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 u=(m=l.agentContent)==null?void 0:m.elicitation;return(u==null?void 0:u.status)!=="pending"||!l.agentContent?l:{...l,agentContent:{...l.agentContent,elicitation:{...u,status:"cancelled"}}}})}));for(const a of o)for(const l of Xn(a.agentContent))l.status==="running"&&i(a.id,l.id,{status:"failed"});s()}},r2=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):1,pendingInputDelivery:"current_turn"})},s2=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({pendingSteeringCount:typeof e.queued=="number"?Math.max(0,e.queued):1,pendingInputDelivery:"next_turn"})},o2=(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})},i2=(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})},a2=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:e.goal??null})},c2=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:null})},l2=(e,t,n)=>{e.sessionId===t().currentSessionId&&n({goal:e.goal??t().goal,isStreaming:!0,agentPhase:"running"})},u2=(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:Si(s),isStreaming:!1,isStopping:!1,agentPhase:"idle",currentRunId:null,pendingSteeringCount:0,pendingInputDelivery:null,recoveredSteeringCount:0,currentAssistantMessageId:null,hasToolCalls:!1})},d2=(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)},f2=(e,t,n)=>{Zx({...e,messageId:`review-${String(e.reviewId??"active")}`,arguments:"{}"},t,n)},m2=(e,t,n)=>{ey(e,t)},p2=(e,t,n)=>{ty(e,t,n)},pi={"message.created":l5,"message.delta":u5,"message.complete":d5,"structured.output":f5,"thinking.delta":m5,"thinking.completed":p5,"tool.start":Zx,"tool.progress":ey,"tool.result":ty,"mcp.catalog.changed":g5,"mcp.content.changed":h5,"mcp.resource.updated":b5,"mcp.connection.changed":k5,"mcp.log":x5,"mcp.instructions.changed":y5,"mcp.task.changed":S5,"project.rules.loaded":v5,"user.shell.started":w5,"user.shell.output":I5,"user.shell.completed":C5,"token.usage":j5,"task.updated":T5,"subagent.start":A5,"subagent.update":E5,"subagent.delta":P5,"subagent.thinking.delta":N5,"subagent.tool.start":R5,"subagent.tool.progress":M5,"subagent.tool.result":O5,"subagent.mcp.catalog.changed":F5,"subagent.mcp.content.changed":D5,"subagent.mcp.resource.updated":_5,"subagent.mcp.connection.changed":L5,"subagent.mcp.log":U5,"subagent.mcp.instructions.changed":B5,"subagent.mcp.task.changed":H5,"subagent.project.rules.loaded":q5,"subagent.complete":$5,"permission.asked":z5,"permission.timeout":K5,"turn.started":G5,"compaction.started":V5,"compaction.completed":W5,"model.fallback":J5,"question.required":Q5,"elicitation.required":Y5,"interaction.resolved":X5,"session.completed":Z5,"session.error":e2,"session.status":t2,"run.cancelled":n2,"steering.queued":r2,"follow_up.queued":s2,"follow_up.started":i2,"steering.applied":o2,"goal.updated":a2,"goal.cleared":c2,"goal.continuation.started":l2,"session.rewound":u2,"review.tool.started":f2,"review.tool.progress":m2,"review.tool.completed":p2,"review.completed":d2},g2=new Set(["message.delta","thinking.delta","subagent.delta","subagent.thinking.delta"]),h2=new Set(["message.complete","thinking.completed","session.completed","session.error","run.cancelled"]),lf=(e,t)=>n=>{const r=e().currentSessionRef,s=n.properties;if(!r||s.sessionId!==r.sessionId||s.projectPath!==r.projectPath)return;if(g2.has(n.type)||console.log("[SSE Event]",n.type,n.properties),h2.has(n.type)){vn.drainAll();const i=pi[n.type];i&&i(n.properties,e,t);return}if(n.type==="tool.start"&&vn.drainAll(),n.type==="message.delta"){const{currentSessionId:i,currentAssistantMessageId:a,hasToolCalls:l}=e();if(s.sessionId!==i)return;const u=s.messageId||a,m=s.delta;if(!a){const x=pi["message.delta"];x&&x(s,e,t);return}const p=l?"after":"before",g=`content:${u}:${p}`;vn.drainAllExcept(g),vn.append(g,m,x=>{const{appendDelta:b}=e();u&&b(u,x,p)});return}if(n.type==="thinking.delta"){const{currentSessionId:i,currentAssistantMessageId:a}=e();if(s.sessionId!==i)return;if(!a){const p=pi["thinking.delta"];p&&p(s,e,t);return}const l=s.delta,u=s.messageId||a,m=`thinking:${u}`;vn.drainAllExcept(m),vn.append(m,l,p=>{const{appendThinking:g}=e();u&&g(u,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||"",u=`subagent:${l}`,{currentAssistantMessageId:m,messages:p}=e(),g=ht(p,l||void 0,m);vn.append(u,a,x=>{const{currentAssistantMessageId:b,messages:y,updateSubagent:j}=e(),k=g||ht(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||"",u=`subagent-thinking:${l}`,{currentAssistantMessageId:m,messages:p}=e(),g=ht(p,l||void 0,m);vn.append(u,a,x=>{const{currentAssistantMessageId:b,messages:y,updateSubagent:j}=e(),k=g||ht(y,l||void 0,b);k&&j(k.messageId,k.subagent.id,A=>({sessionId:A.sessionId||l,thinking:(A.thinking||"")+x}))});return}const o=pi[n.type];o&&o(n.properties,e,t)},b2=(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??lf(t,e);let a=null,l="connecting";return a=await re.openEventSubscription(s,i,{onConnectionStateChange:u=>{l=u,a&&r===a&&e({sessionEventConnectionState:u})}}),n.set(a,l),a},replaceEventSubscription:s=>{const o=t().eventUnsubscribe;if(r=s,e({eventUnsubscribe:s,sessionEventConnectionState:s?n.get(s)??"connected":"idle"}),vn.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:()=>{vn.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{vn.reset()}},handleEvent:s=>{lf(t,e)(s)}}};function k2(e){var t;return((t=e.taskPromptSummary)==null?void 0:t.trimStart().startsWith("/review"))===!0}function Yu(e,t){var r;const n=(r=e.taskStatusReason)==null?void 0:r.trim();if(k2(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(Xx(e.taskFailure.code)):n==="user-cancel"?t("session.reason.cancelledByUser"):n||void 0}const x2=e=>e==="system"?typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches:e==="dark",vi=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"},ho=Ea((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(zt("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}),vi(s)}catch(n){e({error:n.message,isLoading:!1})}},updateSettings:async n=>{const r=t();e({...n,error:null}),n.uiTheme&&vi(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(zt("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&&vi(r.uiTheme)}}}));vi(ln.uiTheme);const z_=()=>ho(e=>x2(e.uiTheme)),ny="blade.projects.selected";function uf(){return typeof localStorage>"u"?null:localStorage.getItem(ny)}function gi(e){typeof localStorage<"u"&&localStorage.setItem(ny,e)}const y2=new Set(["queued","running","completed","failed","cancelled","interrupted"]),ec=new Set(["default","autoEdit","yolo","plan"]),df=new Set(["auto","off","minimal","low","medium","high","xhigh","max"]),ff=new Set(["auto","standard","fast","flex"]),mf=new Set(["auto","low","medium","high"]),pf=new Set(["auto","pragmatic","friendly","explanatory"]);function S2(e){return typeof e=="string"&&y2.has(e)}function v2(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 gf(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Yx(t.code);if(!(!n||typeof t.message!="string"||typeof t.retryable!="boolean"))return{code:n,message:zt(Xx(n)),retryable:i5(n)}}function w2(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 hs(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:void 0}const I2=(e,t)=>{let n=null,r=!1,s=!1,o=0;const i=new Map,a=u=>{const m=qe(u),p=++o;i.set(m,p),re.getSession(u).then(g=>{i.get(m)===p&&e(x=>({sessions:wn(x.sessions,g)}))}).catch(()=>{i.get(m)===p&&t().loadSessions()}).finally(()=>{i.get(m)===p&&i.delete(m)})},l=u=>{const m=qe(u),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:uf(),isDispatchingTask:!1,isBindingProject:!1,cancellingTaskKeys:[],retryingTaskKeys:[],taskDeliveryActions:{},unreadTaskKeys:YD(),handleTaskEvent:u=>{if(u.type==="session.created"){const T=u.properties.sessionId,C=u.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;a({sessionId:T,projectPath:C});return}if(u.type==="session.deleted"){const T=u.properties.sessionId,C=u.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;const $={sessionId:T,projectPath:C};l($),t().removeSession($);return}if(u.type==="session.archived"){const T=u.properties.sessionId,C=u.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;const $={sessionId:T,projectPath:C};l($),t().removeSession($),t().loadArchivedSessions();return}if(u.type==="session.unarchived"){const T=u.properties.sessionId,C=u.properties.projectPath;if(typeof T!="string"||typeof C!="string")return;a({sessionId:T,projectPath:C}),t().loadArchivedSessions();return}if(u.type==="session.updated"){const T=u.properties.sessionId,C=u.properties.projectPath,$=u.properties.title,O=u.properties.selectedModelId,K=u.properties.permissionMode,Y=u.properties.reasoningEffort,P=u.properties.serviceTier,B=u.properties.responseVerbosity,M=u.properties.communicationStyle;if(typeof T!="string"||typeof C!="string"||!(typeof $=="string"&&$.trim()||typeof O=="string"&&O.trim()||ec.has(K)||df.has(Y)||ff.has(P)||mf.has(B)||pf.has(M)))return;const de={sessionId:T,projectPath:C};if(se(t().currentSessionRef,de)&&ec.has(K)&&Et.getState().setMode(K),!t().sessions.some(be=>se(me(be),de))){a(de);return}e(be=>({sessions:be.sessions.map(ae=>se({sessionId:ae.sessionId,projectPath:ae.projectPath},de)?{...ae,...typeof $=="string"&&$.trim()?{title:$}:{},...typeof O=="string"&&O.trim()?{selectedModelId:O}:{},...ec.has(K)?{permissionMode:K}:{},...df.has(Y)?{reasoningEffort:Y}:{},...ff.has(P)?{serviceTier:P}:{},...mf.has(B)?{responseVerbosity:B}:{},...pf.has(M)?{communicationStyle:M}:{}}:ae)}));return}if(u.type==="task.delivery"){const T=u.properties.sessionId,C=u.properties.projectPath,$=w2(u.properties.taskDelivery);if(typeof T!="string"||typeof C!="string"||!$)return;const O={sessionId:T,projectPath:C},K=u.properties.taskWorktreeRemoved===!0;e(Y=>({sessions:Y.sessions.map(P=>se(me(P),O)?{...P,taskDelivery:$,...K?{taskWorktreePath:void 0,taskWorktreeBranch:void 0}:{},lastMessageTime:typeof u.properties.updatedAt=="string"?u.properties.updatedAt:P.lastMessageTime}:P)}));return}if(u.type==="interaction.pending"){const T=u.properties.sessionId,C=u.properties.projectPath,$=u.properties.interactionType,O=u.properties.requestId;if(typeof T!="string"||typeof C!="string"||$!=="permission"&&$!=="question"&&$!=="elicitation"||typeof O!="string"||!O)return;const K={sessionId:T,projectPath:C},Y=t().sessions.find(B=>se(me(B),K));if(!Y){t().loadSessions();return}if(e(B=>({sessions:B.sessions.map(M=>se(me(M),K)?{...M,pendingInteraction:{type:$,requestId:O}}:M)})),!(typeof document<"u"&&document.visibilityState==="visible"&&se(t().currentSessionRef,K))&&ho.getState().notifyErrors){const M=Y.title??Y.sessionId??T;af({ref:K,title:`Blade · ${zt($==="question"?"attention.notification.question":$==="elicitation"?"attention.notification.elicitation":"attention.notification.permission")}`,body:M,onOpen:de=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(Di,{detail:de})))}})}return}if(u.type==="interaction.resolved"){const T=u.properties.sessionId,C=u.properties.projectPath,$=u.properties.requestId;if(typeof T!="string"||typeof C!="string"||typeof $!="string")return;const O={sessionId:T,projectPath:C};e(K=>({sessions:K.sessions.map(Y=>{var P;return se(me(Y),O)&&((P=Y.pendingInteraction)==null?void 0:P.requestId)===$?{...Y,pendingInteraction:void 0}:Y})}));return}if(u.type!=="task.status")return;const m=u.properties.sessionId,p=u.properties.projectPath,g=u.properties.taskStatus;if(typeof m!="string"||typeof p!="string"||!S2(g))return;const x={sessionId:m,projectPath:p},b=hs(u.properties.taskInFlight,0),y=hs(u.properties.taskQueueDepth,0),j=hs(u.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=>se(me(T),x)),A=typeof document<"u"&&document.visibilityState==="visible"&&se(t().currentSessionRef,x),N=QD(k==null?void 0:k.taskStatus,g,A),R=qe(x),J=!t().unreadTaskKeys.includes(R);if(N&&J){e($=>{const O=[...$.unreadTaskKeys,R];return ao(O),{unreadTaskKeys:O}});const T=ho.getState();if(T.notifySounds&&Vx(g)&&XD(g),g==="completed"?T.notifyBuild:T.notifyErrors){const $=zt(g==="completed"?"attention.notification.completed":g==="failed"?"attention.notification.failed":"attention.notification.interrupted"),O=gf(u.properties.taskFailure),K=k?Yu({...k,taskStatus:g,taskFailure:O??k.taskFailure,taskStatusReason:typeof u.properties.taskStatusReason=="string"?u.properties.taskStatusReason:k.taskStatusReason,taskPromptSummary:typeof u.properties.taskPromptSummary=="string"?u.properties.taskPromptSummary:k.taskPromptSummary},zt):(O==null?void 0:O.message)??(typeof u.properties.taskStatusReason=="string"?u.properties.taskStatusReason:void 0),Y=(k==null?void 0:k.title)??(k==null?void 0:k.sessionId)??m;af({ref:x,title:`Blade · ${$}`,body:K?`${Y} · ${K}`:Y,onOpen:P=>{typeof window>"u"||(window.focus(),window.dispatchEvent(new CustomEvent(Di,{detail:P})))}})}}if(!k){a(x);return}e(T=>({sessions:T.sessions.map(C=>se({sessionId:C.sessionId,projectPath:C.projectPath},x)?{...C,taskStatus:g,taskStatusReason:typeof u.properties.taskStatusReason=="string"?u.properties.taskStatusReason:void 0,taskFailure:g==="failed"?gf(u.properties.taskFailure)??C.taskFailure:void 0,taskPromptSummary:typeof u.properties.taskPromptSummary=="string"?u.properties.taskPromptSummary:C.taskPromptSummary,taskStartedAt:typeof u.properties.taskStartedAt=="string"?u.properties.taskStartedAt:g==="queued"?void 0:C.taskStartedAt,taskCompletedAt:typeof u.properties.taskCompletedAt=="string"?u.properties.taskCompletedAt:g==="queued"||g==="running"?void 0:C.taskCompletedAt,taskDiffStat:v2(u.properties.taskDiffStat)??C.taskDiffStat,taskQueuePosition:g==="queued"?hs(u.properties.taskQueuePosition,1)??C.taskQueuePosition:void 0,taskQueueDepth:g==="queued"?hs(u.properties.taskQueueDepth,0)??C.taskQueueDepth:void 0,taskConcurrencyLimit:hs(u.properties.taskConcurrencyLimit,1)??C.taskConcurrencyLimit,lastMessageTime:typeof u.properties.updatedAt=="string"?u.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 u=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(),Et.getState().loadModels()]))}});if(!r||t().taskEventUnsubscribe){u();return}e({taskEventUnsubscribe:u})}catch(u){throw s=!0,e({taskEventsConnected:!1,taskEventConnectionState:"offline"}),u}})();try{await n}finally{n=null}}},reconnectTaskEvents:async()=>{s=!0,t().unsubscribeFromTaskEvents(),await t().subscribeToTaskEvents()},unsubscribeFromTaskEvents:()=>{var u,m;r=!1,(m=(u=t()).taskEventUnsubscribe)==null||m.call(u),e({taskEventUnsubscribe:null,taskEventsConnected:!1,taskEventConnectionState:"offline"})},loadTaskWorkspaceInfo:async()=>{e({isTaskWorkspaceLoading:!0,taskWorkspaceError:null});try{const u=await re.getWorkspaceInfo();e({taskWorkspaceInfo:u,isTaskWorkspaceLoading:!1})}catch(u){e({isTaskWorkspaceLoading:!1,taskWorkspaceError:u instanceof Error?u.message:"Failed to load task workspace"})}},loadBoundProjects:async()=>{try{const u=await re.listProjects(),m=uf(),p=u.find(g=>g.available&&g.path===m)??u.find(g=>g.isCurrent)??u.find(g=>g.available);p&&gi(p.path),e({boundProjects:u,selectedProjectPath:(p==null?void 0:p.path)??null})}catch(u){e({error:u instanceof Error?u.message:"Failed to load projects"})}},bindProject:async u=>{e({isBindingProject:!0,error:null});try{const m=await re.bindProject(u);gi(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 u=>{try{await re.unbindProject(u),e(m=>{const p=m.boundProjects.filter(x=>x.path!==u||x.isCurrent),g=m.selectedProjectPath===u?p.find(x=>x.isCurrent)??p.find(x=>x.available):void 0;return g&&gi(g.path),{boundProjects:p,...g?{selectedProjectPath:g.path}:{}}})}catch(m){throw e({error:m instanceof Error?m.message:"Failed to unbind project"}),m}},selectProject:u=>{gi(u),e({selectedProjectPath:u})},markTaskRead:u=>{const m=qe(u);e(p=>{const g=p.unreadTaskKeys.filter(x=>x!==m);return ao(g),{unreadTaskKeys:g}})},clearUnreadTasks:()=>{ao([]),e({unreadTaskKeys:[]})},cancelTask:async u=>{const m=qe(u);if(!t().cancellingTaskKeys.includes(m)){e(p=>({cancellingTaskKeys:[...p.cancellingTaskKeys,m],error:null,errorContext:null}));try{await re.abortSession(u);const p=se(t().currentSessionRef,u);p&&t().unsubscribeFromEvents(),e(g=>({sessions:g.sessions.map(x=>se(me(x),u)?{...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:u}}),p}finally{e(p=>({cancellingTaskKeys:p.cancellingTaskKeys.filter(g=>g!==m)}))}}},retryTask:async u=>{const m=qe(u);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(u);e(y=>({sessions:wn(y.sessions,b.session)})),t().markTaskRead(u),x()&&await t().selectSession(me(b.session))}catch(b){throw x()&&e({error:b instanceof Error?b.message:"Failed to retry task",errorContext:{kind:"task_action",sessionRef:u}}),b}finally{e(b=>({retryingTaskKeys:b.retryingTaskKeys.filter(y=>y!==m)}))}},deliverTask:async(u,m)=>{const p=qe(u);if(!t().taskDeliveryActions[p]){e(g=>({taskDeliveryActions:{...g.taskDeliveryActions,[p]:m},error:null,errorContext:null}));try{const g=await re.deliverTask(u,m);e(x=>({sessions:wn(x.sessions,g)})),t().markTaskRead(u)}catch(g){throw e({error:g instanceof Error?g.message:"Failed to deliver task changes",errorContext:{kind:"task_action",sessionRef:u}}),g}finally{e(g=>{const{[p]:x,...b}=g.taskDeliveryActions;return{taskDeliveryActions:b}})}}},dispatchTask:async u=>{const m=t().getNavigationVersion(),p=t().selectedProjectPath,g=u.projectPath??p??void 0,x=()=>t().getNavigationVersion()===m&&t().selectedProjectPath===p;e({isDispatchingTask:!0,error:null,errorContext:null});try{const b=await re.createTask({...u,projectPath:g});e(y=>({sessions:wn(y.sessions,b.session),isDispatchingTask:!1})),x()&&await t().selectSession(me(b.session))}catch(b){throw e({isDispatchingTask:!1,...x()?{error:b instanceof Error?b.message:"Failed to dispatch task"}:{}}),b}},startCodeReview:async u=>{const m=t().getNavigationVersion(),p=t().selectedProjectPath,g=u.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=me(b);await re.startCodeReview(j,{kind:u.kind,...u.ref?{ref:u.ref}:{},...u.instructions?{instructions:u.instructions}:{},...u.modelId?{modelId:u.modelId}:{}}),y=!0;const k={...b,taskStatus:"running",taskStatusReason:zt("taskHome.review.running"),taskPromptSummary:`/review ${u.kind}${u.ref?` ${u.ref}`:""}`};e(A=>({sessions:wn(A.sessions,k),isDispatchingTask:!1})),x()&&await t().selectSession(j)}catch(j){throw b&&!y&&await re.deleteSession(me(b)).catch(()=>{}),e({isDispatchingTask:!1,...x()?{error:j instanceof Error?j.message:zt("taskHome.review.startFailed")}:{}}),j}}}},C2=e=>({tokenUsage:eo,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=Ea()((...e)=>({...s5(...e),...I2(...e),...HD(...e),...b2(...e),...C2(...e)}));function j2(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function T2({open:e,onOpenChange:t}){const n=Mt(),r=L(T=>T.currentSessionRef),s=L(T=>T.isStreaming),o=L(T=>T.isTemporarySession),i=L(T=>T.rewindSession),[a,l]=v.useState([]),[u,m]=v.useState(null),[p,g]=v.useState(!1),[x,b]=v.useState(!1),[y,j]=v.useState(!1),[k,A]=v.useState(null);v.useEffect(()=>{if(!e||!r)return;let T=!1;return b(!0),A(null),l([]),m(null),g(!1),re.listRewindCheckpoints(r).then(C=>{var $;T||(l(C),m((($=C[0])==null?void 0:$.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=v.useMemo(()=>a.find(T=>T.messageId===u)??null,[a,u]),R=!!N&&!x&&!y&&!s&&!o,J=async()=>{if(!N||!R)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(Yc,{open:e,onOpenChange:t,children:c.jsxs(qi,{className:"max-w-[620px] gap-0 overflow-hidden border-[#E5E7EB] bg-white p-0 dark:border-zinc-800 dark:bg-[#09090b]",children:[c.jsx(Xc,{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(gd,{className:"h-4 w-4"})}),c.jsxs("div",{children:[c.jsx(zi,{className:"text-[15px] font-semibold text-[#111827] dark:text-zinc-100",children:n("chat.rewind.title")}),c.jsx(Ki,{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(ct,{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(gd,{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===u;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:j2(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(s0,{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(Kf,{className:"border-t border-[#E5E7EB] px-6 py-4 dark:border-zinc-800",children:[c.jsx(hr,{variant:"ghost",onClick:()=>t(!1),disabled:y,children:n("chat.rewind.cancel")}),c.jsxs(hr,{onClick:()=>void J(),disabled:!R,className:"bg-[#16A34A] text-white hover:bg-[#15803D]",children:[y?c.jsx(ct,{className:"mr-2 h-4 w-4 animate-spin"}):c.jsx(Hi,{className:"mr-2 h-4 w-4"}),n("chat.rewind.confirm")]})]})]})})}function ry({inFlight:e,queued:t,maxConcurrent:n,compact:r=!1,className:s}){const o=Mt(),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((u,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 hf(){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 sy=[{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 A2(e){const t=e.key.toLocaleLowerCase();return sy.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 E2(e){return e instanceof Element?!!e.closest('input, textarea, select, [contenteditable="true"], [role="textbox"], [role="combobox"]'):!1}function P2(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 N2(e,t){const n=e.key==="/"?"/":e.key.toLocaleUpperCase(),r=P2();return[...e.primaryModifier?[r?"⌘":"Ctrl"]:[],...e.shiftKey?[r?"⇧":"Shift"]:[],n]}function Lc(e,t){const n=sy.find(r=>r.id===e);return n?N2(n).join(""):""}const oy="blade.sidebar.view",iy="blade.preview.width",tc=640,$2=360,R2=960,O2=()=>{if(typeof localStorage>"u")return"project";const e=localStorage.getItem(oy);return e==="status"||e==="project"?e:"project"},ay=e=>Math.min(R2,Math.max($2,Math.round(e))),M2=()=>{if(typeof localStorage>"u")return tc;const e=localStorage.getItem(iy);if(!e)return tc;const t=Number(e);return Number.isFinite(t)?ay(t):tc},br=Ea(e=>({isSidebarOpen:!0,toggleSidebar:()=>e(t=>({isSidebarOpen:!t.isSidebarOpen})),setSidebarOpen:t=>e({isSidebarOpen:t}),sidebarView:O2(),setSidebarView:t=>{typeof localStorage<"u"&&localStorage.setItem(oy,t),e({sidebarView:t})},isFilePreviewOpen:!1,toggleFilePreview:()=>e(t=>({isFilePreviewOpen:!t.isFilePreviewOpen})),setFilePreviewOpen:t=>e({isFilePreviewOpen:t}),previewWidth:M2(),setPreviewWidth:t=>{const n=ay(t);typeof localStorage<"u"&&localStorage.setItem(iy,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 F2(){const e=br(r=>r.setTaskSwitcherOpen),t=br(r=>r.toggleSidebar),n=L(r=>r.startTemporarySession);v.useEffect(()=>{const r=s=>{if(s.repeat)return;const o=A2(s);if(!o)return;const i=br.getState(),a=i.isTaskSwitcherOpen,l=E2(s.target),u=!!document.querySelector('[role="dialog"]');if(o.id==="searchTasks"||o.id==="openCommands"){if(u&&!a)return;s.preventDefault();const m=o.id==="searchTasks"?"tasks":"commands",p=a&&i.taskSwitcherMode===m;e(!p,m);return}if(!(l||u)){if(o.id==="newTask"){s.preventDefault(),n(),requestAnimationFrame(()=>hf());return}if(o.id==="focusComposer"){hf()&&s.preventDefault();return}o.id==="toggleSidebar"&&(s.preventDefault(),t())}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,n,t])}const Xu=v.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Cf,{ref:r,className:W("overflow-hidden relative",e),...n,children:[c.jsx(Xy,{className:"h-full w-full rounded-[inherit] [&>div]:!block !overflow-auto",children:t}),c.jsx(cy,{}),c.jsx(Zy,{})]}));Xu.displayName=Cf.displayName;const cy=v.forwardRef(({className:e,orientation:t="vertical",...n},r)=>c.jsx(jf,{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(e0,{className:"relative flex-1 rounded-full bg-border"})}));cy.displayName=jf.displayName;function co(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 ly(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=n0,Vn=r0,Mn=v.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},s)=>c.jsx(t0,{children:c.jsx(Tf,{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=Tf.displayName;function D2(){const e=Mt(),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]=v.useState(!1),[u,m]=v.useState(null),[p,g]=v.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(Af,{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(no,{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(ct,{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(Xu,{className:"max-h-[340px]",children:c.jsx("div",{className:"divide-y divide-[hsl(var(--deck-hairline))]",children:t.map(b=>{var N;const y=me(b),j=qe(y),k=u===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:co(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 ly(y)}catch(R){i(R instanceof Error?R.message:"Session export failed")}finally{g(null)}},"aria-label":e("session.action.export",{title:co(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(ct,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Ef,{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:co(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(ct,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(o0,{className:"h-3.5 w-3.5"})})]})]},j)})})})]})]})}function Zu({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 bf={en:"sidebar.language.en",zh:"sidebar.language.zh"};function uy({className:e,variant:t="pill"}){const{locale:n,setLocale:r}=bS(),s=Mt();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(bf[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:fS.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(bf[o])},o)})})}const _2="[data-mobile-navigation-trigger]";function K_(e){return dy(_2,e)}function dy(e,t){const n=document.querySelector(e);return!n||n.getClientRects().length===0?!1:(t.preventDefault(),n.focus({preventScroll:!0}),!0)}function fy({open:e,onOpenChange:t}){const n=Mt(),{boundProjects:r,selectedProjectPath:s,isBindingProject:o,loadBoundProjects:i,bindProject:a,unbindProject:l,selectProject:u,startTemporarySession:m}=L(),[p,g]=v.useState(""),[x,b]=v.useState(null),[y,j]=v.useState(!1),k=v.useRef(0);v.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"))}}},R=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)}},J=T=>{u(T),m(),t(!1)};return e?c.jsx(Yc,{open:e,onOpenChange:t,children:c.jsxs(qi,{onCloseAutoFocus:T=>dy("[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(Xc,{children:[c.jsxs(zi,{className:"flex items-center gap-2 font-mono text-[16px]",children:[c.jsx(wi,{className:"h-4 w-4 text-[hsl(var(--deck-accent))]"}),n("projects.dialog.title")]}),c.jsx(Ki,{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 R(),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(ct,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(i0,{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(ct,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(wi,{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(ro,{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:()=>J(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(Gc,{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(Pf,{className:"h-3.5 w-3.5"})})]},T.path)})})]})}):null}const L2={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 U2({session:e,isActive:t,isForking:n,isUnread:r,anyForking:s,isEditing:o,editingTitle:i,title:a,context:l,isCancelling:u,isRetrying:m,isExporting:p,onSelect:g,onCancelTask:x,onRetryTask:b,onFork:y,onArchive:j,onExport:k,onStartRename:A,onDelete:N,onEditingTitleChange:R,onSaveRename:J,onCancelRename:T}){const C=Mt(),[$,O]=v.useState(!1),K=v.useRef(null),Y=v.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=>R(P.target.value),onKeyDown:P=>{P.key==="Enter"&&J(),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:J,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(Nf,{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(to,{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)]":L2[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(Is,{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(ct,{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(u?"session.action.stopping":"session.action.stop",{title:a}),disabled:u,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:u?c.jsx(ct,{className:"h-3 w-3 animate-spin"}):c.jsx(Vc,{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(ct,{className:"h-3 w-3 animate-spin"}):c.jsx(Hi,{className:"h-3 w-3"})}),c.jsxs(Gn,{open:$,onOpenChange:O,children:[c.jsx(Vn,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":C("session.action.more",{title:a}),"aria-expanded":$,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(a0,{className:"h-3.5 w-3.5"})})}),c.jsxs(Mn,{ref:Y,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=Y.current)==null?void 0:B.querySelector('[role="menuitem"]:not([disabled])'))==null||M.focus()},onKeyDown:P=>{P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),O(!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(),O(!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(c0,{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),O(!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(l0,{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(),O(!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(Af,{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(),O(!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(ct,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):c.jsx(Ef,{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),O(!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(Pf,{className:"h-3 w-3","aria-hidden":!0}),C("session.action.deleteShort")]})]})]})]})]})}function B2({onExpand:e,onNewChat:t,onOpenTaskSwitcher:n,onToggleTerminal:r,onToggleSettings:s,isTerminalOpen:o,taskEventsConnected:i,unreadCount:a,className:l}){const u=Mt(),m=[{icon:$f,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":u("sidebar.action.expand"),children:c.jsx(Zu,{size:28})}),c.jsx("button",{onClick:t,"aria-label":u("sidebar.action.newTaskShort"),title:u("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(Wc,{className:"h-4 w-4 stroke-[2.5]"})}),c.jsx("button",{onClick:r,"aria-label":u("sidebar.action.terminalToggle"),title:u("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(Rf,{className:"w-4 h-4"})}),c.jsxs("button",{onClick:n,"aria-label":u("sidebar.action.searchTasks"),title:`${u("sidebar.action.searchTasks")} (${Lc("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(Jc,{className:"h-4 w-4"}),a>0&&c.jsx("span",{"aria-label":u("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":u(x),title:u(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(uy,{variant:"compact"}),c.jsx("div",{className:"mt-1",children:c.jsx("div",{role:"status","aria-label":u(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:u(i?"sidebar.status.feedLive":"sidebar.status.feedOffline")})})]})}const my="blade.sidebar.project-order.v1";function oi(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 H2(){if(typeof window>"u")return[];try{const e=JSON.parse(window.localStorage.getItem(my)??"[]");return Array.isArray(e)?oi(e):[]}catch{return[]}}function q2(e){if(!(typeof window>"u"))try{window.localStorage.setItem(my,JSON.stringify(oi(e)))}catch{}}function z2(e,t){const n=new Map(oi(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 K2(e,t,n){const r=oi(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 G2(e,t,n){const r=oi(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 V2({name:e,path:t,count:n,countIsPartial:r=!1,isActive:s,hasRunning:o,unreadCount:i,collapsed:a,onToggle:l,onSelect:u,onCreateTask:m,reorderPosition:p,reorderCount:g,isDragging:x=!1,onDragStart:b,onDragEnd:y,onReorderKeyDown:j}){const k=Mt();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(u0,{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(d0,{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:u??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(ro,{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(Wc,{className:"h-3.5 w-3.5"})})]})}function Uc(e){const t=e.lastMessageTime||e.firstMessageTime;if(!t)return 0;const n=new Date(t).getTime();return Number.isNaN(n)?0:n}function kf(e){return e.pendingInteraction?0:e.taskStatus==="running"?1:e.taskStatus==="queued"?2:3}function ed(e,t){return kf(e)-kf(t)||Uc(t)-Uc(e)}const W2=["running","queued","interrupted","failed","cancelled","completed"],J2={running:"RUNNING",queued:"QUEUED",interrupted:"INTERRUPTED",failed:"FAILED",cancelled:"CANCELLED",completed:"DONE"},bs=e=>e.length>1?e.replace(/\/+$/,""):e;function py(e){const t=new Map;for(const n of e){if(!n)continue;const r=qe(me(n));t.has(r)||t.set(r,n)}return Array.from(t.values())}function Q2(e){const t=py(e),n=[];for(const r of W2){const s=t.filter(o=>o.taskStatus===r).sort(ed);s.length>0&&n.push({code:J2[r],status:r,sessions:s})}return n}function Y2(e,t,n=[]){const r=py(e),s=new Map,o=n.map(bs),i=new Map(o.map((u,m)=>[u,m]));for(const u of o)s.set(u,[]);for(const u of r){const m=si(u,t),p=s.get(m);p?p.push(u):s.set(m,[u])}const a=t?bs(t):null,l=Array.from(s.entries()).map(([u,m])=>{const p=[...m].sort(ed),g=m.reduce((x,b)=>Math.max(x,Uc(b)),0);return{path:u,name:Mc(u),isActive:a?bs(u)===a:!1,isBound:i.has(bs(u)),hasRunning:m.some(x=>x.taskStatus==="running"),lastActivity:g,sessions:p}});return l.sort((u,m)=>u.isBound!==m.isBound?u.isBound?-1:1:u.isBound&&m.isBound?(i.get(bs(u.path))??Number.MAX_SAFE_INTEGER)-(i.get(bs(m.path))??Number.MAX_SAFE_INTEGER):m.lastActivity-u.lastActivity),l}const xf=12,X2={RUNNING:"sidebar.group.running",QUEUED:"sidebar.group.queued",INTERRUPTED:"sidebar.group.interrupted",FAILED:"sidebar.group.failed",CANCELLED:"sidebar.group.cancelled",DONE:"sidebar.group.done"},Z2={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 e_({view:e,sessions:t,activeProjectPath:n,boundProjects:r,currentSessionRef:s,unreadTaskKeys:o,catalogLoadState:i,catalogError:a,onSelectProject:l,onCreateTask:u,onRetryCatalog:m,renderRow:p}){const g=Mt(),[x,b]=v.useState({}),[y,j]=v.useState({}),[k,A]=v.useState(H2),[N,R]=v.useState(null),[J,T]=v.useState(null),[C,$]=v.useState(""),O=i==="loading"||i==="hydrating",K=O||i==="error",Y=v.useMemo(()=>e==="status"?Q2(t):[],[t,e]),P=v.useMemo(()=>e==="project"?Y2(t,n,r.map(F=>F.path)):[],[n,r,t,e]),B=v.useMemo(()=>z2(P,k),[P,k]),M=(F,fe)=>{const ye=y[F]??!1,Ee=ye?fe:fe.filter((X,_)=>{if(_<xf)return!0;const Ke=me(X);return!!X.pendingInteraction||o.includes(qe(Ke))||!!(s&&se(Ke,s))}),Pe=fe.length-Ee.length,U=ye?fe.length>xf:Pe>0;return c.jsxs(c.Fragment,{children:[Ee.map(p),U&&c.jsx("button",{type:"button",onClick:()=>j(X=>({...X,[F]:!ye})),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:ye?g("sidebar.group.showLess"):g("sidebar.group.showMore",{count:Pe})})]})},de=O?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(ct,{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(Is,{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(no,{className:"h-2.5 w-2.5"}),g("sidebar.catalog.retry")]})]}):null;if(e==="status")return c.jsxs("div",{className:"flex flex-col",children:[de,Y.map((F,fe)=>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]",Z2[F.code]??"text-[hsl(var(--deck-ink-faint))]",fe===0&&"pt-2"),children:[c.jsx("span",{children:g(X2[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 we=B.some(F=>F.isActive),be=F=>!!(s&&F.sessions.some(fe=>se(me(fe),s))),ae=(F,fe)=>{if(F.join("\0")===B.map(Ee=>Ee.path).join("\0"))return;A(F),q2(F);const ye=B.find(Ee=>Ee.path===fe);$(g("sidebar.project.reordered",{name:(ye==null?void 0:ye.name)??fe,position:F.indexOf(fe)+1}))},Fe=(F,fe)=>{const ye=F.sessions.filter(_=>o.includes(qe(me(_)))).length,Ee=be(F),Pe=ye>0,U=F.sessions.some(_=>!!_.pendingInteraction),X=x[F.path]??(we&&!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 Ke=N||_.dataTransfer.getData("text/plain");Ke&&Ke!==F.path&&ae(K2(B.map(Ne=>Ne.path),Ke,F.path),Ke),R(null),T(null)},className:W("relative transition-colors",J===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(V2,{name:F.name,path:F.path,count:F.sessions.length,countIsPartial:K,isActive:F.isActive,hasRunning:F.hasRunning,unreadCount:ye,collapsed:X,onSelect:()=>l(F.path),onCreateTask:()=>u(F.path),reorderPosition:fe+1,reorderCount:B.length,isDragging:N===F.path,onDragStart:_=>{_.dataTransfer.effectAllowed="move",_.dataTransfer.setData("text/plain",F.path),R(F.path)},onDragEnd:()=>{R(null),T(null)},onReorderKeyDown:_=>{if(_.key!=="ArrowUp"&&_.key!=="ArrowDown")return;_.preventDefault();const Ke=G2(B.map(Ne=>Ne.path),F.path,_.key==="ArrowUp"?-1:1);ae(Ke,F.path)},onToggle:()=>b(_=>({..._,[F.path]:!X}))}),!X&&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}),de,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 t_({className:e,onNavigate:t}){const n=Mt(),{toggleSettings:r,toggleSidebar:s,isSidebarOpen:o,isTerminalOpen:i,toggleTerminal:a,sidebarView:l,setSidebarView:u,setTaskSwitcherOpen:m}=br(),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),R=L(S=>S.forkSession),J=L(S=>S.updateSession),T=L(S=>S.loadSessions),C=L(S=>S.setError),$=L(S=>S.taskEventsConnected),O=L(S=>S.taskWorkspaceInfo),K=L(S=>S.boundProjects),Y=L(S=>S.selectedProjectPath),P=L(S=>S.bindProject),B=L(S=>S.selectProject),M=L(S=>S.cancelTask),de=L(S=>S.cancellingTaskKeys),we=L(S=>S.retryTask),be=L(S=>S.retryingTaskKeys),ae=L(S=>S.unreadTaskKeys),[Fe,F]=v.useState(null),[fe,ye]=v.useState(""),[Ee,Pe]=v.useState(null),[U,X]=v.useState(!1),_=Y??(O==null?void 0:O.cwd)??null,Ke=S=>co(S,n),Ne=S=>{const Q=S.taskSourceProjectPath||S.projectPath,De=Q.split("/").filter(Boolean).at(-1)||Q,ft=S.taskIsolation==="worktree"?S.taskWorktreeBranch||n("session.env.worktree"):n("session.env.local"),zn=S.taskDiffStat?`+${S.taskDiffStat.additions} −${S.taskDiffStat.deletions}`:void 0,us=S.taskStatus==="queued"&&S.taskQueuePosition?n("session.queued",{position:S.taskQueuePosition,depth:S.taskQueueDepth??S.taskQueuePosition}):void 0,ds=Yu(S,n);return{project:De,environment:ft,diff:zn,queue:us,reason:ds}},$e=()=>{k(_??void 0),t==null||t()},on=async S=>{K.some(Q=>Q.path===S)?B(S):await P(S),k(S),t==null||t()},Sn=async S=>{K.some(Q=>Q.path===S)?B(S):await P(S),k(S),t==null||t()},Ye=S=>{S(),t==null||t()},qn=async(S,Q)=>{S.stopPropagation(),await A(me(Q))},dt=async S=>{const Q=me(S),De=qe(Q);if(!Ee){Pe(De);try{await ly(Q)}catch(ft){C(ft instanceof Error?ft.message:"Session export failed")}finally{Pe(null)}}},an=(S,Q)=>{S.stopPropagation(),F(qe(me(Q))),ye(Ke(Q))},On=async S=>{if(!fe.trim()){F(null);return}try{await J(me(S),fe.trim()),F(null),await T()}catch(Q){console.error("Failed to rename session:",Q)}},Dt=()=>{F(null),ye("")};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(Zu,{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(f0,{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:$e,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(Wc,{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:Lc("newTask")})]}),c.jsxs("button",{onClick:()=>Ye(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(Rf,{className:"h-3.5 w-3.5"}),n("sidebar.action.terminal")]}),c.jsxs("button",{type:"button",onClick:()=>Ye(()=>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(Jc,{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:ae.length>0?ae.length:Lc("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:()=>u(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:()=>X(!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(wi,{className:"h-3.5 w-3.5"})})]})]}),c.jsx(Xu,{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(e_,{view:l,sessions:p,activeProjectPath:_,boundProjects:K,currentSessionRef:b,unreadTaskKeys:ae,catalogLoadState:g,catalogError:x,onRetryCatalog:T,onSelectProject:S=>void on(S).catch(()=>{}),onCreateTask:S=>void Sn(S).catch(()=>{}),renderRow:S=>{const Q=me(S),De=qe(Q),ft=se(Q,b),zn=Fe===De,us=se(Q,y),ds=!!y;return c.jsx(U2,{session:S,sessionRef:Q,isActive:ft,isForking:us,isUnread:ae.includes(qe(Q)),anyForking:ds,isEditing:zn,editingTitle:fe,title:Ke(S),context:Ne(S),isCancelling:de.includes(qe(Q)),isRetrying:be.includes(qe(Q)),isExporting:Ee===De,onSelect:()=>(t==null||t(),j(Q)),onCancelTask:()=>{M(Q).catch(()=>{})},onRetryTask:()=>{we(Q).catch(()=>{})},onFork:()=>void R(S),onArchive:()=>void N(Q),onExport:()=>void dt(S),onStartRename:fs=>an(fs,S),onDelete:fs=>qn(fs,S),onEditingTitleChange:ye,onSaveRename:()=>On(S),onCancelRename:Dt},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(Of,{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(D2,{}),[{icon:$f,action:()=>Ye(r),labelKey:"sidebar.section.settings"}].map(({icon:S,action:Q,labelKey:De})=>c.jsxs("button",{"data-settings-trigger":!0,onClick:Q,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(uy,{})]}),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]",$?"text-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))]"),children:[c.jsx("span",{className:W("h-1 w-1 rounded-full",$?"bg-[hsl(var(--deck-accent))] shadow-[0_0_5px_hsl(var(--deck-accent-glow)/0.9)]":"bg-[hsl(var(--deck-ink-faint))]/60")}),n($?"sidebar.status.feedLive":"sidebar.status.feedOffline")]})]})]})]}),c.jsx(fy,{open:U,onOpenChange:X})]}):c.jsx(B2,{className:e,onExpand:s,onNewChat:$e,onOpenTaskSwitcher:()=>Ye(()=>m(!0)),onToggleTerminal:()=>Ye(a),onToggleSettings:()=>Ye(r),isTerminalOpen:i,taskEventsConnected:$,unreadCount:ae.length})}const n_=v.lazy(()=>bo(()=>import("./SettingsModal-Bkh5rMAJ.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.SettingsModal}))),gy=()=>bo(()=>import("./TaskSwitcher-DXcj0iJ_.js"),__vite__mapDeps([4,1,3,2])).then(e=>({default:e.TaskSwitcher})),r_=v.lazy(gy),s_=v.lazy(()=>bo(()=>import("./FilePreview-xicd9-Sl.js"),__vite__mapDeps([5,1,3,2])).then(e=>({default:e.FilePreview}))),o_=v.lazy(()=>bo(()=>import("./TerminalPanel-DWVY-Elm.js"),__vite__mapDeps([6,1,7,8,3,2])).then(e=>({default:e.TerminalPanel}))),nc=e=>{if(e.startsWith("/Users/")){const t=e.split("/");if(t.length>=3)return"~/"+t.slice(3).join("/")}return e},i_=e=>e.replace(/^~\//,"~/§").split("/").filter(Boolean).map((t,n,r)=>{var s;return n===0&&((s=r[0])!=null&&s.startsWith("~"))?"~":t.replace(/^§/,"")});function a_({children:e}){var Ee,Pe;const t=Mt();F2();const{isSidebarOpen:n,isFilePreviewOpen:r,isSettingsOpen:s,isTerminalOpen:o,isTaskSwitcherOpen:i,toggleFilePreview:a,openFilePreview:l,previewRequestId:u,setSidebarOpen:m}=br();v.useEffect(()=>{const U=window.setTimeout(()=>{gy()},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,R]=v.useState(null),[J,T]=v.useState(!1),[C,$]=v.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 639px)").matches),[O,K]=v.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 1023px)").matches),Y=v.useRef(null),P=v.useRef(null),B=v.useRef(null),M=v.useMemo(()=>x.find(U=>se({sessionId:U.sessionId,projectPath:U.projectPath},g)),[g,x]),de=(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;v.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 900px)"),X=()=>{U.matches&&m(!1)};return X(),U.addEventListener("change",X),()=>U.removeEventListener("change",X)},[m]),v.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 639px)"),X=()=>$(U.matches);return X(),U.addEventListener("change",X),()=>U.removeEventListener("change",X)},[]),v.useEffect(()=>{if(typeof window.matchMedia!="function")return;const U=window.matchMedia("(max-width: 1023px)"),X=()=>K(U.matches);return X(),U.addEventListener("change",X),()=>U.removeEventListener("change",X)},[]),v.useEffect(()=>{if(!C||!n)return;const U=requestAnimationFrame(()=>{var X,_;(_=(X=Y.current)==null?void 0:X.querySelector("button"))==null||_.focus()});return()=>{var X;cancelAnimationFrame(U),(X=P.current)==null||X.focus({preventScroll:!0})}},[C,n]);const we=U=>{var Ne;if(!C||!n)return;if(U.key==="Escape"){U.preventDefault(),m(!1);return}if(U.key!=="Tab")return;const X=Array.from(((Ne=Y.current)==null?void 0:Ne.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))??[]);if(X.length===0)return;const _=X[0],Ke=X[X.length-1];U.shiftKey&&document.activeElement===_?(U.preventDefault(),Ke==null||Ke.focus()):!U.shiftKey&&document.activeElement===Ke&&(U.preventDefault(),_==null||_.focus())},be=v.useMemo(()=>!p||y?A?nc(A):null:M!=null&&M.projectPath?nc(M.taskSourceProjectPath||M.projectPath):null,[p,M,y,A]),ae=v.useMemo(()=>be?i_(be):[],[be]);v.useEffect(()=>{var X;if(!g){R(((X=k.find(_=>_.path===A))==null?void 0:X.gitBranch)??null);return}(async()=>{try{const _=await re.getGitInfo({sessionId:g.sessionId,projectPath:de??g.projectPath});R(_.branch)}catch{R(null)}})()},[k,g,de,A]);const Fe=j==null?void 0:j.taskAdmission,F=de??A??(j==null?void 0:j.cwd)??null,fe=g?qe(g):`project:${A??"none"}`,ye=r&&O;return c.jsxs("div",{className:"flex h-screen overflow-hidden bg-[hsl(var(--deck-canvas))]",children:[C&&n&&!ye&&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:Y,role:C&&n&&!ye?"dialog":void 0,"aria-modal":C&&n&&!ye?!0:void 0,"aria-label":C&&n&&!ye?t("sidebar.navigationAria"):void 0,"aria-hidden":ye||C&&!n?!0:void 0,inert:ye||C&&!n?!0:void 0,onKeyDown:we,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(t_,{onNavigate:()=>{C&&m(!1)}})})}),c.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[c.jsxs("header",{"aria-hidden":ye||void 0,inert:ye||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(hr,{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(m0,{className:"h-4 w-4"})}),c.jsxs("div",{className:"flex gap-2 items-center min-w-0",children:[ae.length>0?c.jsx("nav",{"aria-label":t("layout.workspace.pathAria"),title:be??void 0,className:"flex min-w-0 items-center font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:ae.map((U,X)=>{const _=X===ae.length-1,Ke=X===0&&U==="~";return c.jsxs("span",{className:"flex items-center min-w-0",children:[X>0&&c.jsx("span",{className:"mx-1 text-[hsl(var(--deck-ink-faint))]/70",children:"/"}),X===0&&!Ke&&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})]},X)})}):c.jsx("span",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-faint))]",children:j!=null&&j.cwd?nc(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(Gc,{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(ry,{inFlight:Fe.inFlight,queued:Fe.queued,maxConcurrent:Fe.maxConcurrent,compact:!0})}),c.jsxs("div",{className:"flex items-center gap-0.5",children:[c.jsx(hr,{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(Hi,{className:"w-4 h-4"})}),c.jsx(hr,{ref:B,variant:"ghost",size:"icon",onClick:()=>{if(r){a();return}l((!g||y)&&u===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(p0,{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":ye||void 0,inert:ye||void 0,className:"flex relative flex-col flex-1 min-w-0",children:s?c.jsx(v.Suspense,{fallback:null,children:c.jsx(n_,{})}):e}),r&&c.jsx(v.Suspense,{fallback:null,children:c.jsx(s_,{returnFocusElement:B.current},fe)})]})]}),o&&c.jsx(v.Suspense,{fallback:null,children:c.jsx(o_,{workspacePath:F},F??"default-workspace")}),i&&c.jsx(v.Suspense,{fallback:null,children:c.jsx(r_,{})}),c.jsx(T2,{open:J,onOpenChange:T})]})}const rc="BladeCode";function c_(){const e=Mt(),t=L(i=>i.unreadTaskKeys),n=L(i=>i.sessions),r=L(i=>i.selectSession),s=L(i=>i.selectProject),o=v.useMemo(()=>{const i=new Set(t);for(const a of n)a.pendingInteraction&&i.add(qe(me(a)));return i.size},[n,t]);return v.useEffect(()=>(document.title=o>0?`(${o}) ${rc}`:rc,()=>{document.title=rc}),[o]),v.useEffect(()=>{const i=a=>{var g;const l=a.detail;if(!(l!=null&&l.sessionId)||!l.projectPath)return;const u=L.getState(),m=Wu(u.sessions,l),p=m?si(m,u.selectedProjectPath??((g=u.taskWorkspaceInfo)==null?void 0:g.cwd)??null):l.projectPath;u.boundProjects.some(x=>x.available&&x.path===p)&&s(p),r(l)};return window.addEventListener(Di,i),()=>window.removeEventListener(Di,i)},[s,r]),c.jsx("div",{className:"sr-only",role:"status","aria-live":"polite",children:o>0?e("attention.unreadAnnouncement",{count:o}):""})}const Bc=v.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}));Bc.displayName="Textarea";const l_=(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}},u_=(e,t,n={})=>{const{debounceDelay:r=200,maxSuggestions:s=15,workspacePath:o}=n,[i,a]=v.useState([]),[l,u]=v.useState(0),[m,p]=v.useState(!1),g=v.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1,quoted:!1}:l_(e,t),[e,t]);v.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]),v.useEffect(()=>{u(0)},[i]);const x=v.useCallback(()=>{u(y=>(y+1)%Math.max(i.length,1))},[i.length]),b=v.useCallback(()=>{u(y=>(y-1+i.length)%Math.max(i.length,1))},[i.length]);return{...g,suggestions:i,selectedIndex:l,loading:m,setSelectedIndex:u,selectNext:x,selectPrevious:b}},d_=(e,t=!1)=>e.includes(" ")||t?`@"${e}"`:`@${e}`,f_=(e,t,n)=>{if(!t.hasQuery)return{newInput:e,newCursorPos:e.length};const r=d_(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 m_(){const[e,t]=v.useState([]),[n,r]=v.useState(-1),s=v.useRef(""),o=v.useCallback(u=>{u.trim()&&(t(m=>m[m.length-1]===u?m:[...m,u]),r(-1),s.current="")},[]),i=v.useCallback(u=>{if(e.length===0)return null;n===-1&&(s.current=u);const m=n===-1?e.length-1:Math.max(0,n-1);return r(m),e[m]??null},[e,n]),a=v.useCallback(()=>{if(n===-1)return null;const u=n+1;return u>=e.length?(r(-1),s.current):(r(u),e[u]??null)},[e,n]),l=v.useCallback(()=>{r(-1),s.current=""},[]);return{addToHistory:o,getPrevious:i,getNext:a,reset:l,historyIndex:n}}const p_=(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}},g_=(e,t,n={})=>{const{debounceDelay:r=150,workspacePath:s}=n,[o,i]=v.useState([]),[a,l]=v.useState(0),[u,m]=v.useState(!1),p=v.useMemo(()=>t===void 0?{hasQuery:!1,query:"",startIndex:-1,endIndex:-1}:p_(e,t),[e,t]);v.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]),v.useEffect(()=>{l(0)},[o]);const g=v.useCallback(()=>{l(b=>(b+1)%Math.max(o.length,1))},[o.length]),x=v.useCallback(()=>{l(b=>(b-1+o.length)%Math.max(o.length,1))},[o.length]);return{...p,suggestions:o,selectedIndex:a,loading:u,setSelectedIndex:l,selectNext:g,selectPrevious:x}},h_=(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}},b_="blade.composer.draft.",_i=new Map,hy=1;function Li(){return typeof sessionStorage>"u"?null:sessionStorage}function Ui(e){return`${b_}${e}`}function k_(e){var n;if(!e)return{content:"",attachments:[],outputSchema:void 0};const t=_i.get(e);if(t)return{content:t.content,attachments:[...t.attachments],outputSchema:t.outputSchema};try{const r=((n=Li())==null?void 0:n.getItem(Ui(e)))??"";if(!r)return{content:"",attachments:[],outputSchema:void 0};try{const s=JSON.parse(r);if(s.version===hy&&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=_i.get(e),r=t.outputSchema??(n==null?void 0:n.outputSchema);if(!t.content&&t.attachments.length===0&&!r){by(e);return}_i.set(e,{content:t.content,attachments:[...t.attachments],outputSchema:r});try{t.content||r?(s=Li())==null||s.setItem(Ui(e),JSON.stringify({version:hy,content:t.content,...r?{outputSchema:r}:{}})):(o=Li())==null||o.removeItem(Ui(e))}catch{}}function by(e){var t;if(e){_i.delete(e);try{(t=Li())==null||t.removeItem(Ui(e))}catch{}}}function Hc(e){return e.reduce((t,n)=>t+n.dataUrl.length,0)}function x_(e){return`data:${e.type||"application/octet-stream"};base64,`.length+4*Math.ceil(e.size/3)}function y_(e,t){const r=Hc(e)+t.reduce((s,o)=>s+x_(o),0);return e.length+t.length>Hr?{accepted:!1,reason:"count",estimatedBytes:r}:r>io?{accepted:!1,reason:"bytes",estimatedBytes:r}:{accepted:!0,estimatedBytes:r}}const S_=e=>typeof e=="object"&&"command"in e,yf=({type:e,suggestions:t,selectedIndex:n,loading:r,onSelect:s,onHover:o,visible:i})=>{const a=v.useRef(null),l=v.useRef(null);if(v.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 u=e==="command"?Mf:hd;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(u,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:e==="command"?"Commands":"Files"}),r&&c.jsx(ct,{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=S_(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(hd,{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"]})]})]})})},sc=[{value:gr.DEFAULT,labelKey:"chat.input.mode.default",descriptionKey:"chat.input.mode.default.desc",icon:g0},{value:gr.AUTO_EDIT,labelKey:"chat.input.mode.autoEdit",descriptionKey:"chat.input.mode.autoEdit.desc",icon:h0},{value:gr.YOLO,labelKey:"chat.input.mode.yolo",descriptionKey:"chat.input.mode.yolo.desc",icon:Ff,tone:"danger"},{value:gr.PLAN,labelKey:"chat.input.mode.plan",descriptionKey:"chat.input.mode.plan.desc",icon:b0}],v_=["off"],w_=["standard"],I_=[];function oc(e){return e<1024*1024?`${Math.max(1,Math.ceil(e/1024))} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function C_({onSend:e,onAbort:t,disabled:n,submitDisabled:r=!1,shellSubmitDisabled:s=!1,isStreaming:o,isStopping:i=!1,pendingSteeringCount:a=0,pendingInputDelivery:l=null,recoveredSteeringCount:u=0,variant:m="chat",draft:p,draftAttachments:g,draftRevision:x,draftKey:b,placeholder:y,workspacePath:j}){var md;const k=Mt(),A=v.useRef(k_(b)),[N,R]=v.useState(A.current.content),[J,T]=v.useState(A.current.attachments),C=v.useRef(N),$=v.useRef(J),[O,K]=v.useState(A.current.outputSchema??""),Y=v.useRef(O),[P,B]=v.useState(!1),[M,de]=v.useState(null),[we,be]=v.useState(void 0),[ae,Fe]=v.useState(!1),[F,fe]=v.useState(!1),[ye,Ee]=v.useState(!1),[Pe,U]=v.useState(!1),[X,_]=v.useState(!1),[Ke,Ne]=v.useState(!1),[$e,on]=v.useState(!1),[Sn,Ye]=v.useState(null),[qn,dt]=v.useState(null),an=N.trimStart().startsWith("!"),On=an?s:r,Dt=v.useRef(null),S=v.useRef(!1),Q=v.useRef(null),De=v.useRef(null),{currentModelId:ft,configuredModels:zn,hasLoaded:us,loadedWorkspacePath:ds,loadModels:fs,setCurrentModel:ky,currentMode:$a,setMode:td}=Et(),nd=br(w=>w.isSettingsOpen),xy=ho(w=>w.communicationStyle),rd=L(w=>w.setMaxContextTokens),Ce=L(w=>w.currentSessionRef),sd=L(w=>{var V;return(V=w.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.selectedModelId}),yy=L(w=>{var V;return(V=w.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.reasoningEffort}),Sy=L(w=>{var V;return(V=w.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.serviceTier}),vy=L(w=>{var V;return(V=w.sessions.find(q=>q.sessionId===(Ce==null?void 0:Ce.sessionId)&&q.projectPath===(Ce==null?void 0:Ce.projectPath)))==null?void 0:V.responseVerbosity}),[wy,od]=v.useState(null),[Iy,Ra]=v.useState(null),[Cy,Oa]=v.useState(null),[jy,Ma]=v.useState(null),Ty=zn.some(w=>w.id===sd),ms=Ce?wy??(Ty?sd:ft):ft,Xe=zn.find(w=>w.id===ms),Fa=(Xe==null?void 0:Xe.supportedReasoningEfforts)??v_,id=["auto",...Fa],Mr=Iy??yy??"off",ii=(Xe==null?void 0:Xe.supportedServiceTiers)??w_,Ay=["auto",...ii],Fr=Cy??Sy??"auto",ai=(Xe==null?void 0:Xe.supportedResponseVerbosities)??I_,Ey=["auto",...ai],Dr=jy??vy??"auto",ad=xy??"auto",Py=id.length>1,Ny=ii.some(w=>w!=="standard"),$y=ai.length>0,cd=(Xe==null?void 0:Xe.displayName)||(Xe==null?void 0:Xe.model)||ms||k("chat.input.model.placeholder"),lr=((md=Xe==null?void 0:Xe.input)==null?void 0:md.includes("image"))===!0,zs=Xe?k("chat.input.attachment.modelUnsupported",{model:cd}):k("chat.input.attachment.modelRequired"),ci=J.length>0&&!lr,Jt=g_(N,we,{workspacePath:j}),Qt=u_(N,we,{workspacePath:j}),ps=m_(),Ks=Jt.hasQuery&&Jt.suggestions.length>0,li=Qt.hasQuery&&Qt.suggestions.length>0,Ry=Ks||li;v.useEffect(()=>{!nd&&(!us||ds!==(j??null))&&fs(j??void 0)},[nd,fs,ds,us,j]),v.useEffect(()=>{o&&(Fe(!1),fe(!1),Ee(!1),U(!1),B(!1))},[o]),v.useEffect(()=>{od(null),Ra(null),Oa(null),Ma(null)},[Ce==null?void 0:Ce.projectPath,Ce==null?void 0:Ce.sessionId]),v.useEffect(()=>{Mr!=="auto"&&!Fa.includes(Mr)&&Ra("auto")},[Mr,Fa]),v.useEffect(()=>{Fr!=="auto"&&!ii.includes(Fr)&&Oa("auto")},[Fr,ii]),v.useEffect(()=>{Dr!=="auto"&&!ai.includes(Dr)&&Ma("auto")},[Dr,ai]),v.useEffect(()=>{dt(null)},[ms]),v.useEffect(()=>{if(p!==void 0){const w=g??$.current;C.current=p,$.current=w,R(p),T(w),Ye(null),dt(null),be(p.length),cn(b,{content:p,attachments:w}),requestAnimationFrame(()=>{var V;return(V=Q.current)==null?void 0:V.focus()})}},[p,g,b,x]),v.useEffect(()=>()=>{cn(b,{content:C.current,attachments:$.current,outputSchema:Y.current})},[b]),v.useEffect(()=>{if(!Xe)return;const w=!!Xe.contextWindow;rd(Xe.contextWindow||0,!w)},[Xe,rd]),v.useEffect(()=>{lr&&Ye(w=>w!==Dt.current?w:(Dt.current=null,null))},[lr]);const Da=v.useCallback(async()=>{if(!N.trim()&&J.length===0||n||On||ci||S.current)return;let w;if(O.trim()){if(an){de(k("chat.input.outputSchema.shellUnsupported")),B(!0);return}try{const q=JSON.parse(O);if(!q||typeof q!="object"||Array.isArray(q))throw new Error("schema root must be an object");w=q}catch{de(k("chat.input.outputSchema.invalid")),B(!0);return}}N.trim()&&ps.addToHistory(N),S.current=!0,on(!0);const V=b;try{if(await e({content:N,modelId:ms??void 0,reasoningEffort:Mr,serviceTier:Fr,responseVerbosity:Dr,communicationStyle:ad,attachments:J,...w?{outputSchema:w}:{}})===!1)return;by(V),C.current="",$.current=[],Y.current="",R(""),T([]),K(""),de(null),Ye(null),dt(null),Dt.current=null,be(void 0)}catch{}finally{S.current=!1,on(!1)}},[J,ci,b,N,an,n,ms,Mr,Dr,ad,Fr,On,e,O,ps,k]),Oy=v.useCallback(w=>{Ye(null),dt(null),Dt.current=null,T(V=>{const q=V.filter(Te=>Te.id!==w);return $.current=q,cn(b,{content:C.current,attachments:q}),q})},[b]),ld=v.useCallback(w=>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:w.name,mimeType:w.type,dataUrl:Te.result})},Te.onerror=()=>q(Te.error??new Error("Failed to read image")),Te.readAsDataURL(w)}),[]),ui=v.useCallback(async w=>{if(w.length===0)return;if(!lr){Dt.current=zs,dt(null),Ye(zs);return}const V=y_($.current,w),q=Te=>Te==="count"?k("chat.input.attachment.countLimit",{count:Hr}):k("chat.input.attachment.sizeLimit",{size:oc(io)});if(!V.accepted){Dt.current=null,dt(null),Ye(q(V.reason??"bytes"));return}try{const Te=await Promise.all(w.map(gs=>ld(gs))),At=new Set($.current.map(gs=>gs.dataUrl)),pd=Te.filter(gs=>At.has(gs.dataUrl)?!1:(At.add(gs.dataUrl),!0));if(pd.length===0){Ye(null),dt(null),Dt.current=null;return}const di=[...$.current,...pd];if(Hc(di)>io){Dt.current=null,dt(null),Ye(q("bytes"));return}$.current=di,T(di),Ye(null),dt(null),Dt.current=null,cn(b,{content:C.current,attachments:di})}catch{Dt.current=null,dt(null),Ye(k("chat.input.attachment.readFailed"))}},[b,zs,lr,ld,k]),My=v.useCallback(async w=>{const V=Array.from(w.target.files??[]).filter(q=>q.type.startsWith("image/"));await ui(V),w.target.value=""},[ui]),Fy=v.useCallback(async w=>{const V=Array.from(w.clipboardData.items).filter(q=>q.type.startsWith("image/")).map(q=>q.getAsFile()).filter(q=>q!==null);V.length!==0&&(w.preventDefault(),await ui(V))},[ui]),_a=v.useCallback(w=>{const V=Jt.suggestions[w];if(!V)return;const{newInput:q,newCursorPos:Te}=h_(N,Jt,V);C.current=q,R(q),be(Te),cn(b,{content:q,attachments:$.current}),requestAnimationFrame(()=>{Q.current&&(Q.current.focus(),Q.current.setSelectionRange(Te,Te))})},[b,N,Jt]),La=v.useCallback(w=>{const V=Qt.suggestions[w];if(!V)return;const{newInput:q,newCursorPos:Te}=f_(N,Qt,V);C.current=q,R(q),be(Te),cn(b,{content:q,attachments:$.current}),requestAnimationFrame(()=>{Q.current&&(Q.current.focus(),Q.current.setSelectionRange(Te,Te))})},[Qt,b,N]),Dy=v.useCallback(w=>{if(Ks){if(w.key==="ArrowDown"){w.preventDefault(),Jt.selectNext();return}if(w.key==="ArrowUp"){w.preventDefault(),Jt.selectPrevious();return}if(w.key==="Tab"||w.key==="Enter"&&!w.shiftKey){w.preventDefault(),_a(Jt.selectedIndex);return}if(w.key==="Escape"){w.preventDefault(),be(void 0);return}}if(li){if(w.key==="ArrowDown"){w.preventDefault(),Qt.selectNext();return}if(w.key==="ArrowUp"){w.preventDefault(),Qt.selectPrevious();return}if(w.key==="Tab"||w.key==="Enter"&&!w.shiftKey){w.preventDefault(),La(Qt.selectedIndex);return}if(w.key==="Escape"){w.preventDefault(),be(void 0);return}}if(w.key==="Enter"&&!w.shiftKey){w.preventDefault(),Da();return}if(w.key==="ArrowUp"&&!w.shiftKey){const V=w.target,q=V.selectionStart===0&&V.selectionEnd===0,Te=!N.includes(`
|
|
31
|
+
`);if(q||Te){const At=ps.getPrevious(N);At!==null&&(w.preventDefault(),C.current=At,R(At),cn(b,{content:At,attachments:$.current}),requestAnimationFrame(()=>{Q.current&&Q.current.setSelectionRange(At.length,At.length)}))}return}if(w.key==="ArrowDown"&&!w.shiftKey){const V=w.target,q=V.selectionStart===N.length&&V.selectionEnd===N.length,Te=!N.includes(`
|
|
32
|
+
`);if((q||Te)&&ps.historyIndex!==-1){const At=ps.getNext();At!==null&&(w.preventDefault(),C.current=At,R(At),cn(b,{content:At,attachments:$.current}),requestAnimationFrame(()=>{Q.current&&Q.current.setSelectionRange(At.length,At.length)}))}}},[Ks,li,Jt,Qt,_a,La,Da,b,N,ps]),_y=v.useCallback(w=>{const V=w.target.value;C.current=V,R(V),be(w.target.selectionStart),cn(b,{content:V,attachments:$.current})},[b]),ud=v.useCallback(w=>{const V=w.target;be(V.selectionStart)},[]);v.useEffect(()=>{Q.current&&(Q.current.style.height="inherit",Q.current.style.height=`${Math.min(Q.current.scrollHeight,200)}px`)},[N]);const Ua=sc.find(w=>w.value===$a)??sc[1],Ly=k(Ua.labelKey),Uy=Ua.icon,By=!!N.trim()||J.length>0,dd=J.length>=Hr,Hy=Hc(J),Ba=Sn||(ci?zs:null),fd=Ba?null:qn,Ha=!!n||$e,qy=Ha||dd||!lr,Gs=lr?dd?k("chat.input.attachment.countLimit",{count:Hr}):k("chat.input.attachment.add"):zs,zy=()=>{Ha||(dt(Gs),!lr&&!o&&zn.some(w=>{var V;return(V=w.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(yf,{type:"command",suggestions:Jt.suggestions,selectedIndex:Jt.selectedIndex,loading:Jt.loading,onSelect:_a,onHover:Jt.setSelectedIndex,visible:Ks}),c.jsx(yf,{type:"file",suggestions:Qt.suggestions,selectedIndex:Qt.selectedIndex,loading:Qt.loading,onSelect:La,onHover:Qt.setSelectedIndex,visible:li&&!Ks}),c.jsx(Bc,{ref:Q,"data-blade-composer":!0,value:N,onChange:_y,onKeyDown:Dy,onPaste:Fy,onSelect:ud,onClick:ud,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||$e,"aria-busy":$e}),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")]})}),u>0&&c.jsx("div",{className:"px-4 pb-2 text-[11px] font-mono text-cyan-600 dark:text-cyan-400",children:u===1?k("chat.input.steering.recoveredOne",{count:u}):k("chat.input.steering.recoveredMany",{count:u})}),Ba&&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(Is,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"flex-1 min-w-0",children:Ba}),Sn&&c.jsx("button",{type:"button","aria-label":k("chat.error.dismiss"),onClick:()=>{Ye(null),Dt.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(to,{className:"w-3 h-3"})})]}),fd&&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(k0,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),c.jsx("span",{className:"flex-1 min-w-0",children:fd}),c.jsx("button",{type:"button","aria-label":k("chat.notice.dismiss"),onClick:()=>dt(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(to,{className:"w-3 h-3"})})]}),J.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:J.length,limit:Hr,used:oc(Hy),budget:oc(io)})}),c.jsx("div",{className:"flex flex-wrap gap-2",children:J.map(w=>c.jsxs("div",{title:w.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:w.dataUrl,alt:w.name,className:"object-cover w-20 h-20"}),c.jsx("button",{type:"button","aria-label":`${k("chat.input.attachment.remove")} ${w.name}`,title:`${k("chat.input.attachment.remove")} ${w.name}`,onClick:()=>Oy(w.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(to,{className:"w-3 h-3"})})]},w.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:[qy?c.jsx("button",{type:"button",disabled:Ha,"aria-disabled":"true","aria-label":Gs,title:Gs,onClick:zy,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(bd,{className:"w-4 h-4"})}):c.jsxs("label",{title:Gs,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":Gs,className:"absolute inset-0 z-10 w-full h-full opacity-0 cursor-pointer",onChange:My}),c.jsx(bd,{className:"w-4 h-4"})]}),c.jsxs(Gn,{open:ae,onOpenChange:w=>{!o&&!$e&&Fe(w)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||$e,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:[cd,c.jsx(ks,{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((w,V)=>{const q=V.provider||"unknown";return w[q]||(w[q]=[]),w[q].push(V),w},{})).map(([w,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:w.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===ms?"bg-[#E5E7EB] text-[#111827] dark:bg-zinc-800 dark:text-zinc-100":"text-[#6B7280] dark:text-zinc-400"}`,onClick:()=>{if(dt(null),Ce){od(q.id),Fe(!1);return}ky(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)})]},w))})})]}),Py&&c.jsxs(Gn,{open:F,onOpenChange:w=>{!o&&!$e&&fe(w)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||$e,"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:Mr}),c.jsx(ks,{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:id.map(w=>c.jsxs("button",{type:"button","aria-label":k("chat.input.effort.option",{effort:w}),onClick:()=>{Ra(w),fe(!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 ${Mr===w?"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:w}),w==="auto"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.effort.autoHint")})]},w))})]})]}),Ny&&c.jsxs(Gn,{open:ye,onOpenChange:w=>{!o&&!$e&&Ee(w)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||$e,"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:Fr}),c.jsx(ks,{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:Ay.map(w=>c.jsxs("button",{type:"button","aria-label":k("chat.input.serviceTier.option",{tier:w}),onClick:()=>{Oa(w),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 ${Fr===w?"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:w}),w==="fast"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.serviceTier.fastHint")}),w==="flex"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.serviceTier.flexHint")})]},w))})]})]}),$y&&c.jsxs(Gn,{open:Pe,onOpenChange:w=>{!o&&!$e&&U(w)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||$e,"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:Dr}),c.jsx(ks,{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:Ey.map(w=>c.jsxs("button",{type:"button","aria-label":k("chat.input.responseVerbosity.option",{verbosity:w}),onClick:()=>{Ma(w),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 ${Dr===w?"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:w}),w==="auto"&&c.jsx("span",{className:"text-[9px] text-[#9CA3AF] dark:text-zinc-600",children:k("chat.input.responseVerbosity.autoHint")})]},w))})]})]}),c.jsxs(Gn,{open:P,onOpenChange:w=>{!o&&!$e&&B(w)},children:[c.jsx(Vn,{asChild:!0,children:c.jsxs("button",{type:"button",disabled:o||$e,"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 ${O.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(x0,{className:"h-3.5 w-3.5"}),O.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(Bc,{value:O,onChange:w=>{const V=w.target.value;Y.current=V,K(V),de(null),cn(b,{content:C.current,attachments:$.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(Is,{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 w=JSON.stringify({type:"object",properties:{summary:{type:"string"}},required:["summary"],additionalProperties:!1},null,2);Y.current=w,K(w),de(null),cn(b,{content:C.current,attachments:$.current,outputSchema:w})},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:()=>{Y.current="",K(""),de(null),cn(b,{content:C.current,attachments:$.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:X,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 ${Ua.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(Uy,{className:"h-3.5 w-3.5"}),Ly,c.jsx(ks,{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:sc.map(w=>{const V=w.icon,q=$a===w.value,Te=w.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:()=>{w.value===gr.YOLO&&$a!==gr.YOLO?(_(!1),Ne(!0)):(td(w.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(w.labelKey)}),c.jsx("span",{className:"mt-0.5 block text-[11px] leading-snug text-[#6B7280] dark:text-zinc-500",children:k(w.descriptionKey)})]}),q&&c.jsx(Nf,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"})]},w.value)})})]})]})]}),c.jsxs("div",{className:"flex gap-2 items-center",children:[o&&c.jsx(hr,{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(ct,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Vc,{className:"w-3 h-3"})}),c.jsx(hr,{size:"icon",onClick:Da,disabled:!By||n||On||ci||$e||Ry,title:k($e?"chat.input.action.submitting":o?"chat.input.action.steer":"chat.input.action.send"),"aria-label":k($e?"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:$e?c.jsx(ct,{className:"w-4 h-4 animate-spin"}):c.jsx(y0,{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(Yc,{open:Ke,onOpenChange:Ne,children:c.jsx(qi,{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(Ff,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"})}),c.jsx(zi,{className:"font-mono text-sm font-semibold",children:k("chat.input.mode.yolo.confirm.title")})]}),c.jsx(Ki,{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:()=>{td(gr.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 j_={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 T_(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 A_(e){return e.split("/").filter(Boolean).at(-1)||e}function E_({sessions:e,onSelect:t,cancellingTaskKeys:n,retryingTaskKeys:r,unreadTaskKeys:s,onCancel:o,onRetry:i,catalogLoadState:a="ready",className:l}){const u=Mt(),m=[...e].sort(ed).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(ct,{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"}),u(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:u("taskHome.recent.title")}),c.jsx("span",{className:"font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:u(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=j_[g.taskStatus],b=g.pendingInteraction?g.pendingInteraction.type==="question"?"interaction.badge.question":g.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission":null,y=A_(g.taskSourceProjectPath||g.projectPath),j=co(g,u),k=qe(me(g)),A=g.taskStatus==="running"||g.taskStatus==="queued",N=n.includes(k),R=r.includes(k),J=!!g.taskRetryAvailable&&(g.taskStatus==="failed"||g.taskStatus==="interrupted"||g.taskStatus==="cancelled"),T=s.includes(k),C=Yu(g,u);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:u("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:`${u("session.retriedFrom")} ${g.taskRetriedFrom.sessionId.slice(0,6)}`,className:"shrink-0 font-mono text-[8.5px] text-[hsl(var(--deck-accent))]",children:u("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:u(b??x.labelKey)}),c.jsx("span",{className:"opacity-40",children:"·"}),c.jsx("span",{className:"shrink-0",children:T_(g.lastMessageTime||g.firstMessageTime,u)})]}),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(S0,{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":u(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(ct,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Vc,{className:"h-3.5 w-3.5"})}),J&&c.jsx("button",{type:"button","aria-label":u(R?"session.action.retrying":"session.action.retry",{title:j}),disabled:R,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:R?c.jsx(ct,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Hi,{className:"h-3.5 w-3.5"})})]},k)})})]})}function P_({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 ic=[{key:"explore",titleKey:"taskHome.template.explore.title",descriptionKey:"taskHome.template.explore.description",icon:Jc,prompt:"Explore this codebase and explain ",hintKey:"taskHome.template.explore.hint"},{key:"build",titleKey:"taskHome.template.build.title",descriptionKey:"taskHome.template.build.description",icon:v0,prompt:"Build a production-ready ",hintKey:"taskHome.template.build.hint"},{key:"review",titleKey:"taskHome.template.review.title",descriptionKey:"taskHome.template.review.description",icon:w0,prompt:"/review uncommitted",hintKey:"taskHome.template.review.hint"},{key:"fix",titleKey:"taskHome.template.fix.title",descriptionKey:"taskHome.template.fix.description",icon:I0,prompt:"Investigate and fix ",hintKey:"taskHome.template.fix.hint"}];function N_(e,t){return t?t.split("/").filter(Boolean).at(-1)||t:e("taskHome.hero.projectFallback")}function $_(){const e=Mt(),{taskWorkspaceInfo:t,isTaskWorkspaceLoading:n,taskWorkspaceError:r,isDispatchingTask:s,sessions:o,boundProjects:i,selectedProjectPath:a,error:l,selectProject:u,dispatchTask:m,startCodeReview:p,sendMessage:g,startTemporarySession:x,selectSession:b,cancelTask:y,cancellingTaskKeys:j,retryTask:k,retryingTaskKeys:A,unreadTaskKeys:N,taskEventConnectionState:R,catalogLoadState:J,reconnectTaskEvents:T,clearError:C,loadTaskWorkspaceInfo:$,loadBoundProjects:O}=L(),K=br(S=>S.openSettings),Y=br(S=>S.isSettingsOpen),P=Et(S=>S.currentMode),B=Et(S=>S.currentModelId),M=Et(S=>S.configuredModels),de=Et(S=>S.isLoading),we=Et(S=>S.hasLoaded),be=Et(S=>S.loadedWorkspacePath),ae=Et(S=>S.error),Fe=Et(S=>S.loadModels),[F,fe]=v.useState("worktree"),[ye,Ee]=v.useState(),[Pe,U]=v.useState(!1),X=e(R==="connected"?"taskHome.eyebrow":R==="reconnecting"?"taskHome.feed.reconnecting":R==="offline"?"taskHome.feed.offline":"taskHome.feed.connecting"),_=v.useMemo(()=>i.find(S=>S.path===a)??i.find(S=>S.isCurrent),[i,a]),Ke=v.useMemo(()=>JD(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),$e=`task:${Ne??"unavailable"}`;v.useEffect(()=>{!Y&&Ne&&(!we||be!==Ne)&&Fe(Ne)},[Y,Fe,be,we,Ne]);const on=!(_!=null&&_.available)&&n,Sn=_!=null&&_.available?null:r,Ye=!!(Ne&&!on&&!Sn),qn=!!(B&&M.some(S=>S.id===B)),dt=!we||de,an=Ye&&qn&&!dt&&ae===null,On=v.useMemo(()=>({project:N_(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]),Dt=v.useCallback(async S=>{const Q=S.content.trim();if(Q==="/review"||Q.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=Q.split(/\s+/),ft=De[1]||"uncommitted";if(ft!=="uncommitted"&&ft!=="base"&&ft!=="commit"||ft==="uncommitted"&&De.length!==2&&De.length!==1||(ft==="base"||ft==="commit")&&De.length!==3)throw new Error(e("taskHome.review.usage"));await p({projectPath:Ne,kind:ft,...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 v.useEffect(()=>{const S=Q=>{if(!(Q.metaKey||Q.ctrlKey))return;const De=Number.parseInt(Q.key,10);if(Number.isNaN(De)||De<1||De>ic.length)return;const ft=ic[De-1];ft&&(Q.preventDefault(),Ee({key:$e,content:ft.prompt}))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[$e]),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(Zu,{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",R==="offline"?"text-amber-700 dark:text-amber-400":"text-[hsl(var(--deck-accent))]"),children:[R==="offline"?c.jsx(kd,{className:"w-3 h-3"}):c.jsx("span",{className:"deck-pulse-dot"}),X]}),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:On.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(Mf,{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:ic.map((S,Q)=>c.jsx(P_,{index:Q,title:e(S.titleKey),description:e(S.descriptionKey),icon:S.icon,hint:e(S.hintKey),onClick:()=>Ee({key:$e,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(ro,{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)??On.project}),c.jsx(ks,{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:()=>{u(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(ro,{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:()=>fe(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(C0,{className:"w-3 h-3"}):c.jsx(j0,{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(Gc,{className:"w-3 h-3"}),c.jsx("span",{className:"hidden sm:inline",children:On.branch})]})]}),c.jsxs("div",{className:"flex gap-2 items-center px-3 shrink-0",children:[(t==null?void 0:t.taskAdmission)&&c.jsx(ry,{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(ct,{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",Ye?"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(ct,{className:"h-3.5 w-3.5 animate-spin"}):Ye?c.jsx(xd,{className:"h-3.5 w-3.5"}):Sn?c.jsx(Is,{className:"h-3.5 w-3.5"}):c.jsx(ro,{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||(Ye?e("taskHome.setup.workspace.ready",{project:On.project}):e("taskHome.setup.workspace.required"))})]}),!Ye&&c.jsxs("div",{className:"flex gap-1 items-center shrink-0",children:[Sn&&c.jsx("button",{type:"button",onClick:()=>{Promise.all([$(),O()])},"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(no,{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(wi,{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&&!ae?"border-emerald-300/70 bg-emerald-50 text-emerald-700 dark:border-emerald-800/70 dark:bg-emerald-950/40 dark:text-emerald-300":ae?"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:dt?c.jsx(ct,{className:"h-3.5 w-3.5 animate-spin"}):qn&&!ae?c.jsx(xd,{className:"h-3.5 w-3.5"}):ae?c.jsx(Is,{className:"h-3.5 w-3.5"}):c.jsx(yd,{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:ae??void 0,className:W("mt-0.5 block truncate text-[10.5px]",ae?"text-red-600 dark:text-red-400":"text-[hsl(var(--deck-ink-faint))]"),children:dt?e("taskHome.setup.model.loading"):ae||e(qn?"taskHome.setup.model.ready":"taskHome.setup.model.required")})]}),!dt&&(!qn||ae)&&c.jsxs("button",{type:"button","data-model-setup-trigger":!0,onClick:()=>{ae?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:[ae?c.jsx(no,{className:"w-3 h-3"}):c.jsx(yd,{className:"w-3 h-3"}),e(ae?"taskHome.setup.model.retry":"taskHome.setup.model.action")]})]})]})]}),c.jsx("div",{className:"px-3 pt-3 pb-3",children:c.jsx(C_,{variant:"task",draft:(ye==null?void 0:ye.key)===$e?ye.content:void 0,draftKey:$e,placeholder:e("taskHome.composer.placeholder"),onSend:async S=>{try{return await Dt(S),Ee(void 0),!0}catch{return!1}},disabled:s,submitDisabled:!an,shellSubmitDisabled:!an,workspacePath:Ne},$e)})]}),R==="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(kd,{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(no,{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(E_,{sessions:Ke,catalogLoadState:J,cancellingTaskKeys:j,retryingTaskKeys:A,unreadTaskKeys:N,onSelect:S=>{b(me(S))},onCancel:S=>{y(me(S)).catch(()=>{})},onRetry:S=>{k(me(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(Of,{className:"w-3 h-3"}),c.jsx("span",{className:"font-mono uppercase tracking-[0.14em]",children:e("taskHome.footer.note")})]}),c.jsx(fy,{open:Pe,onOpenChange:U})]})})}const qc="blade.sessions.last",Bi="session",zc="project",Kc="workspace";function R_(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 O_(e){var o,i,a;const t=new URLSearchParams(e),n=((o=t.get(Bi))==null?void 0:o.trim())||null,r=((i=t.get(zc))==null?void 0:i.trim())||null,s=((a=t.get(Kc))==null?void 0:a.trim())||null;return{sessionRef:n&&(s||r)?{sessionId:n,projectPath:s||r}:null,projectPath:r,hasSessionParam:t.has(Bi)}}function M_(e=typeof localStorage>"u"?null:localStorage){if(!e)return null;try{const t=e.getItem(qc);return t?R_(JSON.parse(t)):null}catch{return null}}function F_(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(Bi,e.sessionId):s.searchParams.delete(Bi),o?s.searchParams.set(zc,o):s.searchParams.delete(zc),i&&o&&i!==o?s.searchParams.set(Kc,i):s.searchParams.delete(Kc);const a=n.storage===void 0?typeof localStorage>"u"?null:localStorage:n.storage;try{e?a==null||a.setItem(qc,JSON.stringify(e)):a==null||a.removeItem(qc)}catch{}const l=`${s.pathname}${s.search}${s.hash}`,u=n.replaceState??(typeof window>"u"?void 0:m=>window.history.replaceState(null,"",m));return u==null||u(l),l}const D_=v.lazy(()=>bo(()=>import("./ChatView-Fqy97qw9.js"),__vite__mapDeps([9,1,3,2])).then(e=>({default:e.ChatView})));function __(){const e=Mt(),[t,n]=v.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),u=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=Et(A=>A.loadModels),k=ho(A=>A.loadSettings);return v.useEffect(()=>(r().catch(A=>{console.error("Failed to subscribe to task events",A)}),s),[r,s]),v.useEffect(()=>{let A=!1;return(async()=>{var Y;u(),k(),j();const R=O_(window.location.search),J=M_(),T=R.hasSessionParam?R.sessionRef:R.projectPath?null:J,C=Promise.all([a(),l()]),$=!T&&!R.projectPath;if($&&(g(),n(!0)),await C,A)return;const O=L.getState(),K=R.projectPath?(Y=O.boundProjects.find(P=>P.path===R.projectPath&&P.available))==null?void 0:Y.path:null;if(K&&p(K),!(T&&(await m(T),A))){if(!T||!se(L.getState().currentSessionRef,T)){const P=T?L.getState().error:null;g(),P&&x(P)}$||n(!0)}})(),()=>{A=!0}},[l,j,u,k,a,p,m,x,g]),v.useEffect(()=>{if(!t)return;const A=o?Wu(b,o):void 0;F_(o,y,{displayProjectPath:A?si(A,y):y})},[o,t,y,b]),c.jsxs(c.Fragment,{children:[c.jsx(c_,{}),c.jsx(a_,{children:t?!o||i?c.jsx($_,{}):c.jsx(v.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(D_,{})}):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")})})]})}Vy.createRoot(document.getElementById("root")).render(c.jsx(Xs.StrictMode,{children:c.jsx(__,{})}));export{Et as A,Zu as B,C_ as C,Yc as D,ho as E,N2 as F,ed as G,co as H,si as I,Mc as J,sy as K,zt as L,Lc as M,K_ as N,tf as O,Gn as P,hr as Q,z_ as R,Xu as S,bo as _,L as a,br as b,me as c,qe as d,qi as e,Xc as f,zi as g,Ki as h,Kf as i,W as j,re as k,BD as l,Xn as m,Pa as n,Si as o,Wu as p,i5 as q,hf as r,se as s,Xx as t,Mt as u,mr as v,dy as w,Vn as x,Mn as y,bS as z};
|