@tencent-ai/codebuddy-code 2.94.4 → 2.95.0-next.26e75c2.20260503
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/CHANGELOG.md +37 -0
- package/dist/codebuddy-headless.js +115 -102
- package/dist/codebuddy.js +132 -119
- package/dist/web-ui/assets/{index-BpnOVpEQ.js → index-BY1JTnsk.js} +126 -126
- package/dist/web-ui/index.html +1 -1
- package/dist/web-ui/sw.js +1 -1
- package/package.json +3 -2
- package/product.cloudhosted.json +5 -3
- package/product.internal.json +5 -3
- package/product.ioa.json +5 -3
- package/product.json +7 -5
- package/product.selfhosted.json +5 -3
- package/vendor/sandbox/sandbox-cli +0 -0
- package/vendor/sandbox/sandbox-cli.exe +0 -0
- package/vendor/sandbox/sandbox_ffi.dll +0 -0
- package/vendor/sandbox/tsbx.dll +0 -0
- package/vendor/sandbox/tsbx_sdk.dll +0 -0
|
@@ -6,602 +6,602 @@ var cm=Object.defineProperty;var dm=(e,t,n)=>t in e?cm(e,t,{enumerable:!0,config
|
|
|
6
6
|
|
|
7
7
|
`);s=o.pop()||"";for(const c of o){const p=c.split(`
|
|
8
8
|
`);let h="";for(const b of p)b.startsWith("data: ")&&(h+=b.substring(6));if(h)try{const b=JSON.parse(h);this.handleMessage(b)}catch{}}}}finally{n.releaseLock()}}handleMessage(t){if("method"in t&&"id"in t&&t.id!==void 0&&t.id!==null){if(t.method==="session/request_permission"){this.handlePermissionRequest(t.id,t.params);return}if(t.method==="_codebuddy.ai/question"){this.handleExtMethodQuestion(t.id,t.params);return}if(t.method==="_codebuddy.ai/delegateTool"){this.handleExtMethodDelegateTool(t.id,t.params);return}return}if("id"in t&&t.id!==void 0&&t.id!==null&&!("method"in t)){const n=this.pendingRequests.get(t.id);n&&(this.pendingRequests.delete(t.id),"error"in t&&t.error?n.reject(new Error(t.error.message)):n.resolve(t.result))}if("method"in t&&t.method==="session/update"){const n=t.params;if(n!=null&&n.update){const i=n.update,l=((i==null?void 0:i._meta)||{})["codebuddy.ai/interruptionRequest"];l&&this.emit("interruption_request",{sessionUpdate:"interruption_request",sessionId:n.sessionId,interruptionId:l.interruptionId||`ir-${l.toolCallId}`,reason:"Tool requires approval",options:l.options||[],toolName:l.toolName,toolTitle:l.toolTitle,toolInput:l.toolInput,toolCallId:l.toolCallId});const d=n.update.sessionUpdate;this.emit(d,n.update)}}else if("method"in t&&t.method!=="session/update"&&!("id"in t&&t.id!==void 0&&t.id!==null)&&t.method==="_codebuddy.ai/checkpoint"){const i=t.params;(i==null?void 0:i.event)==="created"?this.emit("checkpointCreated",i.checkpoint):(i==null?void 0:i.event)==="updated"?this.emit("checkpointUpdated",i.checkpoint):(i==null?void 0:i.event)==="reverted"&&this.emit("checkpointReverted",i.checkpoint)}}mapPermissionDecisionToOptionId(t){return t==="allowAll"?"allow_always":t==="allow"?"allow":t==="rejectAndExitPlan"?"reject_and_exit_plan":"reject"}async sendJsonRpcResult(t,n){var l;const i={jsonrpc:"2.0",id:t,result:n},s=await fetch(`${this.baseUrl}/api/v1/acp`,{method:"POST",headers:this.buildAcpHeaders(),body:JSON.stringify(i)});if(!s.ok){let d="";try{const a=await s.json();(l=a==null?void 0:a.error)!=null&&l.message&&(d=a.error.message)}catch{}throw new Error(d||`ACP response failed: ${s.status} ${s.statusText}`)}}buildAcpHeaders(){const t={"Content-Type":"application/json",Accept:"application/json, text/event-stream",[ft]:_t};return this.connectionId&&(t["acp-connection-id"]=this.connectionId),this.sessionToken&&(t["acp-session-token"]=this.sessionToken),this.token&&(t.Authorization=`Bearer ${this.token}`),t}handlePermissionRequest(t,n){var c;const i=n==null?void 0:n.toolCall,s=`perm-${t}`,l=((c=i==null?void 0:i._meta)==null?void 0:c["codebuddy.ai/toolName"])||(i==null?void 0:i.toolName)||"tool",d=(i==null?void 0:i.title)||l,a=i==null?void 0:i.rawInput,o=i==null?void 0:i.toolCallId;this.permissionRequestIds.set(s,t),o&&this.permissionRequestToolCallIds.set(o,s),this.emit("interruption_request",{sessionUpdate:"interruption_request",interruptionId:s,reason:"Tool requires approval",options:((n==null?void 0:n.options)||[]).map(p=>p.optionId||p.name),toolName:l,toolTitle:d,toolInput:a,toolCallId:o})}handleExtMethodQuestion(t,n){const{sessionId:i,toolCallId:s,schema:l}=n||{},d=((l==null?void 0:l.questions)||[]).map(a=>({id:a.id,question:a.question,header:a.header||"",options:(a.options||[]).map(o=>({label:o.label||"",description:o.description||""})),multiSelect:!!a.multiSelect}));this.extMethodRequestIds.set(s,t),this.emit("question_request",{toolCallId:s,sessionId:i,questions:d})}async handleExtMethodDelegateTool(t,n){const{toolId:i,input:s}=n||{};try{if(i==="ui-control"){const{uiController:l}=await Dn(async()=>{const{uiController:a}=await import("./index-DixJ0kqk.js");return{uiController:a}},[]),d=await l.execute({sessionId:n.sessionId,action:s.action,target:s.target,value:s.value});await this.sendJsonRpcResult(t,{status:"success",output:d})}else if(i==="ui-query"){const{uiController:l}=await Dn(async()=>{const{uiController:a}=await import("./index-DixJ0kqk.js");return{uiController:a}},[]),d=await l.queryElements({selector:s==null?void 0:s.selector,role:s==null?void 0:s.role,includeHidden:s==null?void 0:s.includeHidden,limit:s==null?void 0:s.limit});await this.sendJsonRpcResult(t,{status:"success",output:d})}else await this.sendJsonRpcResult(t,{status:"error",error:{message:`Unknown delegate tool: ${i}`}})}catch(l){await this.sendJsonRpcResult(t,{status:"error",error:{message:l instanceof Error?l.message:String(l)}})}}emit(t,n){const i=this.listeners.get(t);if(i)for(const s of i)try{s(n)}catch(l){console.error(`Event handler error for ${t}:`,l)}}setStatus(t){this._status=t,this.emit("status_change",t)}}const _m=Object.freeze(Object.defineProperty({__proto__:null,AcpClient:qi,CUSTOM_REQUEST_HEADER_NAME:ft,CUSTOM_REQUEST_HEADER_VALUE:_t,fetchWithRetry:ve},Symbol.toStringTag,{value:"Module"})),Xu="codebuddy.auth.token";function Tr(){try{return sessionStorage.getItem(Xu)}catch{return null}}function Zu(e){try{sessionStorage.setItem(Xu,e)}catch{}}function se(e){const t={[ft]:_t,...e},n=Tr();return n&&(t.Authorization=`Bearer ${n}`),t}const Ju=Ne(e=>({viewState:"loading",error:null,isSubmitting:!1,checkAuth:async()=>{try{e({viewState:"loading",error:null});const t=await ve("/api/v1/auth/status",{headers:se()});if(!t.ok){e({viewState:"authenticated"});return}const n=await t.json();!n.authEnabled||n.authenticated?e({viewState:"authenticated"}):e({viewState:"login"})}catch(t){console.warn("[auth] Failed to check auth status, falling back to authenticated:",t),e({viewState:"authenticated"})}},login:async t=>{try{e({isSubmitting:!0,error:null});const i=await(await fetch("/api/v1/auth/login",{method:"POST",headers:se({"Content-Type":"application/json"}),body:JSON.stringify({password:t})})).json();if(i.success){const s=i.token||t;return Zu(s),e({viewState:"authenticated",isSubmitting:!1,error:null}),!0}return e({error:i.error||"login.error.incorrect",isSubmitting:!1}),!1}catch(n){return console.warn("[auth] Login request failed:",n),e({error:"app.connectFailed",isSubmitting:!1}),!1}},clearError:()=>e({error:null})}));function kn(e){const t=Object.entries(e).filter(([,n])=>n!==void 0);return t.length===0?"":"?"+t.map(([n,i])=>`${n}=${encodeURIComponent(i)}`).join("&")}const Vr={async get(e,t){var l;const n=kn({key:e,scope:t}),i=await fetch(`/api/v1/storage${n}`,{headers:se()});return i.ok?(l=(await i.json()).data)==null?void 0:l.value:void 0},async getNamespace(e,t){const n=kn({namespace:e,scope:t}),i=await fetch(`/api/v1/storage${n}`,{headers:se()});return i.ok?(await i.json()).data??{}:{}},async set(e,t,n){const i=kn({scope:n});await fetch(`/api/v1/storage${i}`,{method:"PUT",headers:se({"Content-Type":"application/json"}),body:JSON.stringify({key:e,value:t})})},async setMany(e,t,n){const i=kn({scope:t});await fetch(`/api/v1/storage${i}`,{method:"PUT",headers:se({"Content-Type":"application/json"}),body:JSON.stringify({entries:e}),keepalive:(n==null?void 0:n.keepalive)===!0})},async remove(e,t){const n=kn({key:e,scope:t});await fetch(`/api/v1/storage${n}`,{method:"DELETE",headers:se()})}};function qn(e){return e instanceof Set?[...e]:e instanceof Map?[...e.entries()]:e}function jn(e,t){return(n,i,s)=>{const l=e(n,i,s);let d=null;const a=t.debounceMs??500,o=t.scope??"global",c=h=>{if(d===null)return;clearTimeout(d),d=null;const b=i(),y=t.fields.map(k=>({key:`${t.namespace}.${String(k)}`,value:qn(b[k])}));if(t.localStorageKey)try{const k={};for(const v of t.fields)k[String(v)]=qn(b[v]);localStorage.setItem(t.localStorageKey,JSON.stringify(k))}catch{}Vr.setMany(y,o,{keepalive:!0}).catch(k=>{console.error(`[persist:${t.namespace}] Save failed (${h}):`,k)})},p=()=>{d&&clearTimeout(d),d=setTimeout(()=>{d=null;const h=i(),b=t.fields.map(y=>({key:`${t.namespace}.${String(y)}`,value:qn(h[y])}));if(t.localStorageKey)try{const y={};for(const k of t.fields)y[String(k)]=qn(h[k]);localStorage.setItem(t.localStorageKey,JSON.stringify(y))}catch{}Vr.setMany(b,o).catch(y=>{console.error(`[persist:${t.namespace}] Save failed:`,y)})},a)};if(typeof window<"u"){const h=()=>c("beforeunload");window.addEventListener("beforeunload",h),window.addEventListener("pagehide",h),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&c("hidden")})}return s.subscribe((h,b)=>{for(const y of t.fields)if(h[y]!==b[y]){p();return}}),Vr.getNamespace(t.namespace,o).then(h=>{if(!h||Object.keys(h).length===0)return;const b={};let y=!1;for(const k of t.fields){const v=String(k);v in h&&h[v]!==void 0&&(b[k]=h[v],y=!0)}y&&(t.onLoad?t.onLoad(b,n):n(b))}).catch(h=>{console.error(`[persist:${t.namespace}] Load failed:`,h)}),l}}const Qu="codebuddy-theme";function ep(){var e;return typeof window<"u"&&((e=window.matchMedia)!=null&&e.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light"}function Kr(e){return e==="system"?ep():e}function Vn(e){document.documentElement.setAttribute("data-theme",e)}function Sm(){try{const e=localStorage.getItem(Qu);if(e){const t=JSON.parse(e),n=(t==null?void 0:t.mode)??e;if(["light","dark","system"].includes(n))return n}}catch{}return"system"}const Ye=Ne()(jn((e,t)=>{const n=Sm(),i=Kr(n);return Vn(i),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{if(t().mode==="system"){const l=ep();Vn(l),e({resolved:l})}}),{mode:n,resolved:i,setMode:s=>{const l=Kr(s);Vn(l),e({mode:s,resolved:l})},toggle:()=>{const s=t().mode,l=s==="light"?"dark":s==="dark"?"system":"light";t().setMode(l)}}},{namespace:"theme",fields:["mode"],scope:"global",debounceMs:300,localStorageKey:Qu,onLoad:(e,t)=>{if(e.mode){const n=Kr(e.mode);Vn(n),t({mode:e.mode,resolved:n})}}}));var Kn={},Cd;function km(){if(Cd)return Kn;Cd=1;var e=mm();return Kn.createRoot=e.createRoot,Kn.hydrateRoot=e.hydrateRoot,Kn}var wm=km();let Et=0;function _i(e){const t=e[e.length-1];return t&&t.type==="message"&&t.role==="assistant"&&t.streaming?e.length-1:-1}function $t(e){const t=_i(e);if(t===-1)return e;const n=[...e],i=n[t],s={streaming:!1};return i.thinking&&i.thinkingStartTime&&!i.thinkingDuration&&(s.thinkingDuration=Math.round((Date.now()-i.thinkingStartTime)/1e3)),n[t]={...i,...s},n}const Ke=Ne((e,t)=>({timeline:[],childToolCalls:new Map,isAgentRunning:!1,stopReason:null,errorMessage:null,errorCategory:null,agentPhaseLabel:null,progressLabel:null,historyLoading:!1,hasPendingInterruption:!1,addUserMessage:(n,i,s)=>{e(l=>({timeline:[...$t(l.timeline),{type:"message",id:`msg-${++Et}`,role:"user",content:n,...i&&i.length>0?{images:i}:{},...s&&s.length>0?{files:s}:{},timestamp:Date.now()}],isAgentRunning:!0,stopReason:null,errorMessage:null}))},addQueuedUserMessage:(n,i,s)=>{e(l=>({timeline:[...l.timeline,{type:"message",id:`msg-${++Et}`,role:"user",content:n,...i&&i.length>0?{images:i}:{},...s&&s.length>0?{files:s}:{},timestamp:Date.now()}]}))},addChunk:(n,i,s)=>{e(l=>{if(i){const o=l.timeline.findIndex(c=>c.type==="tool_call"&&c.id===i);if(o!==-1){const c=l.timeline[o],p=[...c.subagentTimeline||[]],h=p[p.length-1];h&&h.type==="message"&&h.streaming?p[p.length-1]={...h,content:h.content+n}:p.push({type:"message",id:`sub-msg-${++Et}`,content:n,streaming:!0});const b=[...l.timeline];return b[o]={...c,subagentTimeline:p},{timeline:b}}}const d=[...l.timeline],a=_i(d);if(a!==-1){const o=d[a],c={content:o.content+n};s&&!o.isCompactInternal&&(c.isCompactInternal=!0),o.thinking&&o.thinkingStartTime&&!o.thinkingDuration&&!o.content&&(c.thinkingDuration=Math.round((Date.now()-o.thinkingStartTime)/1e3)),d[a]={...o,...c}}else d.push({type:"message",id:`msg-${++Et}`,role:"assistant",content:n,timestamp:Date.now(),streaming:!0,...s?{isCompactInternal:s}:{}});return{timeline:d}})},addThinkingChunk:(n,i)=>{e(s=>{if(i){const a=s.timeline.findIndex(o=>o.type==="tool_call"&&o.id===i);if(a!==-1){const o=s.timeline[a],c=[...o.subagentTimeline||[]],p=c[c.length-1];p&&p.type==="message"&&p.streaming?c[c.length-1]={...p,content:p.content+n}:c.push({type:"message",id:`sub-msg-${++Et}`,content:n,streaming:!0});const h=[...s.timeline];return h[a]={...o,subagentTimeline:c},{timeline:h}}}const l=[...s.timeline],d=_i(l);if(d!==-1){const a=l[d];l[d]={...a,thinking:(a.thinking||"")+n,thinkingStartTime:a.thinkingStartTime||Date.now()}}else l.push({type:"message",id:`msg-${++Et}`,role:"assistant",content:"",thinking:n,thinkingStartTime:Date.now(),timestamp:Date.now(),streaming:!0});return{timeline:l}})},finalizeAssistantMessage:()=>{e(n=>({timeline:$t(n.timeline)}))},addToolCall:n=>{e(i=>{const s=$t(i.timeline);if(n.parentToolCallId){const l=new Map(i.childToolCalls);return l.set(n.id,{...n,type:"tool_call"}),{timeline:s.map(d=>{if(d.type==="tool_call"&&d.id===n.parentToolCallId){const a=(d.subagentTimeline||[]).map(o=>o.type==="message"&&o.streaming?{...o,streaming:!1}:o);return{...d,children:[...d.children||[],n.id],subagentTimeline:[...a,{type:"tool_call_ref",toolCallId:n.id}]}}return d}),childToolCalls:l}}return{timeline:[...s,{...n,type:"tool_call"}]}})},updateToolCall:(n,i)=>{e(s=>{const l=c=>!c||!Array.isArray(c)?!1:c.some(p=>p.type==="diff"),d=c=>{let p=i;if(l(c.content)&&i.content!==void 0&&!l(i.content)){const{content:h,...b}=i;p=b}return{...c,...p,type:"tool_call"}};if(s.timeline.some(c=>c.type==="tool_call"&&c.id===n))return{timeline:s.timeline.map(c=>c.type==="tool_call"&&c.id===n?d(c):c)};const o=s.childToolCalls.get(n);if(o){const c=new Map(s.childToolCalls);return c.set(n,d(o)),{childToolCalls:c}}return{}})},getChildToolCall:n=>t().childToolCalls.get(n),getToolCall:n=>{const i=t();return i.timeline.find(l=>l.type==="tool_call"&&l.id===n)??i.childToolCalls.get(n)},addQuestion:n=>{e(i=>i.timeline.some(l=>l.type==="question"&&l.toolCallId===n.toolCallId&&l.status==="pending")?i:{timeline:[...$t(i.timeline),{...n,type:"question",status:"pending"}],hasPendingInterruption:!0})},submitQuestion:(n,i)=>{e(s=>{const l=s.timeline.map(a=>a.type==="question"&&a.id===n?{...a,status:"answered",answers:i}:a),d=l.some(a=>a.type==="interruption"&&!a.resolved||a.type==="question"&&a.status==="pending");return{timeline:l,hasPendingInterruption:d}})},cancelQuestion:n=>{e(i=>{const s=i.timeline.map(d=>d.type==="question"&&d.id===n?{...d,status:"cancelled"}:d),l=s.some(d=>d.type==="interruption"&&!d.resolved||d.type==="question"&&d.status==="pending");return{timeline:s,hasPendingInterruption:l}})},resolveQuestionByToolCallId:n=>{e(i=>{const s=i.timeline.map(d=>d.type==="question"&&d.toolCallId===n&&d.status==="pending"&&d.source==="interruption"?{...d,status:"cancelled"}:d),l=s.some(d=>d.type==="interruption"&&!d.resolved||d.type==="question"&&d.status==="pending");return{timeline:s,hasPendingInterruption:l}})},addInterruption:n=>{e(i=>n.toolCallId&&i.timeline.some(l=>l.type==="interruption"&&l.toolCallId===n.toolCallId&&!l.resolved)?i:{timeline:[...$t(i.timeline),{...n,type:"interruption"}],hasPendingInterruption:!0})},resolveInterruption:(n,i)=>{e(s=>{const l=s.timeline.map(a=>a.type==="interruption"&&a.id===n?{...a,resolved:!0,decision:i}:a),d=l.some(a=>a.type==="interruption"&&!a.resolved||a.type==="question"&&a.status==="pending");return{timeline:l,hasPendingInterruption:d}})},resolveInterruptionByToolCallId:(n,i)=>{e(s=>{const l=s.timeline.map(a=>a.type==="interruption"&&a.toolCallId===n&&!a.resolved?{...a,resolved:!0,decision:i}:a),d=l.some(a=>a.type==="interruption"&&!a.resolved||a.type==="question"&&a.status==="pending");return{timeline:l,hasPendingInterruption:d}})},setHistoryLoading:n=>e({historyLoading:n}),addHistoryUserMessage:(n,i,s,l)=>{e(d=>({timeline:[...$t(d.timeline),{type:"message",id:`msg-${++Et}`,role:"user",content:n,...i&&i.length>0?{images:i}:{},timestamp:Date.now(),...s?{isCompactInternal:s}:{},...l?{channel:l}:{}}]}))},addHistoryUserMessageChunk:(n,i,s,l,d)=>{!i&&!(s&&s.length>0)||e(a=>{const o=$t(a.timeline),c=o[o.length-1];if(c&&c.type==="message"&&c.role==="user"&&n&&c.messageId===n){const p=[...c.images||[],...s||[]];return o[o.length-1]={...c,content:c.content+i,...p.length>0?{images:p}:{},...l?{isCompactInternal:!0}:{},...d?{channel:d}:{}},{timeline:o}}return{timeline:[...o,{type:"message",id:`msg-${++Et}`,...n?{messageId:n}:{},role:"user",content:i,...s&&s.length>0?{images:s}:{},timestamp:Date.now(),...l?{isCompactInternal:l}:{},...d?{channel:d}:{}}]}})},setAgentRunning:n=>e({isAgentRunning:n,...n?{}:{agentPhaseLabel:null,progressLabel:null}}),setAgentPhaseLabel:n=>e({agentPhaseLabel:n}),setProgressLabel:n=>e({progressLabel:n}),setSessionEnd:(n,i,s)=>{t().finalizeAssistantMessage();const l=n==="end_turn";e(d=>{const a=d.timeline.map(c=>c.type==="tool_call"&&c.status==="running"?{...c,status:"completed"}:c.type==="interruption"&&!c.resolved?{...c,resolved:!0,decision:"deny"}:c.type==="question"&&c.status==="pending"?{...c,status:"cancelled"}:c),o=new Map(d.childToolCalls);for(const[c,p]of o)p.status==="running"&&o.set(c,{...p,status:"completed"});return{isAgentRunning:!1,hasPendingInterruption:!1,agentPhaseLabel:null,progressLabel:null,stopReason:l?null:n,errorMessage:l?null:i||null,errorCategory:l?null:s||null,timeline:a,childToolCalls:o}})},clearMessages:()=>e({timeline:[],childToolCalls:new Map,stopReason:null,errorMessage:null,agentPhaseLabel:null,progressLabel:null,historyLoading:!1,hasPendingInterruption:!1}),clearChat:()=>{t().clearMessages()}})),Em=Object.freeze(Object.defineProperty({__proto__:null,useChatStore:Ke},Symbol.toStringTag,{value:"Module"})),nt=Ne((e,t)=>({status:"disconnected",sessionId:null,models:[],currentModel:"",modes:[],currentMode:"default",commands:[],error:null,topic:null,thinkingEnabled:!1,promptSuggestion:null,externalInput:null,setStatus:n=>e({status:n}),setSessionId:n=>e({sessionId:n}),setModels:n=>e({models:n}),setCurrentModel:n=>e({currentModel:n}),setModes:n=>e({modes:n}),setCurrentMode:n=>e({currentMode:n}),setCommands:n=>e({commands:n}),setTopic:n=>e({topic:n}),setThinkingEnabled:n=>e({thinkingEnabled:n}),setPromptSuggestion:n=>e({promptSuggestion:n}),setExternalInput:n=>e({externalInput:n}),connect:async n=>{const i=Re();try{if(e({status:"connecting",error:null}),n){const{AcpClient:s}=await Dn(async()=>{const{AcpClient:a}=await Promise.resolve().then(()=>_m);return{AcpClient:a}},void 0),l=new s(void 0,n);l.on("status_change",a=>e({status:a})),l.on("model_update",a=>{e({models:a.availableModels||[],currentModel:a.currentModelId||""})});const{sessionId:d}=await l.initializeSession({continue:!0});e({status:"connected",sessionId:d})}else{const{sessionId:s}=await i.initializeSession({continue:!0});e({status:"connected",sessionId:s})}}catch(s){e({status:"error",error:s.message})}},disconnect:async()=>{await Re().disconnect(),e({status:"disconnected",sessionId:null})}})),Nn=Ne((e,t)=>({fileChanges:[],selectedFile:null,selectedDiff:null,diffLoading:!1,isCollapsed:!0,checkpoints:[],showCheckpoints:!1,reverting:!1,onCheckpoint:n=>{const{fileChanges:i}=t(),s=new Map;for(const l of i)s.set(l.uri,l);for(const l of n.fileChanges.files)s.set(l.uri,l);e({fileChanges:Array.from(s.values())})},selectFile:async n=>{const{selectedFile:i}=t();if(i===n){e({selectedFile:null,selectedDiff:null});return}e({selectedFile:n,selectedDiff:null,diffLoading:!0});try{const s=await ve(`/api/v1/file-changes/diff?path=${encodeURIComponent(n)}`,{headers:se()});s.ok?e({selectedDiff:await s.json(),diffLoading:!1}):e({diffLoading:!1})}catch{e({diffLoading:!1})}},setCollapsed:n=>e({isCollapsed:n}),setShowCheckpoints:n=>e({showCheckpoints:n}),loadCheckpoints:async()=>{try{const n=await ve("/api/v1/file-changes/checkpoints",{headers:se()});if(n.ok){const s=((await n.json()).checkpoints||[]).sort((l,d)=>d.createdAt-l.createdAt);e({checkpoints:s})}}catch{}},revertFiles:async n=>{e({reverting:!0});try{const i=await ve("/api/v1/file-changes/revert",{method:"POST",headers:{...se(),"Content-Type":"application/json"},body:JSON.stringify({paths:n})});if(i.ok){const s=await i.json(),l=new Set(s.revertedFiles||[]);e(d=>({fileChanges:d.fileChanges.filter(a=>!l.has(a.uri)),selectedFile:l.has(d.selectedFile||"")?null:d.selectedFile,selectedDiff:l.has(d.selectedFile||"")?null:d.selectedDiff}))}}finally{e({reverting:!1})}},revertAll:async()=>{e({reverting:!0});try{(await ve("/api/v1/file-changes/revert",{method:"POST",headers:{...se(),"Content-Type":"application/json"},body:JSON.stringify({})})).ok&&e({fileChanges:[],selectedFile:null,selectedDiff:null})}finally{e({reverting:!1})}},revertToCheckpoint:async(n,i="CodeAndConversation")=>{e({reverting:!0});try{if((await ve("/api/v1/file-changes/revert",{method:"POST",headers:{...se(),"Content-Type":"application/json"},body:JSON.stringify({checkpointId:n,scope:i})})).ok){if((i==="Code"||i==="CodeAndConversation")&&e({fileChanges:[],selectedFile:null,selectedDiff:null}),i==="Conversation"||i==="CodeAndConversation")try{const{useChatStore:l}=await Dn(async()=>{const{useChatStore:o}=await Promise.resolve().then(()=>Em);return{useChatStore:o}},void 0);l.getState().clearChat();const d=Re(),a=sessionStorage.getItem("acp-session-id");d&&a&&await d.loadSession(a)}catch(l){console.error("Failed to reload session after revert:",l)}t().loadCheckpoints()}}finally{e({reverting:!1})}},reset:()=>e({fileChanges:[],selectedFile:null,selectedDiff:null,diffLoading:!1,isCollapsed:!0,checkpoints:[],showCheckpoints:!1,reverting:!1})})),We=Ne(e=>({isInTeam:!1,teamName:null,isAutoTeam:!1,members:[],focusedMemberName:null,memberHistories:{},setTeamStatus:t=>e({isInTeam:t.isInTeam,teamName:t.teamName||null,isAutoTeam:t.isAutoTeam||!1,members:t.members}),updateMembers:t=>e({members:t}),setFocusedMember:t=>e({focusedMemberName:t}),setMemberHistory:(t,n)=>e(i=>({memberHistories:{...i.memberHistories,[t]:n}})),clearTeam:()=>e({isInTeam:!1,teamName:null,isAutoTeam:!1,members:[],focusedMemberName:null,memberHistories:{}})})),tp=Ne(e=>({userInfo:null,loading:!1,error:null,fetchUserInfo:async t=>{e({loading:!0,error:null});try{const n=await t.getUserInfo();n.userInfo?e({userInfo:n.userInfo,loading:!1}):e({loading:!1})}catch(n){console.warn("[user] Failed to fetch user info:",n),e({error:n.message,loading:!1})}},clearUserInfo:()=>{e({userInfo:null,error:null})}}));function Td(e,t){const n=e.options||e.answers;let i=[];return Array.isArray(n)&&(i=n.map(s=>typeof s=="object"&&s!==null&&"label"in s?{label:String(s.label||""),description:String(s.description||"")}:{label:String(s||""),description:""}).filter(s=>s.label.trim().length>0)),{id:e.id||`q_${t}`,question:e.question||"",header:e.header||"",options:i,multiSelect:!!e.multiSelect}}const Cm={preparing:"phase.preparing",model_requesting:"phase.modelRequesting",model_streaming:"phase.modelStreaming",model_done:"phase.modelDone",tool_executing:"phase.toolExecuting",waiting_for_permission:"chat.waitingPermission",waiting_for_user:"chat.waitingUser",retrying:"phase.retrying",idle:null};function Tm(e){return e.phase==="tool_executing"&&e.toolName?`phase.toolExecutingName:${e.toolName}`:e.phase==="model_streaming"&&e.streamingToolName?`phase.modelStreamingName:${e.streamingToolName}`:Cm[e.phase]??null}let Pt=null;function Re(){return Pt||(Pt=new qi),Pt}function Nm(){const e=C.useRef(Re()),[t,n]=C.useState(0),{sessionId:i,setStatus:s,setSessionId:l,setModels:d,setCurrentModel:a,setModes:o,setCurrentMode:c,setCommands:p,setTopic:h,setThinkingEnabled:b,setPromptSuggestion:y}=nt(),{addChunk:k,addThinkingChunk:v,addToolCall:g,updateToolCall:m,addInterruption:u,addQuestion:f,setSessionEnd:x,resolveInterruptionByToolCallId:E,resolveQuestionByToolCallId:_,setHistoryLoading:S,addHistoryUserMessageChunk:w,finalizeAssistantMessage:A,clearChat:D,setAgentPhaseLabel:R,setProgressLabel:j,setAgentRunning:O}=Ke();C.useEffect(()=>{const U=e.current,q=[],V=(T,N)=>{if(!N)return!1;try{const I=(N._meta||{})["codebuddy.ai/memberEvent"];if(!I)return!1;const G=We.getState(),F=G.memberHistories[I]||[];return G.setMemberHistory(I,[...F,{sessionUpdate:T,...N}]),!0}catch{return!1}};return q.push(U.on("user_message_chunk",T=>{if(V("user_message_chunk",T))return;const N=T.content,L=T._meta||{},I=!!L["codebuddy.ai/isCompactInternal"],G=typeof T.messageId=="string"?T.messageId:typeof L["codebuddy.ai/messageId"]=="string"?L["codebuddy.ai/messageId"]:void 0;let F;const W=L["codebuddy.ai/images"];Array.isArray(W)&&W.length>0&&(F=W.filter($=>$.blobPath&&$.mimeType).map($=>({url:`/api/v1/files/download?path=${encodeURIComponent($.blobPath)}`,mimeType:$.mimeType})),F.length===0&&(F=void 0));let z;const B=L["codebuddy.ai/channelSource"];B&&(z={source:B,sender:L["codebuddy.ai/channelSender"]||"",senderName:L["codebuddy.ai/channelSenderName"],chatId:L["codebuddy.ai/channelChatId"],chatType:L["codebuddy.ai/channelChatType"]}),N&&typeof N.text=="string"&&w(G,N.text,F,I,z)})),q.push(U.on("agent_message_chunk",T=>{if(V("agent_message_chunk",T))return;const N=T.content,L=T._meta||{},I=L["codebuddy.ai/parentToolCallId"],G=!!L["codebuddy.ai/isCompactInternal"];typeof N=="string"?k(N,I,G):N&&typeof N.text=="string"&&k(N.text,I,G)})),q.push(U.on("agent_thought_chunk",T=>{if(V("agent_thought_chunk",T))return;const N=T.content,I=(T._meta||{})["codebuddy.ai/parentToolCallId"];N&&typeof N.text=="string"&&v(N.text,I)})),q.push(U.on("tool_call",T=>{if(V("tool_call",T))return;const N=T._meta||{},L=N["codebuddy.ai/parentToolCallId"],I=!!N["codebuddy.ai/isSubagent"],G=T.toolName||N["codebuddy.ai/toolName"]||"",F=N["codebuddy.ai/planContent"],W={id:T.toolCallId,name:T.title||G||T.kind||"tool",kind:T.kind||"other",toolName:G,input:T.rawInput||T.input,status:"running",locations:T.locations,content:T.content,parentToolCallId:L,subagent:I?{type:N["codebuddy.ai/subagentType"]||"general-purpose",description:N["codebuddy.ai/description"]||"",isBackground:!!N["codebuddy.ai/isBackground"],memberName:N["codebuddy.ai/memberName"]||void 0}:void 0,planContent:F};if(Ke.getState().getToolCall(T.toolCallId)){const{id:B,input:$,...Y}=W,te=$&&typeof $=="object"&&Object.keys($).length>0?{...Y,input:$}:Y;m(T.toolCallId,te)}else g(W)})),q.push(U.on("tool_call_update",T=>{if(V("tool_call_update",T))return;const L={status:T.status==="completed"?"completed":T.status==="failed"?"failed":T.toolStatus==="completed"?"completed":T.toolStatus==="failed"?"failed":"running",result:T.rawOutput||T.toolResult};if(T.content!==void 0){const G=(Array.isArray(T.content)?T.content:[]).filter(F=>{var W;return!F||typeof F!="object"?!0:!(F.type==="content"&&((W=F.content)==null?void 0:W.type)==="text")});G.length>0&&(L.content=G)}T.rawInput&&typeof T.rawInput=="object"&&Object.keys(T.rawInput).length>0&&(L.input=T.rawInput),m(T.toolCallId,L)})),q.push(U.on("interruption_request",T=>{var N;if(T.toolName==="AskUserQuestion"){const L=Array.isArray((N=T.toolInput)==null?void 0:N.questions)?T.toolInput.questions:[];f({id:T.toolCallId,toolCallId:T.toolCallId,sessionId:T.sessionId||i||"",source:"interruption",questions:L.map(Td)});return}u({id:T.interruptionId,sessionId:T.sessionId,reason:T.reason,options:T.options,toolName:T.toolName,toolTitle:T.toolTitle,toolInput:T.toolInput,toolCallId:T.toolCallId})})),q.push(U.on("question_request",T=>{const N=Array.isArray(T.questions)?T.questions:[];f({id:T.toolCallId,toolCallId:T.toolCallId,sessionId:T.sessionId,source:"extMethod",questions:N.map(Td)})})),q.push(U.on("session_end",T=>{x(T.stopReason,T.errorMessage)})),q.push(U.on("session_info_update",T=>{T.title&&h(T.title);const N=T._meta||{};if(N["codebuddy.ai/historyReplay"]==="start"?S(!0):N["codebuddy.ai/historyReplay"]==="end"&&(S(!1),A()),N["codebuddy.ai/agentPhase"]){const I=N["codebuddy.ai/agentPhase"];R(Tm(I))}if("codebuddy.ai/progress"in N){const I=N["codebuddy.ai/progress"];I?(j(`progress.${I.type}`),O(!0)):j(null)}if(N["codebuddy.ai/sessionReset"]){const I=N["codebuddy.ai/newSessionId"];if(I){if(D(),h(null),y(null),l(I),typeof sessionStorage<"u"&&sessionStorage.setItem("acp-session-id",I),typeof window<"u"&&window.history&&window.location){const G=new URL(window.location.href);G.searchParams.get("sessionId")!==I&&(G.searchParams.set("sessionId",I),window.history.replaceState({},"",G.toString()))}U.loadSession(I).then(H).catch(G=>console.error("Failed to load new session after reset:",G))}}if(N["codebuddy.ai/permissionResolved"]){const I=N["codebuddy.ai/toolCallId"],G=N["codebuddy.ai/decision"];I&&G&&(Re().clearPermissionRequestByToolCallId(I),E(I,G),_(I))}if("codebuddy.ai/promptSuggestion"in N){const I=N["codebuddy.ai/promptSuggestion"];y(I||null)}const L=N["codebuddy.ai/teamUpdate"];if(L)switch(L.type){case"member_status_change":L.members&&(L.teamName?We.getState().setTeamStatus({isInTeam:!0,teamName:L.teamName,isAutoTeam:L.isAutoTeam,members:L.members}):We.getState().updateMembers(L.members));break;case"team_created":We.getState().setTeamStatus({isInTeam:!0,teamName:L.teamName,members:[]});break;case"team_deleted":We.getState().clearTeam();break}})),q.push(U.on("model_update",T=>{d(T.availableModels||[]),a(T.currentModelId||"")})),q.push(U.on("mode_update",T=>{T.availableModes&&o(T.availableModes),T.currentModeId&&c(T.currentModeId)})),q.push(U.on("current_mode_update",T=>{T.currentModeId&&c(T.currentModeId)})),q.push(U.on("config_option_update",T=>{const N=T.configOptions||[];for(const L of N)L.id==="thought_level"?b(L.currentValue==="enabled"):L.id==="mode"&&L.currentValue?c(L.currentValue):L.id==="model"&&L.currentValue&&(a(L.currentValue),L.options&&d(L.options.map(I=>({id:I.value,name:I.name||I.value}))))})),q.push(U.on("status_change",T=>{s(T)})),q.push(U.on("available_commands_update",T=>{T.availableCommands&&p(T.availableCommands.map(N=>{var L;return{name:N.name,description:N.description||"",...((L=N._meta)==null?void 0:L.type)==="skill"?{type:"skill"}:{}}}))})),q.push(U.on("checkpointCreated",T=>{Nn.getState().onCheckpoint(T)})),q.push(U.on("checkpointUpdated",T=>{Nn.getState().onCheckpoint(T)})),q.push(U.on("checkpointReverted",()=>{Nn.getState().reset()})),()=>{q.forEach(T=>T())}},[t,i,k,v,g,m,u,f,x,E,_,d,a,o,c,p,h,b,s,S,w,A,D,l,y]);const H=C.useCallback(U=>{if(U.models&&(d(U.models.availableModels.map(q=>({id:q.modelId,name:q.name}))),a(U.models.currentModelId)),U.modes&&(o(U.modes.availableModes),c(U.modes.currentModeId)),U.configOptions)for(const q of U.configOptions)q.id==="thought_level"&&b(q.currentValue==="enabled")},[d,a,o,c,b]),M=C.useCallback(async U=>{const q=typeof U=="string"?U:U==null?void 0:U.token,V=typeof U=="object"?U==null?void 0:U.continue:!1;if(q){if(Pt)try{await Pt.disconnect()}catch{}Pt=new qi(void 0,q),e.current=Pt,n(T=>T+1)}try{s("connecting"),y(null);const T=await e.current.initializeSession({continue:V});l(T.sessionId),H(T),s("connected"),tp.getState().fetchUserInfo(e.current)}catch(T){console.error("Connection failed:",T),s("error")}},[s,l,H,y]);return{client:e.current,connect:M}}/**
|
|
9
|
-
* @license lucide-react v1.
|
|
9
|
+
* @license lucide-react v1.8.0 - ISC
|
|
10
10
|
*
|
|
11
11
|
* This source code is licensed under the ISC license.
|
|
12
12
|
* See the LICENSE file in the root directory of this source tree.
|
|
13
13
|
*/const np=(...e)=>e.filter((t,n,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===n).join(" ").trim();/**
|
|
14
|
-
* @license lucide-react v1.
|
|
14
|
+
* @license lucide-react v1.8.0 - ISC
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the ISC license.
|
|
17
17
|
* See the LICENSE file in the root directory of this source tree.
|
|
18
18
|
*/const Am=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
19
|
-
* @license lucide-react v1.
|
|
19
|
+
* @license lucide-react v1.8.0 - ISC
|
|
20
20
|
*
|
|
21
21
|
* This source code is licensed under the ISC license.
|
|
22
22
|
* See the LICENSE file in the root directory of this source tree.
|
|
23
23
|
*/const Im=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,i)=>i?i.toUpperCase():n.toLowerCase());/**
|
|
24
|
-
* @license lucide-react v1.
|
|
24
|
+
* @license lucide-react v1.8.0 - ISC
|
|
25
25
|
*
|
|
26
26
|
* This source code is licensed under the ISC license.
|
|
27
27
|
* See the LICENSE file in the root directory of this source tree.
|
|
28
28
|
*/const Nd=e=>{const t=Im(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
29
|
-
* @license lucide-react v1.
|
|
29
|
+
* @license lucide-react v1.8.0 - ISC
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the ISC license.
|
|
32
32
|
* See the LICENSE file in the root directory of this source tree.
|
|
33
33
|
*/var Yr={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
34
|
-
* @license lucide-react v1.
|
|
34
|
+
* @license lucide-react v1.8.0 - ISC
|
|
35
35
|
*
|
|
36
36
|
* This source code is licensed under the ISC license.
|
|
37
37
|
* See the LICENSE file in the root directory of this source tree.
|
|
38
38
|
*/const Rm=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Lm=C.createContext({}),Dm=()=>C.useContext(Lm),Om=C.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:i,className:s="",children:l,iconNode:d,...a},o)=>{const{size:c=24,strokeWidth:p=2,absoluteStrokeWidth:h=!1,color:b="currentColor",className:y=""}=Dm()??{},k=i??h?Number(n??p)*24/Number(t??c):n??p;return C.createElement("svg",{ref:o,...Yr,width:t??c??Yr.width,height:t??c??Yr.height,stroke:e??b,strokeWidth:k,className:np("lucide",y,s),...!l&&!Rm(a)&&{"aria-hidden":"true"},...a},[...d.map(([v,g])=>C.createElement(v,g)),...Array.isArray(l)?l:[l]])});/**
|
|
39
|
-
* @license lucide-react v1.
|
|
39
|
+
* @license lucide-react v1.8.0 - ISC
|
|
40
40
|
*
|
|
41
41
|
* This source code is licensed under the ISC license.
|
|
42
42
|
* See the LICENSE file in the root directory of this source tree.
|
|
43
43
|
*/const Z=(e,t)=>{const n=C.forwardRef(({className:i,...s},l)=>C.createElement(Om,{ref:l,iconNode:t,className:np(`lucide-${Am(Nd(e))}`,`lucide-${e}`,i),...s}));return n.displayName=Nd(e),n};/**
|
|
44
|
-
* @license lucide-react v1.
|
|
44
|
+
* @license lucide-react v1.8.0 - ISC
|
|
45
45
|
*
|
|
46
46
|
* This source code is licensed under the ISC license.
|
|
47
47
|
* See the LICENSE file in the root directory of this source tree.
|
|
48
48
|
*/const $m=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Vi=Z("activity",$m);/**
|
|
49
|
-
* @license lucide-react v1.
|
|
49
|
+
* @license lucide-react v1.8.0 - ISC
|
|
50
50
|
*
|
|
51
51
|
* This source code is licensed under the ISC license.
|
|
52
52
|
* See the LICENSE file in the root directory of this source tree.
|
|
53
53
|
*/const jm=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],cn=Z("arrow-left",jm);/**
|
|
54
|
-
* @license lucide-react v1.
|
|
54
|
+
* @license lucide-react v1.8.0 - ISC
|
|
55
55
|
*
|
|
56
56
|
* This source code is licensed under the ISC license.
|
|
57
57
|
* See the LICENSE file in the root directory of this source tree.
|
|
58
58
|
*/const Mm=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Pm=Z("arrow-right",Mm);/**
|
|
59
|
-
* @license lucide-react v1.
|
|
59
|
+
* @license lucide-react v1.8.0 - ISC
|
|
60
60
|
*
|
|
61
61
|
* This source code is licensed under the ISC license.
|
|
62
62
|
* See the LICENSE file in the root directory of this source tree.
|
|
63
63
|
*/const Fm=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Si=Z("arrow-up",Fm);/**
|
|
64
|
-
* @license lucide-react v1.
|
|
64
|
+
* @license lucide-react v1.8.0 - ISC
|
|
65
65
|
*
|
|
66
66
|
* This source code is licensed under the ISC license.
|
|
67
67
|
* See the LICENSE file in the root directory of this source tree.
|
|
68
68
|
*/const Bm=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],Bt=Z("blocks",Bm);/**
|
|
69
|
-
* @license lucide-react v1.
|
|
69
|
+
* @license lucide-react v1.8.0 - ISC
|
|
70
70
|
*
|
|
71
71
|
* This source code is licensed under the ISC license.
|
|
72
72
|
* See the LICENSE file in the root directory of this source tree.
|
|
73
73
|
*/const Um=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Ki=Z("book-open",Um);/**
|
|
74
|
-
* @license lucide-react v1.
|
|
74
|
+
* @license lucide-react v1.8.0 - ISC
|
|
75
75
|
*
|
|
76
76
|
* This source code is licensed under the ISC license.
|
|
77
77
|
* See the LICENSE file in the root directory of this source tree.
|
|
78
78
|
*/const zm=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],ur=Z("bot",zm);/**
|
|
79
|
-
* @license lucide-react v1.
|
|
79
|
+
* @license lucide-react v1.8.0 - ISC
|
|
80
80
|
*
|
|
81
81
|
* This source code is licensed under the ISC license.
|
|
82
82
|
* See the LICENSE file in the root directory of this source tree.
|
|
83
83
|
*/const Hm=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Yi=Z("chart-column",Hm);/**
|
|
84
|
-
* @license lucide-react v1.
|
|
84
|
+
* @license lucide-react v1.8.0 - ISC
|
|
85
85
|
*
|
|
86
86
|
* This source code is licensed under the ISC license.
|
|
87
87
|
* See the LICENSE file in the root directory of this source tree.
|
|
88
88
|
*/const Gm=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ut=Z("check",Gm);/**
|
|
89
|
-
* @license lucide-react v1.
|
|
89
|
+
* @license lucide-react v1.8.0 - ISC
|
|
90
90
|
*
|
|
91
91
|
* This source code is licensed under the ISC license.
|
|
92
92
|
* See the LICENSE file in the root directory of this source tree.
|
|
93
93
|
*/const Wm=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],rt=Z("chevron-down",Wm);/**
|
|
94
|
-
* @license lucide-react v1.
|
|
94
|
+
* @license lucide-react v1.8.0 - ISC
|
|
95
95
|
*
|
|
96
96
|
* This source code is licensed under the ISC license.
|
|
97
97
|
* See the LICENSE file in the root directory of this source tree.
|
|
98
98
|
*/const qm=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Vm=Z("chevron-left",qm);/**
|
|
99
|
-
* @license lucide-react v1.
|
|
99
|
+
* @license lucide-react v1.8.0 - ISC
|
|
100
100
|
*
|
|
101
101
|
* This source code is licensed under the ISC license.
|
|
102
102
|
* See the LICENSE file in the root directory of this source tree.
|
|
103
103
|
*/const Km=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ie=Z("chevron-right",Km);/**
|
|
104
|
-
* @license lucide-react v1.
|
|
104
|
+
* @license lucide-react v1.8.0 - ISC
|
|
105
105
|
*
|
|
106
106
|
* This source code is licensed under the ISC license.
|
|
107
107
|
* See the LICENSE file in the root directory of this source tree.
|
|
108
108
|
*/const Ym=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Xm=Z("circle-alert",Ym);/**
|
|
109
|
-
* @license lucide-react v1.
|
|
109
|
+
* @license lucide-react v1.8.0 - ISC
|
|
110
110
|
*
|
|
111
111
|
* This source code is licensed under the ISC license.
|
|
112
112
|
* See the LICENSE file in the root directory of this source tree.
|
|
113
113
|
*/const Zm=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Jm=Z("circle-check-big",Zm);/**
|
|
114
|
-
* @license lucide-react v1.
|
|
114
|
+
* @license lucide-react v1.8.0 - ISC
|
|
115
115
|
*
|
|
116
116
|
* This source code is licensed under the ISC license.
|
|
117
117
|
* See the LICENSE file in the root directory of this source tree.
|
|
118
118
|
*/const Qm=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],rp=Z("circle-check",Qm);/**
|
|
119
|
-
* @license lucide-react v1.
|
|
119
|
+
* @license lucide-react v1.8.0 - ISC
|
|
120
120
|
*
|
|
121
121
|
* This source code is licensed under the ISC license.
|
|
122
122
|
* See the LICENSE file in the root directory of this source tree.
|
|
123
123
|
*/const eg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],tg=Z("circle-question-mark",eg);/**
|
|
124
|
-
* @license lucide-react v1.
|
|
124
|
+
* @license lucide-react v1.8.0 - ISC
|
|
125
125
|
*
|
|
126
126
|
* This source code is licensed under the ISC license.
|
|
127
127
|
* See the LICENSE file in the root directory of this source tree.
|
|
128
128
|
*/const ng=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],pr=Z("circle-x",ng);/**
|
|
129
|
-
* @license lucide-react v1.
|
|
129
|
+
* @license lucide-react v1.8.0 - ISC
|
|
130
130
|
*
|
|
131
131
|
* This source code is licensed under the ISC license.
|
|
132
132
|
* See the LICENSE file in the root directory of this source tree.
|
|
133
133
|
*/const rg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ig=Z("circle",rg);/**
|
|
134
|
-
* @license lucide-react v1.
|
|
134
|
+
* @license lucide-react v1.8.0 - ISC
|
|
135
135
|
*
|
|
136
136
|
* This source code is licensed under the ISC license.
|
|
137
137
|
* See the LICENSE file in the root directory of this source tree.
|
|
138
138
|
*/const sg=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v.832",key:"1ujtp2"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h2",key:"qvpao1"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],Xi=Z("clipboard-clock",sg);/**
|
|
139
|
-
* @license lucide-react v1.
|
|
139
|
+
* @license lucide-react v1.8.0 - ISC
|
|
140
140
|
*
|
|
141
141
|
* This source code is licensed under the ISC license.
|
|
142
142
|
* See the LICENSE file in the root directory of this source tree.
|
|
143
143
|
*/const ag=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],og=Z("clipboard-list",ag);/**
|
|
144
|
-
* @license lucide-react v1.
|
|
144
|
+
* @license lucide-react v1.8.0 - ISC
|
|
145
145
|
*
|
|
146
146
|
* This source code is licensed under the ISC license.
|
|
147
147
|
* See the LICENSE file in the root directory of this source tree.
|
|
148
148
|
*/const lg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],It=Z("clock",lg);/**
|
|
149
|
-
* @license lucide-react v1.
|
|
149
|
+
* @license lucide-react v1.8.0 - ISC
|
|
150
150
|
*
|
|
151
151
|
* This source code is licensed under the ISC license.
|
|
152
152
|
* See the LICENSE file in the root directory of this source tree.
|
|
153
153
|
*/const cg=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],dg=Z("code-xml",cg);/**
|
|
154
|
-
* @license lucide-react v1.
|
|
154
|
+
* @license lucide-react v1.8.0 - ISC
|
|
155
155
|
*
|
|
156
156
|
* This source code is licensed under the ISC license.
|
|
157
157
|
* See the LICENSE file in the root directory of this source tree.
|
|
158
158
|
*/const ug=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],ip=Z("code",ug);/**
|
|
159
|
-
* @license lucide-react v1.
|
|
159
|
+
* @license lucide-react v1.8.0 - ISC
|
|
160
160
|
*
|
|
161
161
|
* This source code is licensed under the ISC license.
|
|
162
162
|
* See the LICENSE file in the root directory of this source tree.
|
|
163
163
|
*/const pg=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Ad=Z("columns-2",pg);/**
|
|
164
|
-
* @license lucide-react v1.
|
|
164
|
+
* @license lucide-react v1.8.0 - ISC
|
|
165
165
|
*
|
|
166
166
|
* This source code is licensed under the ISC license.
|
|
167
167
|
* See the LICENSE file in the root directory of this source tree.
|
|
168
168
|
*/const hg=[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],mg=Z("copy-minus",hg);/**
|
|
169
|
-
* @license lucide-react v1.
|
|
169
|
+
* @license lucide-react v1.8.0 - ISC
|
|
170
170
|
*
|
|
171
171
|
* This source code is licensed under the ISC license.
|
|
172
172
|
* See the LICENSE file in the root directory of this source tree.
|
|
173
173
|
*/const gg=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],hr=Z("copy",gg);/**
|
|
174
|
-
* @license lucide-react v1.
|
|
174
|
+
* @license lucide-react v1.8.0 - ISC
|
|
175
175
|
*
|
|
176
176
|
* This source code is licensed under the ISC license.
|
|
177
177
|
* See the LICENSE file in the root directory of this source tree.
|
|
178
178
|
*/const fg=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],Id=Z("corner-down-left",fg);/**
|
|
179
|
-
* @license lucide-react v1.
|
|
179
|
+
* @license lucide-react v1.8.0 - ISC
|
|
180
180
|
*
|
|
181
181
|
* This source code is licensed under the ISC license.
|
|
182
182
|
* See the LICENSE file in the root directory of this source tree.
|
|
183
183
|
*/const bg=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],yg=Z("corner-down-right",bg);/**
|
|
184
|
-
* @license lucide-react v1.
|
|
184
|
+
* @license lucide-react v1.8.0 - ISC
|
|
185
185
|
*
|
|
186
186
|
* This source code is licensed under the ISC license.
|
|
187
187
|
* See the LICENSE file in the root directory of this source tree.
|
|
188
188
|
*/const xg=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Wt=Z("cpu",xg);/**
|
|
189
|
-
* @license lucide-react v1.
|
|
189
|
+
* @license lucide-react v1.8.0 - ISC
|
|
190
190
|
*
|
|
191
191
|
* This source code is licensed under the ISC license.
|
|
192
192
|
* See the LICENSE file in the root directory of this source tree.
|
|
193
193
|
*/const vg=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],sp=Z("download",vg);/**
|
|
194
|
-
* @license lucide-react v1.
|
|
194
|
+
* @license lucide-react v1.8.0 - ISC
|
|
195
195
|
*
|
|
196
196
|
* This source code is licensed under the ISC license.
|
|
197
197
|
* See the LICENSE file in the root directory of this source tree.
|
|
198
198
|
*/const _g=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],st=Z("external-link",_g);/**
|
|
199
|
-
* @license lucide-react v1.
|
|
199
|
+
* @license lucide-react v1.8.0 - ISC
|
|
200
200
|
*
|
|
201
201
|
* This source code is licensed under the ISC license.
|
|
202
202
|
* See the LICENSE file in the root directory of this source tree.
|
|
203
203
|
*/const Sg=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],kg=Z("file-code",Sg);/**
|
|
204
|
-
* @license lucide-react v1.
|
|
204
|
+
* @license lucide-react v1.8.0 - ISC
|
|
205
205
|
*
|
|
206
206
|
* This source code is licensed under the ISC license.
|
|
207
207
|
* See the LICENSE file in the root directory of this source tree.
|
|
208
208
|
*/const wg=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],ap=Z("file-pen",wg);/**
|
|
209
|
-
* @license lucide-react v1.
|
|
209
|
+
* @license lucide-react v1.8.0 - ISC
|
|
210
210
|
*
|
|
211
211
|
* This source code is licensed under the ISC license.
|
|
212
212
|
* See the LICENSE file in the root directory of this source tree.
|
|
213
213
|
*/const Eg=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]],Cg=Z("file-plus",Eg);/**
|
|
214
|
-
* @license lucide-react v1.
|
|
214
|
+
* @license lucide-react v1.8.0 - ISC
|
|
215
215
|
*
|
|
216
216
|
* This source code is licensed under the ISC license.
|
|
217
217
|
* See the LICENSE file in the root directory of this source tree.
|
|
218
218
|
*/const Tg=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],dt=Z("file-text",Tg);/**
|
|
219
|
-
* @license lucide-react v1.
|
|
219
|
+
* @license lucide-react v1.8.0 - ISC
|
|
220
220
|
*
|
|
221
221
|
* This source code is licensed under the ISC license.
|
|
222
222
|
* See the LICENSE file in the root directory of this source tree.
|
|
223
223
|
*/const Ng=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],op=Z("file",Ng);/**
|
|
224
|
-
* @license lucide-react v1.
|
|
224
|
+
* @license lucide-react v1.8.0 - ISC
|
|
225
225
|
*
|
|
226
226
|
* This source code is licensed under the ISC license.
|
|
227
227
|
* See the LICENSE file in the root directory of this source tree.
|
|
228
228
|
*/const Ag=[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]],lp=Z("files",Ag);/**
|
|
229
|
-
* @license lucide-react v1.
|
|
229
|
+
* @license lucide-react v1.8.0 - ISC
|
|
230
230
|
*
|
|
231
231
|
* This source code is licensed under the ISC license.
|
|
232
232
|
* See the LICENSE file in the root directory of this source tree.
|
|
233
233
|
*/const Ig=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]],Rg=Z("folder-closed",Ig);/**
|
|
234
|
-
* @license lucide-react v1.
|
|
234
|
+
* @license lucide-react v1.8.0 - ISC
|
|
235
235
|
*
|
|
236
236
|
* This source code is licensed under the ISC license.
|
|
237
237
|
* See the LICENSE file in the root directory of this source tree.
|
|
238
238
|
*/const Lg=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Zi=Z("folder-open",Lg);/**
|
|
239
|
-
* @license lucide-react v1.
|
|
239
|
+
* @license lucide-react v1.8.0 - ISC
|
|
240
240
|
*
|
|
241
241
|
* This source code is licensed under the ISC license.
|
|
242
242
|
* See the LICENSE file in the root directory of this source tree.
|
|
243
243
|
*/const Dg=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Og=Z("folder-plus",Dg);/**
|
|
244
|
-
* @license lucide-react v1.
|
|
244
|
+
* @license lucide-react v1.8.0 - ISC
|
|
245
245
|
*
|
|
246
246
|
* This source code is licensed under the ISC license.
|
|
247
247
|
* See the LICENSE file in the root directory of this source tree.
|
|
248
248
|
*/const $g=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],jg=Z("folder",$g);/**
|
|
249
|
-
* @license lucide-react v1.
|
|
249
|
+
* @license lucide-react v1.8.0 - ISC
|
|
250
250
|
*
|
|
251
251
|
* This source code is licensed under the ISC license.
|
|
252
252
|
* See the LICENSE file in the root directory of this source tree.
|
|
253
253
|
*/const Mg=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],cp=Z("git-branch",Mg);/**
|
|
254
|
-
* @license lucide-react v1.
|
|
254
|
+
* @license lucide-react v1.8.0 - ISC
|
|
255
255
|
*
|
|
256
256
|
* This source code is licensed under the ISC license.
|
|
257
257
|
* See the LICENSE file in the root directory of this source tree.
|
|
258
258
|
*/const Pg=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]],Nr=Z("git-compare",Pg);/**
|
|
259
|
-
* @license lucide-react v1.
|
|
259
|
+
* @license lucide-react v1.8.0 - ISC
|
|
260
260
|
*
|
|
261
261
|
* This source code is licensed under the ISC license.
|
|
262
262
|
* See the LICENSE file in the root directory of this source tree.
|
|
263
263
|
*/const Fg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],dp=Z("globe",Fg);/**
|
|
264
|
-
* @license lucide-react v1.
|
|
264
|
+
* @license lucide-react v1.8.0 - ISC
|
|
265
265
|
*
|
|
266
266
|
* This source code is licensed under the ISC license.
|
|
267
267
|
* See the LICENSE file in the root directory of this source tree.
|
|
268
268
|
*/const Bg=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],Ug=Z("hard-drive",Bg);/**
|
|
269
|
-
* @license lucide-react v1.
|
|
269
|
+
* @license lucide-react v1.8.0 - ISC
|
|
270
270
|
*
|
|
271
271
|
* This source code is licensed under the ISC license.
|
|
272
272
|
* See the LICENSE file in the root directory of this source tree.
|
|
273
273
|
*/const zg=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],up=Z("hash",zg);/**
|
|
274
|
-
* @license lucide-react v1.
|
|
274
|
+
* @license lucide-react v1.8.0 - ISC
|
|
275
275
|
*
|
|
276
276
|
* This source code is licensed under the ISC license.
|
|
277
277
|
* See the LICENSE file in the root directory of this source tree.
|
|
278
278
|
*/const Hg=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],pp=Z("history",Hg);/**
|
|
279
|
-
* @license lucide-react v1.
|
|
279
|
+
* @license lucide-react v1.8.0 - ISC
|
|
280
280
|
*
|
|
281
281
|
* This source code is licensed under the ISC license.
|
|
282
282
|
* See the LICENSE file in the root directory of this source tree.
|
|
283
283
|
*/const Gg=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],hp=Z("image",Gg);/**
|
|
284
|
-
* @license lucide-react v1.
|
|
284
|
+
* @license lucide-react v1.8.0 - ISC
|
|
285
285
|
*
|
|
286
286
|
* This source code is licensed under the ISC license.
|
|
287
287
|
* See the LICENSE file in the root directory of this source tree.
|
|
288
288
|
*/const Wg=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],qg=Z("inbox",Wg);/**
|
|
289
|
-
* @license lucide-react v1.
|
|
289
|
+
* @license lucide-react v1.8.0 - ISC
|
|
290
290
|
*
|
|
291
291
|
* This source code is licensed under the ISC license.
|
|
292
292
|
* See the LICENSE file in the root directory of this source tree.
|
|
293
293
|
*/const Vg=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Kg=Z("info",Vg);/**
|
|
294
|
-
* @license lucide-react v1.
|
|
294
|
+
* @license lucide-react v1.8.0 - ISC
|
|
295
295
|
*
|
|
296
296
|
* This source code is licensed under the ISC license.
|
|
297
297
|
* See the LICENSE file in the root directory of this source tree.
|
|
298
298
|
*/const Yg=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],mp=Z("keyboard",Yg);/**
|
|
299
|
-
* @license lucide-react v1.
|
|
299
|
+
* @license lucide-react v1.8.0 - ISC
|
|
300
300
|
*
|
|
301
301
|
* This source code is licensed under the ISC license.
|
|
302
302
|
* See the LICENSE file in the root directory of this source tree.
|
|
303
303
|
*/const Xg=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],Zg=Z("languages",Xg);/**
|
|
304
|
-
* @license lucide-react v1.
|
|
304
|
+
* @license lucide-react v1.8.0 - ISC
|
|
305
305
|
*
|
|
306
306
|
* This source code is licensed under the ISC license.
|
|
307
307
|
* See the LICENSE file in the root directory of this source tree.
|
|
308
308
|
*/const Jg=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Qg=Z("layers",Jg);/**
|
|
309
|
-
* @license lucide-react v1.
|
|
309
|
+
* @license lucide-react v1.8.0 - ISC
|
|
310
310
|
*
|
|
311
311
|
* This source code is licensed under the ISC license.
|
|
312
312
|
* See the LICENSE file in the root directory of this source tree.
|
|
313
313
|
*/const ef=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],gp=Z("layout-dashboard",ef);/**
|
|
314
|
-
* @license lucide-react v1.
|
|
314
|
+
* @license lucide-react v1.8.0 - ISC
|
|
315
315
|
*
|
|
316
316
|
* This source code is licensed under the ISC license.
|
|
317
317
|
* See the LICENSE file in the root directory of this source tree.
|
|
318
|
-
*/const tf=[["path",{d:"M9 17H7A5 5 0 0 1 7
|
|
319
|
-
* @license lucide-react v1.
|
|
318
|
+
*/const tf=[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]],Rd=Z("link-2-off",tf);/**
|
|
319
|
+
* @license lucide-react v1.8.0 - ISC
|
|
320
320
|
*
|
|
321
321
|
* This source code is licensed under the ISC license.
|
|
322
322
|
* See the LICENSE file in the root directory of this source tree.
|
|
323
|
-
*/const
|
|
324
|
-
* @license lucide-react v1.
|
|
323
|
+
*/const nf=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],rf=Z("link-2",nf);/**
|
|
324
|
+
* @license lucide-react v1.8.0 - ISC
|
|
325
325
|
*
|
|
326
326
|
* This source code is licensed under the ISC license.
|
|
327
327
|
* See the LICENSE file in the root directory of this source tree.
|
|
328
328
|
*/const sf=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],Ji=Z("list-checks",sf);/**
|
|
329
|
-
* @license lucide-react v1.
|
|
329
|
+
* @license lucide-react v1.8.0 - ISC
|
|
330
330
|
*
|
|
331
331
|
* This source code is licensed under the ISC license.
|
|
332
332
|
* See the LICENSE file in the root directory of this source tree.
|
|
333
333
|
*/const af=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],fp=Z("list-todo",af);/**
|
|
334
|
-
* @license lucide-react v1.
|
|
334
|
+
* @license lucide-react v1.8.0 - ISC
|
|
335
335
|
*
|
|
336
336
|
* This source code is licensed under the ISC license.
|
|
337
337
|
* See the LICENSE file in the root directory of this source tree.
|
|
338
338
|
*/const of=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],we=Z("loader-circle",of);/**
|
|
339
|
-
* @license lucide-react v1.
|
|
339
|
+
* @license lucide-react v1.8.0 - ISC
|
|
340
340
|
*
|
|
341
341
|
* This source code is licensed under the ISC license.
|
|
342
342
|
* See the LICENSE file in the root directory of this source tree.
|
|
343
343
|
*/const lf=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],cf=Z("map",lf);/**
|
|
344
|
-
* @license lucide-react v1.
|
|
344
|
+
* @license lucide-react v1.8.0 - ISC
|
|
345
345
|
*
|
|
346
346
|
* This source code is licensed under the ISC license.
|
|
347
347
|
* See the LICENSE file in the root directory of this source tree.
|
|
348
|
-
*/const df=[["path",{d:"
|
|
349
|
-
* @license lucide-react v1.
|
|
348
|
+
*/const df=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],uf=Z("maximize",df);/**
|
|
349
|
+
* @license lucide-react v1.8.0 - ISC
|
|
350
350
|
*
|
|
351
351
|
* This source code is licensed under the ISC license.
|
|
352
352
|
* See the LICENSE file in the root directory of this source tree.
|
|
353
|
-
*/const
|
|
354
|
-
* @license lucide-react v1.
|
|
353
|
+
*/const pf=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Qi=Z("maximize-2",pf);/**
|
|
354
|
+
* @license lucide-react v1.8.0 - ISC
|
|
355
355
|
*
|
|
356
356
|
* This source code is licensed under the ISC license.
|
|
357
357
|
* See the LICENSE file in the root directory of this source tree.
|
|
358
358
|
*/const hf=[["path",{d:"M12 12v-2",key:"fwoke6"}],["path",{d:"M12 18v-2",key:"qj6yno"}],["path",{d:"M16 12v-2",key:"heuere"}],["path",{d:"M16 18v-2",key:"s1ct0w"}],["path",{d:"M2 11h1.5",key:"15p63e"}],["path",{d:"M20 18v-2",key:"12ehxp"}],["path",{d:"M20.5 11H22",key:"khsy7a"}],["path",{d:"M4 18v-2",key:"1c3oqr"}],["path",{d:"M8 12v-2",key:"1mwtfd"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["rect",{x:"2",y:"6",width:"20",height:"10",rx:"2",key:"1qcswk"}]],ki=Z("memory-stick",hf);/**
|
|
359
|
-
* @license lucide-react v1.
|
|
359
|
+
* @license lucide-react v1.8.0 - ISC
|
|
360
360
|
*
|
|
361
361
|
* This source code is licensed under the ISC license.
|
|
362
362
|
* See the LICENSE file in the root directory of this source tree.
|
|
363
363
|
*/const mf=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],gf=Z("menu",mf);/**
|
|
364
|
-
* @license lucide-react v1.
|
|
364
|
+
* @license lucide-react v1.8.0 - ISC
|
|
365
365
|
*
|
|
366
366
|
* This source code is licensed under the ISC license.
|
|
367
367
|
* See the LICENSE file in the root directory of this source tree.
|
|
368
368
|
*/const ff=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Xr=Z("message-circle-question-mark",ff);/**
|
|
369
|
-
* @license lucide-react v1.
|
|
369
|
+
* @license lucide-react v1.8.0 - ISC
|
|
370
370
|
*
|
|
371
371
|
* This source code is licensed under the ISC license.
|
|
372
372
|
* See the LICENSE file in the root directory of this source tree.
|
|
373
373
|
*/const bf=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],bp=Z("message-circle",bf);/**
|
|
374
|
-
* @license lucide-react v1.
|
|
374
|
+
* @license lucide-react v1.8.0 - ISC
|
|
375
375
|
*
|
|
376
376
|
* This source code is licensed under the ISC license.
|
|
377
377
|
* See the LICENSE file in the root directory of this source tree.
|
|
378
378
|
*/const yf=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],dn=Z("message-square",yf);/**
|
|
379
|
-
* @license lucide-react v1.
|
|
379
|
+
* @license lucide-react v1.8.0 - ISC
|
|
380
380
|
*
|
|
381
381
|
* This source code is licensed under the ISC license.
|
|
382
382
|
* See the LICENSE file in the root directory of this source tree.
|
|
383
383
|
*/const xf=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],vf=Z("minimize-2",xf);/**
|
|
384
|
-
* @license lucide-react v1.
|
|
384
|
+
* @license lucide-react v1.8.0 - ISC
|
|
385
385
|
*
|
|
386
386
|
* This source code is licensed under the ISC license.
|
|
387
387
|
* See the LICENSE file in the root directory of this source tree.
|
|
388
388
|
*/const _f=[["path",{d:"M5 12h14",key:"1ays0h"}]],yp=Z("minus",_f);/**
|
|
389
|
-
* @license lucide-react v1.
|
|
389
|
+
* @license lucide-react v1.8.0 - ISC
|
|
390
390
|
*
|
|
391
391
|
* This source code is licensed under the ISC license.
|
|
392
392
|
* See the LICENSE file in the root directory of this source tree.
|
|
393
393
|
*/const Sf=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],xp=Z("moon",Sf);/**
|
|
394
|
-
* @license lucide-react v1.
|
|
394
|
+
* @license lucide-react v1.8.0 - ISC
|
|
395
395
|
*
|
|
396
396
|
* This source code is licensed under the ISC license.
|
|
397
397
|
* See the LICENSE file in the root directory of this source tree.
|
|
398
398
|
*/const kf=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],vp=Z("network",kf);/**
|
|
399
|
-
* @license lucide-react v1.
|
|
399
|
+
* @license lucide-react v1.8.0 - ISC
|
|
400
400
|
*
|
|
401
401
|
* This source code is licensed under the ISC license.
|
|
402
402
|
* See the LICENSE file in the root directory of this source tree.
|
|
403
403
|
*/const wf=[["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-4 0v-9a2 2 0 0 1 2-2h2",key:"39pd36"}],["rect",{width:"8",height:"4",x:"10",y:"6",rx:"1",key:"aywv1n"}]],Ld=Z("newspaper",wf);/**
|
|
404
|
-
* @license lucide-react v1.
|
|
404
|
+
* @license lucide-react v1.8.0 - ISC
|
|
405
405
|
*
|
|
406
406
|
* This source code is licensed under the ISC license.
|
|
407
407
|
* See the LICENSE file in the root directory of this source tree.
|
|
408
408
|
*/const Ef=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Cf=Z("package",Ef);/**
|
|
409
|
-
* @license lucide-react v1.
|
|
409
|
+
* @license lucide-react v1.8.0 - ISC
|
|
410
410
|
*
|
|
411
411
|
* This source code is licensed under the ISC license.
|
|
412
412
|
* See the LICENSE file in the root directory of this source tree.
|
|
413
413
|
*/const Tf=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],es=Z("panel-left",Tf);/**
|
|
414
|
-
* @license lucide-react v1.
|
|
414
|
+
* @license lucide-react v1.8.0 - ISC
|
|
415
415
|
*
|
|
416
416
|
* This source code is licensed under the ISC license.
|
|
417
417
|
* See the LICENSE file in the root directory of this source tree.
|
|
418
418
|
*/const Nf=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],Af=Z("pen-line",Nf);/**
|
|
419
|
-
* @license lucide-react v1.
|
|
419
|
+
* @license lucide-react v1.8.0 - ISC
|
|
420
420
|
*
|
|
421
421
|
* This source code is licensed under the ISC license.
|
|
422
422
|
* See the LICENSE file in the root directory of this source tree.
|
|
423
423
|
*/const If=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],_p=Z("pencil",If);/**
|
|
424
|
-
* @license lucide-react v1.
|
|
424
|
+
* @license lucide-react v1.8.0 - ISC
|
|
425
425
|
*
|
|
426
426
|
* This source code is licensed under the ISC license.
|
|
427
427
|
* See the LICENSE file in the root directory of this source tree.
|
|
428
428
|
*/const Rf=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],Lf=Z("pin",Rf);/**
|
|
429
|
-
* @license lucide-react v1.
|
|
429
|
+
* @license lucide-react v1.8.0 - ISC
|
|
430
430
|
*
|
|
431
431
|
* This source code is licensed under the ISC license.
|
|
432
432
|
* See the LICENSE file in the root directory of this source tree.
|
|
433
433
|
*/const Df=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Of=Z("play",Df);/**
|
|
434
|
-
* @license lucide-react v1.
|
|
434
|
+
* @license lucide-react v1.8.0 - ISC
|
|
435
435
|
*
|
|
436
436
|
* This source code is licensed under the ISC license.
|
|
437
437
|
* See the LICENSE file in the root directory of this source tree.
|
|
438
438
|
*/const $f=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],jf=Z("plug",$f);/**
|
|
439
|
-
* @license lucide-react v1.
|
|
439
|
+
* @license lucide-react v1.8.0 - ISC
|
|
440
440
|
*
|
|
441
441
|
* This source code is licensed under the ISC license.
|
|
442
442
|
* See the LICENSE file in the root directory of this source tree.
|
|
443
443
|
*/const Mf=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ot=Z("plus",Mf);/**
|
|
444
|
-
* @license lucide-react v1.
|
|
444
|
+
* @license lucide-react v1.8.0 - ISC
|
|
445
445
|
*
|
|
446
446
|
* This source code is licensed under the ISC license.
|
|
447
447
|
* See the LICENSE file in the root directory of this source tree.
|
|
448
448
|
*/const Pf=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Ff=Z("power-off",Pf);/**
|
|
449
|
-
* @license lucide-react v1.
|
|
449
|
+
* @license lucide-react v1.8.0 - ISC
|
|
450
450
|
*
|
|
451
451
|
* This source code is licensed under the ISC license.
|
|
452
452
|
* See the LICENSE file in the root directory of this source tree.
|
|
453
453
|
*/const Bf=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],Sp=Z("power",Bf);/**
|
|
454
|
-
* @license lucide-react v1.
|
|
454
|
+
* @license lucide-react v1.8.0 - ISC
|
|
455
455
|
*
|
|
456
456
|
* This source code is licensed under the ISC license.
|
|
457
457
|
* See the LICENSE file in the root directory of this source tree.
|
|
458
458
|
*/const Uf=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],mr=Z("radio",Uf);/**
|
|
459
|
-
* @license lucide-react v1.
|
|
459
|
+
* @license lucide-react v1.8.0 - ISC
|
|
460
460
|
*
|
|
461
461
|
* This source code is licensed under the ISC license.
|
|
462
462
|
* See the LICENSE file in the root directory of this source tree.
|
|
463
463
|
*/const zf=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],qe=Z("refresh-cw",zf);/**
|
|
464
|
-
* @license lucide-react v1.
|
|
464
|
+
* @license lucide-react v1.8.0 - ISC
|
|
465
465
|
*
|
|
466
466
|
* This source code is licensed under the ISC license.
|
|
467
467
|
* See the LICENSE file in the root directory of this source tree.
|
|
468
468
|
*/const Hf=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],Gf=Z("repeat",Hf);/**
|
|
469
|
-
* @license lucide-react v1.
|
|
469
|
+
* @license lucide-react v1.8.0 - ISC
|
|
470
470
|
*
|
|
471
471
|
* This source code is licensed under the ISC license.
|
|
472
472
|
* See the LICENSE file in the root directory of this source tree.
|
|
473
473
|
*/const Wf=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],wi=Z("rotate-ccw",Wf);/**
|
|
474
|
-
* @license lucide-react v1.
|
|
474
|
+
* @license lucide-react v1.8.0 - ISC
|
|
475
475
|
*
|
|
476
476
|
* This source code is licensed under the ISC license.
|
|
477
477
|
* See the LICENSE file in the root directory of this source tree.
|
|
478
478
|
*/const qf=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]],Vf=Z("rows-2",qf);/**
|
|
479
|
-
* @license lucide-react v1.
|
|
479
|
+
* @license lucide-react v1.8.0 - ISC
|
|
480
480
|
*
|
|
481
481
|
* This source code is licensed under the ISC license.
|
|
482
482
|
* See the LICENSE file in the root directory of this source tree.
|
|
483
483
|
*/const Kf=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]],Yf=Z("scan",Kf);/**
|
|
484
|
-
* @license lucide-react v1.
|
|
484
|
+
* @license lucide-react v1.8.0 - ISC
|
|
485
485
|
*
|
|
486
486
|
* This source code is licensed under the ISC license.
|
|
487
487
|
* See the LICENSE file in the root directory of this source tree.
|
|
488
488
|
*/const Xf=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],Zf=Z("scissors",Xf);/**
|
|
489
|
-
* @license lucide-react v1.
|
|
489
|
+
* @license lucide-react v1.8.0 - ISC
|
|
490
490
|
*
|
|
491
491
|
* This source code is licensed under the ISC license.
|
|
492
492
|
* See the LICENSE file in the root directory of this source tree.
|
|
493
493
|
*/const Jf=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],Qf=Z("scroll-text",Jf);/**
|
|
494
|
-
* @license lucide-react v1.
|
|
494
|
+
* @license lucide-react v1.8.0 - ISC
|
|
495
495
|
*
|
|
496
496
|
* This source code is licensed under the ISC license.
|
|
497
497
|
* See the LICENSE file in the root directory of this source tree.
|
|
498
498
|
*/const eb=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],at=Z("search",eb);/**
|
|
499
|
-
* @license lucide-react v1.
|
|
499
|
+
* @license lucide-react v1.8.0 - ISC
|
|
500
500
|
*
|
|
501
501
|
* This source code is licensed under the ISC license.
|
|
502
502
|
* See the LICENSE file in the root directory of this source tree.
|
|
503
503
|
*/const tb=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],nb=Z("send",tb);/**
|
|
504
|
-
* @license lucide-react v1.
|
|
504
|
+
* @license lucide-react v1.8.0 - ISC
|
|
505
505
|
*
|
|
506
506
|
* This source code is licensed under the ISC license.
|
|
507
507
|
* See the LICENSE file in the root directory of this source tree.
|
|
508
508
|
*/const rb=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],gr=Z("server",rb);/**
|
|
509
|
-
* @license lucide-react v1.
|
|
509
|
+
* @license lucide-react v1.8.0 - ISC
|
|
510
510
|
*
|
|
511
511
|
* This source code is licensed under the ISC license.
|
|
512
512
|
* See the LICENSE file in the root directory of this source tree.
|
|
513
513
|
*/const ib=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],ts=Z("settings-2",ib);/**
|
|
514
|
-
* @license lucide-react v1.
|
|
514
|
+
* @license lucide-react v1.8.0 - ISC
|
|
515
515
|
*
|
|
516
516
|
* This source code is licensed under the ISC license.
|
|
517
517
|
* See the LICENSE file in the root directory of this source tree.
|
|
518
518
|
*/const sb=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ab=Z("settings",sb);/**
|
|
519
|
-
* @license lucide-react v1.
|
|
519
|
+
* @license lucide-react v1.8.0 - ISC
|
|
520
520
|
*
|
|
521
521
|
* This source code is licensed under the ISC license.
|
|
522
522
|
* See the LICENSE file in the root directory of this source tree.
|
|
523
523
|
*/const ob=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],kp=Z("sparkles",ob);/**
|
|
524
|
-
* @license lucide-react v1.
|
|
524
|
+
* @license lucide-react v1.8.0 - ISC
|
|
525
525
|
*
|
|
526
526
|
* This source code is licensed under the ISC license.
|
|
527
527
|
* See the LICENSE file in the root directory of this source tree.
|
|
528
528
|
*/const lb=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],un=Z("square-terminal",lb);/**
|
|
529
|
-
* @license lucide-react v1.
|
|
529
|
+
* @license lucide-react v1.8.0 - ISC
|
|
530
530
|
*
|
|
531
531
|
* This source code is licensed under the ISC license.
|
|
532
532
|
* See the LICENSE file in the root directory of this source tree.
|
|
533
533
|
*/const cb=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ns=Z("square",cb);/**
|
|
534
|
-
* @license lucide-react v1.
|
|
534
|
+
* @license lucide-react v1.8.0 - ISC
|
|
535
535
|
*
|
|
536
536
|
* This source code is licensed under the ISC license.
|
|
537
537
|
* See the LICENSE file in the root directory of this source tree.
|
|
538
538
|
*/const db=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]],An=Z("store",db);/**
|
|
539
|
-
* @license lucide-react v1.
|
|
539
|
+
* @license lucide-react v1.8.0 - ISC
|
|
540
540
|
*
|
|
541
541
|
* This source code is licensed under the ISC license.
|
|
542
542
|
* See the LICENSE file in the root directory of this source tree.
|
|
543
543
|
*/const ub=[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14.837 16.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715",key:"xlf6rm"}],["path",{d:"M16 12a4 4 0 0 0-4-4",key:"6vsxu"}],["path",{d:"m19 5-1.256 1.256",key:"1yg6a6"}],["path",{d:"M20 12h2",key:"1q8mjw"}]],pb=Z("sun-moon",ub);/**
|
|
544
|
-
* @license lucide-react v1.
|
|
544
|
+
* @license lucide-react v1.8.0 - ISC
|
|
545
545
|
*
|
|
546
546
|
* This source code is licensed under the ISC license.
|
|
547
547
|
* See the LICENSE file in the root directory of this source tree.
|
|
548
548
|
*/const hb=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],wp=Z("sun",hb);/**
|
|
549
|
-
* @license lucide-react v1.
|
|
549
|
+
* @license lucide-react v1.8.0 - ISC
|
|
550
550
|
*
|
|
551
551
|
* This source code is licensed under the ISC license.
|
|
552
552
|
* See the LICENSE file in the root directory of this source tree.
|
|
553
553
|
*/const mb=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Mn=Z("terminal",mb);/**
|
|
554
|
-
* @license lucide-react v1.
|
|
554
|
+
* @license lucide-react v1.8.0 - ISC
|
|
555
555
|
*
|
|
556
556
|
* This source code is licensed under the ISC license.
|
|
557
557
|
* See the LICENSE file in the root directory of this source tree.
|
|
558
558
|
*/const gb=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Ep=Z("timer",gb);/**
|
|
559
|
-
* @license lucide-react v1.
|
|
559
|
+
* @license lucide-react v1.8.0 - ISC
|
|
560
560
|
*
|
|
561
561
|
* This source code is licensed under the ISC license.
|
|
562
562
|
* See the LICENSE file in the root directory of this source tree.
|
|
563
563
|
*/const fb=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],pn=Z("trash-2",fb);/**
|
|
564
|
-
* @license lucide-react v1.
|
|
564
|
+
* @license lucide-react v1.8.0 - ISC
|
|
565
565
|
*
|
|
566
566
|
* This source code is licensed under the ISC license.
|
|
567
567
|
* See the LICENSE file in the root directory of this source tree.
|
|
568
568
|
*/const bb=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],yb=Z("trending-up",bb);/**
|
|
569
|
-
* @license lucide-react v1.
|
|
569
|
+
* @license lucide-react v1.8.0 - ISC
|
|
570
570
|
*
|
|
571
571
|
* This source code is licensed under the ISC license.
|
|
572
572
|
* See the LICENSE file in the root directory of this source tree.
|
|
573
573
|
*/const xb=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],In=Z("triangle-alert",xb);/**
|
|
574
|
-
* @license lucide-react v1.
|
|
574
|
+
* @license lucide-react v1.8.0 - ISC
|
|
575
575
|
*
|
|
576
576
|
* This source code is licensed under the ISC license.
|
|
577
577
|
* See the LICENSE file in the root directory of this source tree.
|
|
578
578
|
*/const vb=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],fr=Z("undo-2",vb);/**
|
|
579
|
-
* @license lucide-react v1.
|
|
579
|
+
* @license lucide-react v1.8.0 - ISC
|
|
580
580
|
*
|
|
581
581
|
* This source code is licensed under the ISC license.
|
|
582
582
|
* See the LICENSE file in the root directory of this source tree.
|
|
583
583
|
*/const _b=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Cp=Z("users",_b);/**
|
|
584
|
-
* @license lucide-react v1.
|
|
584
|
+
* @license lucide-react v1.8.0 - ISC
|
|
585
585
|
*
|
|
586
586
|
* This source code is licensed under the ISC license.
|
|
587
587
|
* See the LICENSE file in the root directory of this source tree.
|
|
588
588
|
*/const Sb=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Tp=Z("workflow",Sb);/**
|
|
589
|
-
* @license lucide-react v1.
|
|
589
|
+
* @license lucide-react v1.8.0 - ISC
|
|
590
590
|
*
|
|
591
591
|
* This source code is licensed under the ISC license.
|
|
592
592
|
* See the LICENSE file in the root directory of this source tree.
|
|
593
593
|
*/const kb=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Te=Z("x",kb);/**
|
|
594
|
-
* @license lucide-react v1.
|
|
594
|
+
* @license lucide-react v1.8.0 - ISC
|
|
595
595
|
*
|
|
596
596
|
* This source code is licensed under the ISC license.
|
|
597
597
|
* See the LICENSE file in the root directory of this source tree.
|
|
598
598
|
*/const wb=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],nn=Z("zap",wb);/**
|
|
599
|
-
* @license lucide-react v1.
|
|
599
|
+
* @license lucide-react v1.8.0 - ISC
|
|
600
600
|
*
|
|
601
601
|
* This source code is licensed under the ISC license.
|
|
602
602
|
* See the LICENSE file in the root directory of this source tree.
|
|
603
603
|
*/const Eb=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Cb=Z("zoom-in",Eb);/**
|
|
604
|
-
* @license lucide-react v1.
|
|
604
|
+
* @license lucide-react v1.8.0 - ISC
|
|
605
605
|
*
|
|
606
606
|
* This source code is licensed under the ISC license.
|
|
607
607
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -616,7 +616,7 @@ WARNING: This link could potentially be dangerous`)){const m=window.open();if(m)
|
|
|
616
616
|
`,u)}paste(m){this._core.paste(m)}refresh(m,u){this._verifyIntegers(m,u),this._core.refresh(m,u)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(m){this._addonManager.loadAddon(this,m)}static get strings(){return a}_verifyIntegers(...m){for(const u of m)if(u===1/0||isNaN(u)||u%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...m){for(const u of m)if(u&&(u===1/0||isNaN(u)||u%1!=0||u<0))throw new Error("This API only accepts positive integers")}}d.Terminal=v})(),l})()))})(Jr)),Jr.exports}var Lb=Rb();const Ap="codebuddy-locale";function Ip(){if(typeof navigator>"u")return"en";const e=[];Array.isArray(navigator.languages)&&navigator.languages.length>0&&e.push(...navigator.languages),navigator.language&&e.push(navigator.language);try{const t=Intl.DateTimeFormat().resolvedOptions().locale;t&&e.push(t)}catch{}for(const t of e)if(t.toLowerCase().startsWith("zh"))return"zh";return"en"}function Qr(e){return e==="system"?Ip():e}function Db(){try{const e=localStorage.getItem(Ap);if(e){const t=JSON.parse(e),n=(t==null?void 0:t.mode)??e;if(["zh","en","system"].includes(n))return n}}catch{}return"system"}const br=Ne()(jn((e,t)=>{const n=Db(),i=Qr(n);return typeof window<"u"&&window.addEventListener("languagechange",()=>{const s=br.getState();if(s.mode==="system"){const l=Ip();l!==s.resolved&&br.setState({resolved:l})}}),{mode:n,resolved:i,setLocale:s=>{const l=Qr(s);e({mode:s,resolved:l})},toggle:()=>{const s=t().mode,l=s==="zh"?"en":s==="en"?"system":"zh";t().setLocale(l)}}},{namespace:"locale",fields:["mode"],scope:"global",debounceMs:300,localStorageKey:Ap,onLoad:(e,t)=>{if(e.mode){const n=Qr(e.mode);t({mode:e.mode,resolved:n})}}})),$d={zh:{"app.connecting":"正在连接 CodeBuddy Code...","app.connectFailed":"连接失败","app.retry":"重试","app.pwa.newVersion":"检测到 Web UI 新版本","app.pwa.reloadNow":"立即刷新","app.pwa.reloadLater":"稍后","app.pwa.reloadedAfterIdle":"已切换到新版本","chat.empty.title":"CodeBuddy Code","chat.empty.subtitle":"今天有什么可以帮到你?","chat.empty.slogan":"Claw Your Ideas . Into Reality","chat.empty.tag.slides":"幻灯片生成","chat.empty.tag.research":"深度研究","chat.empty.tag.docs":"文档处理","chat.empty.tag.data":"数据分析","chat.thinking":"思考中","chat.waitingPermission":"等待权限确认","chat.waitingUser":"等待用户回答","chat.error":"错误","chat.sessionEnded":"会话已结束","chat.stopped":"已停止","chat.error.refusal":"Agent 拒绝继续执行。这可能是由于内容策略限制或其他限制。","chat.error.network":"网络连接异常或服务暂时不可用,请稍后重试。","chat.error.auth":"身份验证失败或权限不足,请重新登录后再试。","chat.error.quota":"已达到配额上限或请求过于频繁,请稍后再试。","chat.error.modelService":"模型服务返回异常,请重试或稍后再试。","chat.error.maxTokens":"响应因达到最大 token 限制而被截断。您可以继续对话或要求更简洁的回复。","chat.error.maxTurnRequests":"已超过单轮对话允许的最大模型请求次数。您可以发送新消息以继续。","chat.newChat":"新对话","chat.disclaimer":"回答由 AI 生成,仅供参考","chat.compacted":"已精简历史对话","chat.compacting":"正在精简历史对话...","phase.preparing":"准备中","phase.modelRequesting":"等待模型响应","phase.modelStreaming":"接收中","phase.modelDone":"处理中","phase.toolExecuting":"执行工具","phase.modelStreamingTool":"正在写入","phase.retrying":"重试中","progress.compacting":"压缩上下文中","input.placeholder":"从一个想法开始...","input.placeholderRunning":"消息将排队等待处理...","input.placeholderPending":"请先处理权限请求...","input.send":"发送 (Enter)","input.stop":"停止","input.thinking":"思考中","input.deepThinking":"深度思考","input.promptFailed":"发送失败","input.sendQueued":"发送排队消息 (Enter)","input.dropHint":"拖拽文件到这里","input.addImage":"添加图片","input.addFile":"添加文件","input.imageTooLarge":"图片不能超过 10MB","input.tooManyImages":"最多添加 5 张图片","input.fileTooLarge":"文件不能超过 1MB","input.tooManyFiles":"最多添加 10 个文件","input.menu.image":"图片","input.menu.file":"文件","input.newline":"换行","input.contextMenu.newline":"换行","input.contextMenu.send":"发送","queue.more":" 条消息排队中","status.running":"运行中","tool.writeFile":"写入文件","tool.readFile":"读取文件","tool.execute":"执行指令","tool.searchFiles":"搜索文件","tool.searchContent":"搜索内容","tool.fetchWeb":"获取网页","tool.searchWeb":"搜索网络","tool.defaultName":"工具","tool.moreItems":"... 还有 {count} 项","interruption.title":"需要授权","interruption.tool":"工具","interruption.allow":"允许","interruption.allowAll":"全部允许","interruption.deny":"拒绝","interruption.approved":"已允许","interruption.denied":"已拒绝","interruption.edits":"{count} 处编辑","interruption.yes":"是","interruption.keepPlanning":"继续规划","interruption.exitPlanMode":"退出计划模式","interruption.readyToCode":"准备好开始编码了吗?","theme.light":"浅色","theme.dark":"深色","theme.system":"跟随系统","locale.zh":"中文","locale.en":"English","locale.system":"跟随系统","sidebar.nav.plugins":"插件","sidebar.nav.tasks":"任务","sidebar.search.placeholder":"搜索...","sidebar.chatHistory":"对话历史","sidebar.workspace":"工作区","sidebar.connectionStatus":"连接状态","sidebar.status":"状态","sidebar.sessionId":"会话ID","sidebar.notConnected":"未连接","sidebar.modelSelection":"模型选择","sidebar.noModels":"暂无可用模型","sidebar.environment":"环境信息","sidebar.cwd":"工作目录","sidebar.os":"操作系统","sidebar.nodeVersion":"Node.js","sidebar.gatewayMode":"网关模式","sidebar.tunnelUrl":"Tunnel 地址","sidebar.clickToCopy":"点击复制","sidebar.copied":"已复制","sidebar.permissionMode":"权限模式","sidebar.noModes":"暂无可用模式","sidebar.preferences":"设置","sidebar.keybindings":"快捷键","sidebar.group.workspace":"工作区","sidebar.group.observability":"可观测","sidebar.group.preferences":"配置","bottomSheet.attachments":"添加","bottomSheet.navigation":"导航","sidebar.theme":"界面主题","sidebar.language":"界面语言","sidebar.user":"用户","sidebar.authMethod":"密码认证","sidebar.noAuth":"无认证","sidebar.version":"Remote UI v1.0","connection.connected":"已连接","connection.connecting":"连接中","connection.disconnected":"未连接","connection.error":"连接错误","message.copyToClipboard":"复制到剪贴板","message.copied":"已复制","message.copy":"复制","message.assistantName":"CodeBuddy Code","thinking.title":"思考过程","thinking.thinking":"思考中","thinking.done":"已思考","thinking.seconds":"(用时 {n} 秒)","thinking.expand":"展开","thinking.collapse":"收起","diff.noChanges":"无变更","login.title":"CodeBuddy Remote Control","login.subtitle":"请输入终端中显示的密码","login.placeholder":"密码","login.submit":"登录","login.error.incorrect":"密码错误","login.error.rateLimit":"登录尝试次数过多,请稍后再试","login.error.required":"请输入密码","login.hint.password":"提示:密码在服务启动时显示在终端中。","login.hint.urlAuth":"也可以使用 <code>?password=xxx</code> 自动登录。","login.hint.disable":'或在 CodeBuddy 配置目录(默认 <code>~/.codebuddy</code>,可通过 <code>CODEBUDDY_CONFIG_DIR</code> 环境变量覆盖)下的 <code>settings.json</code> 中设置 <code>gateway.auth: "none"</code> 来禁用认证。',"login.slogan":"Claw Your Ideas . Into Reality","login.tagline":"Triggered Anywhere, Completed Locally.","login.privacy":"隐私政策","login.terms":"服务条款","sidebar.interactionMode":"交互模式","sidebar.chatMode":"对话","sidebar.terminalMode":"终端","sidebar.canvas":"画布","canvas.title":"无限画布","canvas.addTerminal":"添加终端","canvas.zoomIn":"放大","canvas.zoomOut":"缩小","canvas.fitView":"适应视图","canvas.resetView":"重置视图","canvas.empty":"点击工具栏 + 按钮添加终端","canvas.openStandalone":"在新窗口打开画布","canvas.tileMenu.close":"关闭","canvas.tileMenu.duplicate":"复刻终端","canvas.tileMenu.maximize":"最大化","canvas.tileMenu.minimize":"最小化","canvas.tileMenu.restore":"还原","canvas.tileMenu.openStandalone":"在新窗口打开","canvas.standalone.missingPaneId":"未指定终端 ID","canvas.defaultTitle":"终端","terminal.connecting":"终端连接中...","terminal.title":"终端","terminal.disconnected":"终端已断开","terminal.error":"终端连接失败","terminal.reconnect":"重新连接","terminal.splitHorizontal":"左右分屏","terminal.splitVertical":"上下分屏","terminal.closePane":"关闭终端","terminal.maxPanes":"已达最大面板数","sidebar.instances":"实例","sidebar.activeInstances":"个活跃实例","sidebar.manageInstances":"管理实例","sidebar.remoteControl":"远程控制","instance.title":"实例列表","instance.switch":"实例","instance.switchTitle":"切换实例","instance.current":"当前实例","instance.manual":"手动添加","instance.switchTo":"切换到此实例","instance.manage":"管理实例","instance.managerTitle":"实例管理","instance.addInstance":"添加实例","instance.name":"实例名称","instance.namePlaceholder":"自定义实例名称(可选,默认为目录名)","instance.url":"实例地址","instance.urlPlaceholder":"https://example.trycloudflare.com","instance.password":"密码","instance.optional":"可选","instance.passwordPlaceholder":"访问密码","instance.cancel":"取消","instance.add":"添加","instance.remove":"删除此实例","instance.noInstances":"暂无其他实例","instance.noInstancesHint":"启动更多 CodeBuddy Code 实例,或手动添加远程实例","instance.cwd":"工作目录","instance.topic":"当前话题","instance.startedAt":"启动于","instance.local":"本地","instance.tunnel":"隧道","instance.uptime.days":"天前","instance.uptime.hours":"小时前","instance.uptime.minutes":"分钟前","instance.uptime.justNow":"刚刚","instance.addError":"添加实例失败","instance.removeError":"删除实例失败","instance.copyUrl":"复制链接","instance.copied":"已复制","instance.subtitle":"管理和切换工作实例","instance.refresh":"刷新","instance.refreshed":"已刷新","instance.loading":"加载实例中...","instance.error":"加载实例列表失败","instance.retry":"重试","question.multiple":"多选","question.customAnswer":"或输入自定义答案...","question.reviewAnswers":"审核答案","question.singleTitle":"问题","question.titleWithCount":"问题({count})","question.reviewTab":"审核","question.next":"下一步","question.submit":"提交","question.cancel":"取消","question.answered":"已回答","question.cancelled":"问题已取消","todo.title":"任务清单","todo.executing":"任务{n}正在执行中","todo.untitled":"未命名","history.title":"会话历史","history.description":"点击会话可切换到该对话","history.noData":"暂无会话历史","history.noDataHint":"开始一段新对话吧","history.backToChat":"返回对话","history.loading":"加载中...","history.loadError":"加载失败","history.retry":"重试","history.current":"当前","history.messages":"{count} 条消息","history.delete":"删除","history.deleteConfirm":"确定要删除这个会话吗?","history.deleteCancel":"取消","history.deleteOk":"删除","history.rename":"重命名","history.renameTitle":"重命名会话","history.renamePlaceholder":"输入新名称","history.renameCancel":"取消","history.renameOk":"确定","history.cannotDeleteCurrent":"无法删除当前会话","settings.title":"设置","settings.appearance":"外观","settings.model":"模型选择","settings.mode":"权限模式","settings.systemInfo":"系统信息","settings.backToChat":"返回对话","settings.tab.user":"用户级","settings.tab.project":"工作空间级","settings.group.modelAndReasoning":"模型与推理","settings.group.behavior":"行为","settings.group.memory":"记忆","settings.group.language":"语言","settings.group.advanced":"高级","settings.group.sandbox":"安全沙箱","settings.item.model":"默认模型","settings.item.model.desc":"设置默认使用的 AI 模型","settings.item.reasoningEffort":"推理努力级别","settings.item.reasoningEffort.desc":"控制模型的推理深度","settings.item.alwaysThinkingEnabled":"始终启用深度思考","settings.item.autoCompactEnabled":"自动压缩上下文","settings.item.includeCoAuthoredBy":"提交包含 Co-authored-by","settings.item.fileCheckpointingEnabled":"文件检查点","settings.item.fileCheckpointingEnabled.desc":"启用文件版本回退功能","settings.item.promptSuggestionEnabled":"提示建议","settings.item.ignoreGitIgnore":"忽略 .gitignore","settings.item.ignoreGitIgnore.desc":"搜索文件时忽略 .gitignore 规则","settings.item.deferToolLoading":"延迟加载工具","settings.item.hookOutputCollapsed":"折叠 Hook 输出","settings.item.memory.enabled":"启用记忆功能","settings.item.memory.autoMemoryEnabled":"自动记忆","settings.item.memory.autoMemoryEnabled.desc":"自动保存重要信息到记忆库","settings.item.language":"响应语言","settings.item.language.desc":"设置 AI 回复使用的语言","settings.item.cleanupPeriodDays":"聊天记录保留天数","settings.item.imageHistoryRetainRounds":"图片保留轮数","settings.item.imageHistoryRetainRounds.desc":"对话历史中保留图片的最近轮数","settings.item.env":"环境变量","settings.item.env.desc":"应用于每个会话的环境变量 (JSON)","settings.item.sandbox.enabled":"启用安全沙箱","settings.item.sandbox.enabled.desc":"在沙箱中运行 Bash 命令,限制文件和网络访问","settings.item.sandbox.autoAllowBashIfSandboxed":"沙箱内自动批准命令","settings.item.sandbox.autoAllowBashIfSandboxed.desc":"命令在沙箱中运行时自动批准","settings.loading":"加载中...","settings.saved":"已保存","settings.saveFailed":"保存失败","settings.notSet":"未设置","settings.default":"默认","settings.reset":"重置","settings.noProjectSettings":"当前工作空间暂无可配置项","settings.effort.low":"低","settings.effort.medium":"中","settings.effort.high":"高","settings.effort.xhigh":"极高","page.title":"CodeBuddy Code","tool.processExited":"[进程已退出]","tool.itemsCount":"{count} 项","tool.showAllItems":"显示全部 {count} 项","tool.moreLinesCount":"... 还有 {count} 行","tool.generatedImage":"生成的图片","tool.editedImage":"编辑后的图片","tool.imageGen":"图片生成","tool.imageEdit":"图片编辑","tool.toolSearch":"工具搜索","tool.teamCreate":"创建团队","tool.teamDelete":"删除团队","tool.taskCreate":"创建任务","tool.taskUpdate":"更新任务","tool.taskList":"任务列表","tool.taskGet":"获取任务","tool.sendMessage":"发送消息","tool.shutdown":"关闭","tool.taskCompleted":"任务完成","tool.shutdownRejected":"关闭被拒绝","tool.planResponse":"计划回复","tool.approved":"已批准","tool.rejected":"已拒绝","tool.webSearch":"网络搜索","tool.webFetch":"网页获取","tool.saveMemory":"保存记忆","tool.askUserQuestion":"询问用户","tool.enterPlanMode":"进入计划模式","tool.exitPlanMode":"退出计划模式","tool.allowedActions":"允许的操作:","tool.skill":"技能","tool.agent":"代理","tool.failed":"失败","tool.completed":"完成","tool.toolsCount":"{count} 个工具","tool.background":"后台","tool.permissionsCount":"{count} 项权限","terminal.unknownError":"未知错误","terminal.processExited":"[进程已退出]","terminal.connectionLost":"连接已断开","terminal.wsConnectionFailed":"WebSocket 连接失败","terminal.createSessionFailed":"创建终端会话失败","terminal.reconnectFailed":"重连失败","team.title":"团队","team.activeCount":"{count} 个活跃","team.doneCount":"{count} 个完成","team.waitingForTeammates":"等待 {count} 个成员完成…","team.backToMain":"返回主对话","team.loadingHistory":"加载对话历史…","team.noHistory":"暂无对话历史","team.agentRunning":"正在运行…","team.delivered":"已送达","team.showLess":"收起","team.moreLines":"… ({count} 更多行)","team.tools":"{count} 工具","team.tokens":"{count} tokens","instance.tunnelMode":"隧道","instance.localMode":"本地","workspace.searchPlaceholder":"搜索目录...","workspace.switch":"切换","workspace.switchHere":"切换到此目录","workspace.switching":"切换中...","workspace.noResults":"没有匹配的目录","workspace.emptyDir":"此目录为空","workspace.pathPlaceholder":"输入路径或目录名...","workspace.selectDir":"在此目录创建机器人","workspace.filterPlaceholder":"过滤子目录...","workspace.recent.title":"最近工作区","workspace.recent.daysAgo":"天前","workspace.recent.hoursAgo":"小时前","workspace.recent.minutesAgo":"分钟前","workspace.recent.justNow":"刚刚","workspace.recent.remove":"移除","workspace.browseTitle":"浏览工作区","workspace.recentWorkspaces":"最近工作区","workspace.createNew":"创建新机器人","workspace.browseDir":"浏览目录","workspace.instanceLocal":"本地","workspace.instanceTunnel":"隧道","workspace.instanceCurrent":"当前","workspace.switchInstance":"切换","workspace.switchingInstance":"切换中...","workspace.switchingWithGateway":"正在准备切换...","workspace.instanceStarted":"启动于","workspace.noWorkspaces":"暂无活跃的工作区","workspace.noWorkspacesHint":"浏览目录创建新机器人","workspace.instanceCount":"{count} 个机器人","question.multiLabel":"多选","tasks.title":"推荐模版","tasks.subtitle":"选择一个模版快速创建定时任务","tasks.loading":"正在获取推荐模版...","tasks.error":"获取模版失败","tasks.retry":"重试","tasks.refresh":"刷新推荐","tasks.refreshed":"已刷新","tasks.empty":"暂无推荐模版","tasks.interval":"每 {value}","tasks.interval.1d":"每天","tasks.interval.2d":"每 2 天","tasks.interval.3d":"每 3 天","tasks.interval.1w":"每周","tasks.interval.2w":"每 2 周","tasks.interval.1m":"每月","scheduled.title":"定时任务","scheduled.subtitle":"当前会话中的活跃定时任务","scheduled.loading":"加载中...","scheduled.empty":"暂无定时任务","scheduled.emptyHint":"在对话中使用 /loop 或 CronCreate 创建","scheduled.create":"创建任务","scheduled.creating":"创建中...","scheduled.delete":"删除","scheduled.cron":"Cron 表达式","scheduled.prompt":"执行内容","scheduled.promptPlaceholder":"定时触发时要执行的提示词...","scheduled.recurring":"循环","scheduled.oneShot":"一次性","scheduled.durable":"持久化","scheduled.sessionOnly":"仅会话","scheduled.lastFired":"上次触发","plugins.title":"插件管理","plugins.installedPlugins":"已安装插件","plugins.browseMarketplace":"浏览市场","plugins.marketplaces":"插件市场","plugins.enabled":"已启用","plugins.disabled":"已禁用","plugins.enable":"启用","plugins.disable":"禁用","plugins.uninstall":"卸载","plugins.install":"安装","plugins.confirmUninstall":"确定要卸载此插件吗?","plugins.marketplace":"市场","plugins.addMarketplace":"添加市场","plugins.removeMarketplace":"移除","plugins.confirmRemoveMarketplace":"确定要移除此市场吗?","plugins.noPlugins":"暂无已安装的插件","plugins.noPluginsHint":"通过插件市场安装插件来扩展功能","plugins.noMarketplaces":"暂无配置的市场","plugins.noMarketplacesHint":"添加一个插件市场来浏览和安装插件","plugins.selectMarketplace":"选择市场","plugins.selectMarketplaceHint":"选择一个市场来浏览可用插件","plugins.marketplaceNotFound":"市场不存在","plugins.noAvailablePlugins":"该市场暂无可用插件","plugins.noAvailablePluginsHint":"请尝试添加其他市场或稍后再试","plugins.installed":"已安装","plugins.browsingMarketplace":"浏览中...","plugins.loading":"加载中...","plugins.error":"加载插件失败","plugins.retry":"重试","plugins.sourcePlaceholder":"市场地址(Git URL 或本地路径)","plugins.namePlaceholder":"市场名称(可选)","plugins.cancel":"取消","plugins.add":"添加","plugins.version":"版本","plugins.operationFailed":"操作失败","plugins.searchPlaceholder":"搜索插件...","plugins.allMarketplaces":"全部市场","plugins.noSearchResults":"没有找到匹配的插件","plugins.totalCount":"个插件","plugins.refresh":"刷新","plugins.installedLabel":"已安装","plugins.category":"分类","plugins.author":"作者","plugins.license":"许可证","plugins.homepage":"主页","plugins.repository":"仓库","plugins.source":"来源","plugins.keywords":"关键词","plugins.features":"功能","plugins.scope":"范围","plugins.scope.user":"用户","plugins.scope.project":"项目","plugins.scope.project-local":"本地","plugins.installScope.user":"为你安装(用户级)","plugins.installScope.project":"为所有协作者安装(项目级)","plugins.installScope.local":"仅在此仓库为你安装(本地级)","plugins.policyCannotRemove":"不可卸载","plugins.policyCannotSwitchoff":"不可禁用","plugins.policyCannotEdit":"不可编辑","channel.from":"来自","channel.group":"群聊","channel.replyTo":"回复来自 {source}","channel.wechat":"微信","channel.wecom":"企业微信","channel.wecomBot":"企微机器人","remoteControl.title":"远程控制","remoteControl.subtitle":"管理渠道连接","remoteControl.connectedChannels":"已连接渠道","remoteControl.noChannels":"暂无已连接渠道","remoteControl.noChannelsHint":"添加微信或企业微信渠道,或从插件市场安装更多","remoteControl.addWeChat":"添加微信机器人","remoteControl.addWeCom":"添加企微机器人","remoteControl.connect":"连接","remoteControl.disconnect":"断开","remoteControl.delete":"删除","remoteControl.add":"添加","remoteControl.connected":"已连接","remoteControl.disconnected":"未连接","remoteControl.connecting":"连接中...","remoteControl.installMore":"安装更多渠道","remoteControl.installMoreHint":"浏览插件市场,安装第三方渠道插件","remoteControl.browseMarketplace":"浏览插件市场","remoteControl.builtIn":"内置","remoteControl.plugin":"插件","remoteControl.rebind":"重新绑定","remoteControl.unbind":"解绑","remoteControl.bot":"机器人","remoteControl.default":"默认","remoteControl.next":"下一步","remoteControl.cancel":"取消","remoteControl.wecomBotIdHint":"从企业微信管理后台 → 应用管理 → AI 助手获取","remoteControl.wecomSecretHint":"输入 Secret 后按回车或点“连接”","remoteControl.fetchingQr":"正在获取二维码...","remoteControl.scanQr":"请用微信扫描二维码","sidebar.docs":"文档","docs.title":"文档中心","docs.search.placeholder":"搜索文档...","docs.search.noResults":"未找到相关文档","docs.search.resultsCount":"{count} 个结果","docs.loading":"加载中...","docs.loadError":"文档加载失败","docs.notFound":"未找到该文档","docs.apiReference":"API 文档","docs.toc":"目录","docs.retry":"重试","docs.backToList":"返回文档列表","docs.expandAll":"展开全部","docs.collapseAll":"收起全部","docs.openStandalone":"独立窗口打开","sidebar.stats":"统计","stats.title":"统计","stats.loading":"正在加载统计数据...","stats.refresh":"刷新","stats.noData":"暂无统计数据","stats.tab.overview":"概览","stats.tab.models":"模型","stats.tab.tools":"工具","stats.sessions":"会话数","stats.messages":"消息数","stats.activeDays":"活跃天数","stats.currentStreak":"当前连续","stats.longestStreak":"最长连续","stats.peakHour":"高峰时段","stats.longestSession":"最长会话","stats.favoriteModel":"最常用模型","stats.totalTokens":"总 Token","stats.timeRange":"统计范围: 最近 {days} 天","stats.heatmap.less":"少","stats.heatmap.more":"多","stats.days":"天","stats.tokensPerDay":"每日 Token 趋势","stats.allModels":"所有模型","stats.input":"输入","stats.output":"输出","stats.cacheRead":"缓存读取","stats.cacheHitRate":"缓存命中率","stats.cost":"成本","stats.topTools":"工具使用排行","stats.session.title":"当前会话","stats.session.apiDuration":"API 时长","stats.session.wallTime":"总时长","stats.session.linesAdded":"新增行","stats.session.linesDeleted":"删除行","stats.session.tokens":"Token","stats.na":"N/A","stats.heatmap.messages":"条消息","stats.funFact.moreTokens":"你已使用约 {times} 倍于《{book}》的 Token 量","stats.funFact.sameTokens":"你使用的 Token 量约等于一本《{book}》","stats.funFact.longerSession":"你最长的会话时长约为「{activity}」的 {times} 倍","sidebar.traces":"链路","traces.title":"链路追踪","traces.loading":"加载中...","traces.refresh":"刷新","traces.clear":"清空","traces.clearConfirm":"确定清空所有链路数据?","traces.noData":"暂无链路数据,发送一条消息后将自动收集","traces.selectWorker":"选择 Worker","traces.current":"当前","traces.spanCount":"{count} spans","traces.duration":"耗时","traces.status.ok":"成功","traces.status.error":"错误","traces.status.running":"运行中","traces.status.cancelled":"已取消","traces.bottleneck":"瓶颈","traces.bottleneckTip":"耗时最长,占总时间 {pct}%","traces.spanDetail":"Span 详情","traces.spanDetail.type":"类型","traces.spanDetail.duration":"耗时","traces.spanDetail.model":"模型","traces.spanDetail.tokens":"Token","traces.spanDetail.input":"输入","traces.spanDetail.output":"输出","traces.spanDetail.error":"错误","traces.spanDetail.attributes":"属性","traces.legend.agent":"Agent","traces.legend.generation":"模型调用","traces.legend.function":"工具","traces.legend.handoff":"切换","traces.legend.guardrail":"防护","traces.back":"返回","traces.tab.timeline":"时间线","traces.tab.tree":"树形","traces.tab.flame":"火焰图","traces.tab.graph":"依赖图","traces.expandAll":"全部展开","traces.collapseAll":"全部收起","traces.search":"搜索 span...","traces.selfTime":"自身耗时","traces.spanDetail.overview":"概览","traces.spanDetail.io":"输入/输出","traces.noSpans":"无 span 数据","traces.auto":"自动","traces.auxiliaryCount":"{count} 个辅助 trace(memory、title 等)","traces.noIO":"无输入/输出数据","traces.noAttrs":"无属性","traces.fit":"适应","traces.allSessions":"所有会话","traces.allInstances":"所有实例","traces.llmCalls":"{count} 次 LLM","sidebar.metrics":"监控","metrics.title":"系统监控","metrics.loading":"加载指标数据...","metrics.refresh":"刷新","metrics.cpu":"CPU","metrics.memory":"内存","metrics.disk":"磁盘","metrics.cores":"核心","metrics.workers":"Workers","metrics.noWorkers":"暂无运行中的 Worker","metrics.current":"当前","metrics.uptime":"运行时长","metrics.version":"版本","sidebar.editor":"文件","editor.title":"代码编辑器","editor.loading":"加载中...","editor.loadError":"加载失败","editor.noFile":"选择一个文件开始编辑","editor.unsaved":"未保存","editor.save":"保存","editor.saveAll":"全部保存","editor.close":"关闭","editor.closeOthers":"关闭其他","editor.closeAll":"关闭全部","editor.newFile":"新建文件","editor.newFolder":"新建文件夹","editor.rename":"重命名","editor.delete":"删除","editor.refresh":"刷新","editor.emptyFolder":"空文件夹","editor.explorer":"资源管理器","editor.toggleSidebar":"切换侧边栏","editor.collapseAll":"全部折叠","editor.openFolder":"打开目录","editor.openFolderPlaceholder":"输入目录路径...","editor.parentFolder":"上级目录","editor.pin":"固定","editor.unpin":"取消固定","editor.copyPath":"复制路径","editor.copyRelativePath":"复制相对路径","editor.revealInExplorer":"在文件树中定位","editor.closeToRight":"关闭右侧","editor.closeSaved":"关闭已保存","editor.quickOpen":"快速打开文件","editor.focusExplorer":"聚焦资源管理器","editor.recentFiles":"最近文件","editor.quickOpenPlaceholder":"输入文件名以搜索...","editor.quickOpenEmpty":"没有匹配的文件","editor.quickOpenLoading":"正在加载文件列表...","editor.selected":"已选","editor.lines":"行","editor.preview":"切换到预览","editor.source":"切换到源码","sidebar.workers":"实例","workers.title":"Agent 实例管理","workers.refresh":"刷新","workers.active":"活跃 Workers","workers.empty":"没有活跃的 worker 进程","workers.daemon":"Daemon 服务","workers.daemon.running":"运行中","workers.daemon.stopped":"已停止","workers.daemon.start":"启动","workers.daemon.starting":"启动中...","workers.daemon.stop":"停止","workers.daemon.restart":"重启","workers.action.logs":"查看日志","workers.action.open":"打开","workers.action.kill":"终止","workers.action.kill.confirm":"确定要终止这个 worker 进程吗?","sidebar.logs":"日志","logs.title":"日志查看器","logs.selectWorker":"选择 Worker","logs.current":"当前","logs.search":"搜索日志...","logs.autoRefresh":"自动刷新","logs.refresh":"刷新","logs.empty":"暂无日志内容","command.btw.description":"快速提问,不打断主要 Agent 工作","command.clear.description":"开始新的对话(之前的对话仍可通过 /resume 访问)","command.context.description":"计算并显示上下文 Token 分布","command.cost.description":"显示当前会话的总费用和持续时间","command.doctor.description":"诊断和验证 CodeBuddy 的安装和设置","command.feedback.description":"打开反馈页面以报告问题或提出建议","command.gateway.description":'管理远程控制网关。子命令: "status" 查看状态, "stop" 停止网关, "token" 重新生成访问令牌, "tunnel" 启动隧道',"command.remote-control.description":"管理远程控制长连接客户端(start, stop, status, list)","command.login.description":"切换腾讯云 CodeBuddy 账号","command.logout.description":"退出 CodeBuddy Code 账号","command.plan.description":"预览当前计划文件内容","command.pr-comments.description":"获取 GitHub Pull Request 的评论","command.release-notes.description":"查看更新日志","command.review.description":"审查 Pull Request","command.skills.description":"列出可用的技能","command.todos.description":"显示当前会话的任务清单","command.reload-plugins.description":"重新加载所有插件、技能、代理、钩子和 MCP/LSP 服务器(无需重启)","command.plugin-validate.description":"验证插件目录结构和清单文件","command.init.description":"正在分析你的代码库…","command.compact.description":"清除对话历史但保留摘要在上下文中。可选: /compact [摘要指令]","command.upgrade.description":"在浏览器中打开升级页面","command.statusline.description":"设置 CodeBuddy Code 的状态栏 UI","command.security-review.description":"对当前分支的待提交变更进行安全审查","command.insights.description":"生成 AI 驱动的 CodeBuddy Code 使用模式和活动洞察","command.loop.description":"按固定间隔运行提示或斜杠命令(例如 /loop 5m /foo,默认 10m)","command.task-manager.description":"团队任务管理 - 智能任务录入、分配、追踪和分析","sidebar.changes":"变更","fileChanges.title":"变更","fileChanges.changesSection":"文件变更","fileChanges.empty":"暂无文件变更","fileChanges.showChanges":"显示文件变更","fileChanges.hideChanges":"隐藏文件变更","fileChanges.revertAll":"撤回全部","fileChanges.revertCode":"回退代码","fileChanges.revertChat":"回退对话","fileChanges.revertCodeAndChat":"回退全部","fileChanges.checkpoints":"回退点","fileChanges.noCheckpoints":"暂无回退点","filePreview.binaryNotSupported":"该文件无法在编辑器中预览","filePreview.download":"下载文件","error.viewCrashed":"页面加载出错","error.appCrashed":"应用遇到了问题","error.newChatFailed":"创建新对话失败,请重试","error.switchSessionFailed":"切换会话失败,请重试","commandPalette.placeholder":"输入命令...","commandPalette.commands":"命令","commandPalette.views":"视图","commandPalette.actions":"操作","commandPalette.noResults":"没有匹配的命令","commandPalette.newChat":"新建对话","commandPalette.toggleTheme":"切换主题","commandPalette.toggleLocale":"切换语言","commandPalette.tip":"打开命令面板","app.confirm":"确定","app.cancel":"取消","tool.toolSingular":"个工具已执行","tool.toolPlural":"个工具已执行","keybindings.title":"快捷键","keybindings.search.placeholder":"搜索快捷键... (如 submit, ctrl+enter)","keybindings.source.default":"默认","keybindings.source.user":"自定义","keybindings.record.title":"录制快捷键","keybindings.record.hint":"请按下快捷键组合...","keybindings.record.conflict":"冲突","keybindings.action.edit":"编辑","keybindings.action.reset":"重置","keybindings.action.unbind":"解绑","keybindings.reset.all":"重置全部","keybindings.noResults":"没有匹配的快捷键","keybindings.empty":"暂无快捷键","keybindings.loading":"加载中...","keybindings.ctx.Global":"全局","keybindings.ctx.Chat":"聊天输入","keybindings.ctx.InputBox":"文本输入","keybindings.ctx.Terminal":"终端","keybindings.ctx.Autocomplete":"自动补全","keybindings.ctx.Confirmation":"确认对话框","keybindings.ctx.HistorySearch":"历史搜索","keybindings.ctx.Task":"任务运行中","keybindings.ctx.Settings":"设置","keybindings.ctx.CommandPalette":"命令面板","keybindings.ctx.Select":"选择列表","keybindings.ctx.PermissionDialog":"权限对话框","keybindings.ctx.Help":"帮助","keybindings.ctx.Plugin":"插件","keybindings.ctx.DiffDialog":"Diff 对话框","keybindings.ctx.MessageSelector":"消息选择器","keybindings.ctxDesc.Global":"在任何位置都生效","keybindings.ctxDesc.Chat":"聊天输入框获得焦点时","keybindings.ctxDesc.InputBox":"文本输入框处于活跃状态时","keybindings.ctxDesc.Terminal":"终端视图处于活跃状态时","keybindings.ctxDesc.Autocomplete":"自动补全菜单显示时","keybindings.ctxDesc.Confirmation":"确认/权限对话框显示时","keybindings.ctxDesc.HistorySearch":"搜索命令历史时 (ctrl+r)","keybindings.ctxDesc.Task":"任务/代理在前台运行时","keybindings.ctxDesc.Settings":"设置面板打开时","keybindings.ctxDesc.CommandPalette":"命令面板打开时","keybindings.ctxDesc.Select":"选择/列表组件获得焦点时","keybindings.ctxDesc.PermissionDialog":"工具权限对话框显示时","keybindings.ctxDesc.Help":"帮助页面打开时","keybindings.ctxDesc.Plugin":"插件对话框打开时","keybindings.ctxDesc.DiffDialog":"Diff 对话框打开时","keybindings.ctxDesc.MessageSelector":"消息选择器 (rewind) 打开时","keybindings.act.app:interrupt":"中断","keybindings.act.app:exit":"退出","keybindings.act.app:redraw":"刷新屏幕","keybindings.act.app:toggleTodos":"切换待办事项","keybindings.act.app:toggleTranscript":"切换转录","keybindings.act.app:toggleSidebar":"切换侧边栏","keybindings.act.app:toggleTerminal":"切换终端","keybindings.act.app:commandPalette":"命令面板","keybindings.act.app:newChat":"新对话","keybindings.act.app:settings":"设置","keybindings.act.app:focusInput":"聚焦输入框","keybindings.act.app:keybindings":"快捷键设置","keybindings.act.history:search":"搜索历史","keybindings.act.history:previous":"上一条历史","keybindings.act.history:next":"下一条历史","keybindings.act.history:open":"打开历史","keybindings.act.chat:cancel":"取消","keybindings.act.chat:submit":"发送","keybindings.act.chat:newline":"换行","keybindings.act.chat:killAgents":"终止代理","keybindings.act.chat:cycleMode":"切换模式","keybindings.act.chat:modelPicker":"选择模型","keybindings.act.chat:thinkingToggle":"切换思考","keybindings.act.chat:undo":"撤销","keybindings.act.chat:externalEditor":"外部编辑器","keybindings.act.chat:stash":"暂存","keybindings.act.chat:imagePaste":"粘贴图片","keybindings.act.autocomplete:accept":"接受补全","keybindings.act.autocomplete:dismiss":"关闭补全","keybindings.act.autocomplete:previous":"上一项","keybindings.act.autocomplete:next":"下一项","keybindings.act.confirm:yes":"确认","keybindings.act.confirm:no":"取消","keybindings.act.confirm:previous":"上一项","keybindings.act.confirm:next":"下一项","keybindings.act.confirm:toggle":"切换选中","keybindings.act.confirm:toggleExplanation":"切换说明","keybindings.act.task:background":"后台运行","keybindings.act.historySearch:next":"下一条","keybindings.act.historySearch:accept":"接受","keybindings.act.historySearch:cancel":"取消","keybindings.act.historySearch:execute":"执行","keybindings.act.settings:close":"关闭设置","keybindings.act.settings:search":"搜索设置","keybindings.act.select:previous":"上一项","keybindings.act.select:next":"下一项","keybindings.act.select:accept":"选择","keybindings.act.select:cancel":"取消","keybindings.act.commandPalette:close":"关闭面板","keybindings.act.commandPalette:execute":"执行命令","keybindings.act.commandPalette:previous":"上一项","keybindings.act.commandPalette:next":"下一项","keybindings.act.permission:toggleDebug":"切换调试","keybindings.act.diff:dismiss":"关闭 Diff","keybindings.act.diff:previousFile":"上一个文件","keybindings.act.diff:nextFile":"下一个文件","keybindings.act.diff:viewDetails":"查看详情","keybindings.act.plugin:toggle":"切换插件","keybindings.act.plugin:install":"安装插件","keybindings.act.help:dismiss":"关闭帮助","keybindings.act.transcript:exit":"退出转录","keybindings.act.transcript:toggleShowAll":"显示全部","keybindings.act.messageSelector:up":"向上","keybindings.act.messageSelector:down":"向下","keybindings.act.messageSelector:top":"到顶部","keybindings.act.messageSelector:bottom":"到底部","keybindings.act.messageSelector:select":"选择","common.close":"关闭","changes.revert":"还原","changes.revertDirectory":"还原目录","message.clickToEnlarge":"点击放大","channel.botIdPlaceholder":"输入 Bot ID","channel.secretPlaceholder":"输入 Secret","filePreview.zoomOut":"缩小","filePreview.zoomIn":"放大","filePreview.fitToWindow":"适应窗口","filePreview.actualSize":"实际大小 (1:1)","filePreview.pdfPreview":"PDF 预览"},en:{"app.connecting":"Connecting to CodeBuddy Code...","app.connectFailed":"Connection failed","app.retry":"Retry","app.pwa.newVersion":"A new Web UI version is available","app.pwa.reloadNow":"Reload now","app.pwa.reloadLater":"Later","app.pwa.reloadedAfterIdle":"Updated to new version","chat.empty.title":"CodeBuddy Code","chat.empty.subtitle":"How can I help you today?","chat.empty.slogan":"Claw Your Ideas . Into Reality","chat.empty.tag.slides":"Slide Generation","chat.empty.tag.research":"Deep Research","chat.empty.tag.docs":"Document Processing","chat.empty.tag.data":"Data Analysis","chat.thinking":"Thinking","chat.waitingPermission":"Waiting for permission","chat.waitingUser":"Waiting for user","chat.error":"Error","chat.sessionEnded":"Session ended","chat.stopped":"Stopped","chat.error.refusal":"The agent refused to continue execution. This may be due to content policy restrictions or other limitations.","chat.error.network":"Network connection failed or the service is temporarily unavailable. Please try again later.","chat.error.auth":"Authentication failed or insufficient permissions. Please sign in again and retry.","chat.error.quota":"Quota limit reached or too many requests. Please try again later.","chat.error.modelService":"The model service returned an error. Please retry or try again later.","chat.error.maxTokens":"Response was truncated due to reaching the maximum token limit. You may continue the conversation or ask for a more concise response.","chat.error.maxTurnRequests":"The maximum number of model requests per turn has been exceeded. You may send a new message to continue.","chat.newChat":"New Chat","chat.disclaimer":"Answers generated by AI are for reference only","chat.compacted":"Conversation compacted","chat.compacting":"Compacting conversation...","phase.preparing":"Preparing","phase.modelRequesting":"Waiting for model","phase.modelStreaming":"Streaming","phase.modelDone":"Processing","phase.toolExecuting":"Running tool","phase.modelStreamingTool":"Writing","phase.retrying":"Retrying","progress.compacting":"Compacting context","input.placeholder":"Start from an idea...","input.placeholderRunning":"Messages will be queued...","input.placeholderPending":"Please handle the permission request first...","input.send":"Send (Enter)","input.stop":"Stop","input.thinking":"Thinking","input.deepThinking":"Deep Thinking","input.promptFailed":"Prompt failed","input.sendQueued":"Send queued (Enter)","input.dropHint":"Drop files here","input.addImage":"Add image","input.addFile":"Add file","input.imageTooLarge":"Image must be under 10MB","input.tooManyImages":"Up to 5 images allowed","input.fileTooLarge":"File must be under 1MB","input.tooManyFiles":"Up to 10 files allowed","input.menu.image":"Image","input.menu.file":"File","input.newline":"New line","input.contextMenu.newline":"New line","input.contextMenu.send":"Send","queue.more":" more queued","status.running":"Running","tool.writeFile":"Write file","tool.readFile":"Read file","tool.execute":"Execute","tool.searchFiles":"Search files","tool.searchContent":"Search content","tool.fetchWeb":"Fetch web","tool.searchWeb":"Search web","tool.defaultName":"Tool","tool.moreItems":"... {count} more","interruption.title":"Permission Required","interruption.tool":"Tool","interruption.allow":"Allow","interruption.allowAll":"Allow All","interruption.deny":"Deny","interruption.approved":"Approved","interruption.denied":"Denied","interruption.edits":"{count} edits","interruption.yes":"Yes","interruption.keepPlanning":"No, keep planning","interruption.exitPlanMode":"Exit plan mode","interruption.readyToCode":"Ready to code?","theme.light":"Light","theme.dark":"Dark","theme.system":"System","locale.zh":"Chinese","locale.en":"English","locale.system":"System","sidebar.nav.plugins":"Plugins","sidebar.nav.tasks":"Tasks","sidebar.search.placeholder":"Search...","sidebar.chatHistory":"Chat History","sidebar.workspace":"Workspace","sidebar.connectionStatus":"Connection Status","sidebar.status":"Status","sidebar.sessionId":"Session ID","sidebar.notConnected":"Not connected","sidebar.modelSelection":"Model Selection","sidebar.noModels":"No models available","sidebar.environment":"Environment","sidebar.cwd":"Working Directory","sidebar.os":"OS","sidebar.nodeVersion":"Node.js","sidebar.gatewayMode":"Gateway Mode","sidebar.tunnelUrl":"Tunnel URL","sidebar.clickToCopy":"Click to copy","sidebar.copied":"Copied","sidebar.permissionMode":"Permission Mode","sidebar.noModes":"No modes available","sidebar.preferences":"Preferences","sidebar.keybindings":"Keybindings","sidebar.group.workspace":"Workspace","sidebar.group.observability":"Observability","sidebar.group.preferences":"Preferences","bottomSheet.attachments":"Attach","bottomSheet.navigation":"Navigate","sidebar.theme":"Theme","sidebar.language":"Language","sidebar.user":"User","sidebar.authMethod":"Password","sidebar.noAuth":"No Auth","sidebar.version":"Remote UI v1.0","connection.connected":"Connected","connection.connecting":"Connecting","connection.disconnected":"Disconnected","connection.error":"Error","message.copyToClipboard":"Copy to clipboard","message.copied":"Copied","message.copy":"Copy","message.assistantName":"CodeBuddy Code","thinking.title":"Thinking Process","thinking.thinking":"Thinking","thinking.done":"Thought for","thinking.seconds":" {n}s","thinking.expand":"Expand","thinking.collapse":"Collapse","diff.noChanges":"No changes","login.title":"CodeBuddy Remote Control","login.subtitle":"Enter the password shown in your terminal","login.placeholder":"Password","login.submit":"Login","login.error.incorrect":"Incorrect password","login.error.rateLimit":"Too many login attempts. Please try again later.","login.error.required":"Password is required","login.hint.password":"Tip: The password is displayed when the server starts.","login.hint.urlAuth":"You can also use <code>?password=xxx</code> to login automatically.","login.hint.disable":'Or set <code>gateway.auth: "none"</code> in <code>settings.json</code> under the CodeBuddy config directory (defaults to <code>~/.codebuddy</code>; override via the <code>CODEBUDDY_CONFIG_DIR</code> environment variable) to disable.',"login.slogan":"Claw Your Ideas . Into Reality","login.tagline":"Triggered Anywhere, Completed Locally.","login.privacy":"Privacy Policy","login.terms":"Terms of Service","sidebar.interactionMode":"Interaction Mode","sidebar.chatMode":"Chat","sidebar.terminalMode":"Terminal","sidebar.canvas":"Canvas","canvas.title":"Infinite Canvas","canvas.addTerminal":"Add Terminal","canvas.zoomIn":"Zoom In","canvas.zoomOut":"Zoom Out","canvas.fitView":"Fit View","canvas.resetView":"Reset View","canvas.empty":"Click the + button in the toolbar to add a terminal","canvas.openStandalone":"Open canvas in new window","canvas.tileMenu.close":"Close","canvas.tileMenu.duplicate":"Duplicate Terminal","canvas.tileMenu.maximize":"Maximize","canvas.tileMenu.minimize":"Minimize","canvas.tileMenu.restore":"Restore","canvas.tileMenu.openStandalone":"Open in new window","canvas.standalone.missingPaneId":"Missing pane ID","canvas.defaultTitle":"Terminal","terminal.connecting":"Connecting terminal...","terminal.title":"Terminal","terminal.disconnected":"Terminal disconnected","terminal.error":"Terminal connection failed","terminal.reconnect":"Reconnect","terminal.splitHorizontal":"Split Right","terminal.splitVertical":"Split Down","terminal.closePane":"Close Terminal","terminal.maxPanes":"Max panes reached","sidebar.instances":"Instances","sidebar.activeInstances":"active instances","sidebar.manageInstances":"Manage Instances","sidebar.remoteControl":"Channels","instance.title":"Instance List","instance.switch":"Instance","instance.switchTitle":"Switch Instance","instance.current":"Current","instance.manual":"Manual","instance.switchTo":"Switch to this instance","instance.manage":"Manage Instances","instance.managerTitle":"Instance Manager","instance.addInstance":"Add Instance","instance.name":"Instance Name","instance.namePlaceholder":"Custom instance name (optional, defaults to directory name)","instance.url":"Instance URL","instance.urlPlaceholder":"https://example.trycloudflare.com","instance.password":"Password","instance.optional":"Optional","instance.passwordPlaceholder":"Access password","instance.cancel":"Cancel","instance.add":"Add","instance.remove":"Remove this instance","instance.noInstances":"No other instances","instance.noInstancesHint":"Start more CodeBuddy Code instances or add remote instances manually","instance.cwd":"Working Directory","instance.topic":"Topic","instance.startedAt":"Started at","instance.local":"Local","instance.tunnel":"Tunnel","instance.uptime.days":"d ago","instance.uptime.hours":"h ago","instance.uptime.minutes":"m ago","instance.uptime.justNow":"Just now","instance.addError":"Failed to add instance","instance.removeError":"Failed to remove instance","instance.copyUrl":"Copy URL","instance.copied":"Copied","instance.subtitle":"Manage and switch between instances","instance.refresh":"Refresh","instance.refreshed":"Refreshed","instance.loading":"Loading instances...","instance.error":"Failed to load instances","instance.retry":"Retry","question.multiple":"multiple","question.customAnswer":"Or type a custom answer...","question.reviewAnswers":"Review answers","question.singleTitle":"Question","question.titleWithCount":"Questions ({count})","question.reviewTab":"Review","question.next":"Next","question.submit":"Submit","question.cancel":"Cancel","question.answered":"Answered","question.cancelled":"Question cancelled","todo.title":"Tasks","todo.executing":"Task {n} executing","todo.untitled":"Untitled","history.title":"Sessions","history.description":"Click a session to switch to that conversation","history.noData":"No sessions","history.noDataHint":"Start a new conversation","history.backToChat":"Back to Chat","history.loading":"Loading...","history.loadError":"Failed to load","history.retry":"Retry","history.current":"Current","history.messages":"{count} messages","history.delete":"Delete","history.deleteConfirm":"Are you sure you want to delete this session?","history.deleteCancel":"Cancel","history.deleteOk":"Delete","history.rename":"Rename","history.renameTitle":"Rename Session","history.renamePlaceholder":"Enter new name","history.renameCancel":"Cancel","history.renameOk":"OK","history.cannotDeleteCurrent":"Cannot delete current session","settings.title":"Preferences","settings.appearance":"Appearance","settings.model":"Model Selection","settings.mode":"Permission Mode","settings.systemInfo":"System Info","settings.backToChat":"Back to Chat","settings.tab.user":"User","settings.tab.project":"Project","settings.group.modelAndReasoning":"Model & Reasoning","settings.group.behavior":"Behavior","settings.group.memory":"Memory","settings.group.language":"Language","settings.group.advanced":"Advanced","settings.group.sandbox":"Security Sandbox","settings.item.model":"Default Model","settings.item.model.desc":"Set the default AI model","settings.item.reasoningEffort":"Reasoning Effort","settings.item.reasoningEffort.desc":"Control model reasoning depth","settings.item.alwaysThinkingEnabled":"Always Enable Thinking","settings.item.autoCompactEnabled":"Auto Compact Context","settings.item.includeCoAuthoredBy":"Include Co-authored-by","settings.item.fileCheckpointingEnabled":"File Checkpointing","settings.item.fileCheckpointingEnabled.desc":"Enable file version rollback","settings.item.promptSuggestionEnabled":"Prompt Suggestions","settings.item.ignoreGitIgnore":"Ignore .gitignore","settings.item.ignoreGitIgnore.desc":"Ignore .gitignore rules when searching","settings.item.deferToolLoading":"Defer Tool Loading","settings.item.hookOutputCollapsed":"Collapse Hook Output","settings.item.memory.enabled":"Enable Memory","settings.item.memory.autoMemoryEnabled":"Auto Memory","settings.item.memory.autoMemoryEnabled.desc":"Auto-save important info to memory","settings.item.language":"Response Language","settings.item.language.desc":"Language for AI responses","settings.item.cleanupPeriodDays":"Chat History Retention (days)","settings.item.imageHistoryRetainRounds":"Image Retention Rounds","settings.item.imageHistoryRetainRounds.desc":"Rounds to retain images in history","settings.item.env":"Environment Variables","settings.item.env.desc":"Variables applied to each session (JSON)","settings.item.sandbox.enabled":"Enable Sandbox","settings.item.sandbox.enabled.desc":"Run Bash commands in sandbox, restrict file and network access","settings.item.sandbox.autoAllowBashIfSandboxed":"Auto-approve in Sandbox","settings.item.sandbox.autoAllowBashIfSandboxed.desc":"Auto-approve commands when running in sandbox","settings.loading":"Loading...","settings.saved":"Saved","settings.saveFailed":"Save failed","settings.notSet":"Not set","settings.default":"Default","settings.reset":"Reset","settings.noProjectSettings":"No project-level settings available","settings.effort.low":"Low","settings.effort.medium":"Medium","settings.effort.high":"High","settings.effort.xhigh":"Extra High","page.title":"CodeBuddy Code","tool.processExited":"[Process exited]","tool.itemsCount":"{count} items","tool.showAllItems":"Show all {count} items","tool.moreLinesCount":"... {count} more lines","tool.generatedImage":"Generated image","tool.editedImage":"Edited image","tool.imageGen":"ImageGen","tool.imageEdit":"ImageEdit","tool.toolSearch":"ToolSearch","tool.teamCreate":"TeamCreate","tool.teamDelete":"TeamDelete","tool.taskCreate":"TaskCreate","tool.taskUpdate":"TaskUpdate","tool.taskList":"TaskList","tool.taskGet":"TaskGet","tool.sendMessage":"SendMessage","tool.shutdown":"Shutdown","tool.taskCompleted":"Task completed","tool.shutdownRejected":"Shutdown rejected","tool.planResponse":"Plan response","tool.approved":"approved","tool.rejected":"rejected","tool.webSearch":"WebSearch","tool.webFetch":"WebFetch","tool.saveMemory":"SaveMemory","tool.askUserQuestion":"AskUserQuestion","tool.enterPlanMode":"Enter Plan Mode","tool.exitPlanMode":"Exit Plan Mode","tool.allowedActions":"Allowed actions:","tool.skill":"Skill","tool.agent":"Agent","tool.failed":"failed","tool.completed":"completed","tool.toolsCount":"{count} tools","tool.background":"background","tool.permissionsCount":"{count} permissions","terminal.unknownError":"Unknown error","terminal.processExited":"[Process exited]","terminal.connectionLost":"Connection lost","terminal.wsConnectionFailed":"WebSocket connection failed","terminal.createSessionFailed":"Failed to create terminal session","terminal.reconnectFailed":"Reconnect failed","team.title":"Team","team.activeCount":"{count} active","team.doneCount":"{count} done","team.waitingForTeammates":"Waiting for {count} teammate{s}…","team.backToMain":"Back to main chat","team.loadingHistory":"Loading conversation…","team.noHistory":"No conversation history yet","team.agentRunning":"Agent is running…","team.delivered":"Delivered","team.showLess":"Show less","team.moreLines":"… ({count} more lines)","team.tools":"{count} tools","team.tokens":"{count} tokens","instance.tunnelMode":"Tunnel","instance.localMode":"Local","workspace.searchPlaceholder":"Search directories...","workspace.switch":"Switch","workspace.switchHere":"Switch to this directory","workspace.switching":"Switching...","workspace.noResults":"No matching directories","workspace.emptyDir":"This directory is empty","workspace.pathPlaceholder":"Enter path or directory name...","workspace.selectDir":"Create bot in this directory","workspace.filterPlaceholder":"Filter subdirectories...","workspace.recent.title":"Recent Workspaces","workspace.recent.daysAgo":"d ago","workspace.recent.hoursAgo":"h ago","workspace.recent.minutesAgo":"m ago","workspace.recent.justNow":"Just now","workspace.recent.remove":"Remove","workspace.browseTitle":"Browse Workspaces","workspace.recentWorkspaces":"Recent Workspaces","workspace.createNew":"Create New Bot","workspace.browseDir":"Browse Directory","workspace.instanceLocal":"Local","workspace.instanceTunnel":"Tunnel","workspace.instanceCurrent":"Current","workspace.switchInstance":"Switch","workspace.switchingInstance":"Switching...","workspace.switchingWithGateway":"Preparing to switch...","workspace.instanceStarted":"Started","workspace.noWorkspaces":"No active workspaces","workspace.noWorkspacesHint":"Browse directories to create a new bot","workspace.instanceCount":"{count} bots","question.multiLabel":"multi","tasks.title":"Recommended Templates","tasks.subtitle":"Select a template to create a scheduled task","tasks.loading":"Loading recommended templates...","tasks.error":"Failed to load templates","tasks.retry":"Retry","tasks.refresh":"Refresh","tasks.refreshed":"Refreshed","tasks.empty":"No templates available","tasks.interval":"Every {value}","tasks.interval.1d":"Daily","tasks.interval.2d":"Every 2 days","tasks.interval.3d":"Every 3 days","tasks.interval.1w":"Weekly","tasks.interval.2w":"Every 2 weeks","tasks.interval.1m":"Monthly","scheduled.title":"Scheduled Tasks","scheduled.subtitle":"Active scheduled tasks in the current session","scheduled.loading":"Loading...","scheduled.empty":"No scheduled tasks","scheduled.emptyHint":"Use /loop or CronCreate in chat to create one","scheduled.create":"Create Task","scheduled.creating":"Creating...","scheduled.delete":"Delete","scheduled.cron":"Cron Expression","scheduled.prompt":"Prompt","scheduled.promptPlaceholder":"Prompt to execute on each fire...","scheduled.recurring":"Recurring","scheduled.oneShot":"One-shot","scheduled.durable":"Durable","scheduled.sessionOnly":"Session-only","scheduled.lastFired":"Last fired","plugins.title":"Plugins","plugins.installedPlugins":"Installed Plugins","plugins.browseMarketplace":"Browse Marketplace","plugins.marketplaces":"Marketplaces","plugins.enabled":"Enabled","plugins.disabled":"Disabled","plugins.enable":"Enable","plugins.disable":"Disable","plugins.uninstall":"Uninstall","plugins.install":"Install","plugins.confirmUninstall":"Are you sure you want to uninstall this plugin?","plugins.marketplace":"Marketplace","plugins.addMarketplace":"Add Marketplace","plugins.removeMarketplace":"Remove","plugins.confirmRemoveMarketplace":"Are you sure you want to remove this marketplace?","plugins.noPlugins":"No plugins installed","plugins.noPluginsHint":"Install plugins from a marketplace to extend functionality","plugins.noMarketplaces":"No marketplaces configured","plugins.noMarketplacesHint":"Add a plugin marketplace to browse and install plugins","plugins.selectMarketplace":"Select Marketplace","plugins.selectMarketplaceHint":"Select a marketplace to browse available plugins","plugins.marketplaceNotFound":"Marketplace not found","plugins.noAvailablePlugins":"No available plugins in this marketplace","plugins.noAvailablePluginsHint":"Try adding other marketplaces or check back later","plugins.installed":"Installed","plugins.browsingMarketplace":"Loading...","plugins.loading":"Loading...","plugins.error":"Failed to load plugins","plugins.retry":"Retry","plugins.sourcePlaceholder":"Marketplace URL (Git URL or local path)","plugins.namePlaceholder":"Marketplace name (optional)","plugins.cancel":"Cancel","plugins.add":"Add","plugins.version":"Version","plugins.operationFailed":"Operation failed","plugins.searchPlaceholder":"Search plugins...","plugins.allMarketplaces":"All Marketplaces","plugins.noSearchResults":"No matching plugins found","plugins.totalCount":"plugins","plugins.refresh":"Refresh","plugins.installedLabel":"Installed","plugins.category":"Category","plugins.author":"Author","plugins.license":"License","plugins.homepage":"Homepage","plugins.repository":"Repository","plugins.source":"Source","plugins.keywords":"Keywords","plugins.features":"Features","plugins.scope":"Scope","plugins.scope.user":"User","plugins.scope.project":"Project","plugins.scope.project-local":"Local","plugins.installScope.user":"Install for you (user scope)","plugins.installScope.project":"Install for all collaborators (project scope)","plugins.installScope.local":"Install for you, in this repo only (local scope)","plugins.policyCannotRemove":"Cannot be uninstalled","plugins.policyCannotSwitchoff":"Cannot be disabled","plugins.policyCannotEdit":"Cannot be edited","channel.from":"From","channel.group":"Group","channel.replyTo":"Reply to {source}","channel.wechat":"WeChat","channel.wecom":"WeCom","channel.wecomBot":"WeCom Bot","remoteControl.title":"Remote Control","remoteControl.subtitle":"Manage channel connections","remoteControl.connectedChannels":"Connected Channels","remoteControl.noChannels":"No channels connected","remoteControl.noChannelsHint":"Add a WeChat or WeCom channel, or install more from the marketplace","remoteControl.addWeChat":"Add WeChat Bot","remoteControl.addWeCom":"Add WeCom Bot","remoteControl.connect":"Connect","remoteControl.disconnect":"Disconnect","remoteControl.delete":"Delete","remoteControl.add":"Add","remoteControl.connected":"Connected","remoteControl.disconnected":"Disconnected","remoteControl.connecting":"Connecting...","remoteControl.installMore":"Install More Channels","remoteControl.installMoreHint":"Browse the plugin marketplace for third-party channel plugins","remoteControl.browseMarketplace":"Browse Marketplace","remoteControl.builtIn":"Built-in","remoteControl.plugin":"Plugin","remoteControl.rebind":"Rebind","remoteControl.unbind":"Unbind","remoteControl.bot":" Bot","remoteControl.default":"Default ","remoteControl.next":"Next","remoteControl.cancel":"Cancel","remoteControl.wecomBotIdHint":"From: WeCom Admin → Apps → AI Assistant","remoteControl.wecomSecretHint":"Enter Secret and press Enter or click Connect","remoteControl.fetchingQr":"Fetching QR code...","remoteControl.scanQr":"Scan QR code with WeChat","sidebar.docs":"Docs","docs.title":"Documentation","docs.search.placeholder":"Search docs...","docs.search.noResults":"No matching documents found","docs.search.resultsCount":"{count} results","docs.loading":"Loading...","docs.loadError":"Failed to load document","docs.notFound":"Document not found","docs.apiReference":"API Reference","docs.toc":"On this page","docs.retry":"Retry","docs.backToList":"Back to docs","docs.expandAll":"Expand all","docs.collapseAll":"Collapse all","docs.openStandalone":"Open in new window","sidebar.stats":"Statistics","stats.title":"Statistics","stats.loading":"Loading statistics...","stats.refresh":"Refresh","stats.noData":"No statistics available","stats.tab.overview":"Overview","stats.tab.models":"Models","stats.tab.tools":"Tools","stats.sessions":"Sessions","stats.messages":"Messages","stats.activeDays":"Active Days","stats.currentStreak":"Current Streak","stats.longestStreak":"Longest Streak","stats.peakHour":"Peak Hour","stats.longestSession":"Longest Session","stats.favoriteModel":"Favorite Model","stats.totalTokens":"Total Tokens","stats.timeRange":"Stats from the last {days} days","stats.heatmap.less":"Less","stats.heatmap.more":"More","stats.days":"days","stats.tokensPerDay":"Tokens per Day","stats.allModels":"All Models","stats.input":"Input","stats.output":"Output","stats.cacheRead":"Cache Read","stats.cacheHitRate":"Cache Hit Rate","stats.cost":"Cost","stats.topTools":"Top Tools","stats.session.title":"Current Session","stats.session.apiDuration":"API Duration","stats.session.wallTime":"Wall Time","stats.session.linesAdded":"Lines Added","stats.session.linesDeleted":"Lines Deleted","stats.session.tokens":"Tokens","stats.na":"N/A","stats.heatmap.messages":"messages","stats.funFact.moreTokens":"You've used ~{times}x more tokens than {book}","stats.funFact.sameTokens":"You've used the same number of tokens as {book}","stats.funFact.longerSession":"Your longest session is ~{times}x longer than {activity}","sidebar.traces":"Traces","traces.title":"Traces","traces.loading":"Loading...","traces.refresh":"Refresh","traces.clear":"Clear","traces.clearConfirm":"Clear all trace data?","traces.noData":"No trace data yet. Send a message and traces will be collected automatically.","traces.selectWorker":"Select Worker","traces.current":"current","traces.spanCount":"{count} spans","traces.duration":"Duration","traces.status.ok":"OK","traces.status.error":"Error","traces.status.running":"Running","traces.status.cancelled":"Cancelled","traces.bottleneck":"Bottleneck","traces.bottleneckTip":"Slowest span, {pct}% of total","traces.spanDetail":"Span Detail","traces.spanDetail.type":"Type","traces.spanDetail.duration":"Duration","traces.spanDetail.model":"Model","traces.spanDetail.tokens":"Tokens","traces.spanDetail.input":"Input","traces.spanDetail.output":"Output","traces.spanDetail.error":"Error","traces.spanDetail.attributes":"Attributes","traces.legend.agent":"Agent","traces.legend.generation":"Generation","traces.legend.function":"Function","traces.legend.handoff":"Handoff","traces.legend.guardrail":"Guardrail","traces.back":"Back","traces.tab.timeline":"Timeline","traces.tab.tree":"Tree","traces.tab.flame":"Flame","traces.tab.graph":"Graph","traces.expandAll":"Expand All","traces.collapseAll":"Collapse All","traces.search":"Search spans...","traces.selfTime":"Self Time","traces.spanDetail.overview":"Overview","traces.spanDetail.io":"Input/Output","traces.noSpans":"No spans","traces.auto":"auto","traces.auxiliaryCount":"{count} auxiliary traces (memory, title, etc.)","traces.noIO":"No input/output data","traces.noAttrs":"No attributes","traces.fit":"Fit","traces.allSessions":"All sessions","traces.allInstances":"All instances","traces.llmCalls":"{count} LLM","sidebar.metrics":"Metrics","metrics.title":"System Metrics","metrics.loading":"Loading metrics...","metrics.refresh":"Refresh","metrics.cpu":"CPU","metrics.memory":"Memory","metrics.disk":"Disk","metrics.cores":"cores","metrics.workers":"Workers","metrics.noWorkers":"No running workers","metrics.current":"Current","metrics.uptime":"Uptime","metrics.version":"Version","sidebar.editor":"Files","editor.title":"Code Editor","editor.loading":"Loading...","editor.loadError":"Failed to load","editor.noFile":"Select a file to start editing","editor.unsaved":"Unsaved","editor.save":"Save","editor.saveAll":"Save All","editor.close":"Close","editor.closeOthers":"Close Others","editor.closeAll":"Close All","editor.newFile":"New File","editor.newFolder":"New Folder","editor.rename":"Rename","editor.delete":"Delete","editor.refresh":"Refresh","editor.emptyFolder":"Empty folder","editor.explorer":"EXPLORER","editor.toggleSidebar":"Toggle Sidebar","editor.collapseAll":"Collapse All","editor.openFolder":"Open Folder","editor.openFolderPlaceholder":"Enter directory path...","editor.parentFolder":"Parent Folder","editor.pin":"Pin","editor.unpin":"Unpin","editor.copyPath":"Copy Path","editor.copyRelativePath":"Copy Relative Path","editor.revealInExplorer":"Reveal in Explorer","editor.closeToRight":"Close to the Right","editor.closeSaved":"Close Saved","editor.quickOpen":"Quick Open File","editor.focusExplorer":"Focus Explorer","editor.recentFiles":"Recent Files","editor.quickOpenPlaceholder":"Type filename to search...","editor.quickOpenEmpty":"No matching files","editor.quickOpenLoading":"Loading file list...","editor.selected":"selected","editor.lines":"lines","editor.preview":"Switch to Preview","editor.source":"Switch to Source","sidebar.workers":"Workers","workers.title":"Worker Processes","workers.refresh":"Refresh","workers.active":"Active Workers","workers.empty":"No active worker processes","workers.daemon":"Daemon","workers.daemon.running":"Running","workers.daemon.stopped":"Stopped","workers.daemon.start":"Start","workers.daemon.starting":"Starting...","workers.daemon.stop":"Stop","workers.daemon.restart":"Restart","workers.action.logs":"Logs","workers.action.open":"Open","workers.action.kill":"Kill","workers.action.kill.confirm":"Are you sure you want to kill this worker process?","sidebar.logs":"Logs","logs.title":"Log Viewer","logs.selectWorker":"Select Worker","logs.current":"current","logs.search":"Search logs...","logs.autoRefresh":"Auto Refresh","logs.refresh":"Refresh","logs.empty":"No log content","command.btw.description":"Ask a quick side question without interrupting the main Agent work","command.clear.description":"Start a fresh conversation (previous chats remain accessible via /resume)","command.context.description":"Calculate and display context token distribution","command.cost.description":"Show the total cost and duration of the current session","command.doctor.description":"Diagnose and verify your CodeBuddy installation and settings","command.feedback.description":"Open the issue feedback page to report bugs or suggest features","command.gateway.description":'Manage the remote control gateway. Subcommands: "status" to show current status, "stop" to stop the gateway, "token" to regenerate access token, "tunnel" to start with tunnel',"command.remote-control.description":"Manage remote control long connection clients (start, stop, status, list)","command.login.description":"Switch Tencent Cloud CodeBuddy accounts","command.logout.description":"Sign out from your CodeBuddy Code account","command.plan.description":"Preview the current plan file content","command.pr-comments.description":"Get comments from a GitHub pull request","command.release-notes.description":"View release notes","command.review.description":"Review a pull request","command.skills.description":"List available skills","command.todos.description":"Display the current session's todo list","command.reload-plugins.description":"Reload all plugins, skills, agents, hooks, and MCP/LSP servers without restarting","command.plugin-validate.description":"Validate a plugin directory structure and manifest","command.init.description":"Analyzing your codebase…","command.compact.description":"Clear conversation history but keep a summary in context. Optional: /compact [instructions for summarization]","command.upgrade.description":"Open upgrade page in browser","command.statusline.description":"Set up Codebuddy Code's status line UI","command.security-review.description":"Complete a security review of the pending changes on the current branch","command.insights.description":"Generate AI-powered insights about your CodeBuddy Code usage patterns and activity","command.loop.description":"Run a prompt or slash command on a recurring interval (e.g. /loop 5m /foo, defaults to 10m)","command.task-manager.description":"Team task management - Smart task entry, assignment, tracking and analysis","sidebar.changes":"Changes","fileChanges.title":"Changes","fileChanges.changesSection":"FILE CHANGES","fileChanges.empty":"No file changes","fileChanges.showChanges":"Show file changes","fileChanges.hideChanges":"Hide file changes","fileChanges.revertAll":"Revert all","fileChanges.revertCode":"Revert code","fileChanges.revertChat":"Revert chat","fileChanges.revertCodeAndChat":"Revert all","fileChanges.checkpoints":"Checkpoints","fileChanges.noCheckpoints":"No checkpoints","filePreview.binaryNotSupported":"This file cannot be previewed in the editor","filePreview.download":"Download","error.viewCrashed":"This view encountered an error","error.appCrashed":"Something went wrong","error.newChatFailed":"Failed to create new chat, please try again","error.switchSessionFailed":"Failed to switch session, please try again","commandPalette.placeholder":"Type a command...","commandPalette.commands":"Commands","commandPalette.views":"Views","commandPalette.actions":"Actions","commandPalette.noResults":"No matching commands","commandPalette.newChat":"New Chat","commandPalette.toggleTheme":"Toggle Theme","commandPalette.toggleLocale":"Toggle Language","commandPalette.tip":"Open command palette","app.confirm":"Confirm","app.cancel":"Cancel","tool.toolSingular":"tool executed","tool.toolPlural":"tools executed","keybindings.title":"Keybindings","keybindings.search.placeholder":"Search keybindings... (e.g. submit, ctrl+enter)","keybindings.source.default":"Default","keybindings.source.user":"User","keybindings.record.title":"Record Shortcut","keybindings.record.hint":"Press desired key combination...","keybindings.record.conflict":"Conflicts with","keybindings.action.edit":"Edit","keybindings.action.reset":"Reset","keybindings.action.unbind":"Unbind","keybindings.reset.all":"Reset all","keybindings.noResults":"No matching keybindings","keybindings.empty":"No keybindings","keybindings.loading":"Loading...","keybindings.ctx.Global":"Global","keybindings.ctx.Chat":"Chat Input","keybindings.ctx.InputBox":"Text Input","keybindings.ctx.Terminal":"Terminal","keybindings.ctx.Autocomplete":"Autocomplete","keybindings.ctx.Confirmation":"Confirmation","keybindings.ctx.HistorySearch":"History Search","keybindings.ctx.Task":"Task Running","keybindings.ctx.Settings":"Settings","keybindings.ctx.CommandPalette":"Command Palette","keybindings.ctx.Select":"Select List","keybindings.ctx.PermissionDialog":"Permission Dialog","keybindings.ctx.Help":"Help","keybindings.ctx.Plugin":"Plugin","keybindings.ctx.DiffDialog":"Diff Dialog","keybindings.ctx.MessageSelector":"Message Selector","keybindings.ctxDesc.Global":"Active everywhere, regardless of focus","keybindings.ctxDesc.Chat":"When the chat input is focused","keybindings.ctxDesc.InputBox":"When a text input is active","keybindings.ctxDesc.Terminal":"When the terminal view is active","keybindings.ctxDesc.Autocomplete":"When autocomplete menu is visible","keybindings.ctxDesc.Confirmation":"When a confirmation/permission dialog is shown","keybindings.ctxDesc.HistorySearch":"When searching command history (ctrl+r)","keybindings.ctxDesc.Task":"When a task/agent is running in the foreground","keybindings.ctxDesc.Settings":"When the settings panel is open","keybindings.ctxDesc.CommandPalette":"When the command palette is open","keybindings.ctxDesc.Select":"When a select/list component is focused","keybindings.ctxDesc.PermissionDialog":"When a tool permission dialog is shown","keybindings.ctxDesc.Help":"When the help overlay is open","keybindings.ctxDesc.Plugin":"When the plugin dialog is open","keybindings.ctxDesc.DiffDialog":"When the diff dialog is open","keybindings.ctxDesc.MessageSelector":"When the message selector (rewind) is open","keybindings.act.app:interrupt":"Interrupt","keybindings.act.app:exit":"Exit","keybindings.act.app:redraw":"Redraw Screen","keybindings.act.app:toggleTodos":"Toggle Todos","keybindings.act.app:toggleTranscript":"Toggle Transcript","keybindings.act.app:toggleSidebar":"Toggle Sidebar","keybindings.act.app:toggleTerminal":"Toggle Terminal","keybindings.act.app:commandPalette":"Command Palette","keybindings.act.app:newChat":"New Chat","keybindings.act.app:settings":"Settings","keybindings.act.app:focusInput":"Focus Input","keybindings.act.app:keybindings":"Keybinding Settings","keybindings.act.history:search":"Search History","keybindings.act.history:previous":"Previous History","keybindings.act.history:next":"Next History","keybindings.act.history:open":"Open History","keybindings.act.chat:cancel":"Cancel","keybindings.act.chat:submit":"Submit","keybindings.act.chat:newline":"New Line","keybindings.act.chat:killAgents":"Kill Agents","keybindings.act.chat:cycleMode":"Cycle Mode","keybindings.act.chat:modelPicker":"Model Picker","keybindings.act.chat:thinkingToggle":"Toggle Thinking","keybindings.act.chat:undo":"Undo","keybindings.act.chat:externalEditor":"External Editor","keybindings.act.chat:stash":"Stash","keybindings.act.chat:imagePaste":"Paste Image","keybindings.act.autocomplete:accept":"Accept","keybindings.act.autocomplete:dismiss":"Dismiss","keybindings.act.autocomplete:previous":"Previous","keybindings.act.autocomplete:next":"Next","keybindings.act.confirm:yes":"Confirm","keybindings.act.confirm:no":"Cancel","keybindings.act.confirm:previous":"Previous","keybindings.act.confirm:next":"Next","keybindings.act.confirm:toggle":"Toggle","keybindings.act.confirm:toggleExplanation":"Toggle Explanation","keybindings.act.task:background":"Run in Background","keybindings.act.historySearch:next":"Next","keybindings.act.historySearch:accept":"Accept","keybindings.act.historySearch:cancel":"Cancel","keybindings.act.historySearch:execute":"Execute","keybindings.act.settings:close":"Close Settings","keybindings.act.settings:search":"Search Settings","keybindings.act.select:previous":"Previous","keybindings.act.select:next":"Next","keybindings.act.select:accept":"Select","keybindings.act.select:cancel":"Cancel","keybindings.act.commandPalette:close":"Close Palette","keybindings.act.commandPalette:execute":"Execute Command","keybindings.act.commandPalette:previous":"Previous","keybindings.act.commandPalette:next":"Next","keybindings.act.permission:toggleDebug":"Toggle Debug","keybindings.act.diff:dismiss":"Close Diff","keybindings.act.diff:previousFile":"Previous File","keybindings.act.diff:nextFile":"Next File","keybindings.act.diff:viewDetails":"View Details","keybindings.act.plugin:toggle":"Toggle Plugin","keybindings.act.plugin:install":"Install Plugin","keybindings.act.help:dismiss":"Close Help","keybindings.act.transcript:exit":"Exit Transcript","keybindings.act.transcript:toggleShowAll":"Show All","keybindings.act.messageSelector:up":"Up","keybindings.act.messageSelector:down":"Down","keybindings.act.messageSelector:top":"Top","keybindings.act.messageSelector:bottom":"Bottom","keybindings.act.messageSelector:select":"Select","common.close":"Close","changes.revert":"Revert","changes.revertDirectory":"Revert directory","message.clickToEnlarge":"Click to enlarge","channel.botIdPlaceholder":"Enter Bot ID","channel.secretPlaceholder":"Enter Secret","filePreview.zoomOut":"Zoom Out","filePreview.zoomIn":"Zoom In","filePreview.fitToWindow":"Fit to Window","filePreview.actualSize":"Actual Size (1:1)","filePreview.pdfPreview":"PDF Preview"}};function ne(){const{mode:e,resolved:t,setLocale:n,toggle:i}=br();function s(d){return $d[t][d]??d}function l(d){return $d[t][d]}return{t:s,tryT:l,locale:e,resolved:t,setLocale:n,toggleLocale:i}}const Rp=4;let Ob=0;function $b(){return`pane-${Date.now()}-${++Ob}`}function Lp(e){return{id:$b(),ptySessionId:null,ptyStatus:"disconnected",errorMessage:null}}function an(e){return e.type==="leaf"?1:an(e.children[0])+an(e.children[1])}function yr(e){return e.type==="leaf"?[e.paneId]:[...yr(e.children[0]),...yr(e.children[1])]}function Ei(e,t,n,i){return e.type==="leaf"?e.paneId===t?{type:"split",direction:n,children:[{type:"leaf",paneId:t},{type:"leaf",paneId:i}],ratio:.5}:e:{...e,children:[Ei(e.children[0],t,n,i),Ei(e.children[1],t,n,i)]}}function Ci(e,t){if(e.type==="leaf")return e.paneId===t?null:e;const n=Ci(e.children[0],t),i=Ci(e.children[1],t);return n===null?i:i===null?n:{...e,children:[n,i]}}function Dp(e,t,n){if(t.length===0)return e.type==="split"?{...e,ratio:n}:e;if(e.type==="split"){const[i,...s]=t,l=[...e.children];return l[i]=Dp(l[i],s,n),{...e,children:l}}return e}function jd(e){const t=se({"Content-Type":"application/json"});fetch(`/api/v1/pty/${e}`,{method:"DELETE",headers:t}).catch(()=>{})}function Op(){const e=Lp();return{panes:{[e.id]:e},layout:{type:"leaf",paneId:e.id},activePaneId:e.id}}const ei=Op(),ue=Ne()(jn((e,t)=>({mode:"chat",mainView:"chat",terminalTitle:null,panes:ei.panes,layout:ei.layout,activePaneId:ei.activePaneId,setMode:n=>{e({mode:n,mainView:n==="terminal"?"terminal":"chat"})},setMainView:n=>{e({mainView:n,mode:n==="terminal"?"terminal":"chat"})},setTerminalTitle:n=>e({terminalTitle:n}),splitPane:(n,i)=>{const s=t(),l=i??s.activePaneId;if(an(s.layout)>=Rp)return;const d=Lp(),a=Ei(s.layout,l,n,d.id),o={...s.panes,[d.id]:d};e({layout:a,panes:o,activePaneId:d.id})},closePane:n=>{const i=t();if(an(i.layout)<=1)return;const s=Ci(i.layout,n);if(!s)return;const l=i.panes[n];l!=null&&l.ptySessionId&&jd(l.ptySessionId);const d={...i.panes};delete d[n];const a=yr(s),o=a.includes(i.activePaneId)?i.activePaneId:a[0];e({layout:s,panes:d,activePaneId:o})},setActivePaneId:n=>e({activePaneId:n}),setRatio:(n,i)=>{const s=Math.max(.1,Math.min(.9,i)),l=Dp(t().layout,n,s);e({layout:l})},setPaneSession:(n,i)=>{const s={...t().panes};s[n]&&(s[n]={...s[n],ptySessionId:i},e({panes:s}))},setPaneStatus:(n,i)=>{const s={...t().panes};s[n]&&(s[n]={...s[n],ptyStatus:i},e({panes:s}))},setPaneError:(n,i)=>{const s={...t().panes};s[n]&&(s[n]={...s[n],errorMessage:i},e({panes:s}))},setPaneTitle:(n,i)=>{const s={...t().panes};s[n]&&(s[n]={...s[n],title:i},e({panes:s}))},reset:()=>{const n=t().panes;for(const s of Object.values(n))s.ptySessionId&&jd(s.ptySessionId);const i=Op();e({panes:i.panes,layout:i.layout,activePaneId:i.activePaneId})}}),{namespace:"terminal",fields:["layout","panes"],scope:"workspace",debounceMs:500,onLoad:(e,t)=>{if(e.layout&&e.panes){const n=e.layout,i=e.panes,s=yr(n);if(s.every(l=>l in i)){const l=ue.getState().panes,d={};for(const a of s){const o=l[a],c=i[a];d[a]={...c,ptySessionId:(o==null?void 0:o.ptySessionId)??c.ptySessionId??null,ptyStatus:"disconnected",errorMessage:null}}t({layout:n,panes:d,activePaneId:s[0]})}}}})),$p="/assets/dark-claw-cat-D_ew_BKV.png",jp="/assets/light-claw-cat-BgBWmnmi.png",Mp="/assets/red-claw-cat--t2EuBIB.png",Pp={small:{container:"w-20 h-20",text:"text-[12px]"},medium:{container:"w-32 h-32",text:"text-[14px]"},large:{container:"w-40 h-40",text:"text-[16px]"}};function Fp({size:e="medium",className:t=""}){const i=Ye(l=>l.resolved)==="dark"?$p:jp,s=Pp[e];return r.jsxs("div",{className:`relative ${s.container} ${t}`,children:[r.jsx("img",{src:i,alt:"",className:"cat-loading-layer cat-loading-layer-base absolute inset-0 w-full h-full object-contain",decoding:"async",loading:"eager"}),r.jsx("img",{src:Mp,alt:"",className:"cat-loading-layer cat-loading-layer-color absolute inset-0 w-full h-full object-contain",decoding:"async",loading:"eager"})]})}function ut({size:e="medium",text:t="Loading...",className:n=""}){const i=Pp[e];return r.jsxs("div",{className:`flex flex-col items-center justify-center gap-4 ${n}`,children:[r.jsx(Fp,{size:e}),t&&r.jsx("div",{className:`text-text-secondary ${i.text} font-medium animate-pulse`,children:t})]})}function jb({size:e="medium",className:t=""}){return r.jsx(Fp,{size:e,className:t})}const Yn={background:"#ffffff",foreground:"#1e1e1e",cursor:"#1e1e1e",cursorAccent:"#ffffff",selectionBackground:"#add6ff80",black:"#000000",red:"#cd3131",green:"#00bc00",yellow:"#949800",blue:"#0451a5",magenta:"#bc05bc",cyan:"#0598bc",white:"#555555",brightBlack:"#666666",brightRed:"#cd3131",brightGreen:"#14ce14",brightYellow:"#b5ba00",brightBlue:"#0451a5",brightMagenta:"#bc05bc",brightCyan:"#0598bc",brightWhite:"#a5a5a5"},Xn={background:"#121212",foreground:"#cccccc",cursor:"#cccccc",cursorAccent:"#121212",selectionBackground:"#264f7880",black:"#000000",red:"#f44747",green:"#6a9955",yellow:"#d7ba7d",blue:"#569cd6",magenta:"#c586c0",cyan:"#4ec9b0",white:"#d4d4d4",brightBlack:"#808080",brightRed:"#f44747",brightGreen:"#6a9955",brightYellow:"#d7ba7d",brightBlue:"#569cd6",brightMagenta:"#c586c0",brightCyan:"#4ec9b0",brightWhite:"#e5e5e5"},Mb=2e3;function hn(){return se({"Content-Type":"application/json"})}function Pb(e){const t=Tr(),n=t?`?password=${encodeURIComponent(t)}`:"";return`/api/v1/pty/${e}/output${n}`}async function Fb(e,t){try{await fetch(`/api/v1/pty/${e}/input/send`,{method:"POST",headers:hn(),body:JSON.stringify({data:t})})}catch{}}async function Md(e,t,n){try{await fetch(`/api/v1/pty/${e}/resize`,{method:"POST",headers:hn(),body:JSON.stringify({cols:t,rows:n})})}catch{}}async function Pd(e){try{return(await fetch(`/api/v1/pty/${e}`,{headers:hn()})).ok}catch{return!1}}async function Fd(e,t,n){const i={cols:e,rows:t};n&&(i.cwd=n);const s=await fetch("/api/v1/pty",{method:"POST",headers:hn(),body:JSON.stringify(i)});if(!s.ok){const a=await s.json().catch(()=>null),o=typeof(a==null?void 0:a.error)=="string"?a.error:typeof(a==null?void 0:a.message)=="string"?a.message:`HTTP ${s.status}`;throw new Error(o)}const l=await s.json(),d=l.data??l;return{sessionId:d.sessionId,cwd:typeof d.cwd=="string"?d.cwd:""}}async function Bd(e){try{const t=await fetch(`/api/v1/pty/${e}`,{headers:hn()});if(!t.ok)return null;const n=await t.json(),i=n.data??n;return{cwd:typeof(i==null?void 0:i.cwd)=="string"?i.cwd:""}}catch{return null}}async function Bb(){try{const e=await fetch("/api/v1/pty",{headers:hn()});if(!e.ok)return[];const t=await e.json();return(t.data??t).sessions||[]}catch{return[]}}function Ub(e){const t=ue.getState().panes,n=new Set;for(const[i,s]of Object.entries(t))i!==e&&s.ptySessionId&&n.add(s.ptySessionId);return n}function zb(e,t){const n=[];let i="",s="",l=t;for(;l<e.length;){const d=e.indexOf(`
|
|
617
617
|
`,l);if(d===-1)break;const a=e.substring(l,d);l=d+1,a===""?(s&&n.push({event:i||"message",data:s}),i="",s=""):a.startsWith("event: ")?i=a.substring(7):a.startsWith("data: ")&&(s=a.substring(6))}return{events:n,newIndex:l}}function rs({paneId:e,initialCwd:t,onPtyCreated:n}){const{t:i}=ne(),{resolved:s}=Ye(),l=ue(N=>N.panes[e]),d=ue(N=>N.activePaneId),a=ue(N=>N.layout),o=ue(N=>N.mainView),c=ue(N=>N.setActivePaneId),p=ue(N=>N.closePane),h=ue(N=>N.setPaneSession),b=ue(N=>N.setPaneStatus),y=ue(N=>N.setPaneError),k=ue(N=>N.setPaneTitle),v=ue(N=>N.setTerminalTitle),g=d===e,m=an(a),u=C.useRef(null),f=C.useRef(null),x=C.useRef(null),E=C.useRef(null),_=C.useRef(!0),S=C.useRef(!1),w=C.useRef(!1),A=C.useRef(null),D=C.useRef(null),R=C.useRef(t);R.current=t;const j=C.useRef(n);j.current=n;const O=C.useCallback(()=>{const N=E.current;N&&(N.abort(),E.current=null)},[]),H=C.useCallback((N,L)=>{O(),b(e,"connecting"),D.current=L;const I=new XMLHttpRequest;E.current=I;let G=0;I.open("GET",Pb(L)),I.setRequestHeader(ft,_t);const F=Tr();F&&I.setRequestHeader("Authorization",`Bearer ${F}`),I.onreadystatechange=()=>{if(I.readyState===XMLHttpRequest.HEADERS_RECEIVED)if(I.status===200){if(!_.current)return;b(e,"connected"),y(e,null);const $=x.current;if($)try{$.fit(),Md(L,N.cols,N.rows)}catch{}N.focus()}else{if(!_.current)return;b(e,"error"),y(e,`HTTP ${I.status}`)}},I.onprogress=()=>{if(!_.current)return;const{events:$,newIndex:Y}=zb(I.responseText,G);G=Y;let X="";for(const te of $)try{const J=JSON.parse(te.data);switch(te.event){case"output":X+=J.data;break;case"exit":X&&(N.write(X),X=""),h(e,null),b(e,"disconnected"),w.current=!1,D.current=null,N.write(`\r
|
|
618
618
|
${i("terminal.processExited")}\r
|
|
619
|
-
`);break;case"keepalive":break}}catch{}X&&N.write(X)},I.onerror=()=>{_.current&&(b(e,"error"),y(e,i("terminal.connectionLost")))},I.onloadend=()=>{var Y;if(!_.current)return;((Y=ue.getState().panes[e])==null?void 0:Y.ptyStatus)==="connected"&&(b(e,"error"),y(e,i("terminal.connectionLost")))},I.send();const W=N.onData($=>{D.current&&Fb(D.current,$)}),z=N.onResize(({cols:$,rows:Y})=>{D.current&&Md(D.current,$,Y)});w.current=!0;const B=()=>{W.dispose(),z.dispose(),O(),D.current=null};return A.current=B,B},[O,e,h,b,y]),M=C.useCallback(()=>{const N=u.current;if(!N||S.current)return;const L=s==="dark"?Xn:Yn;for(;N.firstChild;)N.removeChild(N.firstChild);const I=new Lb.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:L,allowProposedApi:!0,scrollback:1e4}),G=new Ib.FitAddon;I.loadAddon(G),I.open(N);const F=N.querySelector(".xterm-helper-textarea");F&&(F.setAttribute("autocomplete","off"),F.setAttribute("autocorrect","off"),F.setAttribute("autocapitalize","off"),F.setAttribute("spellcheck","false"),F.setAttribute("unselectable","on")),f.current=I,x.current=G,S.current=!0;const W=I.onTitleChange(Y=>{_.current&&(v(Y||null),k(e,Y||null))});let z=null;const B=()=>{z&&clearTimeout(z),z=setTimeout(()=>{if(_.current)try{G.fit()}catch{}},50)},$=new ResizeObserver(B);return $.observe(N),window.addEventListener("resize",B),()=>{W.dispose(),$.disconnect(),window.removeEventListener("resize",B),z&&clearTimeout(z)}},[]),U=C.useCallback(async()=>{var W,z;const N=f.current,L=x.current;if(!N||!L||!_.current||w.current)return;try{L.fit()}catch{}const I=N.cols||80,G=N.rows||24,F=(W=ue.getState().panes[e])==null?void 0:W.ptySessionId;if(F&&await Pd(F)&&_.current){if(H(N,F),j.current){const $=await Bd(F);$&&_.current&&j.current({sessionId:F,cwd:$.cwd})}return}if(_.current){if(!F){const B=Ub(e),Y=(await Bb()).find(X=>!X.hasClient&&!B.has(X.id));if(Y&&_.current){if(h(e,Y.id),H(N,Y.id),j.current){const X=await Bd(Y.id);X&&_.current&&j.current({sessionId:Y.id,cwd:X.cwd})}return}}if(_.current){b(e,"connecting");try{const B=R.current||void 0,{sessionId:$,cwd:Y}=await Fd(I,G,B);if(!_.current)return;h(e,$),H(N,$),(z=j.current)==null||z.call(j,{sessionId:$,cwd:Y})}catch(B){if(!_.current)return;b(e,"error"),y(e,B.message||i("terminal.createSessionFailed"))}}}},[H,e,h,b,y]),q=C.useRef(null);C.useEffect(()=>{_.current=!0;const N=u.current;if(!N)return;const L=()=>{if(!_.current)return;const{clientWidth:G,clientHeight:F}=N;if(!(G===0||F===0)&&(S.current||(q.current=M()||null),f.current&&x.current)){try{x.current.fit()}catch{}w.current||U()}};if(N.clientWidth>0&&N.clientHeight>0){const G=requestAnimationFrame(L);return()=>cancelAnimationFrame(G)}const I=new ResizeObserver(G=>{for(const F of G){const{width:W,height:z}=F.contentRect;if(W>0&&z>0){I.disconnect(),L();break}}});return I.observe(N),()=>I.disconnect()},[M,U]),C.useEffect(()=>()=>{var N,L,I;_.current=!1,(N=A.current)==null||N.call(A),(L=q.current)==null||L.call(q),(I=f.current)==null||I.dispose(),f.current=null,x.current=null,S.current=!1,w.current=!1},[]),C.useEffect(()=>{const N=f.current;if(N){const L=s==="dark"?Xn:Yn;N.options.theme=L;try{N.refresh(0,N.rows-1)}catch{}}},[s,o]);const V=C.useCallback(async()=>{var L,I,G;if(O(),w.current=!1,b(e,"connecting"),y(e,null),await new Promise(F=>setTimeout(F,Mb)),!_.current)return;const N=f.current;if(N)try{N.clear();try{(L=x.current)==null||L.fit()}catch{}const F=N.cols||80,W=N.rows||24,z=(I=ue.getState().panes[e])==null?void 0:I.ptySessionId;if(z&&await Pd(z)&&_.current){H(N,z);return}if(!_.current)return;const B=R.current||void 0,{sessionId:$,cwd:Y}=await Fd(F,W,B);if(!_.current)return;h(e,$),H(N,$),(G=j.current)==null||G.call(j,{sessionId:$,cwd:Y})}catch(F){if(!_.current)return;b(e,"error"),y(e,F.message||i("terminal.reconnectFailed"))}},[O,H,e,h,b,y]),T=C.useCallback(()=>{var N;g||c(e),(N=f.current)==null||N.focus()},[g,e,c]);return l?r.jsxs("div",{className:`terminal-pane flex flex-col h-full w-full ${g&&m>1?"active":""}`,style:{backgroundColor:s==="dark"?Xn.background:Yn.background},onClick:T,children:[m>1&&r.jsx("div",{className:"terminal-pane-toolbar",children:r.jsx("button",{onClick:N=>{N.stopPropagation(),p(e)},className:"w-6 h-6 flex items-center justify-center rounded bg-bg-tertiary/80 text-text-secondary hover:text-text-primary hover:bg-bg-hover transition-colors",title:i("terminal.closePane"),children:r.jsx(Te,{size:14})})}),r.jsx("div",{ref:u,className:"flex-1 w-full",style:{overflow:"hidden",padding:"4px"}}),l.ptyStatus==="connecting"&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",style:{backgroundColor:s==="dark"?`${Xn.background}cc`:`${Yn.background}cc`},children:r.jsx(ut,{size:"small",text:i("terminal.connecting")})}),l.ptyStatus==="error"&&r.jsxs("div",{className:"absolute bottom-0 left-0 right-0 flex items-center justify-between px-4 py-2 bg-accent-red/10 border-t border-accent-red/30 z-10",children:[r.jsxs("div",{className:"flex items-center gap-2 text-accent-red text-xs",children:[r.jsx(Xm,{size:14}),r.jsx("span",{children:l.errorMessage||i("terminal.error")})]}),r.jsxs("button",{onClick:V,className:"flex items-center gap-1.5 px-3 py-1 rounded-md bg-bg-secondary border border-border-muted text-text-primary text-xs hover:bg-bg-hover transition-colors",children:[r.jsx(qe,{size:12}),r.jsx("span",{children:i("terminal.reconnect")})]})]})]}):r.jsx("div",{})}const Hb="chat",Ud=new Set(["chat","tasks","plugins","terminal","canvas","canvas-pane","remote-control","settings","docs","editor","changes","metrics","workers","logs","keybindings","stats","traces"]);function is(){let t=window.location.hash.slice(1);t.startsWith("/")&&(t=t.slice(1));const n=t.split("?")[0]||"";if(Ud.has(n))return n;const i=n.split("/")[0];return Ud.has(i)?i:Hb}function zd(e){const t=new URLSearchParams(window.location.search),n=window.location.hash.slice(1),i=n.indexOf("?");i!==-1&&new URLSearchParams(n.slice(i+1)).forEach((a,o)=>{t.has(o)||t.set(o,a)});const s=t.toString(),l=s?`#/${e}?${s}`:`#/${e}`;window.location.hash=l}function Gb(e){const t=()=>{const n=is();e(n)};return window.addEventListener("hashchange",t),()=>{window.removeEventListener("hashchange",t)}}function xr(){const t=window.location.hash.slice(1).replace(/^\//,"").split("?")[0],n=t.indexOf("/");return n>0?t.slice(n+1):void 0}function wn(e,t){const i=new URLSearchParams(window.location.search).toString(),s=i?`#/${e}/${t}?${i}`:`#/${e}/${t}`;window.location.hash=s}function vr(){const e=window.location.hash.slice(1),t=e.indexOf("?");return t>=0?new URLSearchParams(e.slice(t+1)):new URLSearchParams}function Bp(e){const t=new URLSearchParams(window.location.search);t.set("path",e),window.location.hash=`#/editor?${t.toString()}`}const Hd=400,Gd=300,ti=200,ni=150,ri=.1,ii=5,gt=20,Wd=3,Up=8,Wb=10,zp=32,qb=zp;function Hp(){return se({"Content-Type":"application/json"})}async function Vb(e){try{const t=await fetch(`/api/v1/pty/${e}`,{headers:Hp()});if(!t.ok)return null;const n=await t.json(),i=n.data??n;return typeof(i==null?void 0:i.cwd)=="string"?i.cwd:null}catch{return null}}function Gp(e){const t=Object.values(e);if(t.length===0)return;const i={...ue.getState().panes};let s=!1;for(const l of t){const d=i[l.paneId];d?l.ptySessionId&&d.ptySessionId!==l.ptySessionId&&(i[l.paneId]={...d,ptySessionId:l.ptySessionId},s=!0):(i[l.paneId]={id:l.paneId,ptySessionId:l.ptySessionId??null,ptyStatus:"disconnected",errorMessage:null},s=!0)}s&&ue.setState({panes:i})}const Ce=Ne()(jn((e,t)=>({viewport:{panX:0,panY:0,zoom:1},tiles:{},nextZIndex:1,selectedTileIds:[],setViewport:n=>{e({viewport:n})},addTile:()=>{const n=`tile-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,i=`canvas-pane-${n}`,{nextZIndex:s,viewport:l}=t(),d=l.zoom||1,a=(-l.panX+window.innerWidth/2)/d-Hd/2,o=(-l.panY+window.innerHeight/2)/d-Gd/2,c=Math.round(a/gt)*gt,p=Math.round(o/gt)*gt,h={id:n,type:"terminal",x:c,y:p,width:Hd,height:Gd,zIndex:s,paneId:i,windowState:"normal",ptySessionId:null,cwd:null},b=ue.getState();if(!b.panes[i]){const y={...b.panes,[i]:{id:i,ptySessionId:null,ptyStatus:"disconnected",errorMessage:null}};ue.setState({panes:y})}return e(y=>({tiles:{...y.tiles,[n]:h},nextZIndex:y.nextZIndex+1})),n},duplicateTile:n=>{var u,f,x,E;const i=t().tiles[n];if(!i)return null;const s=`tile-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,l=`canvas-pane-${s}`,{nextZIndex:d}=t(),a=((u=i.prevBounds)==null?void 0:u.width)??i.width,o=((f=i.prevBounds)==null?void 0:f.height)??i.height,c=((x=i.prevBounds)==null?void 0:x.x)??i.x,p=((E=i.prevBounds)==null?void 0:E.y)??i.y,h=gt*2,b=Math.round((c+h)/gt)*gt,y=Math.round((p+h)/gt)*gt,k={id:s,type:"terminal",x:b,y,width:a,height:o,zIndex:d,paneId:l,windowState:"normal",ptySessionId:null,cwd:i.cwd??null},v=ue.getState();v.panes[l]||ue.setState({panes:{...v.panes,[l]:{id:l,ptySessionId:null,ptyStatus:"disconnected",errorMessage:null}}}),e(_=>({tiles:{..._.tiles,[s]:k},nextZIndex:_.nextZIndex+1}));const g=ue.getState().panes[i.paneId],m=g==null?void 0:g.ptySessionId;return m&&Vb(m).then(_=>{_&&(t().updateTile(i.id,{cwd:_}),t().updateTile(s,{cwd:_}))}),s},removeTile:n=>{const i=t().tiles[n];if(i){const s=ue.getState(),l=s.panes[i.paneId];if(l!=null&&l.ptySessionId&&fetch(`/api/v1/pty/${l.ptySessionId}`,{method:"DELETE",headers:Hp()}).catch(()=>{}),s.panes[i.paneId]){const{[i.paneId]:d,...a}=s.panes;ue.setState({panes:a})}}e(s=>{const{[n]:l,...d}=s.tiles;return{tiles:d,selectedTileIds:s.selectedTileIds.filter(a=>a!==n)}})},updateTile:(n,i)=>{e(s=>{const l=s.tiles[n];return l?{tiles:{...s.tiles,[n]:{...l,...i}}}:s})},selectTile:n=>e({selectedTileIds:[n]}),deselectAll:()=>e({selectedTileIds:[]}),selectTiles:n=>e({selectedTileIds:n}),bringToFront:n=>{e(i=>{const s=i.tiles[n];return s?{tiles:{...i.tiles,[n]:{...s,zIndex:i.nextZIndex}},nextZIndex:i.nextZIndex+1}:i})},maximizeTile:n=>{e(i=>{const s=i.tiles[n];if(!s)return i;const l=s.windowState==="normal"?{x:s.x,y:s.y,width:s.width,height:s.height}:s.prevBounds;return{tiles:{...i.tiles,[n]:{...s,windowState:"maximized",prevBounds:l,zIndex:i.nextZIndex}},nextZIndex:i.nextZIndex+1}})},minimizeTile:n=>{e(i=>{const s=i.tiles[n];if(!s)return i;const l=s.windowState==="normal"?{x:s.x,y:s.y,width:s.width,height:s.height}:s.prevBounds;return{tiles:{...i.tiles,[n]:{...s,height:qb,windowState:"minimized",prevBounds:l}}}})},restoreTile:n=>{e(i=>{const s=i.tiles[n];return!s||!s.prevBounds?s?{tiles:{...i.tiles,[n]:{...s,windowState:"normal"}}}:i:{tiles:{...i.tiles,[n]:{...s,x:s.prevBounds.x,y:s.prevBounds.y,width:s.prevBounds.width,height:s.prevBounds.height,windowState:"normal",prevBounds:void 0}}}})},toggleMaximize:n=>{const i=t().tiles[n];i&&(i.windowState==="maximized"?t().restoreTile(n):t().maximizeTile(n))},toggleMinimize:n=>{const i=t().tiles[n];i&&(i.windowState==="minimized"?t().restoreTile(n):t().minimizeTile(n))},setTilePty:(n,i,s)=>{let l=null;if(e(d=>{const a=d.tiles[n];if(!a)return d;l=a.paneId;const o={...a,ptySessionId:i};return s!==void 0&&(o.cwd=s),{tiles:{...d.tiles,[n]:o}}}),l){const d=ue.getState(),a=d.panes[l];a&&a.ptySessionId!==i&&ue.setState({panes:{...d.panes,[l]:{...a,ptySessionId:i}}})}},loadFromStorage:()=>{}}),{namespace:"canvas",fields:["viewport","tiles","nextZIndex"],scope:"workspace",debounceMs:1e3,onLoad:(e,t)=>{const n={};e.viewport&&(n.viewport=e.viewport),e.tiles&&(n.tiles=e.tiles),e.nextZIndex!==void 0&&(n.nextZIndex=e.nextZIndex),Object.keys(n).length>0&&(t(n),n.tiles&&Gp(n.tiles))}}));Gp(Ce.getState().tiles);function Kb(){const{t:e}=ne(),[t,n]=C.useState(()=>vr().get("paneId")||"");C.useEffect(()=>{const a=()=>{n(vr().get("paneId")||"")};return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[]);const i=Ce(a=>Object.values(a.tiles).find(o=>o.paneId===t)??null),s=ue(a=>{var o;return t?(o=a.panes[t])==null?void 0:o.title:null}),l=Ce(a=>a.setTilePty),d=C.useCallback(a=>{i&&l(i.id,a.sessionId,a.cwd||null)},[i,l]);return C.useEffect(()=>{if(!t)return;const a=ue.getState();a.panes[t]||ue.setState({panes:{...a.panes,[t]:{id:t,ptySessionId:(i==null?void 0:i.ptySessionId)??null,ptyStatus:"disconnected",errorMessage:null}}})},[t,i==null?void 0:i.ptySessionId]),t?r.jsxs("div",{className:"flex flex-col h-full w-full bg-bg-primary",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 select-none",style:{height:32,background:"var(--color-canvas-tile-header)",color:"var(--color-canvas-tile-header-text)",borderBottom:"1px solid var(--color-border-default)"},children:[r.jsx(un,{size:14,style:{opacity:.6}}),r.jsx("span",{className:"text-xs truncate",style:{fontSize:12,fontWeight:500},children:s||e("canvas.defaultTitle")})]}),r.jsx("div",{className:"flex-1 min-h-0 relative",children:r.jsx(rs,{paneId:t,initialCwd:(i==null?void 0:i.cwd)??null,onPtyCreated:d})})]}):r.jsx("div",{className:"flex items-center justify-center h-full w-full bg-bg-primary text-text-secondary text-sm",children:e("canvas.standalone.missingPaneId")})}class ar{constructor(){be(this,"panX",0);be(this,"panY",0);be(this,"zoom",1)}getState(){return{panX:this.panX,panY:this.panY,zoom:this.zoom}}setState(t){this.panX=t.panX,this.panY=t.panY,this.zoom=Math.max(ri,Math.min(ii,t.zoom))}screenToWorld(t,n){return this.zoom===0?{x:0,y:0}:{x:(t-this.panX)/this.zoom,y:(n-this.panY)/this.zoom}}worldToScreen(t,n){return{x:t*this.zoom+this.panX,y:n*this.zoom+this.panY}}applyZoom(t,n,i){const s=this.zoom,l=Math.exp(-t*.6/100),d=Math.max(ri,Math.min(ii,s*l));if(s===0)return this.zoom=d,this.getState();const a=d/s-1;return this.panX-=(n-this.panX)*a,this.panY-=(i-this.panY)*a,this.zoom=d,this.getState()}applyPan(t,n){return this.panX+=t,this.panY+=n,this.getState()}fitTiles(t,n,i,s=40){if(t.length===0)return this.resetView();let l=1/0,d=1/0,a=-1/0,o=-1/0;for(const g of t)l=Math.min(l,g.x),d=Math.min(d,g.y),a=Math.max(a,g.x+g.width),o=Math.max(o,g.y+g.height);const c=a-l,p=o-d;if(c<=0||p<=0)return this.resetView();const h=n-s*2,b=i-s*2;if(h<=0||b<=0)return this.resetView();const y=Math.max(ri,Math.min(ii,Math.min(h/c,b/p))),k=(n-c*y)/2-l*y,v=(i-p*y)/2-d*y;return this.panX=k,this.panY=v,this.zoom=y,this.getState()}resetView(){return this.panX=0,this.panY=0,this.zoom=1,this.getState()}}const qd=120;function Yb(){const{t:e}=ne(),t=Ce(m=>m.viewport),n=Ce(m=>m.tiles),i=Ce(m=>m.setViewport),s=Ce(m=>m.addTile),l=C.useRef(null),d=Math.round(t.zoom*100),a=typeof window<"u"&&window.location.hash.includes("standalone");if(Object.values(n).some(m=>m.windowState==="maximized"))return null;const c=()=>{var u;const m=(u=l.current)==null?void 0:u.parentElement;return{w:(m==null?void 0:m.clientWidth)??window.innerWidth,h:(m==null?void 0:m.clientHeight)??window.innerHeight}},p=()=>{const m=new ar;m.setState(t);const{w:u,h:f}=c(),x=m.applyZoom(-qd,u/2,f/2);i(x)},h=()=>{const m=new ar;m.setState(t);const{w:u,h:f}=c(),x=m.applyZoom(qd,u/2,f/2);i(x)},b=()=>{const m=new ar;m.setState(t);const{w:u,h:f}=c(),x=Object.values(n);x.length===0?i(m.resetView()):i(m.fitTiles(x,u,f,60))},y=()=>{s()},k=()=>{const m=new URLSearchParams(window.location.search),u=new URLSearchParams;u.set("standalone","1"),m.forEach((x,E)=>{u.has(E)||u.set(E,x)});const f=`${window.location.pathname}${window.location.search}#/canvas?${u.toString()}`;window.open(f,"canvas-standalone","noopener,noreferrer")},v="w-8 h-8 flex items-center justify-center rounded-lg transition-colors",g={border:"none",background:"transparent",color:"var(--color-text-secondary)",cursor:"pointer"};return r.jsxs("div",{ref:l,className:"canvas-toolbar fixed bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-1 px-2 py-1 rounded-xl",style:{background:"var(--color-bg-card)",border:"1px solid var(--color-border-default)",boxShadow:"0 2px 12px rgba(0,0,0,0.12)",zIndex:1e4},children:[r.jsx("button",{className:v,style:g,onClick:y,title:e("canvas.addTerminal"),children:r.jsx(ot,{size:16})}),r.jsx("div",{style:{width:1,height:20,background:"var(--color-border-muted)"}}),r.jsx("button",{className:v,style:g,onClick:h,title:e("canvas.zoomOut"),children:r.jsx(Nb,{size:16})}),r.jsxs("span",{className:"text-xs tabular-nums select-none",style:{minWidth:40,textAlign:"center",color:"var(--color-text-secondary)"},children:[d,"%"]}),r.jsx("button",{className:v,style:g,onClick:p,title:e("canvas.zoomIn"),children:r.jsx(Cb,{size:16})}),r.jsx("div",{style:{width:1,height:20,background:"var(--color-border-muted)"}}),r.jsx("button",{className:v,style:g,onClick:b,title:e("canvas.fitView"),children:r.jsx(pf,{size:16})}),!a&&r.jsxs(r.Fragment,{children:[r.jsx("div",{style:{width:1,height:20,background:"var(--color-border-muted)"}}),r.jsx("button",{className:v,style:g,onClick:k,title:e("canvas.openStandalone"),children:r.jsx(st,{size:16})})]})]})}function Kt(e,t=gt,n=Wb){const i=(e%t+t)%t;return i<=n?e-i:t-i<=n?e+(t-i):e}function Xb(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}class Zb{constructor(){be(this,"dragState",null);be(this,"spacePressed",!1);be(this,"callbacks",null);be(this,"keydownHandler",null);be(this,"keyupHandler",null);be(this,"dragStarted",!1);be(this,"panSamples",[])}attach(t){this.callbacks=t,this.keydownHandler=n=>{if(n.code==="Space"&&!n.repeat){if(Xb(n.target))return;this.spacePressed=!0,n.preventDefault()}},this.keyupHandler=n=>{n.code==="Space"&&(this.spacePressed=!1)},window.addEventListener("keydown",this.keydownHandler),window.addEventListener("keyup",this.keyupHandler)}detach(){this.keydownHandler&&(window.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.keyupHandler&&(window.removeEventListener("keyup",this.keyupHandler),this.keyupHandler=null),this.callbacks=null,this.dragState=null}get isSpacePressed(){return this.spacePressed}get isDragging(){return this.dragState!==null&&this.dragStarted}get currentDrag(){return this.dragState}handlePointerDown(t,n,i,s){var o,c,p;const l=t.clientX,d=t.clientY;this.dragStarted=!1,this.panSamples=[],(c=(o=this.callbacks)==null?void 0:o.onInteractionStart)==null||c.call(o);const a=(p=this.callbacks)==null?void 0:p.getViewport();if(this.spacePressed||!n&&!i){const h=t.shiftKey||t.ctrlKey||t.metaKey;!this.spacePressed&&h?this.dragState={type:"select",startScreenX:l,startScreenY:d}:(this.dragState={type:"pan",startScreenX:l,startScreenY:d,initialViewport:a?{...a}:void 0},this.panSamples=[{t:performance.now(),x:l,y:d}]);return}if(n&&i){const h=s[n];if(!h)return;this.dragState={type:"resize",startScreenX:l,startScreenY:d,tileId:n,handle:i,initialTiles:{[n]:{x:h.x,y:h.y,width:h.width,height:h.height}}};return}if(n){const h=s[n];if(!h)return;const b={};b[n]={x:h.x,y:h.y,width:h.width,height:h.height},this.dragState={type:"move",startScreenX:l,startScreenY:d,tileId:n,initialTiles:b}}}handlePointerMove(t){var l,d;if(!this.dragState||!this.callbacks)return;const n=t.clientX-this.dragState.startScreenX,i=t.clientY-this.dragState.startScreenY;if(!this.dragStarted){if(Math.abs(n)<Wd&&Math.abs(i)<Wd)return;this.dragStarted=!0}const s=this.callbacks.getViewport();switch(this.dragState.type){case"pan":{const a=this.dragState.initialViewport;if(a){const p=n,h=i;this.callbacks.onViewportPan(a.panX+p-s.panX,a.panY+h-s.panY)}const o=performance.now();this.panSamples.push({t:o,x:t.clientX,y:t.clientY});const c=o-100;for(;this.panSamples.length>2&&this.panSamples[0].t<c;)this.panSamples.shift();break}case"move":{if(this.dragState.tileId&&s.zoom!==0){const a=n/s.zoom,o=i/s.zoom,c=(l=this.dragState.initialTiles)==null?void 0:l[this.dragState.tileId];c&&this.callbacks.onTileMove(this.dragState.tileId,Kt(c.x+a),Kt(c.y+o))}break}case"resize":{if(this.dragState.tileId&&this.dragState.handle&&s.zoom!==0){const a=(d=this.dragState.initialTiles)==null?void 0:d[this.dragState.tileId];if(a){const o=n/s.zoom,c=i/s.zoom,p=this.applyResize(this.dragState.handle,a,o,c);this.callbacks.onTileResize(this.dragState.tileId,p)}}break}case"select":{const a={x:Math.min(this.dragState.startScreenX,t.clientX),y:Math.min(this.dragState.startScreenY,t.clientY),width:Math.abs(n),height:Math.abs(i)};this.callbacks.onSelectionBox(a);break}}}handlePointerUp(t){var s,l,d,a;if(!this.callbacks){this.dragState=null;return}const n=((s=this.dragState)==null?void 0:s.type)==="pan",i=this.dragStarted;if(this.dragStarted?((a=this.dragState)==null?void 0:a.type)==="select"&&(this.callbacks.onSelectionBox(null),this.callbacks.onBoxSelectEnd([])):(l=this.dragState)!=null&&l.tileId?this.callbacks.onTileClick(this.dragState.tileId):((d=this.dragState)==null?void 0:d.type)==="select"&&this.callbacks.onCanvasClick(),n&&i&&this.panSamples.length>=2&&this.callbacks.onPanInertiaStart){const o=this.panSamples[this.panSamples.length-1],c=this.panSamples[0],p=o.t-c.t;if(p>0){const h=(o.x-c.x)/p,b=(o.y-c.y)/p;Math.hypot(h,b)>.05&&this.callbacks.onPanInertiaStart(h,b)}}this.dragState=null,this.dragStarted=!1,this.panSamples=[]}getSelectedTileIds(t,n){const i=[],s=t.x,l=t.y,d=t.width,a=t.height;for(const o of Object.values(n))o.x<s+d&&o.x+o.width>s&&o.y<l+a&&o.y+o.height>l&&i.push(o.id);return i}getResizeHandle(t,n,i,s=Up){const{x:l,y:d,width:a,height:o}=t,c=l+a/2,p=d+o/2,h=l+a,b=d+o;return this.hitTest(n,i,l,d,s)?"nw":this.hitTest(n,i,h,d,s)?"ne":this.hitTest(n,i,l,b,s)?"sw":this.hitTest(n,i,h,b,s)?"se":this.hitTest(n,i,c,d,s)?"n":this.hitTest(n,i,c,b,s)?"s":this.hitTest(n,i,l,p,s)?"w":this.hitTest(n,i,h,p,s)?"e":null}applyResize(t,n,i,s){let{x:l,y:d,width:a,height:o}=n;switch(t){case"n":d=n.y+s,o=n.height-s;break;case"s":o=n.height+s;break;case"w":l=n.x+i,a=n.width-i;break;case"e":a=n.width+i;break;case"nw":l=n.x+i,d=n.y+s,a=n.width-i,o=n.height-s;break;case"ne":d=n.y+s,a=n.width+i,o=n.height-s;break;case"sw":l=n.x+i,a=n.width-i,o=n.height+s;break;case"se":a=n.width+i,o=n.height+s;break}return a<ti&&((t==="w"||t==="nw"||t==="sw")&&(l=n.x+n.width-ti),a=ti),o<ni&&((t==="n"||t==="nw"||t==="ne")&&(d=n.y+n.height-ni),o=ni),l=Kt(l),d=Kt(d),a=Kt(a),o=Kt(o),{x:l,y:d,width:a,height:o}}isInTileHeader(t,n,i,s){const l=zp*s;return n>=t.x&&n<=t.x+t.width&&i>=t.y&&i<=t.y+l}hitTest(t,n,i,s,l){return Math.abs(t-i)<=l&&Math.abs(n-s)<=l}}const Jb=[{position:"n",cursor:"ns-resize",className:"top-0 left-2 right-2 h-1.5 -translate-y-1/2"},{position:"s",cursor:"ns-resize",className:"bottom-0 left-2 right-2 h-1.5 translate-y-1/2"},{position:"e",cursor:"ew-resize",className:"right-0 top-2 bottom-2 w-1.5 translate-x-1/2"},{position:"w",cursor:"ew-resize",className:"left-0 top-2 bottom-2 w-1.5 -translate-x-1/2"},{position:"nw",cursor:"nwse-resize",className:"top-0 left-0 w-3 h-3 -translate-x-1/2 -translate-y-1/2"},{position:"ne",cursor:"nesw-resize",className:"top-0 right-0 w-3 h-3 translate-x-1/2 -translate-y-1/2"},{position:"sw",cursor:"nesw-resize",className:"bottom-0 left-0 w-3 h-3 -translate-x-1/2 translate-y-1/2"},{position:"se",cursor:"nwse-resize",className:"bottom-0 right-0 w-3 h-3 translate-x-1/2 translate-y-1/2"}];function Qb({tile:e,viewport:t,isSelected:n}){const{t:i}=ne(),s=Ce(N=>N.removeTile),l=Ce(N=>N.duplicateTile),d=Ce(N=>N.toggleMaximize),a=Ce(N=>N.toggleMinimize),o=Ce(N=>N.setTilePty),c=Ce(N=>N.selectTile),p=Ce(N=>N.bringToFront),h=ue(N=>{var L;return(L=N.panes[e.paneId])==null?void 0:L.title}),{panX:b,panY:y,zoom:k}=t,v=e.x*k+b,g=e.y*k+y,m=e.windowState==="maximized",u=e.windowState==="minimized",f=n?"var(--color-canvas-tile-border-selected)":"var(--color-canvas-tile-border)",x=C.useCallback(()=>{d(e.id)},[e.id,d]),E=C.useCallback(()=>{a(e.id)},[e.id,a]),_=C.useCallback(()=>{l(e.id)},[e.id,l]),S=C.useCallback(N=>{N.target.closest("button")||(N.stopPropagation(),u?a(e.id):d(e.id))},[e.id,u,d,a]),w=C.useCallback(N=>{o(e.id,N.sessionId,N.cwd||null)},[e.id,o]),A=C.useRef(null),[D,R]=C.useState(!1);C.useEffect(()=>{const N=L=>{R(L.shiftKey||L.altKey)};return window.addEventListener("keydown",N),window.addEventListener("keyup",N),()=>{window.removeEventListener("keydown",N),window.removeEventListener("keyup",N)}},[]);const j=n||D,O=C.useRef(null),H=C.useCallback(N=>{O.current={x:N.clientX,y:N.clientY,id:N.pointerId}},[]),M=C.useCallback(N=>{O.current=null},[]),U=C.useCallback(N=>{var G;if(N.ctrlKey||N.metaKey||N.shiftKey||!n)return;const I=(G=A.current)==null?void 0:G.querySelector(".xterm-viewport");I&&(I.scrollTop+=N.deltaY,N.stopPropagation())},[n]),q=C.useCallback(()=>{const N=new URLSearchParams(window.location.search),L=new URLSearchParams;L.set("paneId",e.paneId),N.forEach((G,F)=>{L.has(F)||L.set(F,G)});const I=`${window.location.pathname}${window.location.search}#/canvas-pane?${L.toString()}`;window.open(I,`canvas-pane-${e.paneId}`,"noopener,noreferrer")},[e.paneId]),V=m?{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",transform:"none",pointerEvents:"auto",zIndex:9999,borderRadius:0,border:"none",overflow:"hidden",boxShadow:"none"}:{transform:`translate(${v}px, ${g}px) scale(${k})`,transformOrigin:"top left",width:e.width,height:e.height,willChange:"transform",pointerEvents:"auto",zIndex:e.zIndex,borderRadius:8,border:`1px solid ${f}`,overflow:"hidden",boxShadow:n?"0 0 0 1px var(--color-canvas-tile-border-selected)":"0 2px 8px rgba(0,0,0,0.08)"},T=C.useCallback(N=>{var F;if(N.button!==0)return;c(e.id),p(e.id);const L=(F=A.current)==null?void 0:F.querySelector(".xterm-helper-textarea");if(!L)return;const I=()=>{try{L.focus()}catch{}};I();const G=()=>{window.removeEventListener("pointerup",G,!0),I()};window.addEventListener("pointerup",G,!0)},[e.id,c,p]);return r.jsxs("div",{className:m?"canvas-tile":"absolute canvas-tile",style:V,onPointerDownCapture:T,children:[r.jsxs("div",{className:"canvas-tile-header flex items-center gap-1.5 px-2 select-none",style:{height:32,background:"var(--color-canvas-tile-header)",color:"var(--color-canvas-tile-header-text)",cursor:"grab",borderBottom:u?"none":"1px solid var(--color-canvas-tile-border)"},onDoubleClick:S,children:[r.jsx(un,{size:13,style:{opacity:.5,flexShrink:0}}),r.jsx("span",{className:"flex-1 text-xs truncate",style:{fontSize:12,fontWeight:500},children:h||i("canvas.defaultTitle")}),r.jsx("button",{onClick:N=>{N.stopPropagation(),_()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:i("canvas.tileMenu.duplicate"),children:r.jsx(hr,{size:12})}),r.jsx("button",{onClick:N=>{N.stopPropagation(),q()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:i("canvas.tileMenu.openStandalone"),children:r.jsx(st,{size:12})}),r.jsx("button",{onClick:N=>{N.stopPropagation(),E()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:i(u?"canvas.tileMenu.restore":"canvas.tileMenu.minimize"),children:u?r.jsx(ns,{size:12}):r.jsx(yp,{size:12})}),r.jsx("button",{onClick:N=>{N.stopPropagation(),x()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:i(m?"canvas.tileMenu.restore":"canvas.tileMenu.maximize"),children:m?r.jsx(vf,{size:12}):r.jsx(Qi,{size:12})}),r.jsx("button",{onClick:N=>{N.stopPropagation(),s(e.id)},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:i("canvas.tileMenu.close"),children:r.jsx(Te,{size:12})})]}),!u&&r.jsxs("div",{ref:A,className:"flex-1 relative",style:{height:"calc(100% - 32px)",overflow:"hidden"},children:[r.jsx(rs,{paneId:e.paneId,initialCwd:e.cwd??null,onPtyCreated:w}),r.jsx("div",{className:"absolute inset-0","data-canvas-tile-focused":n?"true":"false",style:{zIndex:5,pointerEvents:j?"none":"auto",background:"transparent"},onPointerDown:H,onPointerUp:M,onWheel:U})]}),!u&&Jb.map(N=>r.jsx("div",{className:`absolute ${N.className}`,style:{cursor:N.cursor,zIndex:10,opacity:0},"data-resize-handle":N.position},N.position))]})}function ey({rect:e}){return r.jsx("div",{className:"absolute pointer-events-none",style:{left:e.x,top:e.y,width:e.width,height:e.height,background:"var(--color-canvas-selection-fill)",border:"1px solid var(--color-canvas-selection-stroke)",borderRadius:2,zIndex:999}})}function ty(){const e=C.useRef(null),t=C.useRef(new ar),n=C.useRef(new Zb),i=Ce(N=>N.tiles),s=Ce(N=>N.viewport),l=Ce(N=>N.selectedTileIds),d=Ce(N=>N.setViewport),a=Ce(N=>N.updateTile),o=Ce(N=>N.selectTile),c=Ce(N=>N.selectTiles),p=Ce(N=>N.deselectAll),h=Ce(N=>N.bringToFront),[b,y]=C.useState(null),[k,v]=C.useState(!1),[g,m]=C.useState(!1),[u,f]=C.useState(null);C.useEffect(()=>{t.current.setState(s)},[s]);const x=C.useMemo(()=>Object.values(i).sort((N,L)=>N.zIndex-L.zIndex),[i]),E=C.useMemo(()=>new Set(l),[l]),_=C.useRef(s);_.current=s;const S=C.useRef({setViewport:d,updateTile:a,selectTile:o,deselectAll:p,bringToFront:h,selectTiles:c});S.current={setViewport:d,updateTile:a,selectTile:o,deselectAll:p,bringToFront:h,selectTiles:c};const w=.92,A=.01,D=3.5,R=C.useRef(null),j=C.useRef({vx:0,vy:0,last:0}),O=C.useCallback(()=>{R.current!==null&&(cancelAnimationFrame(R.current),R.current=null)},[]),H=C.useCallback((N,L)=>{O();const I=Math.hypot(N,L);if(I>D){const F=D/I;N*=F,L*=F}j.current={vx:N,vy:L,last:performance.now()};const G=()=>{const F=performance.now(),W=j.current,z=Math.min(32,F-W.last);W.last=F;const $=t.current.applyPan(W.vx*z,W.vy*z);S.current.setViewport($);const Y=Math.pow(w,z/16.67);if(W.vx*=Y,W.vy*=Y,Math.hypot(W.vx,W.vy)<A){R.current=null;return}R.current=requestAnimationFrame(G)};R.current=requestAnimationFrame(G)},[O]);C.useEffect(()=>()=>O(),[O]),C.useEffect(()=>{const N=n.current,L={onViewportPan:(I,G)=>{const W=t.current.applyPan(I,G);S.current.setViewport(W)},onTileMove:(I,G,F)=>{S.current.updateTile(I,{x:G,y:F})},onTileResize:(I,G)=>{S.current.updateTile(I,G)},onTileSelect:I=>{S.current.selectTile(I),S.current.bringToFront(I)},onSelectionBox:I=>{if(I){const G=e.current,F=G==null?void 0:G.getBoundingClientRect();y(F?{x:I.x-F.left,y:I.y-F.top,width:I.width,height:I.height}:I)}else y(null)},onBoxSelectEnd:()=>{},onTileClick:I=>{S.current.selectTile(I),S.current.bringToFront(I)},onCanvasClick:()=>{S.current.deselectAll()},onInteractionStart:()=>{O()},onPanInertiaStart:(I,G)=>{H(I,G)},getViewport:()=>_.current};return N.attach(L),()=>N.detach()},[]),C.useEffect(()=>{const N=e.current;if(!N)return;const L=t.current,I=W=>{const z=W.target,B=!!(z&&z.closest('.xterm, .xterm-screen, .xterm-viewport, input, textarea, [contenteditable="true"], [contenteditable=""]')),$=!!(z&&z.closest('[data-canvas-tile-focused="true"]')),Y=W.ctrlKey||W.metaKey;if((B||$)&&!Y&&!W.shiftKey)return;W.preventDefault();const X=N.getBoundingClientRect(),te=W.clientX-X.left,J=W.clientY-X.top;if(Y){const ie=L.applyZoom(W.deltaY,te,J);d(ie);return}let ae=-W.deltaX,ge=-W.deltaY;W.shiftKey&&ae===0&&(ae=-W.deltaY,ge=0);const de=W.deltaMode===1?16:W.deltaMode===2?100:1,he=L.applyPan(ae*de,ge*de);d(he)},G=W=>{if(!(W.ctrlKey||W.metaKey))return;const z=W.target;if(z){const B=z.tagName;if(B==="INPUT"||B==="TEXTAREA"||B==="SELECT"||z.isContentEditable)return}if(W.key==="+"||W.key==="="||W.key==="-"||W.key==="_"||W.key==="0"){W.preventDefault();const B=N.clientWidth,$=N.clientHeight;if(W.key==="0")d(L.resetView());else if(W.key==="-"||W.key==="_"){const Y=L.applyZoom(120,B/2,$/2);d(Y)}else{const Y=L.applyZoom(-120,B/2,$/2);d(Y)}}},F=W=>{W.preventDefault()};return N.addEventListener("wheel",I,{passive:!1}),window.addEventListener("keydown",G),N.addEventListener("gesturestart",F),N.addEventListener("gesturechange",F),N.addEventListener("gestureend",F),()=>{N.removeEventListener("wheel",I),window.removeEventListener("keydown",G),N.removeEventListener("gesturestart",F),N.removeEventListener("gesturechange",F),N.removeEventListener("gestureend",F)}},[d]);const M=C.useCallback(N=>{const L=e.current;if(!L)return;const I=N.button===1||N.button===2,G=n.current.isSpacePressed,F=L.getBoundingClientRect(),W=N.clientX-F.left,z=N.clientY-F.top,B=n.current;let $=null,Y=null,X=null;if(!I&&!G){const de=[...Object.values(i)].sort((he,ie)=>ie.zIndex-he.zIndex);for(const he of de){const ie=he.x*s.zoom+s.panX,Oe=he.y*s.zoom+s.panY,_e=he.width*s.zoom,re=he.height*s.zoom,ce={x:ie,y:Oe,width:_e,height:re},Ee=B.getResizeHandle(ce,W,z,Up);if(Ee){$=he.id,Y=Ee,X=he.id;break}if(B.isInTileHeader(ce,W,z,s.zoom)){$=he.id,X=he.id;break}if(W>=ie&&W<=ie+_e&&z>=Oe&&z<=Oe+re){X=he.id;break}}}const te=N.target;if(!I&&!G&&Y===null&&X&&E.has(X)&&te&&te.closest(".xterm, .xterm-screen, .xterm-viewport, .xterm-rows"))return;const J=N.target;if(J&&!(I||G||Y!==null)&&(J.closest("button")||J.closest("input, textarea:not(.xterm-helper-textarea), select")||J.closest('[contenteditable="true"], [contenteditable=""]')))return;if(I&&N.preventDefault(),!X&&!Y){const de=document.activeElement;de&&typeof de.blur=="function"&&de.blur(),p()}const ge=N.nativeEvent;B.handlePointerDown(ge,$,Y,i),X?(o(X),h(X)):(N.shiftKey||N.ctrlKey||N.metaKey)&&p(),L.setPointerCapture(N.pointerId),v(B.isSpacePressed)},[i,s,o,p,h,E]),U=C.useCallback(N=>{var I;const L=n.current;L.handlePointerMove(N.nativeEvent),v(L.isSpacePressed),m(L.isDragging),f(((I=L.currentDrag)==null?void 0:I.type)??null)},[]),q=C.useCallback(N=>{var G;const L=n.current;if(((G=L.currentDrag)==null?void 0:G.type)==="select"&&L.isDragging&&b){const F=s.zoom||1,W={x:(b.x-s.panX)/F,y:(b.y-s.panY)/F,width:b.width/F,height:b.height/F},z=L.getSelectedTileIds(W,i);c(z)}L.handlePointerUp(N.nativeEvent);const I=e.current;I&&I.releasePointerCapture(N.pointerId),m(!1),f(null),y(null)},[s,i,c,b]),T=g&&u==="pan"?"grabbing":k?"grab":"default";return r.jsxs("div",{ref:e,className:"absolute inset-0",style:{cursor:T,touchAction:"none",overscrollBehavior:"contain"},onPointerDown:M,onPointerMove:U,onPointerUp:q,onContextMenu:N=>N.preventDefault(),children:[r.jsx("div",{className:"absolute inset-0",style:{pointerEvents:"none"},children:x.map(N=>r.jsx(Qb,{tile:N,viewport:s,isSelected:E.has(N.id)},N.id))}),b&&r.jsx(ey,{rect:b})]})}function Vd(){const e=Ce(i=>i.tiles),{t}=ne(),n=Object.keys(e).length>0;return r.jsxs("div",{className:"relative w-full h-full overflow-hidden bg-bg-primary",children:[r.jsx(ty,{}),r.jsx(Yb,{}),!n&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:r.jsx("p",{className:"text-text-tertiary text-sm",children:t("canvas.empty")})})]})}function Kd(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function ny(e){if(Array.isArray(e))return e}function ry(e,t,n){return(t=dy(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iy(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,s,l,d,a=[],o=!0,c=!1;try{if(l=(n=n.call(e)).next,t!==0)for(;!(o=(i=l.call(n)).done)&&(a.push(i.value),a.length!==t);o=!0);}catch(p){c=!0,s=p}finally{try{if(!o&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(c)throw s}}return a}}function sy(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
619
|
+
`);break;case"keepalive":break}}catch{}X&&N.write(X)},I.onerror=()=>{_.current&&(b(e,"error"),y(e,i("terminal.connectionLost")))},I.onloadend=()=>{var Y;if(!_.current)return;((Y=ue.getState().panes[e])==null?void 0:Y.ptyStatus)==="connected"&&(b(e,"error"),y(e,i("terminal.connectionLost")))},I.send();const W=N.onData($=>{D.current&&Fb(D.current,$)}),z=N.onResize(({cols:$,rows:Y})=>{D.current&&Md(D.current,$,Y)});w.current=!0;const B=()=>{W.dispose(),z.dispose(),O(),D.current=null};return A.current=B,B},[O,e,h,b,y]),M=C.useCallback(()=>{const N=u.current;if(!N||S.current)return;const L=s==="dark"?Xn:Yn;for(;N.firstChild;)N.removeChild(N.firstChild);const I=new Lb.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:L,allowProposedApi:!0,scrollback:1e4}),G=new Ib.FitAddon;I.loadAddon(G),I.open(N);const F=N.querySelector(".xterm-helper-textarea");F&&(F.setAttribute("autocomplete","off"),F.setAttribute("autocorrect","off"),F.setAttribute("autocapitalize","off"),F.setAttribute("spellcheck","false"),F.setAttribute("unselectable","on")),f.current=I,x.current=G,S.current=!0;const W=I.onTitleChange(Y=>{_.current&&(v(Y||null),k(e,Y||null))});let z=null;const B=()=>{z&&clearTimeout(z),z=setTimeout(()=>{if(_.current)try{G.fit()}catch{}},50)},$=new ResizeObserver(B);return $.observe(N),window.addEventListener("resize",B),()=>{W.dispose(),$.disconnect(),window.removeEventListener("resize",B),z&&clearTimeout(z)}},[]),U=C.useCallback(async()=>{var W,z;const N=f.current,L=x.current;if(!N||!L||!_.current||w.current)return;try{L.fit()}catch{}const I=N.cols||80,G=N.rows||24,F=(W=ue.getState().panes[e])==null?void 0:W.ptySessionId;if(F&&await Pd(F)&&_.current){if(H(N,F),j.current){const $=await Bd(F);$&&_.current&&j.current({sessionId:F,cwd:$.cwd})}return}if(_.current){if(!F){const B=Ub(e),Y=(await Bb()).find(X=>!X.hasClient&&!B.has(X.id));if(Y&&_.current){if(h(e,Y.id),H(N,Y.id),j.current){const X=await Bd(Y.id);X&&_.current&&j.current({sessionId:Y.id,cwd:X.cwd})}return}}if(_.current){b(e,"connecting");try{const B=R.current||void 0,{sessionId:$,cwd:Y}=await Fd(I,G,B);if(!_.current)return;h(e,$),H(N,$),(z=j.current)==null||z.call(j,{sessionId:$,cwd:Y})}catch(B){if(!_.current)return;b(e,"error"),y(e,B.message||i("terminal.createSessionFailed"))}}}},[H,e,h,b,y]),q=C.useRef(null);C.useEffect(()=>{_.current=!0;const N=u.current;if(!N)return;const L=()=>{if(!_.current)return;const{clientWidth:G,clientHeight:F}=N;if(!(G===0||F===0)&&(S.current||(q.current=M()||null),f.current&&x.current)){try{x.current.fit()}catch{}w.current||U()}};if(N.clientWidth>0&&N.clientHeight>0){const G=requestAnimationFrame(L);return()=>cancelAnimationFrame(G)}const I=new ResizeObserver(G=>{for(const F of G){const{width:W,height:z}=F.contentRect;if(W>0&&z>0){I.disconnect(),L();break}}});return I.observe(N),()=>I.disconnect()},[M,U]),C.useEffect(()=>()=>{var N,L,I;_.current=!1,(N=A.current)==null||N.call(A),(L=q.current)==null||L.call(q),(I=f.current)==null||I.dispose(),f.current=null,x.current=null,S.current=!1,w.current=!1},[]),C.useEffect(()=>{const N=f.current;if(N){const L=s==="dark"?Xn:Yn;N.options.theme=L;try{N.refresh(0,N.rows-1)}catch{}}},[s,o]);const V=C.useCallback(async()=>{var L,I,G;if(O(),w.current=!1,b(e,"connecting"),y(e,null),await new Promise(F=>setTimeout(F,Mb)),!_.current)return;const N=f.current;if(N)try{N.clear();try{(L=x.current)==null||L.fit()}catch{}const F=N.cols||80,W=N.rows||24,z=(I=ue.getState().panes[e])==null?void 0:I.ptySessionId;if(z&&await Pd(z)&&_.current){H(N,z);return}if(!_.current)return;const B=R.current||void 0,{sessionId:$,cwd:Y}=await Fd(F,W,B);if(!_.current)return;h(e,$),H(N,$),(G=j.current)==null||G.call(j,{sessionId:$,cwd:Y})}catch(F){if(!_.current)return;b(e,"error"),y(e,F.message||i("terminal.reconnectFailed"))}},[O,H,e,h,b,y]),T=C.useCallback(()=>{var N;g||c(e),(N=f.current)==null||N.focus()},[g,e,c]);return l?r.jsxs("div",{className:`terminal-pane flex flex-col h-full w-full ${g&&m>1?"active":""}`,style:{backgroundColor:s==="dark"?Xn.background:Yn.background},onClick:T,children:[m>1&&r.jsx("div",{className:"terminal-pane-toolbar",children:r.jsx("button",{onClick:N=>{N.stopPropagation(),p(e)},className:"w-6 h-6 flex items-center justify-center rounded bg-bg-tertiary/80 text-text-secondary hover:text-text-primary hover:bg-bg-hover transition-colors",title:i("terminal.closePane"),children:r.jsx(Te,{size:14})})}),r.jsx("div",{ref:u,className:"flex-1 w-full",style:{overflow:"hidden",padding:"4px"}}),l.ptyStatus==="connecting"&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",style:{backgroundColor:s==="dark"?`${Xn.background}cc`:`${Yn.background}cc`},children:r.jsx(ut,{size:"small",text:i("terminal.connecting")})}),l.ptyStatus==="error"&&r.jsxs("div",{className:"absolute bottom-0 left-0 right-0 flex items-center justify-between px-4 py-2 bg-accent-red/10 border-t border-accent-red/30 z-10",children:[r.jsxs("div",{className:"flex items-center gap-2 text-accent-red text-xs",children:[r.jsx(Xm,{size:14}),r.jsx("span",{children:l.errorMessage||i("terminal.error")})]}),r.jsxs("button",{onClick:V,className:"flex items-center gap-1.5 px-3 py-1 rounded-md bg-bg-secondary border border-border-muted text-text-primary text-xs hover:bg-bg-hover transition-colors",children:[r.jsx(qe,{size:12}),r.jsx("span",{children:i("terminal.reconnect")})]})]})]}):r.jsx("div",{})}const Hb="chat",Ud=new Set(["chat","tasks","plugins","terminal","canvas","canvas-pane","remote-control","settings","docs","editor","changes","metrics","workers","logs","keybindings","stats","traces"]);function is(){let t=window.location.hash.slice(1);t.startsWith("/")&&(t=t.slice(1));const n=t.split("?")[0]||"";if(Ud.has(n))return n;const i=n.split("/")[0];return Ud.has(i)?i:Hb}function zd(e){const t=new URLSearchParams(window.location.search),n=window.location.hash.slice(1),i=n.indexOf("?");i!==-1&&new URLSearchParams(n.slice(i+1)).forEach((a,o)=>{t.has(o)||t.set(o,a)});const s=t.toString(),l=s?`#/${e}?${s}`:`#/${e}`;window.location.hash=l}function Gb(e){const t=()=>{const n=is();e(n)};return window.addEventListener("hashchange",t),()=>{window.removeEventListener("hashchange",t)}}function xr(){const t=window.location.hash.slice(1).replace(/^\//,"").split("?")[0],n=t.indexOf("/");return n>0?t.slice(n+1):void 0}function wn(e,t){const i=new URLSearchParams(window.location.search).toString(),s=i?`#/${e}/${t}?${i}`:`#/${e}/${t}`;window.location.hash=s}function vr(){const e=window.location.hash.slice(1),t=e.indexOf("?");return t>=0?new URLSearchParams(e.slice(t+1)):new URLSearchParams}function Bp(e){const t=new URLSearchParams(window.location.search);t.set("path",e),window.location.hash=`#/editor?${t.toString()}`}const Hd=400,Gd=300,ti=200,ni=150,ri=.1,ii=5,gt=20,Wd=3,Up=8,Wb=10,zp=32,qb=zp;function Hp(){return se({"Content-Type":"application/json"})}async function Vb(e){try{const t=await fetch(`/api/v1/pty/${e}`,{headers:Hp()});if(!t.ok)return null;const n=await t.json(),i=n.data??n;return typeof(i==null?void 0:i.cwd)=="string"?i.cwd:null}catch{return null}}function Gp(e){const t=Object.values(e);if(t.length===0)return;const i={...ue.getState().panes};let s=!1;for(const l of t){const d=i[l.paneId];d?l.ptySessionId&&d.ptySessionId!==l.ptySessionId&&(i[l.paneId]={...d,ptySessionId:l.ptySessionId},s=!0):(i[l.paneId]={id:l.paneId,ptySessionId:l.ptySessionId??null,ptyStatus:"disconnected",errorMessage:null},s=!0)}s&&ue.setState({panes:i})}const Ce=Ne()(jn((e,t)=>({viewport:{panX:0,panY:0,zoom:1},tiles:{},nextZIndex:1,selectedTileIds:[],setViewport:n=>{e({viewport:n})},addTile:()=>{const n=`tile-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,i=`canvas-pane-${n}`,{nextZIndex:s,viewport:l}=t(),d=l.zoom||1,a=(-l.panX+window.innerWidth/2)/d-Hd/2,o=(-l.panY+window.innerHeight/2)/d-Gd/2,c=Math.round(a/gt)*gt,p=Math.round(o/gt)*gt,h={id:n,type:"terminal",x:c,y:p,width:Hd,height:Gd,zIndex:s,paneId:i,windowState:"normal",ptySessionId:null,cwd:null},b=ue.getState();if(!b.panes[i]){const y={...b.panes,[i]:{id:i,ptySessionId:null,ptyStatus:"disconnected",errorMessage:null}};ue.setState({panes:y})}return e(y=>({tiles:{...y.tiles,[n]:h},nextZIndex:y.nextZIndex+1})),n},duplicateTile:n=>{var u,f,x,E;const i=t().tiles[n];if(!i)return null;const s=`tile-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,l=`canvas-pane-${s}`,{nextZIndex:d}=t(),a=((u=i.prevBounds)==null?void 0:u.width)??i.width,o=((f=i.prevBounds)==null?void 0:f.height)??i.height,c=((x=i.prevBounds)==null?void 0:x.x)??i.x,p=((E=i.prevBounds)==null?void 0:E.y)??i.y,h=gt*2,b=Math.round((c+h)/gt)*gt,y=Math.round((p+h)/gt)*gt,k={id:s,type:"terminal",x:b,y,width:a,height:o,zIndex:d,paneId:l,windowState:"normal",ptySessionId:null,cwd:i.cwd??null},v=ue.getState();v.panes[l]||ue.setState({panes:{...v.panes,[l]:{id:l,ptySessionId:null,ptyStatus:"disconnected",errorMessage:null}}}),e(_=>({tiles:{..._.tiles,[s]:k},nextZIndex:_.nextZIndex+1}));const g=ue.getState().panes[i.paneId],m=g==null?void 0:g.ptySessionId;return m&&Vb(m).then(_=>{_&&(t().updateTile(i.id,{cwd:_}),t().updateTile(s,{cwd:_}))}),s},removeTile:n=>{const i=t().tiles[n];if(i){const s=ue.getState(),l=s.panes[i.paneId];if(l!=null&&l.ptySessionId&&fetch(`/api/v1/pty/${l.ptySessionId}`,{method:"DELETE",headers:Hp()}).catch(()=>{}),s.panes[i.paneId]){const{[i.paneId]:d,...a}=s.panes;ue.setState({panes:a})}}e(s=>{const{[n]:l,...d}=s.tiles;return{tiles:d,selectedTileIds:s.selectedTileIds.filter(a=>a!==n)}})},updateTile:(n,i)=>{e(s=>{const l=s.tiles[n];return l?{tiles:{...s.tiles,[n]:{...l,...i}}}:s})},selectTile:n=>e({selectedTileIds:[n]}),deselectAll:()=>e({selectedTileIds:[]}),selectTiles:n=>e({selectedTileIds:n}),bringToFront:n=>{e(i=>{const s=i.tiles[n];return s?{tiles:{...i.tiles,[n]:{...s,zIndex:i.nextZIndex}},nextZIndex:i.nextZIndex+1}:i})},maximizeTile:n=>{e(i=>{const s=i.tiles[n];if(!s)return i;const l=s.windowState==="normal"?{x:s.x,y:s.y,width:s.width,height:s.height}:s.prevBounds;return{tiles:{...i.tiles,[n]:{...s,windowState:"maximized",prevBounds:l,zIndex:i.nextZIndex}},nextZIndex:i.nextZIndex+1}})},minimizeTile:n=>{e(i=>{const s=i.tiles[n];if(!s)return i;const l=s.windowState==="normal"?{x:s.x,y:s.y,width:s.width,height:s.height}:s.prevBounds;return{tiles:{...i.tiles,[n]:{...s,height:qb,windowState:"minimized",prevBounds:l}}}})},restoreTile:n=>{e(i=>{const s=i.tiles[n];return!s||!s.prevBounds?s?{tiles:{...i.tiles,[n]:{...s,windowState:"normal"}}}:i:{tiles:{...i.tiles,[n]:{...s,x:s.prevBounds.x,y:s.prevBounds.y,width:s.prevBounds.width,height:s.prevBounds.height,windowState:"normal",prevBounds:void 0}}}})},toggleMaximize:n=>{const i=t().tiles[n];i&&(i.windowState==="maximized"?t().restoreTile(n):t().maximizeTile(n))},toggleMinimize:n=>{const i=t().tiles[n];i&&(i.windowState==="minimized"?t().restoreTile(n):t().minimizeTile(n))},setTilePty:(n,i,s)=>{let l=null;if(e(d=>{const a=d.tiles[n];if(!a)return d;l=a.paneId;const o={...a,ptySessionId:i};return s!==void 0&&(o.cwd=s),{tiles:{...d.tiles,[n]:o}}}),l){const d=ue.getState(),a=d.panes[l];a&&a.ptySessionId!==i&&ue.setState({panes:{...d.panes,[l]:{...a,ptySessionId:i}}})}},loadFromStorage:()=>{}}),{namespace:"canvas",fields:["viewport","tiles","nextZIndex"],scope:"workspace",debounceMs:1e3,onLoad:(e,t)=>{const n={};e.viewport&&(n.viewport=e.viewport),e.tiles&&(n.tiles=e.tiles),e.nextZIndex!==void 0&&(n.nextZIndex=e.nextZIndex),Object.keys(n).length>0&&(t(n),n.tiles&&Gp(n.tiles))}}));Gp(Ce.getState().tiles);function Kb(){const{t:e}=ne(),[t,n]=C.useState(()=>vr().get("paneId")||"");C.useEffect(()=>{const a=()=>{n(vr().get("paneId")||"")};return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[]);const i=Ce(a=>Object.values(a.tiles).find(o=>o.paneId===t)??null),s=ue(a=>{var o;return t?(o=a.panes[t])==null?void 0:o.title:null}),l=Ce(a=>a.setTilePty),d=C.useCallback(a=>{i&&l(i.id,a.sessionId,a.cwd||null)},[i,l]);return C.useEffect(()=>{if(!t)return;const a=ue.getState();a.panes[t]||ue.setState({panes:{...a.panes,[t]:{id:t,ptySessionId:(i==null?void 0:i.ptySessionId)??null,ptyStatus:"disconnected",errorMessage:null}}})},[t,i==null?void 0:i.ptySessionId]),t?r.jsxs("div",{className:"flex flex-col h-full w-full bg-bg-primary",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 select-none",style:{height:32,background:"var(--color-canvas-tile-header)",color:"var(--color-canvas-tile-header-text)",borderBottom:"1px solid var(--color-border-default)"},children:[r.jsx(un,{size:14,style:{opacity:.6}}),r.jsx("span",{className:"text-xs truncate",style:{fontSize:12,fontWeight:500},children:s||e("canvas.defaultTitle")})]}),r.jsx("div",{className:"flex-1 min-h-0 relative",children:r.jsx(rs,{paneId:t,initialCwd:(i==null?void 0:i.cwd)??null,onPtyCreated:d})})]}):r.jsx("div",{className:"flex items-center justify-center h-full w-full bg-bg-primary text-text-secondary text-sm",children:e("canvas.standalone.missingPaneId")})}class ar{constructor(){be(this,"panX",0);be(this,"panY",0);be(this,"zoom",1)}getState(){return{panX:this.panX,panY:this.panY,zoom:this.zoom}}setState(t){this.panX=t.panX,this.panY=t.panY,this.zoom=Math.max(ri,Math.min(ii,t.zoom))}screenToWorld(t,n){return this.zoom===0?{x:0,y:0}:{x:(t-this.panX)/this.zoom,y:(n-this.panY)/this.zoom}}worldToScreen(t,n){return{x:t*this.zoom+this.panX,y:n*this.zoom+this.panY}}applyZoom(t,n,i){const s=this.zoom,l=Math.exp(-t*.6/100),d=Math.max(ri,Math.min(ii,s*l));if(s===0)return this.zoom=d,this.getState();const a=d/s-1;return this.panX-=(n-this.panX)*a,this.panY-=(i-this.panY)*a,this.zoom=d,this.getState()}applyPan(t,n){return this.panX+=t,this.panY+=n,this.getState()}fitTiles(t,n,i,s=40){if(t.length===0)return this.resetView();let l=1/0,d=1/0,a=-1/0,o=-1/0;for(const g of t)l=Math.min(l,g.x),d=Math.min(d,g.y),a=Math.max(a,g.x+g.width),o=Math.max(o,g.y+g.height);const c=a-l,p=o-d;if(c<=0||p<=0)return this.resetView();const h=n-s*2,b=i-s*2;if(h<=0||b<=0)return this.resetView();const y=Math.max(ri,Math.min(ii,Math.min(h/c,b/p))),k=(n-c*y)/2-l*y,v=(i-p*y)/2-d*y;return this.panX=k,this.panY=v,this.zoom=y,this.getState()}resetView(){return this.panX=0,this.panY=0,this.zoom=1,this.getState()}}const qd=120;function Yb(){const{t:e}=ne(),t=Ce(m=>m.viewport),n=Ce(m=>m.tiles),i=Ce(m=>m.setViewport),s=Ce(m=>m.addTile),l=C.useRef(null),d=Math.round(t.zoom*100),a=typeof window<"u"&&window.location.hash.includes("standalone");if(Object.values(n).some(m=>m.windowState==="maximized"))return null;const c=()=>{var u;const m=(u=l.current)==null?void 0:u.parentElement;return{w:(m==null?void 0:m.clientWidth)??window.innerWidth,h:(m==null?void 0:m.clientHeight)??window.innerHeight}},p=()=>{const m=new ar;m.setState(t);const{w:u,h:f}=c(),x=m.applyZoom(-qd,u/2,f/2);i(x)},h=()=>{const m=new ar;m.setState(t);const{w:u,h:f}=c(),x=m.applyZoom(qd,u/2,f/2);i(x)},b=()=>{const m=new ar;m.setState(t);const{w:u,h:f}=c(),x=Object.values(n);x.length===0?i(m.resetView()):i(m.fitTiles(x,u,f,60))},y=()=>{s()},k=()=>{const m=new URLSearchParams(window.location.search),u=new URLSearchParams;u.set("standalone","1"),m.forEach((x,E)=>{u.has(E)||u.set(E,x)});const f=`${window.location.pathname}${window.location.search}#/canvas?${u.toString()}`;window.open(f,"canvas-standalone","noopener,noreferrer")},v="w-8 h-8 flex items-center justify-center rounded-lg transition-colors",g={border:"none",background:"transparent",color:"var(--color-text-secondary)",cursor:"pointer"};return r.jsxs("div",{ref:l,className:"canvas-toolbar fixed bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-1 px-2 py-1 rounded-xl",style:{background:"var(--color-bg-card)",border:"1px solid var(--color-border-default)",boxShadow:"0 2px 12px rgba(0,0,0,0.12)",zIndex:1e4},children:[r.jsx("button",{className:v,style:g,onClick:y,title:e("canvas.addTerminal"),children:r.jsx(ot,{size:16})}),r.jsx("div",{style:{width:1,height:20,background:"var(--color-border-muted)"}}),r.jsx("button",{className:v,style:g,onClick:h,title:e("canvas.zoomOut"),children:r.jsx(Nb,{size:16})}),r.jsxs("span",{className:"text-xs tabular-nums select-none",style:{minWidth:40,textAlign:"center",color:"var(--color-text-secondary)"},children:[d,"%"]}),r.jsx("button",{className:v,style:g,onClick:p,title:e("canvas.zoomIn"),children:r.jsx(Cb,{size:16})}),r.jsx("div",{style:{width:1,height:20,background:"var(--color-border-muted)"}}),r.jsx("button",{className:v,style:g,onClick:b,title:e("canvas.fitView"),children:r.jsx(uf,{size:16})}),!a&&r.jsxs(r.Fragment,{children:[r.jsx("div",{style:{width:1,height:20,background:"var(--color-border-muted)"}}),r.jsx("button",{className:v,style:g,onClick:k,title:e("canvas.openStandalone"),children:r.jsx(st,{size:16})})]})]})}function Kt(e,t=gt,n=Wb){const i=(e%t+t)%t;return i<=n?e-i:t-i<=n?e+(t-i):e}function Xb(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}class Zb{constructor(){be(this,"dragState",null);be(this,"spacePressed",!1);be(this,"callbacks",null);be(this,"keydownHandler",null);be(this,"keyupHandler",null);be(this,"dragStarted",!1);be(this,"panSamples",[])}attach(t){this.callbacks=t,this.keydownHandler=n=>{if(n.code==="Space"&&!n.repeat){if(Xb(n.target))return;this.spacePressed=!0,n.preventDefault()}},this.keyupHandler=n=>{n.code==="Space"&&(this.spacePressed=!1)},window.addEventListener("keydown",this.keydownHandler),window.addEventListener("keyup",this.keyupHandler)}detach(){this.keydownHandler&&(window.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null),this.keyupHandler&&(window.removeEventListener("keyup",this.keyupHandler),this.keyupHandler=null),this.callbacks=null,this.dragState=null}get isSpacePressed(){return this.spacePressed}get isDragging(){return this.dragState!==null&&this.dragStarted}get currentDrag(){return this.dragState}handlePointerDown(t,n,i,s){var o,c,p;const l=t.clientX,d=t.clientY;this.dragStarted=!1,this.panSamples=[],(c=(o=this.callbacks)==null?void 0:o.onInteractionStart)==null||c.call(o);const a=(p=this.callbacks)==null?void 0:p.getViewport();if(this.spacePressed||!n&&!i){const h=t.shiftKey||t.ctrlKey||t.metaKey;!this.spacePressed&&h?this.dragState={type:"select",startScreenX:l,startScreenY:d}:(this.dragState={type:"pan",startScreenX:l,startScreenY:d,initialViewport:a?{...a}:void 0},this.panSamples=[{t:performance.now(),x:l,y:d}]);return}if(n&&i){const h=s[n];if(!h)return;this.dragState={type:"resize",startScreenX:l,startScreenY:d,tileId:n,handle:i,initialTiles:{[n]:{x:h.x,y:h.y,width:h.width,height:h.height}}};return}if(n){const h=s[n];if(!h)return;const b={};b[n]={x:h.x,y:h.y,width:h.width,height:h.height},this.dragState={type:"move",startScreenX:l,startScreenY:d,tileId:n,initialTiles:b}}}handlePointerMove(t){var l,d;if(!this.dragState||!this.callbacks)return;const n=t.clientX-this.dragState.startScreenX,i=t.clientY-this.dragState.startScreenY;if(!this.dragStarted){if(Math.abs(n)<Wd&&Math.abs(i)<Wd)return;this.dragStarted=!0}const s=this.callbacks.getViewport();switch(this.dragState.type){case"pan":{const a=this.dragState.initialViewport;if(a){const p=n,h=i;this.callbacks.onViewportPan(a.panX+p-s.panX,a.panY+h-s.panY)}const o=performance.now();this.panSamples.push({t:o,x:t.clientX,y:t.clientY});const c=o-100;for(;this.panSamples.length>2&&this.panSamples[0].t<c;)this.panSamples.shift();break}case"move":{if(this.dragState.tileId&&s.zoom!==0){const a=n/s.zoom,o=i/s.zoom,c=(l=this.dragState.initialTiles)==null?void 0:l[this.dragState.tileId];c&&this.callbacks.onTileMove(this.dragState.tileId,Kt(c.x+a),Kt(c.y+o))}break}case"resize":{if(this.dragState.tileId&&this.dragState.handle&&s.zoom!==0){const a=(d=this.dragState.initialTiles)==null?void 0:d[this.dragState.tileId];if(a){const o=n/s.zoom,c=i/s.zoom,p=this.applyResize(this.dragState.handle,a,o,c);this.callbacks.onTileResize(this.dragState.tileId,p)}}break}case"select":{const a={x:Math.min(this.dragState.startScreenX,t.clientX),y:Math.min(this.dragState.startScreenY,t.clientY),width:Math.abs(n),height:Math.abs(i)};this.callbacks.onSelectionBox(a);break}}}handlePointerUp(t){var s,l,d,a;if(!this.callbacks){this.dragState=null;return}const n=((s=this.dragState)==null?void 0:s.type)==="pan",i=this.dragStarted;if(this.dragStarted?((a=this.dragState)==null?void 0:a.type)==="select"&&(this.callbacks.onSelectionBox(null),this.callbacks.onBoxSelectEnd([])):(l=this.dragState)!=null&&l.tileId?this.callbacks.onTileClick(this.dragState.tileId):((d=this.dragState)==null?void 0:d.type)==="select"&&this.callbacks.onCanvasClick(),n&&i&&this.panSamples.length>=2&&this.callbacks.onPanInertiaStart){const o=this.panSamples[this.panSamples.length-1],c=this.panSamples[0],p=o.t-c.t;if(p>0){const h=(o.x-c.x)/p,b=(o.y-c.y)/p;Math.hypot(h,b)>.05&&this.callbacks.onPanInertiaStart(h,b)}}this.dragState=null,this.dragStarted=!1,this.panSamples=[]}getSelectedTileIds(t,n){const i=[],s=t.x,l=t.y,d=t.width,a=t.height;for(const o of Object.values(n))o.x<s+d&&o.x+o.width>s&&o.y<l+a&&o.y+o.height>l&&i.push(o.id);return i}getResizeHandle(t,n,i,s=Up){const{x:l,y:d,width:a,height:o}=t,c=l+a/2,p=d+o/2,h=l+a,b=d+o;return this.hitTest(n,i,l,d,s)?"nw":this.hitTest(n,i,h,d,s)?"ne":this.hitTest(n,i,l,b,s)?"sw":this.hitTest(n,i,h,b,s)?"se":this.hitTest(n,i,c,d,s)?"n":this.hitTest(n,i,c,b,s)?"s":this.hitTest(n,i,l,p,s)?"w":this.hitTest(n,i,h,p,s)?"e":null}applyResize(t,n,i,s){let{x:l,y:d,width:a,height:o}=n;switch(t){case"n":d=n.y+s,o=n.height-s;break;case"s":o=n.height+s;break;case"w":l=n.x+i,a=n.width-i;break;case"e":a=n.width+i;break;case"nw":l=n.x+i,d=n.y+s,a=n.width-i,o=n.height-s;break;case"ne":d=n.y+s,a=n.width+i,o=n.height-s;break;case"sw":l=n.x+i,a=n.width-i,o=n.height+s;break;case"se":a=n.width+i,o=n.height+s;break}return a<ti&&((t==="w"||t==="nw"||t==="sw")&&(l=n.x+n.width-ti),a=ti),o<ni&&((t==="n"||t==="nw"||t==="ne")&&(d=n.y+n.height-ni),o=ni),l=Kt(l),d=Kt(d),a=Kt(a),o=Kt(o),{x:l,y:d,width:a,height:o}}isInTileHeader(t,n,i,s){const l=zp*s;return n>=t.x&&n<=t.x+t.width&&i>=t.y&&i<=t.y+l}hitTest(t,n,i,s,l){return Math.abs(t-i)<=l&&Math.abs(n-s)<=l}}const Jb=[{position:"n",cursor:"ns-resize",className:"top-0 left-2 right-2 h-1.5 -translate-y-1/2"},{position:"s",cursor:"ns-resize",className:"bottom-0 left-2 right-2 h-1.5 translate-y-1/2"},{position:"e",cursor:"ew-resize",className:"right-0 top-2 bottom-2 w-1.5 translate-x-1/2"},{position:"w",cursor:"ew-resize",className:"left-0 top-2 bottom-2 w-1.5 -translate-x-1/2"},{position:"nw",cursor:"nwse-resize",className:"top-0 left-0 w-3 h-3 -translate-x-1/2 -translate-y-1/2"},{position:"ne",cursor:"nesw-resize",className:"top-0 right-0 w-3 h-3 translate-x-1/2 -translate-y-1/2"},{position:"sw",cursor:"nesw-resize",className:"bottom-0 left-0 w-3 h-3 -translate-x-1/2 translate-y-1/2"},{position:"se",cursor:"nwse-resize",className:"bottom-0 right-0 w-3 h-3 translate-x-1/2 translate-y-1/2"}];function Qb({tile:e,viewport:t,isSelected:n}){const{t:i}=ne(),s=Ce(N=>N.removeTile),l=Ce(N=>N.duplicateTile),d=Ce(N=>N.toggleMaximize),a=Ce(N=>N.toggleMinimize),o=Ce(N=>N.setTilePty),c=Ce(N=>N.selectTile),p=Ce(N=>N.bringToFront),h=ue(N=>{var L;return(L=N.panes[e.paneId])==null?void 0:L.title}),{panX:b,panY:y,zoom:k}=t,v=e.x*k+b,g=e.y*k+y,m=e.windowState==="maximized",u=e.windowState==="minimized",f=n?"var(--color-canvas-tile-border-selected)":"var(--color-canvas-tile-border)",x=C.useCallback(()=>{d(e.id)},[e.id,d]),E=C.useCallback(()=>{a(e.id)},[e.id,a]),_=C.useCallback(()=>{l(e.id)},[e.id,l]),S=C.useCallback(N=>{N.target.closest("button")||(N.stopPropagation(),u?a(e.id):d(e.id))},[e.id,u,d,a]),w=C.useCallback(N=>{o(e.id,N.sessionId,N.cwd||null)},[e.id,o]),A=C.useRef(null),[D,R]=C.useState(!1);C.useEffect(()=>{const N=L=>{R(L.shiftKey||L.altKey)};return window.addEventListener("keydown",N),window.addEventListener("keyup",N),()=>{window.removeEventListener("keydown",N),window.removeEventListener("keyup",N)}},[]);const j=n||D,O=C.useRef(null),H=C.useCallback(N=>{O.current={x:N.clientX,y:N.clientY,id:N.pointerId}},[]),M=C.useCallback(N=>{O.current=null},[]),U=C.useCallback(N=>{var G;if(N.ctrlKey||N.metaKey||N.shiftKey||!n)return;const I=(G=A.current)==null?void 0:G.querySelector(".xterm-viewport");I&&(I.scrollTop+=N.deltaY,N.stopPropagation())},[n]),q=C.useCallback(()=>{const N=new URLSearchParams(window.location.search),L=new URLSearchParams;L.set("paneId",e.paneId),N.forEach((G,F)=>{L.has(F)||L.set(F,G)});const I=`${window.location.pathname}${window.location.search}#/canvas-pane?${L.toString()}`;window.open(I,`canvas-pane-${e.paneId}`,"noopener,noreferrer")},[e.paneId]),V=m?{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100vw",height:"100vh",transform:"none",pointerEvents:"auto",zIndex:9999,borderRadius:0,border:"none",overflow:"hidden",boxShadow:"none"}:{transform:`translate(${v}px, ${g}px) scale(${k})`,transformOrigin:"top left",width:e.width,height:e.height,willChange:"transform",pointerEvents:"auto",zIndex:e.zIndex,borderRadius:8,border:`1px solid ${f}`,overflow:"hidden",boxShadow:n?"0 0 0 1px var(--color-canvas-tile-border-selected)":"0 2px 8px rgba(0,0,0,0.08)"},T=C.useCallback(N=>{var F;if(N.button!==0)return;c(e.id),p(e.id);const L=(F=A.current)==null?void 0:F.querySelector(".xterm-helper-textarea");if(!L)return;const I=()=>{try{L.focus()}catch{}};I();const G=()=>{window.removeEventListener("pointerup",G,!0),I()};window.addEventListener("pointerup",G,!0)},[e.id,c,p]);return r.jsxs("div",{className:m?"canvas-tile":"absolute canvas-tile",style:V,onPointerDownCapture:T,children:[r.jsxs("div",{className:"canvas-tile-header flex items-center gap-1.5 px-2 select-none",style:{height:32,background:"var(--color-canvas-tile-header)",color:"var(--color-canvas-tile-header-text)",cursor:"grab",borderBottom:u?"none":"1px solid var(--color-canvas-tile-border)"},onDoubleClick:S,children:[r.jsx(un,{size:13,style:{opacity:.5,flexShrink:0}}),r.jsx("span",{className:"flex-1 text-xs truncate",style:{fontSize:12,fontWeight:500},children:h||i("canvas.defaultTitle")}),r.jsx("button",{onClick:N=>{N.stopPropagation(),_()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:i("canvas.tileMenu.duplicate"),children:r.jsx(hr,{size:12})}),r.jsx("button",{onClick:N=>{N.stopPropagation(),q()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:i("canvas.tileMenu.openStandalone"),children:r.jsx(st,{size:12})}),r.jsx("button",{onClick:N=>{N.stopPropagation(),E()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:i(u?"canvas.tileMenu.restore":"canvas.tileMenu.minimize"),children:u?r.jsx(ns,{size:12}):r.jsx(yp,{size:12})}),r.jsx("button",{onClick:N=>{N.stopPropagation(),x()},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:i(m?"canvas.tileMenu.restore":"canvas.tileMenu.maximize"),children:m?r.jsx(vf,{size:12}):r.jsx(Qi,{size:12})}),r.jsx("button",{onClick:N=>{N.stopPropagation(),s(e.id)},className:"w-5 h-5 flex items-center justify-center rounded hover:bg-bg-hover transition-colors",style:{cursor:"pointer",border:"none",background:"transparent",color:"inherit"},title:i("canvas.tileMenu.close"),children:r.jsx(Te,{size:12})})]}),!u&&r.jsxs("div",{ref:A,className:"flex-1 relative",style:{height:"calc(100% - 32px)",overflow:"hidden"},children:[r.jsx(rs,{paneId:e.paneId,initialCwd:e.cwd??null,onPtyCreated:w}),r.jsx("div",{className:"absolute inset-0","data-canvas-tile-focused":n?"true":"false",style:{zIndex:5,pointerEvents:j?"none":"auto",background:"transparent"},onPointerDown:H,onPointerUp:M,onWheel:U})]}),!u&&Jb.map(N=>r.jsx("div",{className:`absolute ${N.className}`,style:{cursor:N.cursor,zIndex:10,opacity:0},"data-resize-handle":N.position},N.position))]})}function ey({rect:e}){return r.jsx("div",{className:"absolute pointer-events-none",style:{left:e.x,top:e.y,width:e.width,height:e.height,background:"var(--color-canvas-selection-fill)",border:"1px solid var(--color-canvas-selection-stroke)",borderRadius:2,zIndex:999}})}function ty(){const e=C.useRef(null),t=C.useRef(new ar),n=C.useRef(new Zb),i=Ce(N=>N.tiles),s=Ce(N=>N.viewport),l=Ce(N=>N.selectedTileIds),d=Ce(N=>N.setViewport),a=Ce(N=>N.updateTile),o=Ce(N=>N.selectTile),c=Ce(N=>N.selectTiles),p=Ce(N=>N.deselectAll),h=Ce(N=>N.bringToFront),[b,y]=C.useState(null),[k,v]=C.useState(!1),[g,m]=C.useState(!1),[u,f]=C.useState(null);C.useEffect(()=>{t.current.setState(s)},[s]);const x=C.useMemo(()=>Object.values(i).sort((N,L)=>N.zIndex-L.zIndex),[i]),E=C.useMemo(()=>new Set(l),[l]),_=C.useRef(s);_.current=s;const S=C.useRef({setViewport:d,updateTile:a,selectTile:o,deselectAll:p,bringToFront:h,selectTiles:c});S.current={setViewport:d,updateTile:a,selectTile:o,deselectAll:p,bringToFront:h,selectTiles:c};const w=.92,A=.01,D=3.5,R=C.useRef(null),j=C.useRef({vx:0,vy:0,last:0}),O=C.useCallback(()=>{R.current!==null&&(cancelAnimationFrame(R.current),R.current=null)},[]),H=C.useCallback((N,L)=>{O();const I=Math.hypot(N,L);if(I>D){const F=D/I;N*=F,L*=F}j.current={vx:N,vy:L,last:performance.now()};const G=()=>{const F=performance.now(),W=j.current,z=Math.min(32,F-W.last);W.last=F;const $=t.current.applyPan(W.vx*z,W.vy*z);S.current.setViewport($);const Y=Math.pow(w,z/16.67);if(W.vx*=Y,W.vy*=Y,Math.hypot(W.vx,W.vy)<A){R.current=null;return}R.current=requestAnimationFrame(G)};R.current=requestAnimationFrame(G)},[O]);C.useEffect(()=>()=>O(),[O]),C.useEffect(()=>{const N=n.current,L={onViewportPan:(I,G)=>{const W=t.current.applyPan(I,G);S.current.setViewport(W)},onTileMove:(I,G,F)=>{S.current.updateTile(I,{x:G,y:F})},onTileResize:(I,G)=>{S.current.updateTile(I,G)},onTileSelect:I=>{S.current.selectTile(I),S.current.bringToFront(I)},onSelectionBox:I=>{if(I){const G=e.current,F=G==null?void 0:G.getBoundingClientRect();y(F?{x:I.x-F.left,y:I.y-F.top,width:I.width,height:I.height}:I)}else y(null)},onBoxSelectEnd:()=>{},onTileClick:I=>{S.current.selectTile(I),S.current.bringToFront(I)},onCanvasClick:()=>{S.current.deselectAll()},onInteractionStart:()=>{O()},onPanInertiaStart:(I,G)=>{H(I,G)},getViewport:()=>_.current};return N.attach(L),()=>N.detach()},[]),C.useEffect(()=>{const N=e.current;if(!N)return;const L=t.current,I=W=>{const z=W.target,B=!!(z&&z.closest('.xterm, .xterm-screen, .xterm-viewport, input, textarea, [contenteditable="true"], [contenteditable=""]')),$=!!(z&&z.closest('[data-canvas-tile-focused="true"]')),Y=W.ctrlKey||W.metaKey;if((B||$)&&!Y&&!W.shiftKey)return;W.preventDefault();const X=N.getBoundingClientRect(),te=W.clientX-X.left,J=W.clientY-X.top;if(Y){const ie=L.applyZoom(W.deltaY,te,J);d(ie);return}let ae=-W.deltaX,ge=-W.deltaY;W.shiftKey&&ae===0&&(ae=-W.deltaY,ge=0);const de=W.deltaMode===1?16:W.deltaMode===2?100:1,he=L.applyPan(ae*de,ge*de);d(he)},G=W=>{if(!(W.ctrlKey||W.metaKey))return;const z=W.target;if(z){const B=z.tagName;if(B==="INPUT"||B==="TEXTAREA"||B==="SELECT"||z.isContentEditable)return}if(W.key==="+"||W.key==="="||W.key==="-"||W.key==="_"||W.key==="0"){W.preventDefault();const B=N.clientWidth,$=N.clientHeight;if(W.key==="0")d(L.resetView());else if(W.key==="-"||W.key==="_"){const Y=L.applyZoom(120,B/2,$/2);d(Y)}else{const Y=L.applyZoom(-120,B/2,$/2);d(Y)}}},F=W=>{W.preventDefault()};return N.addEventListener("wheel",I,{passive:!1}),window.addEventListener("keydown",G),N.addEventListener("gesturestart",F),N.addEventListener("gesturechange",F),N.addEventListener("gestureend",F),()=>{N.removeEventListener("wheel",I),window.removeEventListener("keydown",G),N.removeEventListener("gesturestart",F),N.removeEventListener("gesturechange",F),N.removeEventListener("gestureend",F)}},[d]);const M=C.useCallback(N=>{const L=e.current;if(!L)return;const I=N.button===1||N.button===2,G=n.current.isSpacePressed,F=L.getBoundingClientRect(),W=N.clientX-F.left,z=N.clientY-F.top,B=n.current;let $=null,Y=null,X=null;if(!I&&!G){const de=[...Object.values(i)].sort((he,ie)=>ie.zIndex-he.zIndex);for(const he of de){const ie=he.x*s.zoom+s.panX,Oe=he.y*s.zoom+s.panY,_e=he.width*s.zoom,re=he.height*s.zoom,ce={x:ie,y:Oe,width:_e,height:re},Ee=B.getResizeHandle(ce,W,z,Up);if(Ee){$=he.id,Y=Ee,X=he.id;break}if(B.isInTileHeader(ce,W,z,s.zoom)){$=he.id,X=he.id;break}if(W>=ie&&W<=ie+_e&&z>=Oe&&z<=Oe+re){X=he.id;break}}}const te=N.target;if(!I&&!G&&Y===null&&X&&E.has(X)&&te&&te.closest(".xterm, .xterm-screen, .xterm-viewport, .xterm-rows"))return;const J=N.target;if(J&&!(I||G||Y!==null)&&(J.closest("button")||J.closest("input, textarea:not(.xterm-helper-textarea), select")||J.closest('[contenteditable="true"], [contenteditable=""]')))return;if(I&&N.preventDefault(),!X&&!Y){const de=document.activeElement;de&&typeof de.blur=="function"&&de.blur(),p()}const ge=N.nativeEvent;B.handlePointerDown(ge,$,Y,i),X?(o(X),h(X)):(N.shiftKey||N.ctrlKey||N.metaKey)&&p(),L.setPointerCapture(N.pointerId),v(B.isSpacePressed)},[i,s,o,p,h,E]),U=C.useCallback(N=>{var I;const L=n.current;L.handlePointerMove(N.nativeEvent),v(L.isSpacePressed),m(L.isDragging),f(((I=L.currentDrag)==null?void 0:I.type)??null)},[]),q=C.useCallback(N=>{var G;const L=n.current;if(((G=L.currentDrag)==null?void 0:G.type)==="select"&&L.isDragging&&b){const F=s.zoom||1,W={x:(b.x-s.panX)/F,y:(b.y-s.panY)/F,width:b.width/F,height:b.height/F},z=L.getSelectedTileIds(W,i);c(z)}L.handlePointerUp(N.nativeEvent);const I=e.current;I&&I.releasePointerCapture(N.pointerId),m(!1),f(null),y(null)},[s,i,c,b]),T=g&&u==="pan"?"grabbing":k?"grab":"default";return r.jsxs("div",{ref:e,className:"absolute inset-0",style:{cursor:T,touchAction:"none",overscrollBehavior:"contain"},onPointerDown:M,onPointerMove:U,onPointerUp:q,onContextMenu:N=>N.preventDefault(),children:[r.jsx("div",{className:"absolute inset-0",style:{pointerEvents:"none"},children:x.map(N=>r.jsx(Qb,{tile:N,viewport:s,isSelected:E.has(N.id)},N.id))}),b&&r.jsx(ey,{rect:b})]})}function Vd(){const e=Ce(i=>i.tiles),{t}=ne(),n=Object.keys(e).length>0;return r.jsxs("div",{className:"relative w-full h-full overflow-hidden bg-bg-primary",children:[r.jsx(ty,{}),r.jsx(Yb,{}),!n&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:r.jsx("p",{className:"text-text-tertiary text-sm",children:t("canvas.empty")})})]})}function Kd(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function ny(e){if(Array.isArray(e))return e}function ry(e,t,n){return(t=dy(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iy(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,s,l,d,a=[],o=!0,c=!1;try{if(l=(n=n.call(e)).next,t!==0)for(;!(o=(i=l.call(n)).done)&&(a.push(i.value),a.length!==t);o=!0);}catch(p){c=!0,s=p}finally{try{if(!o&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(c)throw s}}return a}}function sy(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
620
620
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function Xd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Yd(Object(n),!0).forEach(function(i){ry(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yd(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function ay(e,t){if(e==null)return{};var n,i,s=oy(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(i=0;i<l.length;i++)n=l[i],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function oy(e,t){if(e==null)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.indexOf(i)!==-1)continue;n[i]=e[i]}return n}function ly(e,t){return ny(e)||iy(e,t)||uy(e,t)||sy()}function cy(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dy(e){var t=cy(e,"string");return typeof t=="symbol"?t:t+""}function uy(e,t){if(e){if(typeof e=="string")return Kd(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kd(e,t):void 0}}function py(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function Jd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zd(Object(n),!0).forEach(function(i){py(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zd(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function hy(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(i){return t.reduceRight(function(s,l){return l(s)},i)}}function En(e){return function t(){for(var n=this,i=arguments.length,s=new Array(i),l=0;l<i;l++)s[l]=arguments[l];return s.length>=e.length?e.apply(this,s):function(){for(var d=arguments.length,a=new Array(d),o=0;o<d;o++)a[o]=arguments[o];return t.apply(n,[].concat(s,a))}}}function _r(e){return{}.toString.call(e).includes("Object")}function my(e){return!Object.keys(e).length}function On(e){return typeof e=="function"}function gy(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function fy(e,t){return _r(t)||At("changeType"),Object.keys(t).some(function(n){return!gy(e,n)})&&At("changeField"),t}function by(e){On(e)||At("selectorType")}function yy(e){On(e)||_r(e)||At("handlerType"),_r(e)&&Object.values(e).some(function(t){return!On(t)})&&At("handlersType")}function xy(e){e||At("initialIsRequired"),_r(e)||At("initialType"),my(e)&&At("initialContent")}function vy(e,t){throw new Error(e[t]||e.default)}var _y={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},At=En(vy)(_y),Zn={changes:fy,selector:by,handler:yy,initial:xy};function Sy(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Zn.initial(e),Zn.handler(t);var n={current:e},i=En(Ey)(n,t),s=En(wy)(n),l=En(Zn.changes)(e),d=En(ky)(n);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(p){return p};return Zn.selector(c),c(n.current)}function o(c){hy(i,s,l,d)(c)}return[a,o]}function ky(e,t){return On(t)?t(e.current):t}function wy(e,t){return e.current=Jd(Jd({},e.current),t),t}function Ey(e,t,n){return On(t)?t(e.current):Object.keys(n).forEach(function(i){var s;return(s=t[i])===null||s===void 0?void 0:s.call(t,e.current[i])}),n}var Cy={create:Sy},Ty={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function Ny(e){return function t(){for(var n=this,i=arguments.length,s=new Array(i),l=0;l<i;l++)s[l]=arguments[l];return s.length>=e.length?e.apply(this,s):function(){for(var d=arguments.length,a=new Array(d),o=0;o<d;o++)a[o]=arguments[o];return t.apply(n,[].concat(s,a))}}}function Ay(e){return{}.toString.call(e).includes("Object")}function Iy(e){return e||Qd("configIsRequired"),Ay(e)||Qd("configType"),e.urls?(Ry(),{paths:{vs:e.urls.monacoBase}}):e}function Ry(){console.warn(Wp.deprecation)}function Ly(e,t){throw new Error(e[t]||e.default)}var Wp={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
621
621
|
You are using deprecated way of configuration.
|
|
622
622
|
|
|
@@ -678,7 +678,7 @@ ${n("tool.moreLinesCount").replace("{count}",String(s.length-t))}`})]})}function
|
|
|
678
678
|
text-text-primary focus:outline-none focus:border-accent-brand min-w-[180px]`,children:[r.jsx("option",{value:"",children:e("logs.selectWorker")}),i.map(_=>r.jsxs("option",{value:_.pid,children:["PID ",_.pid," — ",_.name||_.kind,_.isCurrent?` (${e("logs.current")})`:""]},_.pid))]}),a.length>0&&r.jsx("div",{className:"flex items-center gap-0.5 bg-bg-tertiary rounded-lg p-0.5",children:a.map(_=>{var S;return r.jsx("button",{onClick:()=>u(_),className:`px-2.5 py-1 text-[11px] font-medium rounded-md transition-colors ${_===d?"bg-bg-primary text-text-primary shadow-sm":"text-text-tertiary hover:text-text-secondary"}`,children:((S=pk[_])==null?void 0:S[t])||_},_)})}),r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"relative",children:[r.jsx(at,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-text-tertiary"}),r.jsx("input",{type:"text",value:b,onChange:_=>y(_.target.value),placeholder:e("logs.search"),className:`pl-7 pr-7 py-1.5 text-xs rounded-lg border border-border-primary bg-bg-secondary
|
|
679
679
|
text-text-primary placeholder:text-text-tertiary focus:outline-none focus:border-accent-brand w-[180px]`}),b&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"absolute right-8 top-1/2 -translate-y-1/2 text-[10px] text-text-tertiary",children:x}),r.jsx("button",{onClick:()=>y(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-tertiary hover:text-text-primary",children:r.jsx(Te,{size:12})})]})]}),r.jsxs("button",{onClick:()=>v(!k),className:`flex items-center gap-1 px-2.5 py-1.5 text-xs rounded-lg border transition-colors ${k?"border-accent-brand/40 bg-accent-brand/10 text-accent-brand":"border-border-primary text-text-secondary hover:text-text-primary"}`,title:e("logs.autoRefresh"),children:[r.jsx(qe,{size:12,className:k?"animate-spin":""}),e("logs.autoRefresh")]}),r.jsx("button",{onClick:m,className:"p-1.5 rounded-lg text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors",title:e("logs.refresh"),children:r.jsx(qe,{size:14})})]}),E&&r.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[11px] text-text-tertiary",children:[o&&r.jsx(St,{path:o,className:"font-mono truncate max-w-[400px]"}),E.url&&r.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:"text-accent-brand hover:underline",children:E.url})]})]}),r.jsx("div",{className:"flex-1 overflow-auto bg-bg-primary",children:p?!l&&a.length===0?r.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-sm",children:e("logs.empty")}):b?r.jsx("div",{ref:g,className:"p-4 font-mono text-xs leading-5 min-h-full",children:f?f.split(`
|
|
680
680
|
`).map((_,S)=>r.jsx(bk,{line:_,searchText:b},S)):r.jsx("span",{className:"text-text-tertiary",children:e("logs.empty")})}):r.jsx("div",{ref:g,className:"min-h-full",children:r.jsx(dk,{language:"log",style:n==="dark"?Fr:Br,showLineNumbers:!0,wrapLongLines:!0,customStyle:{margin:0,padding:"16px",border:"none",background:"transparent",fontSize:"12px",lineHeight:"1.5"},codeTagProps:{style:{background:"transparent",textShadow:"none"}},lineNumberStyle:{minWidth:"3em",paddingRight:"1em",color:"var(--color-text-tertiary)",userSelect:"none"},children:l||e("logs.empty")})}):r.jsx("div",{className:"flex items-center justify-center h-full text-text-tertiary text-sm",children:e("logs.selectWorker")})})]})}const mk={ERROR:"text-red-500 dark:text-red-400",WARN:"text-amber-600 dark:text-amber-400",INFO:"text-blue-500 dark:text-blue-400",DEBUG:"text-text-tertiary"},gk={ERROR:"bg-red-50/50 dark:bg-red-900/10",WARN:"bg-amber-50/50 dark:bg-amber-900/10"},fk=/^\[(\w+)\]\s/;function bk({line:e,searchText:t}){var o;if(!e.trim())return r.jsx("div",{className:"h-5"});const n=e.match(fk),i=((o=n==null?void 0:n[1])==null?void 0:o.toUpperCase())||"",s=mk[i]||"text-text-secondary",l=gk[i]||"",a=t&&e.toLowerCase().includes(t.toLowerCase())?"bg-yellow-100/60 dark:bg-yellow-900/20":"";return r.jsx("div",{className:`whitespace-pre-wrap break-all px-2 py-px rounded-sm ${l} ${a}`,children:n?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:`font-semibold ${s}`,children:["[",n[1],"]"]}),r.jsx("span",{className:"text-text-secondary",children:zu(e.slice(n[0].length),t)})]}):r.jsx("span",{className:"text-text-secondary",children:zu(e,t)})})}function zu(e,t){if(!t)return e;const n=e.toLowerCase(),i=t.toLowerCase(),s=[];let l=0,d=n.indexOf(i);for(;d!==-1;)d>l&&s.push(e.slice(l,d)),s.push(r.jsx("mark",{className:"bg-yellow-300 dark:bg-yellow-700 text-text-primary rounded-sm px-px",children:e.slice(d,d+t.length)},d)),l=d+t.length,d=n.indexOf(i,l);return l<e.length&&s.push(e.slice(l)),s.length>0?r.jsx(r.Fragment,{children:s}):e}const yk=8e3,xk=Ne((e,t)=>({metrics:null,loading:!1,error:null,_pollTimer:null,fetchMetrics:async()=>{e({loading:!t().metrics,error:null});try{const n=await ve("/api/v1/metrics",{headers:se()});if(!n.ok)throw new Error(`Failed to fetch metrics: ${n.status}`);const i=await n.json();e({metrics:i.data,loading:!1})}catch(n){e({error:n.message,loading:!1})}},startPolling:(n=yk)=>{const{stopPolling:i,fetchMetrics:s}=t();i(),s();const l=setInterval(s,n);e({_pollTimer:l})},stopPolling:()=>{const{_pollTimer:n}=t();n&&(clearInterval(n),e({_pollTimer:null}))}})),vk={interactive:"bg-blue-50 text-blue-700 border border-blue-200 dark:bg-blue-500/10 dark:text-blue-400 dark:border-blue-500/20",bg:"bg-purple-50 text-purple-700 border border-purple-200 dark:bg-purple-500/10 dark:text-purple-400 dark:border-purple-500/20",daemon:"bg-green-50 text-green-700 border border-green-200 dark:bg-green-500/10 dark:text-green-400 dark:border-green-500/20","daemon-worker":"bg-orange-50 text-orange-700 border border-orange-200 dark:bg-orange-500/10 dark:text-orange-400 dark:border-orange-500/20"};function _k(){const{t:e}=ne(),{metrics:t,loading:n,error:i,fetchMetrics:s,startPolling:l,stopPolling:d}=xk(),{workers:a,fetchWorkers:o}=Ur();if(C.useEffect(()=>(l(8e3),o(),()=>d()),[l,d,o]),n&&!t)return r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(ut,{size:"large",text:e("metrics.loading")})});if(i&&!t)return r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-text-secondary mb-4",children:i}),r.jsx("button",{onClick:s,className:"px-4 py-2 bg-accent-brand text-white rounded-lg text-sm",children:e("metrics.refresh")})]})});const c=Sk((t==null?void 0:t.instances)||[],a);return r.jsxs("div",{className:"flex-1 overflow-auto p-4 md:p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Vi,{size:20,className:"text-accent-brand"}),r.jsx("h1",{className:"text-lg font-semibold text-text-primary",children:e("metrics.title")})]}),r.jsxs("button",{onClick:()=>{s(),o()},className:`flex items-center gap-1.5 px-3 py-1.5 text-sm text-text-secondary
|
|
681
|
-
hover:text-text-primary hover:bg-bg-hover rounded-lg transition-colors`,title:e("metrics.refresh"),children:[r.jsx(qe,{size:14}),r.jsx("span",{children:e("metrics.refresh")})]})]}),t&&r.jsxs(r.Fragment,{children:[r.jsx(kk,{metrics:t}),r.jsx(wk,{workers:c})]})]})}function Sk(e,t){return e.map(n=>{const i=t.find(s=>s.pid===n.pid);return{...n,kind:i==null?void 0:i.kind,name:i==null?void 0:i.name,url:(i==null?void 0:i.url)||(i==null?void 0:i.endpoint),status:i==null?void 0:i.status}})}function kk({metrics:e}){const{t}=ne(),n=e.memTotalMib>0?e.memUsedMib/e.memTotalMib*100:0,i=e.diskTotal>0?e.diskUsed/e.diskTotal*100:0;return r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[r.jsx(bi,{icon:r.jsx(Wt,{size:18}),label:t("metrics.cpu"),value:`${e.cpuUsedPct.toFixed(1)}%`,subtext:`${e.cpuCount} ${t("metrics.cores")}`,percent:e.cpuUsedPct,colorClasses:dr(e.cpuUsedPct)}),r.jsx(bi,{icon:r.jsx(ki,{size:18}),label:t("metrics.memory"),value:`${Hu(e.memUsedMib)} / ${Hu(e.memTotalMib)}`,subtext:`${n.toFixed(1)}%`,percent:n,colorClasses:dr(n)}),r.jsx(bi,{icon:r.jsx(Ug,{size:18}),label:t("metrics.disk"),value:`${Gu(e.diskUsed)} / ${Gu(e.diskTotal)}`,subtext:`${i.toFixed(1)}%`,percent:i,colorClasses:dr(i)})]})}function bi({icon:e,label:t,value:n,subtext:i,percent:s,colorClasses:l}){const[d,a]=l;return r.jsxs("div",{className:"bg-bg-secondary rounded-xl p-4 border border-border-primary",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx("span",{className:d,children:e}),r.jsx("span",{className:"text-sm font-medium text-text-secondary",children:t})]}),r.jsx("div",{className:"text-xl font-semibold text-text-primary mb-1",children:n}),r.jsx("div",{className:"text-xs text-text-tertiary mb-3",children:i}),r.jsx("div",{className:"h-2 bg-bg-tertiary rounded-full overflow-hidden",children:r.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${a}`,style:{width:`${Math.min(s,100)}%`}})})]})}function wk({workers:e}){const{t}=ne();return e.length===0?r.jsx("div",{className:"text-center py-12 text-text-tertiary",children:t("metrics.noWorkers")}):r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Wt,{size:18,className:"text-text-secondary"}),r.jsxs("h2",{className:"text-base font-medium text-text-primary",children:["Workers (",e.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:e.map(n=>r.jsx(Ek,{worker:n},n.id))})]})}function Ek({worker:e}){const{t}=ne();return r.jsx("div",{className:`bg-bg-secondary rounded-xl p-4 md:p-5 border transition-colors hover:border-gray-300 dark:hover:border-gray-600 border-border-primary ${e.error?"opacity-60":""}`,children:r.jsxs("div",{className:"flex flex-col gap-4",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${e.error?"bg-red-400":"bg-green-400"}`}),e.kind&&r.jsx("span",{className:`inline-block px-2.5 py-0.5 text-xs font-medium rounded-md ${vk[e.kind]||"bg-gray-100 text-gray-600"}`,children:e.kind}),r.jsx("span",{className:"text-sm font-medium text-text-primary",children:e.name||e.hostname}),e.isCurrent&&r.jsx("span",{className:"text-[10px] uppercase font-bold tracking-wider px-1.5 py-0.5 bg-accent-brand/10 text-accent-brand rounded",children:t("metrics.current")}),e.error&&r.jsx("span",{className:"text-xs text-red-400",children:e.error})]}),r.jsxs("span",{className:"text-xs text-text-tertiary font-mono bg-bg-tertiary px-2 py-0.5 rounded-md border border-border-primary/50",children:["PID ",e.pid]})]}),r.jsxs("div",{className:"flex flex-col md:flex-row md:items-start justify-between gap-4 md:gap-6",children:[r.jsxs("div",{className:"flex flex-col gap-2.5 flex-1 min-w-0",children:[r.jsx(St,{path:e.cwd,displayMode:"basename",className:"text-[13px] text-text-secondary font-mono truncate max-w-full"}),e.url&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(st,{size:14,className:"text-text-tertiary flex-none"}),r.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-accent-brand hover:underline truncate",children:e.url})]})]}),e.rssMib>0||e.heapUsedMib>0?r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 flex-none",style:{minWidth:"460px"},children:[r.jsxs("div",{className:"min-w-[100px]",children:[r.jsx(Xt,{icon:r.jsx(ki,{size:14}),label:"RSS",value:`${e.rssMib.toFixed(0)} MiB`}),r.jsx("div",{className:"mt-1.5 h-1.5 bg-bg-tertiary rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full bg-blue-500 transition-all duration-500",style:{width:`${Math.min(e.rssMib/2048*100,100)}%`}})})]}),r.jsxs("div",{className:"min-w-[140px]",children:[r.jsx(Xt,{icon:r.jsx(ki,{size:14}),label:"Heap",value:`${e.heapUsedMib.toFixed(0)} / ${e.heapTotalMib.toFixed(0)} MiB`}),e.heapTotalMib>0&&r.jsx("div",{className:"mt-1.5 h-1.5 bg-bg-tertiary rounded-full overflow-hidden",children:r.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${dr(e.heapUsedMib/e.heapTotalMib*100)[1]}`,style:{width:`${Math.min(e.heapUsedMib/e.heapTotalMib*100,100)}%`}})})]}),r.jsx("div",{className:"min-w-[80px]",children:r.jsx(Xt,{icon:r.jsx(It,{size:14}),label:t("metrics.uptime"),value:Wu(e.uptimeSeconds)})}),r.jsx("div",{className:"min-w-[60px]",children:r.jsx(Xt,{icon:r.jsx(gr,{size:14}),label:t("metrics.version"),value:e.version||"-"})})]}):r.jsxs("div",{className:"grid grid-cols-2 gap-4 flex-none",style:{minWidth:"200px"},children:[r.jsx("div",{className:"min-w-[80px]",children:r.jsx(Xt,{icon:r.jsx(It,{size:14}),label:t("metrics.uptime"),value:Wu(e.uptimeSeconds)})}),r.jsx("div",{className:"min-w-[60px]",children:r.jsx(Xt,{icon:r.jsx(gr,{size:14}),label:t("metrics.version"),value:e.version||"-"})})]})]})]})})}function Xt({icon:e,label:t,value:n}){return r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-text-tertiary",children:[e,r.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wider",children:t})]}),r.jsx("div",{className:"text-sm font-semibold text-text-primary",style:{fontVariantNumeric:"tabular-nums"},children:n})]})}function dr(e){return e>=90?["text-red-500","bg-red-500"]:e>=70?["text-amber-500","bg-amber-500"]:["text-green-500","bg-green-500"]}function Hu(e){return e>=1024?`${(e/1024).toFixed(1)} GiB`:`${e} MiB`}function Gu(e){if(e===0)return"0 B";const t=e/(1024*1024*1024);return t>=1?`${t.toFixed(1)} GB`:`${(e/(1024*1024)).toFixed(0)} MB`}function Wu(e){if(e<60)return`${e}s`;if(e<3600)return`${Math.floor(e/60)}m ${e%60}s`;const t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>=24?`${Math.floor(t/24)}d ${t%24}h`:`${t}h ${n}m`}function Ck({onNavigate:e}){const{t}=ne(),[n,i]=C.useState(xr);if(C.useEffect(()=>{const s=()=>i(xr());return window.addEventListener("hashchange",s),()=>window.removeEventListener("hashchange",s)},[]),n==="add-wechat"||n!=null&&n.startsWith("rebind-wechat/")){const s=n!=null&&n.startsWith("rebind-wechat/")?n.split("/")[1]:void 0;return r.jsx(Nk,{onBack:()=>zd("remote-control"),t,existingInstanceId:s})}return n==="add-wecom"?r.jsx(Ak,{onBack:()=>zd("remote-control"),t}):r.jsx(Tk,{onNavigate:e,t})}function Tk({onNavigate:e,t}){const[n,i]=C.useState([]),[s,l]=C.useState(!0),[d,a]=C.useState(null),[o,c]=C.useState(null),p=C.useCallback(async()=>{try{const _=await ve("/api/v1/channels");if(_.ok){const S=await _.json();i((S.clients||[]).filter(w=>!w.hidden&&!w.instanceId.startsWith("_pending")))}}catch{}finally{l(!1)}},[]);C.useEffect(()=>{p();const _=setInterval(p,5e3);return()=>clearInterval(_)},[p]);const h=C.useCallback(async(_,S,w)=>{const A=`${S}:${w}:${_}`;c(A),a(null);try{const D=_==="delete"?"DELETE":"POST",R=_==="delete"?`/api/v1/channels/${S}/${w}`:`/api/v1/channels/${S}/${w}/${_}`,j=await ve(R,{method:D});if(!j.ok){const H=await j.json().catch(()=>({}));throw new Error(H.error||`Failed: ${j.status}`)}const O=await j.json().catch(()=>({}));if(_==="unbind"&&S==="wechat"&&O.needsQrScan){wn("remote-control",`rebind-wechat/${w}`);return}await p()}catch(D){a((D==null?void 0:D.message)||"Action failed")}finally{c(null)}},[p]),b=_=>_==="connected"?"text-green-500":_==="connecting"?"text-yellow-500":_==="error"?"text-red-500":"text-text-tertiary",y=_=>t(_==="connected"?"remoteControl.connected":_==="connecting"?"remoteControl.connecting":"remoteControl.disconnected"),k=_=>_==="wechat"?r.jsx(bp,{size:18,className:"text-green-500"}):_==="wecom"?r.jsx(mr,{size:18,className:"text-accent-brand"}):r.jsx(Rd,{size:18,className:"text-text-tertiary"}),v=_=>_==="wechat"?t("channel.wechat")+t("remoteControl.bot"):_==="wecom"?t("channel.wecom")+t("remoteControl.bot"):_,g=_=>`${v(_.clientType)} #${_.instanceId.slice(0,4)}`,m=n.filter(_=>_.clientType==="wechat"),u=n.filter(_=>_.clientType==="wecom"),f=n.filter(_=>_.clientType!=="wechat"&&_.clientType!=="wecom"),x=_=>{const S=`${_.clientType}:${_.instanceId}`,w=_.status==="connected",A=o==null?void 0:o.startsWith(S);return r.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-bg-secondary hover:bg-bg-hover transition-colors cursor-pointer",onClick:()=>{A||h(w?"stop":"start",_.clientType,_.instanceId)},children:[k(_.clientType),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-sm font-medium text-text-primary truncate",children:g(_)}),r.jsx("span",{className:`text-xs ${b(_.status)}`,children:y(_.status)})]}),r.jsxs("div",{className:"flex items-center gap-1",onClick:D=>D.stopPropagation(),children:[r.jsx("button",{className:`p-1.5 rounded-md text-text-tertiary transition-colors ${w?"hover:text-orange-500":"hover:text-green-500"} hover:bg-bg-hover`,title:t(w?"remoteControl.disconnect":"remoteControl.connect"),disabled:!!A,onClick:()=>h(w?"stop":"start",_.clientType,_.instanceId),children:w?r.jsx(Rd,{size:14}):r.jsx(nf,{size:14})}),w&&r.jsx("button",{className:"p-1.5 rounded-md text-text-tertiary hover:text-orange-500 hover:bg-bg-hover transition-colors",title:t("remoteControl.unbind"),disabled:!!A,onClick:()=>h("unbind",_.clientType,_.instanceId),children:r.jsx(qe,{size:14})}),r.jsx("button",{className:"p-1.5 rounded-md text-text-tertiary hover:text-red-500 hover:bg-bg-hover transition-colors",title:t("remoteControl.delete"),disabled:!!A,onClick:()=>h("delete",_.clientType,_.instanceId),children:r.jsx(pn,{size:14})})]})]},S)},E=(_,S,w,A)=>r.jsxs("div",{children:[r.jsx("h2",{className:"text-sm font-medium text-text-secondary mb-2",children:_}),S.length===0?r.jsx("div",{className:"py-4 text-center text-xs text-text-tertiary",children:t("remoteControl.noChannels")}):r.jsx("div",{className:"space-y-2",children:S.map(x)}),w&&r.jsxs("button",{className:"flex items-center gap-1.5 mt-2 px-3 py-1.5 text-xs text-text-tertiary hover:text-text-primary hover:bg-bg-hover rounded-md transition-colors",onClick:w,children:[r.jsx(ot,{size:12}),A||t("remoteControl.add")]})]});return r.jsxs("div",{className:"flex flex-col h-full overflow-y-auto",children:[r.jsxs("div",{className:"px-6 py-5 border-b border-border-primary",children:[r.jsx("h1",{className:"text-lg font-semibold text-text-primary",children:t("remoteControl.title")}),r.jsx("p",{className:"text-sm text-text-tertiary mt-1",children:t("remoteControl.subtitle")})]}),r.jsxs("div",{className:"px-6 py-4 flex-1 space-y-6",children:[d&&r.jsx("div",{className:"p-3 rounded-lg bg-red-500/10 text-red-500 text-sm",children:d}),s?r.jsx("div",{className:"text-sm text-text-tertiary py-4",children:t("remoteControl.connecting")}):n.length===0?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"py-8 text-center",children:[r.jsx(mr,{size:32,className:"mx-auto mb-3 text-text-tertiary opacity-50"}),r.jsx("p",{className:"text-sm text-text-tertiary",children:t("remoteControl.noChannels")}),r.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:t("remoteControl.noChannelsHint")})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("button",{className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-bg-secondary hover:bg-bg-hover text-sm text-text-primary transition-colors border border-border-primary",onClick:()=>wn("remote-control","add-wechat"),children:[r.jsx(ot,{size:14}),t("remoteControl.addWeChat")]}),r.jsxs("button",{className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-bg-secondary hover:bg-bg-hover text-sm text-text-primary transition-colors border border-border-primary",onClick:()=>wn("remote-control","add-wecom"),children:[r.jsx(ot,{size:14}),t("remoteControl.addWeCom")]})]})]}):r.jsxs(r.Fragment,{children:[E(t("channel.wechat")+t("remoteControl.bot"),m,()=>wn("remote-control","add-wechat"),t("remoteControl.addWeChat")),E(t("channel.wecom")+t("remoteControl.bot"),u,()=>wn("remote-control","add-wecom"),t("remoteControl.addWeCom")),f.length>0&&E(t("remoteControl.plugin"),f)]}),r.jsx("hr",{className:"border-border-primary"}),r.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg bg-bg-secondary hover:bg-bg-hover cursor-pointer transition-colors border border-border-primary",onClick:()=>{e?e("plugins"):window.location.hash="#/plugins"},children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-sm font-medium text-text-primary",children:t("remoteControl.installMore")}),r.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:t("remoteControl.installMoreHint")})]}),r.jsx(Pm,{size:16,className:"text-text-tertiary"})]})]})]})}function Nk({onBack:e,t,existingInstanceId:n}){const[i,s]=C.useState(null),[l,d]=C.useState(t("remoteControl.fetchingQr")),[a,o]=C.useState(n??null),[c,p]=C.useState(null),[h,b]=C.useState(!1);return C.useEffect(()=>{let y=!1;return(async()=>{try{let k=n;if(!k){const v=await ve("/api/v1/channels/wechat",{method:"POST"});if(!v.ok)throw new Error((await v.json().catch(()=>({}))).error||"Failed");const g=await v.json();if(y)return;k=g.instanceId,o(k)}for(let v=0;v<180&&!y;v++){await new Promise(g=>setTimeout(g,1e3));try{const g=await fetch(`/api/v1/channels/wechat/${k}/qr`,{headers:se()});if(!g.ok)continue;const m=await g.json();if(y)return;if(m.qrUrl&&s(m.qrUrl),m.message&&d(m.message),m.type==="confirmed"){b(!0),d(t("remoteControl.connected")),setTimeout(()=>{y||e()},1500);return}if(m.type==="error"){p(m.message);return}}catch{}}!y&&!h&&p("Timeout")}catch(k){y||p((k==null?void 0:k.message)||"Failed")}})(),()=>{y=!0}},[n]),r.jsxs("div",{className:"flex flex-col h-full overflow-y-auto",children:[r.jsxs("div",{className:"px-6 py-5 border-b border-border-primary flex items-center gap-3",children:[r.jsx("button",{onClick:e,className:"p-1 rounded-md hover:bg-bg-hover transition-colors",children:r.jsx(cn,{size:18})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-lg font-semibold text-text-primary",children:t("remoteControl.addWeChat")}),r.jsx("p",{className:"text-sm text-text-tertiary",children:t("remoteControl.scanQr")})]})]}),r.jsx("div",{className:"flex-1 flex flex-col items-center justify-center px-6 py-8",children:c?r.jsxs("div",{className:"text-center space-y-4",children:[r.jsx("p",{className:"text-red-500",children:c}),r.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg bg-bg-secondary hover:bg-bg-hover text-sm border border-border-primary",children:t("remoteControl.cancel")})]}):i?r.jsxs("div",{className:"text-center space-y-4",children:[r.jsx("div",{className:"inline-block p-4 bg-white rounded-xl",children:r.jsx("img",{src:`https://api.qrserver.com/v1/create-qr-code/?size=240x240&data=${encodeURIComponent(i)}`,alt:"QR Code",className:"w-60 h-60"})}),r.jsx("p",{className:"text-sm text-text-secondary",children:l})]}):r.jsxs("div",{className:"text-center space-y-3",children:[r.jsx("div",{className:"w-8 h-8 mx-auto border-2 border-accent-brand border-t-transparent rounded-full animate-spin"}),r.jsx("p",{className:"text-sm text-text-tertiary",children:l})]})})]})}function Ak({onBack:e,t}){const[n,i]=C.useState(""),[s,l]=C.useState(""),[d,a]=C.useState("botId"),[o,c]=C.useState(!1),[p,h]=C.useState(null),b=C.useCallback(async()=>{if(!(!n.trim()||!s.trim())){c(!0),h(null);try{const y=await ve("/api/v1/channels/wecom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botId:n.trim(),secret:s.trim()})});if(!y.ok){const k=await y.json().catch(()=>({}));throw new Error(k.error||"Failed")}e()}catch(y){h((y==null?void 0:y.message)||"Failed")}finally{c(!1)}}},[n,s,e]);return r.jsxs("div",{className:"flex flex-col h-full overflow-y-auto",children:[r.jsxs("div",{className:"px-6 py-5 border-b border-border-primary flex items-center gap-3",children:[r.jsx("button",{onClick:e,className:"p-1 rounded-md hover:bg-bg-hover transition-colors",children:r.jsx(cn,{size:18})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-lg font-semibold text-text-primary",children:t("remoteControl.addWeCom")}),r.jsx("p",{className:"text-sm text-text-tertiary",children:t("remoteControl.wecomBotIdHint")})]})]}),r.jsxs("div",{className:"px-6 py-8 max-w-md mx-auto w-full space-y-6",children:[p&&r.jsx("div",{className:"p-3 rounded-lg bg-red-500/10 text-red-500 text-sm",children:p}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium text-text-primary",children:"Bot ID"}),r.jsx("input",{type:"text",className:"w-full px-3 py-2 rounded-lg bg-bg-secondary border border-border-primary text-sm text-text-primary placeholder-text-tertiary focus:outline-none focus:border-accent-brand transition-colors",placeholder:t("channel.botIdPlaceholder"),value:n,onChange:y=>i(y.target.value),autoFocus:!0,disabled:d==="secret",onKeyDown:y=>{y.key==="Enter"&&n.trim()&&a("secret")}})]}),d==="secret"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium text-text-primary",children:"Secret"}),r.jsx("input",{type:"password",className:"w-full px-3 py-2 rounded-lg bg-bg-secondary border border-border-primary text-sm text-text-primary placeholder-text-tertiary focus:outline-none focus:border-accent-brand transition-colors",placeholder:t("channel.secretPlaceholder"),value:s,onChange:y=>l(y.target.value),autoFocus:!0,onKeyDown:y=>{y.key==="Enter"&&s.trim()&&b()}}),r.jsx("p",{className:"text-xs text-text-tertiary",children:t("remoteControl.wecomSecretHint")})]}),r.jsxs("div",{className:"flex gap-3 pt-2",children:[d==="botId"?r.jsx("button",{className:"px-4 py-2 rounded-lg bg-accent-brand text-white text-sm hover:bg-accent-brand/90 transition-colors disabled:opacity-50",disabled:!n.trim(),onClick:()=>a("secret"),children:t("remoteControl.next")}):r.jsx("button",{className:"px-4 py-2 rounded-lg bg-accent-brand text-white text-sm hover:bg-accent-brand/90 transition-colors disabled:opacity-50",disabled:!s.trim()||o,onClick:b,children:t(o?"remoteControl.connecting":"remoteControl.connect")}),r.jsx("button",{className:"px-4 py-2 rounded-lg bg-bg-secondary border border-border-primary text-sm text-text-secondary hover:bg-bg-hover transition-colors",onClick:e,children:t("remoteControl.cancel")})]})]})]})}const Ik="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23copilot-clip-34e811bed903495093b85bf96a98fb1b_0)'%3e%3crect%20width='24'%20height='24'%20rx='12'%20fill='%234C4F6B'%3e%3c/rect%3e%3cpath%20d='M3.4689%2011.0144C3.32344%2011.2025%203.31607%2011.4567%203.4345%2012.0298C3.65883%2013.0748%204.24029%2014.4426%205.15579%2016.0716L5.747%2017.1172L5.72862%2017.511C5.70544%2017.9326%205.72848%2018.5857%205.77921%2019.0271C5.80994%2019.2967%205.8055%2019.3035%205.66483%2019.4638C5.12042%2020.0864%205.03916%2021.1287%205.44787%2022.2839C5.62456%2022.7775%206.16958%2023.6999%206.50726%2024.0756C7.35392%2025.0154%208.35051%2025.4646%209.11147%2025.246C9.25446%2025.2051%209.28403%2025.213%209.47117%2025.3424C10.182%2025.8233%2011.3834%2026.2377%2012.4447%2026.3663C14.2242%2026.5843%2016.2727%2026.143%2018.8281%2024.9925C19.8948%2024.5099%2022.2541%2023.1352%2023.2513%2022.4096C25.1083%2021.0667%2026.4805%2019.6414%2027.251%2018.2635C27.9337%2017.0364%2028.2735%2015.7781%2028.2495%2014.5174C28.2466%2014.2525%2028.2536%2014.2359%2028.3599%2014.1746C28.8797%2013.8703%2029.1497%2013.198%2029.0927%2012.3562C29.075%2012.1165%2029.0266%2011.7946%2028.9902%2011.6448C28.7404%2010.7144%2028.0885%209.59971%2027.4078%208.94729C26.6515%208.22182%2025.7943%207.9129%2025.1958%208.14598C25.0631%208.19758%2025.0452%208.19542%2024.9177%208.08995C24.6357%207.86124%2023.9604%207.43473%2023.5488%207.22673L23.1224%207.01477L22.8206%206.45595C22.0392%205.01609%2020.7826%203.33003%2019.8801%202.50992C19.4937%202.15818%2019.2668%202.03929%2019.019%202.05739C18.866%202.06657%2018.8535%202.07379%2018.645%202.26084C18.0389%202.79819%2017.1889%204.41355%2016.3588%206.60463L16.1271%207.21325L15.7053%207.34845C14.3909%207.76995%2013.2238%208.30219%2012.1896%208.94928C11.1973%209.56799%2010.6591%209.97037%209.84886%2010.688L9.36087%2011.1197L9.13878%2011.0813C7.00072%2010.7039%205.07892%2010.5639%204.19776%2010.7186C3.84772%2010.7832%203.55743%2010.9008%203.4689%2011.0144Z'%20fill='%23D2D3E0'%3e%3c/path%3e%3crect%20x='6.68555'%20y='16.3788'%20width='17.7918'%20height='11.5605'%20rx='4.61469'%20transform='rotate(-30%206.68555%2016.3788)'%20fill='%23212234'%3e%3c/rect%3e%3cg%3e%3crect%20x='12.2119'%20y='17.2593'%20width='2.13173'%20height='4.42744'%20rx='1.06587'%20transform='rotate(-30%2012.2119%2017.2593)'%20fill='%23D2D3E0'%3e%3canimate%20attributeName='height'%20values='4.42744;2.2;4.42744;4.42744;2.2;4.42744'%20dur='0.6s'%20begin='0s;blink134e811bed903495093b85bf96a98fb1b_0.end+3s'%20id='blink134e811bed903495093b85bf96a98fb1b_0'%3e%3c/animate%3e%3canimate%20attributeName='y'%20values='17.2593;18.2593;17.2593;17.2593;18.2593;17.2593'%20dur='0.6s'%20begin='0s;blink134e811bed903495093b85bf96a98fb1b_0.end+3s'%3e%3c/animate%3e%3canimate%20attributeName='opacity'%20values='1;0.2;1;1;0.2;1'%20dur='0.6s'%20begin='0s;blink134e811bed903495093b85bf96a98fb1b_0.end+3s'%3e%3c/animate%3e%3c/rect%3e%3c/g%3e%3cg%3e%3crect%20x='17.9634'%20y='13.9387'%20width='2.13173'%20height='4.42744'%20rx='1.06587'%20transform='rotate(-30%2017.9634%2013.9387)'%20fill='%23D2D3E0'%3e%3canimate%20attributeName='height'%20values='4.42744;2.2;4.42744;4.42744;2.2;4.42744'%20dur='0.6s'%20begin='0s;blink234e811bed903495093b85bf96a98fb1b_0.end+3s'%20id='blink234e811bed903495093b85bf96a98fb1b_0'%3e%3c/animate%3e%3canimate%20attributeName='y'%20values='13.9387;14.9387;13.9387;13.9387;14.9387;13.9387'%20dur='0.6s'%20begin='0s;blink234e811bed903495093b85bf96a98fb1b_0.end+3s'%3e%3c/animate%3e%3canimate%20attributeName='opacity'%20values='1;0.2;1;1;0.2;1'%20dur='0.6s'%20begin='0s;blink234e811bed903495093b85bf96a98fb1b_0.end+3s'%3e%3c/animate%3e%3c/rect%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='copilot-clip-34e811bed903495093b85bf96a98fb1b_0'%3e%3crect%20width='24'%20height='24'%20rx='12'%20fill='white'%3e%3c/rect%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Rk="/assets/logo-iZVLr450.svg";function Lk({isOpen:e,onClose:t,mainView:n,onNavigate:i}){const{t:s}=ne(),{userInfo:l}=tp(),d=Ht(p=>p.info),a=Ht(p=>p.fetch),o=Nn(p=>p.fileChanges.length);C.useEffect(()=>{d||a()},[a,d]);const c=(l==null?void 0:l.userName)||(d==null?void 0:d.userName)||s("sidebar.user");return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:`sidebar-overlay ${e?"":"sidebar-overlay-hidden"}`,onClick:t}),r.jsxs("aside",{className:`sidebar ${e?"":"sidebar-closed"}`,role:"navigation","aria-label":"Main navigation",children:[r.jsxs("div",{className:"sidebar-header",children:[r.jsx("img",{src:Rk,alt:"CodeBuddy",className:"sidebar-logo"}),r.jsx("span",{className:"sidebar-brand",children:"CodeBuddy"}),r.jsx("div",{className:"flex-1"}),r.jsx("button",{onClick:t,className:"md:hidden w-7 h-7 flex items-center justify-center rounded-md text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors","aria-label":"Close sidebar",children:r.jsx(Te,{size:16})})]}),r.jsxs("nav",{className:"sidebar-nav","aria-label":"Primary",children:[r.jsxs("button",{className:`sidebar-nav-item ${n==="chat"?"active":""}`,onClick:()=>i("chat"),"aria-current":n==="chat"?"page":void 0,children:[r.jsx(dn,{size:16}),r.jsx("span",{children:s("sidebar.chatMode")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="workers"?"active":""}`,onClick:()=>i("workers"),children:[r.jsx(Wt,{size:16}),r.jsx("span",{children:s("sidebar.workers")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="remote-control"?"active":""}`,onClick:()=>i("remote-control"),children:[r.jsx(mr,{size:16}),r.jsx("span",{children:s("sidebar.remoteControl")})]})]}),r.jsx("div",{className:"sidebar-content",children:r.jsxs("div",{className:"px-3 py-1",children:[r.jsx("div",{className:"sidebar-section-title",children:s("sidebar.group.workspace")}),r.jsxs("button",{className:`sidebar-nav-item ${n==="tasks"?"active":""}`,onClick:()=>i("tasks"),children:[r.jsx(Ji,{size:16}),r.jsx("span",{children:s("sidebar.nav.tasks")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="terminal"?"active":""}`,onClick:()=>i("terminal"),children:[r.jsx(un,{size:16}),r.jsx("span",{children:s("sidebar.terminalMode")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="canvas"?"active":""}`,onClick:()=>i("canvas"),children:[r.jsx(gp,{size:16}),r.jsx("span",{children:s("sidebar.canvas")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="editor"?"active":""}`,onClick:()=>i("editor"),children:[r.jsx(lp,{size:16}),r.jsx("span",{children:s("sidebar.editor")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="changes"?"active":""}`,onClick:()=>i("changes"),children:[r.jsx(Nr,{size:16}),r.jsx("span",{children:s("sidebar.changes")}),o>0&&r.jsx("span",{className:"sidebar-badge",children:o})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="plugins"?"active":""}`,onClick:()=>i("plugins"),children:[r.jsx(Bt,{size:16}),r.jsx("span",{children:s("sidebar.nav.plugins")})]}),r.jsx("div",{className:"sidebar-section-title",children:s("sidebar.group.observability")}),r.jsxs("button",{className:`sidebar-nav-item ${n==="stats"?"active":""}`,onClick:()=>i("stats"),children:[r.jsx(Yi,{size:16}),r.jsx("span",{children:s("sidebar.stats")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="traces"?"active":""}`,onClick:()=>i("traces"),children:[r.jsx(Tp,{size:16}),r.jsx("span",{children:s("sidebar.traces")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="metrics"?"active":""}`,onClick:()=>i("metrics"),children:[r.jsx(Vi,{size:16}),r.jsx("span",{children:s("sidebar.metrics")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="logs"?"active":""}`,onClick:()=>i("logs"),children:[r.jsx(Xi,{size:16}),r.jsx("span",{children:s("sidebar.logs")})]}),r.jsx("div",{className:"sidebar-section-title",children:s("sidebar.group.preferences")}),r.jsxs("button",{className:`sidebar-nav-item ${n==="settings"?"active":""}`,onClick:()=>i("settings"),children:[r.jsx(ts,{size:16}),r.jsx("span",{children:s("sidebar.preferences")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="keybindings"?"active":""}`,onClick:()=>i("keybindings"),children:[r.jsx(mp,{size:16}),r.jsx("span",{children:s("sidebar.keybindings")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="docs"?"active":""}`,onClick:()=>i("docs"),children:[r.jsx(Ki,{size:16}),r.jsx("span",{children:s("sidebar.docs")})]})]})}),r.jsx("div",{className:"sidebar-footer",children:r.jsxs("div",{className:"sidebar-user",children:[r.jsx("img",{src:Ik,alt:"User",className:"sidebar-user-avatar"}),r.jsxs("div",{className:"sidebar-user-info",children:[r.jsx("div",{className:"sidebar-user-name",children:c}),(d==null?void 0:d.version)&&r.jsxs("div",{className:"sidebar-user-status",children:["v",d.version]})]})]})})]})]})}const Dk=Ne((e,t)=>({stats:null,statsLoading:!1,statsError:null,sessionStats:null,sessionLoading:!1,sessionError:null,fetchStats:async()=>{e({statsLoading:!t().stats,statsError:null});try{const n=await ve("/api/v1/stats",{headers:se()});if(!n.ok)throw new Error(`HTTP ${n.status}`);const i=await n.json();e({stats:i.data,statsLoading:!1})}catch(n){e({statsError:n.message,statsLoading:!1})}},fetchSessionStats:async()=>{e({sessionLoading:!t().sessionStats,sessionError:null});try{const n=await ve("/api/v1/stats/session",{headers:se()});if(!n.ok)throw new Error(`HTTP ${n.status}`);const i=await n.json();e({sessionStats:i.data,sessionLoading:!1})}catch(n){e({sessionError:n.message,sessionLoading:!1})}},fetchAll:async()=>{await Promise.all([t().fetchStats(),t().fetchSessionStats()])}}));function Rt(e){return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"k":e.toString()}function Gi(e){if(e<=0)return"-";const t=Math.floor(e/1e3),n=Math.floor(t/60),i=Math.floor(n/60);return i>0?`${i}h ${n%60}m ${t%60}s`:n>0?`${n}m ${t%60}s`:`${t}s`}function md(e){return e.replace(/^anthropic\./,"").replace(/^openai\./,"").replace(/-\d{8}$/,"").replace(/@.*$/,"")}function Ok(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric"})}const $k=["#ebedf0","#9be9a8","#40c463","#30a14e","#216e39"],jk=["#161b22","#0e4429","#006d32","#26a641","#39d353"],qu=["#3b82f6","#10b981","#8b5cf6"],Mk=[{name:"The Little Prince",tokens:22e3},{name:"The Old Man and the Sea",tokens:35e3},{name:"A Christmas Carol",tokens:37e3},{name:"Animal Farm",tokens:39e3},{name:"Fahrenheit 451",tokens:6e4},{name:"The Great Gatsby",tokens:62e3},{name:"Brave New World",tokens:83e3},{name:"Harry Potter and the Philosopher's Stone",tokens:103e3},{name:"1984",tokens:123e3},{name:"Pride and Prejudice",tokens:156e3},{name:"Dune",tokens:244e3},{name:"A Game of Thrones",tokens:381e3},{name:"The Lord of the Rings",tokens:576e3},{name:"War and Peace",tokens:73e4}],Pk=[{name:"朝花夕拾",tokens:18e3},{name:"骆驼祥子",tokens:6e4},{name:"活着",tokens:72e3},{name:"围城",tokens:84e3},{name:"三体",tokens:126e3},{name:"射雕英雄传",tokens:234e3},{name:"红楼梦",tokens:438e3},{name:"三国演义",tokens:48e4},{name:"西游记",tokens:492e3},{name:"水浒传",tokens:576e3},{name:"平凡的世界",tokens:6e5},{name:"金庸全集",tokens:636e4}],Fk=[{en:"a TED talk",zh:"一场 TED 演讲",minutes:18},{en:"an episode of The Office",zh:"一集《办公室》",minutes:22},{en:"listening to Abbey Road",zh:"听一遍《Abbey Road》专辑",minutes:47},{en:"a yoga class",zh:"一节瑜伽课",minutes:60},{en:"a World Cup soccer match",zh:"一场世界杯比赛",minutes:90},{en:"a half marathon (average time)",zh:"一场半程马拉松",minutes:120},{en:"the movie Inception",zh:"电影《盗梦空间》",minutes:148},{en:"watching Titanic",zh:"电影《泰坦尼克号》",minutes:195},{en:"a transatlantic flight",zh:"一趟跨大西洋航班",minutes:420},{en:"a full night of sleep",zh:"一整晚的睡眠",minutes:480}];function Bk(e,t,n,i){const s=[],l=i==="zh"?Pk:Mk;if(t>0){for(const d of l)if(t>=d.tokens){const a=t/d.tokens;s.push(a>=2?n("stats.funFact.moreTokens").replace("{times}",String(Math.floor(a))).replace("{book}",d.name):n("stats.funFact.sameTokens").replace("{book}",d.name))}}if(e.longestSession){const d=e.longestSession.duration/6e4;for(const a of Fk){const o=d/a.minutes;if(o>=2){const c=i==="zh"?a.zh:a.en;s.push(n("stats.funFact.longerSession").replace("{times}",String(Math.floor(o))).replace("{activity}",c))}}}return s.length===0?"":s[Math.floor(Math.random()*s.length)]}function Uk(){const{t:e}=ne(),{stats:t,statsLoading:n,statsError:i,sessionStats:s,fetchAll:l}=Dk(),[d,a]=C.useState("overview");if(C.useEffect(()=>{l()},[l]),n&&!t)return r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(ut,{size:"large",text:e("stats.loading")})});if(i&&!t)return r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-text-secondary mb-4",children:i}),r.jsx("button",{onClick:l,className:"px-4 py-2 bg-accent-brand text-white rounded-lg text-sm",children:e("stats.refresh")})]})});const o=[{key:"overview",label:e("stats.tab.overview")},{key:"models",label:e("stats.tab.models")},{key:"tools",label:e("stats.tab.tools")}];return r.jsxs("div",{className:"flex-1 overflow-auto p-4 md:p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yi,{size:20,className:"text-accent-brand"}),r.jsx("h1",{className:"text-lg font-semibold text-text-primary",children:e("stats.title")})]}),r.jsxs("button",{onClick:l,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm text-text-secondary
|
|
681
|
+
hover:text-text-primary hover:bg-bg-hover rounded-lg transition-colors`,title:e("metrics.refresh"),children:[r.jsx(qe,{size:14}),r.jsx("span",{children:e("metrics.refresh")})]})]}),t&&r.jsxs(r.Fragment,{children:[r.jsx(kk,{metrics:t}),r.jsx(wk,{workers:c})]})]})}function Sk(e,t){return e.map(n=>{const i=t.find(s=>s.pid===n.pid);return{...n,kind:i==null?void 0:i.kind,name:i==null?void 0:i.name,url:(i==null?void 0:i.url)||(i==null?void 0:i.endpoint),status:i==null?void 0:i.status}})}function kk({metrics:e}){const{t}=ne(),n=e.memTotalMib>0?e.memUsedMib/e.memTotalMib*100:0,i=e.diskTotal>0?e.diskUsed/e.diskTotal*100:0;return r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[r.jsx(bi,{icon:r.jsx(Wt,{size:18}),label:t("metrics.cpu"),value:`${e.cpuUsedPct.toFixed(1)}%`,subtext:`${e.cpuCount} ${t("metrics.cores")}`,percent:e.cpuUsedPct,colorClasses:dr(e.cpuUsedPct)}),r.jsx(bi,{icon:r.jsx(ki,{size:18}),label:t("metrics.memory"),value:`${Hu(e.memUsedMib)} / ${Hu(e.memTotalMib)}`,subtext:`${n.toFixed(1)}%`,percent:n,colorClasses:dr(n)}),r.jsx(bi,{icon:r.jsx(Ug,{size:18}),label:t("metrics.disk"),value:`${Gu(e.diskUsed)} / ${Gu(e.diskTotal)}`,subtext:`${i.toFixed(1)}%`,percent:i,colorClasses:dr(i)})]})}function bi({icon:e,label:t,value:n,subtext:i,percent:s,colorClasses:l}){const[d,a]=l;return r.jsxs("div",{className:"bg-bg-secondary rounded-xl p-4 border border-border-primary",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx("span",{className:d,children:e}),r.jsx("span",{className:"text-sm font-medium text-text-secondary",children:t})]}),r.jsx("div",{className:"text-xl font-semibold text-text-primary mb-1",children:n}),r.jsx("div",{className:"text-xs text-text-tertiary mb-3",children:i}),r.jsx("div",{className:"h-2 bg-bg-tertiary rounded-full overflow-hidden",children:r.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${a}`,style:{width:`${Math.min(s,100)}%`}})})]})}function wk({workers:e}){const{t}=ne();return e.length===0?r.jsx("div",{className:"text-center py-12 text-text-tertiary",children:t("metrics.noWorkers")}):r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Wt,{size:18,className:"text-text-secondary"}),r.jsxs("h2",{className:"text-base font-medium text-text-primary",children:["Workers (",e.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:e.map(n=>r.jsx(Ek,{worker:n},n.id))})]})}function Ek({worker:e}){const{t}=ne();return r.jsx("div",{className:`bg-bg-secondary rounded-xl p-4 md:p-5 border transition-colors hover:border-gray-300 dark:hover:border-gray-600 border-border-primary ${e.error?"opacity-60":""}`,children:r.jsxs("div",{className:"flex flex-col gap-4",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${e.error?"bg-red-400":"bg-green-400"}`}),e.kind&&r.jsx("span",{className:`inline-block px-2.5 py-0.5 text-xs font-medium rounded-md ${vk[e.kind]||"bg-gray-100 text-gray-600"}`,children:e.kind}),r.jsx("span",{className:"text-sm font-medium text-text-primary",children:e.name||e.hostname}),e.isCurrent&&r.jsx("span",{className:"text-[10px] uppercase font-bold tracking-wider px-1.5 py-0.5 bg-accent-brand/10 text-accent-brand rounded",children:t("metrics.current")}),e.error&&r.jsx("span",{className:"text-xs text-red-400",children:e.error})]}),r.jsxs("span",{className:"text-xs text-text-tertiary font-mono bg-bg-tertiary px-2 py-0.5 rounded-md border border-border-primary/50",children:["PID ",e.pid]})]}),r.jsxs("div",{className:"flex flex-col md:flex-row md:items-start justify-between gap-4 md:gap-6",children:[r.jsxs("div",{className:"flex flex-col gap-2.5 flex-1 min-w-0",children:[r.jsx(St,{path:e.cwd,displayMode:"basename",className:"text-[13px] text-text-secondary font-mono truncate max-w-full"}),e.url&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(st,{size:14,className:"text-text-tertiary flex-none"}),r.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-accent-brand hover:underline truncate",children:e.url})]})]}),e.rssMib>0||e.heapUsedMib>0?r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 flex-none",style:{minWidth:"460px"},children:[r.jsxs("div",{className:"min-w-[100px]",children:[r.jsx(Xt,{icon:r.jsx(ki,{size:14}),label:"RSS",value:`${e.rssMib.toFixed(0)} MiB`}),r.jsx("div",{className:"mt-1.5 h-1.5 bg-bg-tertiary rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full bg-blue-500 transition-all duration-500",style:{width:`${Math.min(e.rssMib/2048*100,100)}%`}})})]}),r.jsxs("div",{className:"min-w-[140px]",children:[r.jsx(Xt,{icon:r.jsx(ki,{size:14}),label:"Heap",value:`${e.heapUsedMib.toFixed(0)} / ${e.heapTotalMib.toFixed(0)} MiB`}),e.heapTotalMib>0&&r.jsx("div",{className:"mt-1.5 h-1.5 bg-bg-tertiary rounded-full overflow-hidden",children:r.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${dr(e.heapUsedMib/e.heapTotalMib*100)[1]}`,style:{width:`${Math.min(e.heapUsedMib/e.heapTotalMib*100,100)}%`}})})]}),r.jsx("div",{className:"min-w-[80px]",children:r.jsx(Xt,{icon:r.jsx(It,{size:14}),label:t("metrics.uptime"),value:Wu(e.uptimeSeconds)})}),r.jsx("div",{className:"min-w-[60px]",children:r.jsx(Xt,{icon:r.jsx(gr,{size:14}),label:t("metrics.version"),value:e.version||"-"})})]}):r.jsxs("div",{className:"grid grid-cols-2 gap-4 flex-none",style:{minWidth:"200px"},children:[r.jsx("div",{className:"min-w-[80px]",children:r.jsx(Xt,{icon:r.jsx(It,{size:14}),label:t("metrics.uptime"),value:Wu(e.uptimeSeconds)})}),r.jsx("div",{className:"min-w-[60px]",children:r.jsx(Xt,{icon:r.jsx(gr,{size:14}),label:t("metrics.version"),value:e.version||"-"})})]})]})]})})}function Xt({icon:e,label:t,value:n}){return r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-text-tertiary",children:[e,r.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wider",children:t})]}),r.jsx("div",{className:"text-sm font-semibold text-text-primary",style:{fontVariantNumeric:"tabular-nums"},children:n})]})}function dr(e){return e>=90?["text-red-500","bg-red-500"]:e>=70?["text-amber-500","bg-amber-500"]:["text-green-500","bg-green-500"]}function Hu(e){return e>=1024?`${(e/1024).toFixed(1)} GiB`:`${e} MiB`}function Gu(e){if(e===0)return"0 B";const t=e/(1024*1024*1024);return t>=1?`${t.toFixed(1)} GB`:`${(e/(1024*1024)).toFixed(0)} MB`}function Wu(e){if(e<60)return`${e}s`;if(e<3600)return`${Math.floor(e/60)}m ${e%60}s`;const t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>=24?`${Math.floor(t/24)}d ${t%24}h`:`${t}h ${n}m`}function Ck({onNavigate:e}){const{t}=ne(),[n,i]=C.useState(xr);if(C.useEffect(()=>{const s=()=>i(xr());return window.addEventListener("hashchange",s),()=>window.removeEventListener("hashchange",s)},[]),n==="add-wechat"||n!=null&&n.startsWith("rebind-wechat/")){const s=n!=null&&n.startsWith("rebind-wechat/")?n.split("/")[1]:void 0;return r.jsx(Nk,{onBack:()=>zd("remote-control"),t,existingInstanceId:s})}return n==="add-wecom"?r.jsx(Ak,{onBack:()=>zd("remote-control"),t}):r.jsx(Tk,{onNavigate:e,t})}function Tk({onNavigate:e,t}){const[n,i]=C.useState([]),[s,l]=C.useState(!0),[d,a]=C.useState(null),[o,c]=C.useState(null),p=C.useCallback(async()=>{try{const _=await ve("/api/v1/channels");if(_.ok){const S=await _.json();i((S.clients||[]).filter(w=>!w.hidden&&!w.instanceId.startsWith("_pending")))}}catch{}finally{l(!1)}},[]);C.useEffect(()=>{p();const _=setInterval(p,5e3);return()=>clearInterval(_)},[p]);const h=C.useCallback(async(_,S,w)=>{const A=`${S}:${w}:${_}`;c(A),a(null);try{const D=_==="delete"?"DELETE":"POST",R=_==="delete"?`/api/v1/channels/${S}/${w}`:`/api/v1/channels/${S}/${w}/${_}`,j=await ve(R,{method:D});if(!j.ok){const H=await j.json().catch(()=>({}));throw new Error(H.error||`Failed: ${j.status}`)}const O=await j.json().catch(()=>({}));if(_==="unbind"&&S==="wechat"&&O.needsQrScan){wn("remote-control",`rebind-wechat/${w}`);return}await p()}catch(D){a((D==null?void 0:D.message)||"Action failed")}finally{c(null)}},[p]),b=_=>_==="connected"?"text-green-500":_==="connecting"?"text-yellow-500":_==="error"?"text-red-500":"text-text-tertiary",y=_=>t(_==="connected"?"remoteControl.connected":_==="connecting"?"remoteControl.connecting":"remoteControl.disconnected"),k=_=>_==="wechat"?r.jsx(bp,{size:18,className:"text-green-500"}):_==="wecom"?r.jsx(mr,{size:18,className:"text-accent-brand"}):r.jsx(Rd,{size:18,className:"text-text-tertiary"}),v=_=>_==="wechat"?t("channel.wechat")+t("remoteControl.bot"):_==="wecom"?t("channel.wecom")+t("remoteControl.bot"):_,g=_=>`${v(_.clientType)} #${_.instanceId.slice(0,4)}`,m=n.filter(_=>_.clientType==="wechat"),u=n.filter(_=>_.clientType==="wecom"),f=n.filter(_=>_.clientType!=="wechat"&&_.clientType!=="wecom"),x=_=>{const S=`${_.clientType}:${_.instanceId}`,w=_.status==="connected",A=o==null?void 0:o.startsWith(S);return r.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-bg-secondary hover:bg-bg-hover transition-colors cursor-pointer",onClick:()=>{A||h(w?"stop":"start",_.clientType,_.instanceId)},children:[k(_.clientType),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-sm font-medium text-text-primary truncate",children:g(_)}),r.jsx("span",{className:`text-xs ${b(_.status)}`,children:y(_.status)})]}),r.jsxs("div",{className:"flex items-center gap-1",onClick:D=>D.stopPropagation(),children:[r.jsx("button",{className:`p-1.5 rounded-md text-text-tertiary transition-colors ${w?"hover:text-orange-500":"hover:text-green-500"} hover:bg-bg-hover`,title:t(w?"remoteControl.disconnect":"remoteControl.connect"),disabled:!!A,onClick:()=>h(w?"stop":"start",_.clientType,_.instanceId),children:w?r.jsx(Rd,{size:14}):r.jsx(rf,{size:14})}),w&&r.jsx("button",{className:"p-1.5 rounded-md text-text-tertiary hover:text-orange-500 hover:bg-bg-hover transition-colors",title:t("remoteControl.unbind"),disabled:!!A,onClick:()=>h("unbind",_.clientType,_.instanceId),children:r.jsx(qe,{size:14})}),r.jsx("button",{className:"p-1.5 rounded-md text-text-tertiary hover:text-red-500 hover:bg-bg-hover transition-colors",title:t("remoteControl.delete"),disabled:!!A,onClick:()=>h("delete",_.clientType,_.instanceId),children:r.jsx(pn,{size:14})})]})]},S)},E=(_,S,w,A)=>r.jsxs("div",{children:[r.jsx("h2",{className:"text-sm font-medium text-text-secondary mb-2",children:_}),S.length===0?r.jsx("div",{className:"py-4 text-center text-xs text-text-tertiary",children:t("remoteControl.noChannels")}):r.jsx("div",{className:"space-y-2",children:S.map(x)}),w&&r.jsxs("button",{className:"flex items-center gap-1.5 mt-2 px-3 py-1.5 text-xs text-text-tertiary hover:text-text-primary hover:bg-bg-hover rounded-md transition-colors",onClick:w,children:[r.jsx(ot,{size:12}),A||t("remoteControl.add")]})]});return r.jsxs("div",{className:"flex flex-col h-full overflow-y-auto",children:[r.jsxs("div",{className:"px-6 py-5 border-b border-border-primary",children:[r.jsx("h1",{className:"text-lg font-semibold text-text-primary",children:t("remoteControl.title")}),r.jsx("p",{className:"text-sm text-text-tertiary mt-1",children:t("remoteControl.subtitle")})]}),r.jsxs("div",{className:"px-6 py-4 flex-1 space-y-6",children:[d&&r.jsx("div",{className:"p-3 rounded-lg bg-red-500/10 text-red-500 text-sm",children:d}),s?r.jsx("div",{className:"text-sm text-text-tertiary py-4",children:t("remoteControl.connecting")}):n.length===0?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"py-8 text-center",children:[r.jsx(mr,{size:32,className:"mx-auto mb-3 text-text-tertiary opacity-50"}),r.jsx("p",{className:"text-sm text-text-tertiary",children:t("remoteControl.noChannels")}),r.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:t("remoteControl.noChannelsHint")})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("button",{className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-bg-secondary hover:bg-bg-hover text-sm text-text-primary transition-colors border border-border-primary",onClick:()=>wn("remote-control","add-wechat"),children:[r.jsx(ot,{size:14}),t("remoteControl.addWeChat")]}),r.jsxs("button",{className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-bg-secondary hover:bg-bg-hover text-sm text-text-primary transition-colors border border-border-primary",onClick:()=>wn("remote-control","add-wecom"),children:[r.jsx(ot,{size:14}),t("remoteControl.addWeCom")]})]})]}):r.jsxs(r.Fragment,{children:[E(t("channel.wechat")+t("remoteControl.bot"),m,()=>wn("remote-control","add-wechat"),t("remoteControl.addWeChat")),E(t("channel.wecom")+t("remoteControl.bot"),u,()=>wn("remote-control","add-wecom"),t("remoteControl.addWeCom")),f.length>0&&E(t("remoteControl.plugin"),f)]}),r.jsx("hr",{className:"border-border-primary"}),r.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg bg-bg-secondary hover:bg-bg-hover cursor-pointer transition-colors border border-border-primary",onClick:()=>{e?e("plugins"):window.location.hash="#/plugins"},children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-sm font-medium text-text-primary",children:t("remoteControl.installMore")}),r.jsx("p",{className:"text-xs text-text-tertiary mt-1",children:t("remoteControl.installMoreHint")})]}),r.jsx(Pm,{size:16,className:"text-text-tertiary"})]})]})]})}function Nk({onBack:e,t,existingInstanceId:n}){const[i,s]=C.useState(null),[l,d]=C.useState(t("remoteControl.fetchingQr")),[a,o]=C.useState(n??null),[c,p]=C.useState(null),[h,b]=C.useState(!1);return C.useEffect(()=>{let y=!1;return(async()=>{try{let k=n;if(!k){const v=await ve("/api/v1/channels/wechat",{method:"POST"});if(!v.ok)throw new Error((await v.json().catch(()=>({}))).error||"Failed");const g=await v.json();if(y)return;k=g.instanceId,o(k)}for(let v=0;v<180&&!y;v++){await new Promise(g=>setTimeout(g,1e3));try{const g=await fetch(`/api/v1/channels/wechat/${k}/qr`,{headers:se()});if(!g.ok)continue;const m=await g.json();if(y)return;if(m.qrUrl&&s(m.qrUrl),m.message&&d(m.message),m.type==="confirmed"){b(!0),d(t("remoteControl.connected")),setTimeout(()=>{y||e()},1500);return}if(m.type==="error"){p(m.message);return}}catch{}}!y&&!h&&p("Timeout")}catch(k){y||p((k==null?void 0:k.message)||"Failed")}})(),()=>{y=!0}},[n]),r.jsxs("div",{className:"flex flex-col h-full overflow-y-auto",children:[r.jsxs("div",{className:"px-6 py-5 border-b border-border-primary flex items-center gap-3",children:[r.jsx("button",{onClick:e,className:"p-1 rounded-md hover:bg-bg-hover transition-colors",children:r.jsx(cn,{size:18})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-lg font-semibold text-text-primary",children:t("remoteControl.addWeChat")}),r.jsx("p",{className:"text-sm text-text-tertiary",children:t("remoteControl.scanQr")})]})]}),r.jsx("div",{className:"flex-1 flex flex-col items-center justify-center px-6 py-8",children:c?r.jsxs("div",{className:"text-center space-y-4",children:[r.jsx("p",{className:"text-red-500",children:c}),r.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg bg-bg-secondary hover:bg-bg-hover text-sm border border-border-primary",children:t("remoteControl.cancel")})]}):i?r.jsxs("div",{className:"text-center space-y-4",children:[r.jsx("div",{className:"inline-block p-4 bg-white rounded-xl",children:r.jsx("img",{src:`https://api.qrserver.com/v1/create-qr-code/?size=240x240&data=${encodeURIComponent(i)}`,alt:"QR Code",className:"w-60 h-60"})}),r.jsx("p",{className:"text-sm text-text-secondary",children:l})]}):r.jsxs("div",{className:"text-center space-y-3",children:[r.jsx("div",{className:"w-8 h-8 mx-auto border-2 border-accent-brand border-t-transparent rounded-full animate-spin"}),r.jsx("p",{className:"text-sm text-text-tertiary",children:l})]})})]})}function Ak({onBack:e,t}){const[n,i]=C.useState(""),[s,l]=C.useState(""),[d,a]=C.useState("botId"),[o,c]=C.useState(!1),[p,h]=C.useState(null),b=C.useCallback(async()=>{if(!(!n.trim()||!s.trim())){c(!0),h(null);try{const y=await ve("/api/v1/channels/wecom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botId:n.trim(),secret:s.trim()})});if(!y.ok){const k=await y.json().catch(()=>({}));throw new Error(k.error||"Failed")}e()}catch(y){h((y==null?void 0:y.message)||"Failed")}finally{c(!1)}}},[n,s,e]);return r.jsxs("div",{className:"flex flex-col h-full overflow-y-auto",children:[r.jsxs("div",{className:"px-6 py-5 border-b border-border-primary flex items-center gap-3",children:[r.jsx("button",{onClick:e,className:"p-1 rounded-md hover:bg-bg-hover transition-colors",children:r.jsx(cn,{size:18})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-lg font-semibold text-text-primary",children:t("remoteControl.addWeCom")}),r.jsx("p",{className:"text-sm text-text-tertiary",children:t("remoteControl.wecomBotIdHint")})]})]}),r.jsxs("div",{className:"px-6 py-8 max-w-md mx-auto w-full space-y-6",children:[p&&r.jsx("div",{className:"p-3 rounded-lg bg-red-500/10 text-red-500 text-sm",children:p}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium text-text-primary",children:"Bot ID"}),r.jsx("input",{type:"text",className:"w-full px-3 py-2 rounded-lg bg-bg-secondary border border-border-primary text-sm text-text-primary placeholder-text-tertiary focus:outline-none focus:border-accent-brand transition-colors",placeholder:t("channel.botIdPlaceholder"),value:n,onChange:y=>i(y.target.value),autoFocus:!0,disabled:d==="secret",onKeyDown:y=>{y.key==="Enter"&&n.trim()&&a("secret")}})]}),d==="secret"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium text-text-primary",children:"Secret"}),r.jsx("input",{type:"password",className:"w-full px-3 py-2 rounded-lg bg-bg-secondary border border-border-primary text-sm text-text-primary placeholder-text-tertiary focus:outline-none focus:border-accent-brand transition-colors",placeholder:t("channel.secretPlaceholder"),value:s,onChange:y=>l(y.target.value),autoFocus:!0,onKeyDown:y=>{y.key==="Enter"&&s.trim()&&b()}}),r.jsx("p",{className:"text-xs text-text-tertiary",children:t("remoteControl.wecomSecretHint")})]}),r.jsxs("div",{className:"flex gap-3 pt-2",children:[d==="botId"?r.jsx("button",{className:"px-4 py-2 rounded-lg bg-accent-brand text-white text-sm hover:bg-accent-brand/90 transition-colors disabled:opacity-50",disabled:!n.trim(),onClick:()=>a("secret"),children:t("remoteControl.next")}):r.jsx("button",{className:"px-4 py-2 rounded-lg bg-accent-brand text-white text-sm hover:bg-accent-brand/90 transition-colors disabled:opacity-50",disabled:!s.trim()||o,onClick:b,children:t(o?"remoteControl.connecting":"remoteControl.connect")}),r.jsx("button",{className:"px-4 py-2 rounded-lg bg-bg-secondary border border-border-primary text-sm text-text-secondary hover:bg-bg-hover transition-colors",onClick:e,children:t("remoteControl.cancel")})]})]})]})}const Ik="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23copilot-clip-34e811bed903495093b85bf96a98fb1b_0)'%3e%3crect%20width='24'%20height='24'%20rx='12'%20fill='%234C4F6B'%3e%3c/rect%3e%3cpath%20d='M3.4689%2011.0144C3.32344%2011.2025%203.31607%2011.4567%203.4345%2012.0298C3.65883%2013.0748%204.24029%2014.4426%205.15579%2016.0716L5.747%2017.1172L5.72862%2017.511C5.70544%2017.9326%205.72848%2018.5857%205.77921%2019.0271C5.80994%2019.2967%205.8055%2019.3035%205.66483%2019.4638C5.12042%2020.0864%205.03916%2021.1287%205.44787%2022.2839C5.62456%2022.7775%206.16958%2023.6999%206.50726%2024.0756C7.35392%2025.0154%208.35051%2025.4646%209.11147%2025.246C9.25446%2025.2051%209.28403%2025.213%209.47117%2025.3424C10.182%2025.8233%2011.3834%2026.2377%2012.4447%2026.3663C14.2242%2026.5843%2016.2727%2026.143%2018.8281%2024.9925C19.8948%2024.5099%2022.2541%2023.1352%2023.2513%2022.4096C25.1083%2021.0667%2026.4805%2019.6414%2027.251%2018.2635C27.9337%2017.0364%2028.2735%2015.7781%2028.2495%2014.5174C28.2466%2014.2525%2028.2536%2014.2359%2028.3599%2014.1746C28.8797%2013.8703%2029.1497%2013.198%2029.0927%2012.3562C29.075%2012.1165%2029.0266%2011.7946%2028.9902%2011.6448C28.7404%2010.7144%2028.0885%209.59971%2027.4078%208.94729C26.6515%208.22182%2025.7943%207.9129%2025.1958%208.14598C25.0631%208.19758%2025.0452%208.19542%2024.9177%208.08995C24.6357%207.86124%2023.9604%207.43473%2023.5488%207.22673L23.1224%207.01477L22.8206%206.45595C22.0392%205.01609%2020.7826%203.33003%2019.8801%202.50992C19.4937%202.15818%2019.2668%202.03929%2019.019%202.05739C18.866%202.06657%2018.8535%202.07379%2018.645%202.26084C18.0389%202.79819%2017.1889%204.41355%2016.3588%206.60463L16.1271%207.21325L15.7053%207.34845C14.3909%207.76995%2013.2238%208.30219%2012.1896%208.94928C11.1973%209.56799%2010.6591%209.97037%209.84886%2010.688L9.36087%2011.1197L9.13878%2011.0813C7.00072%2010.7039%205.07892%2010.5639%204.19776%2010.7186C3.84772%2010.7832%203.55743%2010.9008%203.4689%2011.0144Z'%20fill='%23D2D3E0'%3e%3c/path%3e%3crect%20x='6.68555'%20y='16.3788'%20width='17.7918'%20height='11.5605'%20rx='4.61469'%20transform='rotate(-30%206.68555%2016.3788)'%20fill='%23212234'%3e%3c/rect%3e%3cg%3e%3crect%20x='12.2119'%20y='17.2593'%20width='2.13173'%20height='4.42744'%20rx='1.06587'%20transform='rotate(-30%2012.2119%2017.2593)'%20fill='%23D2D3E0'%3e%3canimate%20attributeName='height'%20values='4.42744;2.2;4.42744;4.42744;2.2;4.42744'%20dur='0.6s'%20begin='0s;blink134e811bed903495093b85bf96a98fb1b_0.end+3s'%20id='blink134e811bed903495093b85bf96a98fb1b_0'%3e%3c/animate%3e%3canimate%20attributeName='y'%20values='17.2593;18.2593;17.2593;17.2593;18.2593;17.2593'%20dur='0.6s'%20begin='0s;blink134e811bed903495093b85bf96a98fb1b_0.end+3s'%3e%3c/animate%3e%3canimate%20attributeName='opacity'%20values='1;0.2;1;1;0.2;1'%20dur='0.6s'%20begin='0s;blink134e811bed903495093b85bf96a98fb1b_0.end+3s'%3e%3c/animate%3e%3c/rect%3e%3c/g%3e%3cg%3e%3crect%20x='17.9634'%20y='13.9387'%20width='2.13173'%20height='4.42744'%20rx='1.06587'%20transform='rotate(-30%2017.9634%2013.9387)'%20fill='%23D2D3E0'%3e%3canimate%20attributeName='height'%20values='4.42744;2.2;4.42744;4.42744;2.2;4.42744'%20dur='0.6s'%20begin='0s;blink234e811bed903495093b85bf96a98fb1b_0.end+3s'%20id='blink234e811bed903495093b85bf96a98fb1b_0'%3e%3c/animate%3e%3canimate%20attributeName='y'%20values='13.9387;14.9387;13.9387;13.9387;14.9387;13.9387'%20dur='0.6s'%20begin='0s;blink234e811bed903495093b85bf96a98fb1b_0.end+3s'%3e%3c/animate%3e%3canimate%20attributeName='opacity'%20values='1;0.2;1;1;0.2;1'%20dur='0.6s'%20begin='0s;blink234e811bed903495093b85bf96a98fb1b_0.end+3s'%3e%3c/animate%3e%3c/rect%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='copilot-clip-34e811bed903495093b85bf96a98fb1b_0'%3e%3crect%20width='24'%20height='24'%20rx='12'%20fill='white'%3e%3c/rect%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",Rk="/assets/logo-iZVLr450.svg";function Lk({isOpen:e,onClose:t,mainView:n,onNavigate:i}){const{t:s}=ne(),{userInfo:l}=tp(),d=Ht(p=>p.info),a=Ht(p=>p.fetch),o=Nn(p=>p.fileChanges.length);C.useEffect(()=>{d||a()},[a,d]);const c=(l==null?void 0:l.userName)||(d==null?void 0:d.userName)||s("sidebar.user");return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:`sidebar-overlay ${e?"":"sidebar-overlay-hidden"}`,onClick:t}),r.jsxs("aside",{className:`sidebar ${e?"":"sidebar-closed"}`,role:"navigation","aria-label":"Main navigation",children:[r.jsxs("div",{className:"sidebar-header",children:[r.jsx("img",{src:Rk,alt:"CodeBuddy",className:"sidebar-logo"}),r.jsx("span",{className:"sidebar-brand",children:"CodeBuddy"}),r.jsx("div",{className:"flex-1"}),r.jsx("button",{onClick:t,className:"md:hidden w-7 h-7 flex items-center justify-center rounded-md text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-colors","aria-label":"Close sidebar",children:r.jsx(Te,{size:16})})]}),r.jsxs("nav",{className:"sidebar-nav","aria-label":"Primary",children:[r.jsxs("button",{className:`sidebar-nav-item ${n==="chat"?"active":""}`,onClick:()=>i("chat"),"aria-current":n==="chat"?"page":void 0,children:[r.jsx(dn,{size:16}),r.jsx("span",{children:s("sidebar.chatMode")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="workers"?"active":""}`,onClick:()=>i("workers"),children:[r.jsx(Wt,{size:16}),r.jsx("span",{children:s("sidebar.workers")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="remote-control"?"active":""}`,onClick:()=>i("remote-control"),children:[r.jsx(mr,{size:16}),r.jsx("span",{children:s("sidebar.remoteControl")})]})]}),r.jsx("div",{className:"sidebar-content",children:r.jsxs("div",{className:"px-3 py-1",children:[r.jsx("div",{className:"sidebar-section-title",children:s("sidebar.group.workspace")}),r.jsxs("button",{className:`sidebar-nav-item ${n==="tasks"?"active":""}`,onClick:()=>i("tasks"),children:[r.jsx(Ji,{size:16}),r.jsx("span",{children:s("sidebar.nav.tasks")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="terminal"?"active":""}`,onClick:()=>i("terminal"),children:[r.jsx(un,{size:16}),r.jsx("span",{children:s("sidebar.terminalMode")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="canvas"?"active":""}`,onClick:()=>i("canvas"),children:[r.jsx(gp,{size:16}),r.jsx("span",{children:s("sidebar.canvas")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="editor"?"active":""}`,onClick:()=>i("editor"),children:[r.jsx(lp,{size:16}),r.jsx("span",{children:s("sidebar.editor")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="changes"?"active":""}`,onClick:()=>i("changes"),children:[r.jsx(Nr,{size:16}),r.jsx("span",{children:s("sidebar.changes")}),o>0&&r.jsx("span",{className:"sidebar-badge",children:o})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="plugins"?"active":""}`,onClick:()=>i("plugins"),children:[r.jsx(Bt,{size:16}),r.jsx("span",{children:s("sidebar.nav.plugins")})]}),r.jsx("div",{className:"sidebar-section-title",children:s("sidebar.group.observability")}),r.jsxs("button",{className:`sidebar-nav-item ${n==="stats"?"active":""}`,onClick:()=>i("stats"),children:[r.jsx(Yi,{size:16}),r.jsx("span",{children:s("sidebar.stats")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="traces"?"active":""}`,onClick:()=>i("traces"),children:[r.jsx(Tp,{size:16}),r.jsx("span",{children:s("sidebar.traces")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="metrics"?"active":""}`,onClick:()=>i("metrics"),children:[r.jsx(Vi,{size:16}),r.jsx("span",{children:s("sidebar.metrics")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="logs"?"active":""}`,onClick:()=>i("logs"),children:[r.jsx(Xi,{size:16}),r.jsx("span",{children:s("sidebar.logs")})]}),r.jsx("div",{className:"sidebar-section-title",children:s("sidebar.group.preferences")}),r.jsxs("button",{className:`sidebar-nav-item ${n==="settings"?"active":""}`,onClick:()=>i("settings"),children:[r.jsx(ts,{size:16}),r.jsx("span",{children:s("sidebar.preferences")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="keybindings"?"active":""}`,onClick:()=>i("keybindings"),children:[r.jsx(mp,{size:16}),r.jsx("span",{children:s("sidebar.keybindings")})]}),r.jsxs("button",{className:`sidebar-nav-item ${n==="docs"?"active":""}`,onClick:()=>i("docs"),children:[r.jsx(Ki,{size:16}),r.jsx("span",{children:s("sidebar.docs")})]})]})}),r.jsx("div",{className:"sidebar-footer",children:r.jsxs("div",{className:"sidebar-user",children:[r.jsx("img",{src:Ik,alt:"User",className:"sidebar-user-avatar"}),r.jsxs("div",{className:"sidebar-user-info",children:[r.jsx("div",{className:"sidebar-user-name",children:c}),(d==null?void 0:d.version)&&r.jsxs("div",{className:"sidebar-user-status",children:["v",d.version]})]})]})})]})]})}const Dk=Ne((e,t)=>({stats:null,statsLoading:!1,statsError:null,sessionStats:null,sessionLoading:!1,sessionError:null,fetchStats:async()=>{e({statsLoading:!t().stats,statsError:null});try{const n=await ve("/api/v1/stats",{headers:se()});if(!n.ok)throw new Error(`HTTP ${n.status}`);const i=await n.json();e({stats:i.data,statsLoading:!1})}catch(n){e({statsError:n.message,statsLoading:!1})}},fetchSessionStats:async()=>{e({sessionLoading:!t().sessionStats,sessionError:null});try{const n=await ve("/api/v1/stats/session",{headers:se()});if(!n.ok)throw new Error(`HTTP ${n.status}`);const i=await n.json();e({sessionStats:i.data,sessionLoading:!1})}catch(n){e({sessionError:n.message,sessionLoading:!1})}},fetchAll:async()=>{await Promise.all([t().fetchStats(),t().fetchSessionStats()])}}));function Rt(e){return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"k":e.toString()}function Gi(e){if(e<=0)return"-";const t=Math.floor(e/1e3),n=Math.floor(t/60),i=Math.floor(n/60);return i>0?`${i}h ${n%60}m ${t%60}s`:n>0?`${n}m ${t%60}s`:`${t}s`}function md(e){return e.replace(/^anthropic\./,"").replace(/^openai\./,"").replace(/-\d{8}$/,"").replace(/@.*$/,"")}function Ok(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric"})}const $k=["#ebedf0","#9be9a8","#40c463","#30a14e","#216e39"],jk=["#161b22","#0e4429","#006d32","#26a641","#39d353"],qu=["#3b82f6","#10b981","#8b5cf6"],Mk=[{name:"The Little Prince",tokens:22e3},{name:"The Old Man and the Sea",tokens:35e3},{name:"A Christmas Carol",tokens:37e3},{name:"Animal Farm",tokens:39e3},{name:"Fahrenheit 451",tokens:6e4},{name:"The Great Gatsby",tokens:62e3},{name:"Brave New World",tokens:83e3},{name:"Harry Potter and the Philosopher's Stone",tokens:103e3},{name:"1984",tokens:123e3},{name:"Pride and Prejudice",tokens:156e3},{name:"Dune",tokens:244e3},{name:"A Game of Thrones",tokens:381e3},{name:"The Lord of the Rings",tokens:576e3},{name:"War and Peace",tokens:73e4}],Pk=[{name:"朝花夕拾",tokens:18e3},{name:"骆驼祥子",tokens:6e4},{name:"活着",tokens:72e3},{name:"围城",tokens:84e3},{name:"三体",tokens:126e3},{name:"射雕英雄传",tokens:234e3},{name:"红楼梦",tokens:438e3},{name:"三国演义",tokens:48e4},{name:"西游记",tokens:492e3},{name:"水浒传",tokens:576e3},{name:"平凡的世界",tokens:6e5},{name:"金庸全集",tokens:636e4}],Fk=[{en:"a TED talk",zh:"一场 TED 演讲",minutes:18},{en:"an episode of The Office",zh:"一集《办公室》",minutes:22},{en:"listening to Abbey Road",zh:"听一遍《Abbey Road》专辑",minutes:47},{en:"a yoga class",zh:"一节瑜伽课",minutes:60},{en:"a World Cup soccer match",zh:"一场世界杯比赛",minutes:90},{en:"a half marathon (average time)",zh:"一场半程马拉松",minutes:120},{en:"the movie Inception",zh:"电影《盗梦空间》",minutes:148},{en:"watching Titanic",zh:"电影《泰坦尼克号》",minutes:195},{en:"a transatlantic flight",zh:"一趟跨大西洋航班",minutes:420},{en:"a full night of sleep",zh:"一整晚的睡眠",minutes:480}];function Bk(e,t,n,i){const s=[],l=i==="zh"?Pk:Mk;if(t>0){for(const d of l)if(t>=d.tokens){const a=t/d.tokens;s.push(a>=2?n("stats.funFact.moreTokens").replace("{times}",String(Math.floor(a))).replace("{book}",d.name):n("stats.funFact.sameTokens").replace("{book}",d.name))}}if(e.longestSession){const d=e.longestSession.duration/6e4;for(const a of Fk){const o=d/a.minutes;if(o>=2){const c=i==="zh"?a.zh:a.en;s.push(n("stats.funFact.longerSession").replace("{times}",String(Math.floor(o))).replace("{activity}",c))}}}return s.length===0?"":s[Math.floor(Math.random()*s.length)]}function Uk(){const{t:e}=ne(),{stats:t,statsLoading:n,statsError:i,sessionStats:s,fetchAll:l}=Dk(),[d,a]=C.useState("overview");if(C.useEffect(()=>{l()},[l]),n&&!t)return r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsx(ut,{size:"large",text:e("stats.loading")})});if(i&&!t)return r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-text-secondary mb-4",children:i}),r.jsx("button",{onClick:l,className:"px-4 py-2 bg-accent-brand text-white rounded-lg text-sm",children:e("stats.refresh")})]})});const o=[{key:"overview",label:e("stats.tab.overview")},{key:"models",label:e("stats.tab.models")},{key:"tools",label:e("stats.tab.tools")}];return r.jsxs("div",{className:"flex-1 overflow-auto p-4 md:p-6",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yi,{size:20,className:"text-accent-brand"}),r.jsx("h1",{className:"text-lg font-semibold text-text-primary",children:e("stats.title")})]}),r.jsxs("button",{onClick:l,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm text-text-secondary
|
|
682
682
|
hover:text-text-primary hover:bg-bg-hover rounded-lg transition-colors`,title:e("stats.refresh"),children:[r.jsx(qe,{size:14}),r.jsx("span",{children:e("stats.refresh")})]})]}),r.jsx("div",{className:"flex gap-1 mb-6 bg-bg-secondary rounded-lg p-1 w-fit",children:o.map(c=>r.jsx("button",{onClick:()=>a(c.key),className:`px-4 py-1.5 text-sm rounded-md transition-colors ${d===c.key?"bg-bg-primary text-text-primary font-medium shadow-sm":"text-text-secondary hover:text-text-primary"}`,children:c.label},c.key))}),t?r.jsxs(r.Fragment,{children:[d==="overview"&&r.jsx(zk,{stats:t,sessionStats:s}),d==="models"&&r.jsx(Hk,{stats:t}),d==="tools"&&r.jsx(Gk,{toolUsage:t.toolUsage}),r.jsx("div",{className:"mt-8 text-xs text-text-tertiary text-center",children:e("stats.timeRange").replace("{days}",String(t.totalDays))})]}):r.jsx("div",{className:"text-center py-12 text-text-tertiary",children:e("stats.noData")})]})}function zk({stats:e,sessionStats:t}){const{t:n,resolved:i}=ne(),s=C.useMemo(()=>Object.entries(e.modelUsage).sort(([,c],[,p])=>p.inputTokens+p.outputTokens-(c.inputTokens+c.outputTokens)),[e.modelUsage]),l=C.useMemo(()=>s.reduce((c,[,p])=>c+p.inputTokens+p.outputTokens,0),[s]),d=C.useMemo(()=>{const c=s.reduce((h,[,b])=>h+b.inputTokens,0),p=s.reduce((h,[,b])=>h+b.cacheReadInputTokens,0);return c>0?p/c*100:0},[s]),a=s[0],o=C.useMemo(()=>Bk(e,l,n,i),[e,l,n,i]);return r.jsxs(r.Fragment,{children:[t&&r.jsx(Wk,{sessionStats:t}),e.dailyActivity.length>0&&r.jsx("div",{className:"mb-6",children:r.jsx(qk,{dailyActivity:e.dailyActivity})}),a&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4",children:[r.jsx(xt,{icon:r.jsx(kp,{size:16}),label:n("stats.favoriteModel"),value:md(a[0])}),r.jsx(xt,{icon:r.jsx(up,{size:16}),label:n("stats.totalTokens"),value:Rt(l)}),r.jsx(xt,{icon:r.jsx(nn,{size:16}),label:n("stats.cacheHitRate"),value:`${d.toFixed(1)}%`})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-6",children:[r.jsx(xt,{icon:r.jsx(dn,{size:16}),label:n("stats.sessions"),value:Rt(e.totalSessions)}),r.jsx(xt,{icon:r.jsx(Ep,{size:16}),label:n("stats.longestSession"),value:e.longestSession?Gi(e.longestSession.duration):n("stats.na")}),r.jsx(xt,{icon:r.jsx(yb,{size:16}),label:n("stats.activeDays"),value:`${e.activeDays}/${e.totalDays}`}),r.jsx(xt,{icon:r.jsx(nn,{size:16}),label:n("stats.currentStreak"),value:`${e.streaks.currentStreak} ${n("stats.days")}`}),r.jsx(xt,{icon:r.jsx(nn,{size:16}),label:n("stats.longestStreak"),value:`${e.streaks.longestStreak} ${n("stats.days")}`}),r.jsx(xt,{icon:r.jsx(It,{size:16}),label:n("stats.peakHour"),value:e.peakActivityHour!==null?`${e.peakActivityHour}:00-${e.peakActivityHour+1}:00`:n("stats.na")})]}),o&&r.jsx("div",{className:"p-3 bg-bg-secondary/50 rounded-lg border border-border-primary/50 text-sm text-accent-brand",children:o})]})}function Hk({stats:e}){const{t}=ne(),n=C.useMemo(()=>Object.entries(e.modelUsage).map(([s,l])=>{const d=l.inputTokens>0?l.cacheReadInputTokens/l.inputTokens*100:0;return{name:s,shortName:md(s),inputTokens:l.inputTokens,outputTokens:l.outputTokens,cacheReadInputTokens:l.cacheReadInputTokens,cacheHitRate:d,total:l.inputTokens+l.outputTokens,costUSD:l.costUSD}}).sort((s,l)=>l.total-s.total),[e.modelUsage]),i=C.useMemo(()=>n.reduce((s,l)=>s+l.total,0),[n]);return n.length===0?r.jsx("div",{className:"text-center py-12 text-text-tertiary",children:t("stats.noData")}):r.jsxs(r.Fragment,{children:[e.dailyModelTokens.length>=2&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-sm font-medium text-text-primary mb-3",children:t("stats.tokensPerDay")}),r.jsx(Vk,{dailyModelTokens:e.dailyModelTokens,topModels:n.slice(0,3).map(s=>s.name)})]}),r.jsx("h2",{className:"text-sm font-medium text-text-primary mb-3",children:t("stats.allModels")}),r.jsx("div",{className:"space-y-3",children:n.map(s=>{const l=i>0?s.total/i*100:0;return r.jsxs("div",{className:"bg-bg-secondary rounded-lg p-3 border border-border-primary",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"text-sm font-medium text-text-primary",children:s.shortName}),r.jsxs("span",{className:"text-xs text-text-tertiary",children:[l.toFixed(1),"%"]})]}),r.jsx("div",{className:"h-1.5 bg-bg-tertiary rounded-full mb-2",children:r.jsx("div",{className:"h-full rounded-full bg-accent-brand transition-all duration-500",style:{width:`${Math.min(l,100)}%`}})}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 text-xs text-text-secondary",children:[r.jsxs("span",{children:[t("stats.input"),": ",Rt(s.inputTokens)]}),r.jsxs("span",{children:[t("stats.output"),": ",Rt(s.outputTokens)]}),s.cacheReadInputTokens>0&&r.jsxs("span",{children:[t("stats.cacheHitRate"),": ",s.cacheHitRate.toFixed(1),"%"]}),s.costUSD>0&&r.jsxs("span",{children:[t("stats.cost"),": $",s.costUSD.toFixed(2)]})]})]},s.name)})})]})}function Gk({toolUsage:e}){var s;const{t}=ne(),n=e.slice(0,20),i=((s=n[0])==null?void 0:s.count)||0;return n.length===0?r.jsx("div",{className:"text-center py-12 text-text-tertiary",children:t("stats.noData")}):r.jsxs(r.Fragment,{children:[r.jsx("h2",{className:"text-sm font-medium text-text-primary mb-4",children:t("stats.topTools")}),r.jsx("div",{className:"space-y-2",children:n.map(l=>r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-xs text-text-secondary w-28 text-right truncate font-mono",children:l.toolName}),r.jsx("div",{className:"flex-1 h-6 bg-bg-tertiary rounded overflow-hidden",children:r.jsx("div",{className:"h-full bg-accent-brand/60 rounded transition-all duration-500 flex items-center pl-2",style:{width:`${Math.max(l.count/i*100,2)}%`},children:l.count/i>.15&&r.jsx("span",{className:"text-[10px] text-text-primary font-mono",children:Rt(l.count)})})}),l.count/i<=.15&&r.jsx("span",{className:"text-xs text-text-tertiary w-12 font-mono",children:Rt(l.count)})]},l.toolName))})]})}function Wk({sessionStats:e}){const{t}=ne(),n=C.useMemo(()=>Object.values(e.tokenUsageByModel).reduce((i,s)=>i+s.inputTokens+s.outputTokens,0),[e.tokenUsageByModel]);return r.jsxs("div",{className:"flex flex-wrap gap-3 mb-6 p-3 bg-bg-secondary/50 rounded-xl border border-border-primary/50",children:[r.jsx(Zt,{label:t("stats.session.title"),icon:r.jsx(dg,{size:12})}),r.jsx(Zt,{label:t("stats.session.apiDuration"),value:Gi(e.apiDuration)}),r.jsx(Zt,{label:t("stats.session.wallTime"),value:Gi(e.runningTime)}),r.jsx(Zt,{label:t("stats.session.linesAdded"),value:`+${e.fileChangeStats.totalAddedLines}`,valueClass:"text-green-500"}),r.jsx(Zt,{label:t("stats.session.linesDeleted"),value:`-${e.fileChangeStats.totalDeletedLines}`,valueClass:"text-red-500"}),r.jsx(Zt,{label:t("stats.session.tokens"),value:Rt(n)})]})}function Zt({label:e,value:t,icon:n,valueClass:i}){return r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[n,r.jsx("span",{className:"text-text-tertiary",children:e}),t&&r.jsx("span",{className:`font-medium text-text-primary ${i||""}`,children:t})]})}function xt({icon:e,label:t,value:n}){return r.jsxs("div",{className:"bg-bg-secondary rounded-xl p-4 border border-border-primary",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("span",{className:"text-text-tertiary",children:e}),r.jsx("span",{className:"text-xs font-medium text-text-secondary",children:t})]}),r.jsx("div",{className:"text-lg font-semibold text-text-primary",style:{fontVariantNumeric:"tabular-nums"},children:n})]})}function qk({dailyActivity:e}){const{t}=ne(),i=Ye(d=>d.resolved)==="dark"?jk:$k,s=C.useMemo(()=>{const h=new Map;for(const D of e)h.set(D.date,D.messageCount);const b=e.map(D=>D.messageCount).filter(D=>D>0).sort((D,R)=>D-R),y=b.length>0?b[Math.floor(b.length*.25)]:0,k=b.length>0?b[Math.floor(b.length*.5)]:0,v=b.length>0?b[Math.floor(b.length*.75)]:0,g=D=>D===0||b.length===0?0:D>=v?4:D>=k?3:D>=y?2:1,m=new Date;m.setHours(0,0,0,0);const u=new Date(m);u.setDate(m.getDate()-m.getDay());const f=new Date(u);f.setDate(f.getDate()-357);const x=[],E=[];let _=-1;const S=new Date(f);for(let D=0;D<52;D++)for(let R=0;R<7;R++){if(S>m){S.setDate(S.getDate()+1);continue}const j=S.getFullYear(),O=String(S.getMonth()+1).padStart(2,"0"),H=String(S.getDate()).padStart(2,"0"),M=`${j}-${O}-${H}`,U=h.get(M)||0;if(R===0&&S.getMonth()!==_){const q=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];E.push({text:q[S.getMonth()],x:32+D*14}),_=S.getMonth()}x.push({key:M,x:32+D*14,y:20+R*14,level:g(U),date:M,count:U}),S.setDate(S.getDate()+1)}return{cells:x,monthLabels:E,width:770,height:128,CELL_SIZE:12,TOP_PADDING:20,LEFT_PADDING:32,CELL_GAP:2}},[e]),l=["","Mon","","Wed","","Fri",""];return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("svg",{width:s.width,height:s.height+30,viewBox:`0 0 ${s.width} ${s.height+30}`,className:"min-w-[500px]",children:[s.monthLabels.map((d,a)=>r.jsx("text",{x:d.x,y:s.TOP_PADDING-6,className:"fill-text-tertiary",fontSize:10,children:d.text},a)),l.map((d,a)=>d?r.jsx("text",{x:s.LEFT_PADDING-6,y:s.TOP_PADDING+a*(s.CELL_SIZE+s.CELL_GAP)+s.CELL_SIZE-2,className:"fill-text-tertiary",fontSize:10,textAnchor:"end",children:d},a):null),s.cells.map(d=>r.jsx("rect",{x:d.x,y:d.y,width:s.CELL_SIZE,height:s.CELL_SIZE,rx:2,fill:i[d.level],children:r.jsxs("title",{children:[d.date,": ",d.count," ",t("stats.heatmap.messages")]})},d.key)),(()=>{const d=s.height+4,a=s.LEFT_PADDING;return r.jsxs("g",{children:[r.jsx("text",{x:a,y:d+10,className:"fill-text-tertiary",fontSize:10,children:t("stats.heatmap.less")}),i.map((o,c)=>r.jsx("rect",{x:a+30+c*(s.CELL_SIZE+2),y:d,width:s.CELL_SIZE,height:s.CELL_SIZE,rx:2,fill:o},c)),r.jsx("text",{x:a+30+5*(s.CELL_SIZE+2)+4,y:d+10,className:"fill-text-tertiary",fontSize:10,children:t("stats.heatmap.more")})]})})()]})})}function Vk({dailyModelTokens:e,topModels:t}){const n=C.useMemo(()=>{const l={top:20,right:20,bottom:40,left:60},d=700-l.left-l.right,a=220-l.top-l.bottom;let o=0;for(const k of e)for(const v of t){const g=k.tokensByModel[v]||0;g>o&&(o=g)}o===0&&(o=1);const c=t.map((k,v)=>{const g=e.map((u,f)=>{const x=l.left+f/Math.max(e.length-1,1)*d,E=u.tokensByModel[k]||0,_=l.top+a-E/o*a;return`${x},${_}`});return e.some(u=>(u.tokensByModel[k]||0)>0)?{path:`M${g.join("L")}`,color:qu[v%qu.length],model:k}:null}).filter(Boolean),p=Array.from({length:5},(k,v)=>{const g=o*(1-v/4);return{y:l.top+v/4*a,label:Rt(Math.round(g))}}),h=Math.min(5,e.length),b=Math.max(1,Math.floor((e.length-1)/(h-1))),y=Array.from({length:h},(k,v)=>{const g=Math.min(v*b,e.length-1);return{x:l.left+g/Math.max(e.length-1,1)*d,label:Ok(e[g].date)}});return{W:700,H:220,PAD:l,CW:d,CH:a,lines:c,yGridLines:p,xLabels:y}},[e,t]);return r.jsxs("div",{children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("svg",{viewBox:`0 0 ${n.W} ${n.H}`,className:"w-full min-w-[500px]",style:{maxHeight:"240px"},children:[n.yGridLines.map((i,s)=>r.jsxs("g",{children:[r.jsx("line",{x1:n.PAD.left,y1:i.y,x2:n.W-n.PAD.right,y2:i.y,className:"stroke-border-primary",strokeWidth:.5,strokeDasharray:"4 4"}),r.jsx("text",{x:n.PAD.left-8,y:i.y+4,textAnchor:"end",className:"fill-text-tertiary",fontSize:10,children:i.label})]},s)),n.lines.map((i,s)=>r.jsx("path",{d:i.path,fill:"none",stroke:i.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},s)),n.xLabels.map((i,s)=>r.jsx("text",{x:i.x,y:n.H-10,textAnchor:"middle",className:"fill-text-tertiary",fontSize:10,children:i.label},s))]})}),r.jsx("div",{className:"flex gap-4 mt-2 justify-center",children:n.lines.map(i=>r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-text-secondary",children:[r.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:i.color}}),r.jsx("span",{children:md(i.model)})]},i.model))})]})}function Kk({onMenuClick:e,onNewChat:t,onSplitTerminal:n,onHistory:i,rightActions:s}){const{t:l}=ne(),{topic:d,status:a,currentModel:o}=nt(),{mainView:c,layout:p,terminalTitle:h}=ue(),[b,y]=C.useState(!1),k=C.useRef(null),v=c==="terminal",m=an(p)<Rp;C.useEffect(()=>{if(!b)return;const _=S=>{k.current&&!k.current.contains(S.target)&&y(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[b]);const u=C.useCallback(_=>{y(!1),n==null||n(_)},[n]),f=()=>{switch(c){case"chat":return d||l("chat.newChat");case"terminal":return h||l("terminal.title");case"settings":return l("settings.title");case"tasks":return l("scheduled.title");case"plugins":return l("sidebar.nav.plugins");case"workers":return l("workers.title");case"metrics":return l("sidebar.metrics");case"logs":return l("sidebar.logs");case"docs":return l("sidebar.docs");case"remote-control":return l("sidebar.remoteControl");case"keybindings":return l("keybindings.title");default:return""}},x=o?o.replace(/^(claude-|gpt-|deepseek-)/,"").split("-").slice(0,2).join("-"):"",E=()=>s||(v?r.jsxs("div",{ref:k,className:"relative",children:[r.jsx("button",{onClick:()=>m&&y(!b),className:`text-text-secondary transition-colors flex items-center justify-center w-8 h-8 rounded-full ${m?"hover:text-text-primary hover:bg-bg-secondary":"opacity-40 cursor-not-allowed"}`,title:m?void 0:l("terminal.maxPanes"),"aria-label":"Split terminal",children:r.jsx(Ad,{size:20})}),b&&r.jsxs("div",{className:"absolute right-0 top-full mt-1 bg-bg-secondary border border-border-muted rounded-lg shadow-lg py-1 z-50 min-w-[140px]",children:[r.jsxs("button",{onClick:()=>u("horizontal"),className:"w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-text-primary hover:bg-bg-hover transition-colors",children:[r.jsx(Ad,{size:16,className:"text-text-secondary"}),r.jsx("span",{children:l("terminal.splitHorizontal")})]}),r.jsxs("button",{onClick:()=>u("vertical"),className:"w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-text-primary hover:bg-bg-hover transition-colors",children:[r.jsx(Vf,{size:16,className:"text-text-secondary"}),r.jsx("span",{children:l("terminal.splitVertical")})]})]})]}):c==="chat"?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{onClick:t,className:"text-text-secondary hover:text-text-primary transition-colors flex items-center justify-center w-8 h-8 rounded-full hover:bg-bg-secondary","aria-label":"New chat",children:r.jsx(ot,{size:20})}),r.jsx("button",{onClick:i,className:"text-text-secondary hover:text-text-primary transition-colors flex items-center justify-center w-8 h-8 rounded-full hover:bg-bg-secondary",title:l("sidebar.chatHistory"),"aria-label":"Chat history",children:r.jsx(pp,{size:18})})]}):null);return r.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-6 h-14 bg-bg-primary text-xs flex-shrink-0 transition-colors duration-200 sticky top-0 z-10",role:"banner","aria-label":"Status bar",children:[r.jsx("div",{className:"flex items-center gap-4",children:r.jsx("button",{onClick:e,className:"text-text-secondary hover:text-text-primary transition-colors flex items-center justify-center w-8 h-8 rounded-full hover:bg-bg-secondary","aria-label":"Toggle sidebar",children:r.jsx(es,{size:20})})}),r.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center min-w-0 px-2",children:[r.jsx("span",{className:"font-medium text-text-primary text-[15px] tracking-wide truncate max-w-full",children:f()}),c==="chat"&&(x||a==="connected")&&r.jsx("span",{className:"hidden sm:block text-[10px] text-text-tertiary mt-0.5 truncate max-w-[200px]",children:[a==="connected"?"":"disconnected",x].filter(Boolean).join(" · ")})]}),r.jsx("div",{className:"flex items-center",children:E()})]})}let yi=1e5;function Yk(e){if(!Array.isArray(e))return[];const t=[];let n=null;for(const i of e)if(i.sessionUpdate==="user_message_chunk"){n&&(t.push(n),n=null);const s=i.content,l=(s==null?void 0:s.text)||"";if(!l.trim())continue;t.push({type:"message",id:`member-msg-${++yi}`,role:"user",content:l,timestamp:Date.now()})}else if(i.sessionUpdate==="agent_message_chunk"){const s=i.content;if((s==null?void 0:s.type)==="thinking")continue;const l=(s==null?void 0:s.text)||"";if(!l)continue;n?n={...n,content:n.content+l}:n={type:"message",id:`member-msg-${++yi}`,role:"assistant",content:l,timestamp:Date.now()}}else if(i.sessionUpdate==="tool_call"){n&&(t.push(n),n=null);const l=(i._meta||{})["codebuddy.ai/toolName"]||"";t.push({type:"tool_call",id:i.toolCallId||`member-tc-${++yi}`,name:i.title||l||i.kind||"tool",kind:i.kind||"other",toolName:l,input:i.rawInput||i.input,status:i.status==="completed"?"completed":i.status==="failed"?"failed":"running",locations:i.locations,content:i.content})}else if(i.sessionUpdate==="tool_call_update"){const s=t.findIndex(l=>l.type==="tool_call"&&l.id===i.toolCallId);if(s!==-1){const l=t[s];t[s]={...l,status:i.status==="completed"?"completed":i.status==="failed"?"failed":l.status,result:i.rawOutput||i.toolResult||l.result,...i.content!==void 0?{content:i.content}:{}}}}return n&&t.push(n),t}function Xk(){var b;const e=We(y=>y.focusedMemberName),t=We(y=>y.memberHistories),n=We(y=>y.members),i=We(y=>y.setFocusedMember),s=C.useRef(null),l=n.find(y=>y.name===e),d=e&&t[e]||[],a=C.useMemo(()=>Yk(d),[d]),o=C.useMemo(()=>Ah(a),[a]);C.useEffect(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},[o]);const c=C.useCallback(()=>{i(null)},[i]),p=(l==null?void 0:l.status)==="running"||(l==null?void 0:l.status)==="pending",{t:h}=ne();return r.jsxs("div",{ref:s,className:"absolute inset-0 overflow-y-auto overflow-x-hidden",children:[r.jsx("div",{className:"sticky top-0 z-10 bg-bg-primary/95 backdrop-blur-sm border-b border-border-muted/30",children:r.jsxs("div",{className:"max-w-3xl mx-auto px-4 sm:px-6 py-3 flex items-center gap-3",children:[r.jsx("button",{type:"button",onClick:c,className:"p-1.5 rounded-md hover:bg-bg-secondary text-text-tertiary hover:text-text-secondary transition-colors",title:h("team.backToMain"),children:r.jsx(cn,{size:16})}),r.jsx(ur,{size:16,className:"text-accent-purple flex-shrink-0"}),r.jsxs("span",{className:"text-[14px] font-semibold text-accent-purple",children:["@",e]}),(l==null?void 0:l.description)&&r.jsx("span",{className:"text-[12px] text-text-tertiary truncate flex-1",children:l.description}),p&&r.jsx(we,{size:14,className:"animate-spin text-accent-purple flex-shrink-0"}),r.jsx("div",{className:"flex-1"}),l&&r.jsxs("span",{className:"text-[11px] text-text-tertiary flex-shrink-0",children:[l.toolCallCount?h("team.tools").replace("{count}",String(l.toolCallCount)):"",(b=l.tokenUsage)!=null&&b.lastContextWindow?`${l.toolCallCount?" · ":""}${h("team.tokens").replace("{count}",String(Math.round(l.tokenUsage.lastContextWindow/1e3))+"k")}`:""]})]})}),r.jsx("div",{className:"px-4 sm:px-6 pt-4 pb-8",children:r.jsxs("div",{className:"max-w-3xl mx-auto flex flex-col",children:[p&&o.length===0?r.jsxs("div",{className:"flex items-center justify-center gap-2 py-20 text-text-tertiary text-[13px]",children:[r.jsx(we,{size:16,className:"animate-spin"}),r.jsx("span",{children:h("team.loadingHistory")})]}):o.length===0?r.jsx("div",{className:"flex items-center justify-center py-20 text-text-tertiary text-[13px]",children:h("team.noHistory")}):o.map((y,k)=>{if(y.kind==="user"){const v=y.entry.content?Th(y.entry.content):void 0;if(v)return v.from==="system"?null:r.jsx("div",{children:r.jsx(Nh,{msg:v})},y.entry.id);let g=y.entry.content||"";return g=g.replace(/<system-reminder>[\s\S]*?<\/system-reminder>\s*/g,"").trim(),g?r.jsx("div",{className:"flex justify-end mb-6",children:r.jsx("div",{className:"max-w-[85%] sm:max-w-[75%] px-5 py-3 rounded-2xl rounded-tr-sm bg-bg-user border border-transparent",children:r.jsx("p",{className:"whitespace-pre-wrap break-words text-text-primary text-chat",children:g})})},y.entry.id):null}return y.kind==="assistant_message"?r.jsx("div",{className:"mb-6",children:r.jsx(ld,{message:y.entry})},y.entry.id):y.kind==="assistant_tools"?r.jsx("div",{className:"mb-6",children:r.jsx(Ch,{entries:y.entries})},`tools-${k}`):null}),p&&o.length>0&&r.jsxs("div",{className:"flex items-center gap-2 py-4 text-text-tertiary text-[12px]",children:[r.jsx(we,{size:12,className:"animate-spin"}),r.jsx("span",{children:h("team.agentRunning")})]})]})})]})}let Zk=0;const Jk={info:5e3,success:5e3,warn:8e3,error:0},tn=Ne((e,t)=>({toasts:[],addToast:(n,i,s)=>{const l=(s==null?void 0:s.id)??`toast-${++Zk}`,d={id:l,type:n,message:i,createdAt:Date.now(),action:s==null?void 0:s.action};e(o=>{const c=o.toasts.findIndex(h=>h.id===l);if(c>=0){const h=[...o.toasts];return h[c]=d,{toasts:h}}return{toasts:[...o.toasts.slice(-2),d]}});const a=(s==null?void 0:s.durationMs)??Jk[n];return a>0&&setTimeout(()=>{t().removeToast(l)},a),l},removeToast:n=>{e(i=>({toasts:i.toasts.filter(s=>s.id!==n)}))},clearAll:()=>e({toasts:[]})})),Wi={info:(e,t)=>tn.getState().addToast("info",e,t),warn:(e,t)=>tn.getState().addToast("warn",e,t),error:(e,t)=>tn.getState().addToast("error",e,t),success:(e,t)=>tn.getState().addToast("success",e,t)},Qk={info:Kg,success:Jm,warn:In,error:pr},ew={info:"text-accent-blue",success:"text-accent-green",warn:"text-accent-yellow",error:"text-accent-red"};function tw({item:e}){const t=tn(a=>a.removeToast),[n,i]=C.useState(!1),s=Qk[e.type],l=()=>{i(!0),setTimeout(()=>t(e.id),200)},d=async()=>{if(e.action)try{await e.action.onClick()!==!1&&l()}catch{l()}};return r.jsxs("div",{role:"alert",className:["flex items-start gap-3 px-4 py-3 rounded-xl border border-border-default shadow-lg","bg-bg-card backdrop-blur-sm","max-w-[360px] min-w-[280px]","transition-all duration-200",n?"opacity-0 translate-x-4":"opacity-100 translate-x-0","animate-fadeIn"].join(" "),children:[r.jsx(s,{size:18,className:`${ew[e.type]} shrink-0 mt-0.5`}),r.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2",children:[r.jsx("p",{className:"text-[13px] text-text-primary leading-[1.5] break-words",children:e.message}),e.action&&r.jsx("button",{type:"button",onClick:d,className:"self-start px-2.5 py-1 rounded-md text-[12px] font-medium bg-accent-blue text-white hover:opacity-90 transition-opacity",children:e.action.label})]}),r.jsx("button",{onClick:l,"aria-label":"Dismiss",className:"shrink-0 w-5 h-5 flex items-center justify-center rounded text-text-tertiary hover:text-text-primary transition-colors",children:r.jsx(Te,{size:14})})]})}function nw(){const e=tn(t=>t.toasts);return e.length===0?null:r.jsx("div",{className:"fixed bottom-6 right-6 z-[999] flex flex-col-reverse gap-2 pointer-events-auto max-md:bottom-20 max-md:right-4 max-md:left-4 max-md:items-stretch",children:e.map(t=>r.jsx(tw,{item:t},t.id))})}function rw(e,t){const n=[];for(const i of e)i.type==="tool_call"&&n.push(i);for(const i of t.values())n.push(i);return n}function iw(e,t){const n={};for(const i of e){const s=i.input||{},l=i.toolName;if(l==="TaskCreate"){const d=i.result,a=typeof d=="string"?d:d&&typeof d=="object"?String(d.text??d.output??""):"",o=!a&&Array.isArray(i.content)?i.content.reduce((b,y)=>{var k;return b||String(((k=y==null?void 0:y.content)==null?void 0:k.text)??(y==null?void 0:y.text)??"")},""):"",c=(a||o).match(/Task #(\d+)/),p=c?c[1]:`t-${Object.keys(n).length+1}`;let h=s.owner?String(s.owner):void 0;if(!h&&(t!=null&&t.length)){const b=s.subject?String(s.subject).toLowerCase():"",y=s.description?String(s.description).toLowerCase():"",k=b+" "+y;for(const v of t)if(k.includes(v.toLowerCase())){h=v;break}}n[p]={id:p,subject:s.subject?String(s.subject):"",status:"pending",owner:h,activeForm:s.activeForm?String(s.activeForm):void 0}}else if(l==="TaskUpdate"){const d=s.taskId?String(s.taskId):void 0;if(d&&n[d]){const a=n[d];s.status&&s.status!=="deleted"&&(a.status=String(s.status)),s.subject&&(a.subject=String(s.subject)),s.owner!==void 0&&(a.owner=s.owner?String(s.owner):void 0),s.activeForm&&(a.activeForm=String(s.activeForm)),s.status==="deleted"&&delete n[d]}}}return Object.values(n)}function sw(e){return e.filter(t=>t.toolName==="TaskCreate"||t.toolName==="TaskUpdate").length}function aw({status:e}){switch(e){case"completed":return r.jsx(rp,{size:14,className:"text-accent-green flex-shrink-0"});case"in_progress":return r.jsx(we,{size:14,className:"text-accent-brand flex-shrink-0 animate-spin"});default:return r.jsx(ig,{size:14,className:"text-text-tertiary flex-shrink-0"})}}function ow({member:e,isFocused:t,onClick:n}){var o;const i=e.status==="running"||e.status==="pending",s=e.status==="failed"||e.status==="killed",l=Ax(e.color),d=as(e.color),a=[];return e.toolCallCount&&a.push(`${e.toolCallCount} tools`),(o=e.tokenUsage)!=null&&o.lastContextWindow&&a.push(`${(e.tokenUsage.lastContextWindow/1e3).toFixed(1)}k`),r.jsxs("button",{type:"button",onClick:n,className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] transition-colors cursor-pointer ${t?`${l.bg}`:i?`${l.bg} hover:opacity-80`:s?"bg-accent-red/10 text-accent-red":"bg-bg-secondary/50 text-text-tertiary hover:bg-bg-secondary/70"}`,style:{color:t||i?d:void 0,...t?{boxShadow:`0 0 0 1px ${d}40`}:{}},children:[r.jsxs("span",{className:"font-medium",children:["@",e.name]}),a.length>0&&r.jsx("span",{className:"opacity-70",children:a.join(" · ")}),i&&r.jsx(we,{size:9,className:"animate-spin flex-shrink-0"}),s&&r.jsx(pr,{size:9,className:"flex-shrink-0"}),!i&&!s&&r.jsx(Ut,{size:9,className:"flex-shrink-0"})]})}function lw(){const e=Ke(I=>I.timeline),t=Ke(I=>I.childToolCalls),n=Ke(I=>I.isAgentRunning),{t:i}=ne(),[s,l]=C.useState(!0),d=We(I=>I.isInTeam),a=We(I=>I.members),o=We(I=>I.focusedMemberName),c=We(I=>I.setFocusedMember),p=C.useMemo(()=>{const I=new Map;for(const G of a)G.color&&I.set(G.name,G.color);return I},[a]),h=C.useRef(0),[b,y]=C.useState(!1),k=C.useRef(n),v=C.useMemo(()=>rw(e,t),[e,t]),g=C.useMemo(()=>a.map(I=>I.name),[a]),m=C.useMemo(()=>iw(v,g),[v,g]),u=C.useMemo(()=>sw(v),[v]);C.useEffect(()=>{!k.current&&n&&(h.current=u,y(!0)),k.current=n},[n,u]),C.useEffect(()=>{b&&u>h.current&&y(!1)},[b,u]);const f=C.useCallback(()=>l(I=>!I),[]),x=C.useCallback(I=>{I.stopPropagation(),h.current=u,y(!0)},[u]),E=C.useCallback(I=>{c(o===I?null:I)},[o,c]),_=C.useCallback(I=>{I.owner&&p.has(I.owner)&&c(o===I.owner?null:I.owner)},[o,p,c]),S=a.filter(I=>I.status==="running"||I.status==="pending"),w=S.length>0,A=!n&&w,D=d&&a.length>0,R=m.length>0,j=R&&m.every(I=>I.status==="completed"),O=D&&!w&&!n,H=R&&m.every(I=>I.status==="pending")&&!n&&!w,U=R&&!(j||O||H)&&!b,q=D&&(w||o);if(!U&&!q)return null;const V=m.filter(I=>I.status==="completed").length,T=m.length,N=m.find(I=>I.status==="in_progress"),L=N?N.activeForm||N.subject:`${V}/${T}`;return r.jsx("div",{className:"flex-none px-4 sm:px-6 pb-1",children:r.jsx("div",{className:"max-w-3xl mx-auto",children:r.jsxs("div",{className:"rounded-lg border border-border-muted/15 bg-bg-secondary/30 overflow-hidden",children:[r.jsxs("button",{onClick:f,className:"flex items-center gap-2 w-full px-3 py-1.5 hover:bg-bg-hover/30 transition-colors cursor-pointer",children:[A?r.jsx(we,{size:13,className:"animate-spin text-accent-purple flex-shrink-0"}):q?r.jsx(Cp,{size:13,className:"text-accent-purple flex-shrink-0"}):r.jsx(fp,{size:13,className:"text-text-tertiary flex-shrink-0"}),A?r.jsx("span",{className:"text-xs font-medium text-accent-purple",children:i("team.waitingForTeammates").replace("{count}",String(S.length)).replace("{s}",S.length>1?"s":"")}):r.jsxs(r.Fragment,{children:[U&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-xs font-medium text-text-primary",children:i("todo.title")}),r.jsxs("span",{className:"text-[11px] text-text-tertiary tabular-nums",children:[V,"/",T]})]}),q&&U&&r.jsx("span",{className:"text-border-muted/40",children:"·"}),q&&r.jsxs("span",{className:"text-[11px] text-text-tertiary",children:[i("team.title")," ",S.length>0?i("team.activeCount").replace("{count}",String(S.length)):""]})]}),!s&&U&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-border-muted/60 select-none",children:"|"}),N&&n&&r.jsx(we,{size:10,className:"text-accent-brand animate-spin flex-shrink-0"}),r.jsx("span",{className:"text-xs text-text-secondary truncate flex-1 text-left",children:L})]}),r.jsx("span",{className:"flex-1"}),!n&&!A&&r.jsx("span",{role:"button",tabIndex:0,onClick:x,onKeyDown:I=>{I.key==="Enter"&&x(I)},className:"text-text-tertiary hover:text-text-primary p-0.5 rounded transition-colors flex-shrink-0",children:r.jsx(Te,{size:12})}),s?r.jsx(rt,{size:12,className:"text-text-tertiary flex-shrink-0"}):r.jsx(Ie,{size:12,className:"text-text-tertiary flex-shrink-0"})]}),s&&r.jsxs("div",{className:"border-t border-border-muted/40",children:[q&&r.jsx("div",{className:"flex flex-wrap gap-1.5 px-3 py-1.5",children:a.map(I=>r.jsx(ow,{member:I,isFocused:o===I.name,onClick:()=>E(I.name)},I.name))}),U&&r.jsx("div",{className:`px-3 py-1.5 space-y-0.5 max-h-52 overflow-y-auto ${q?"border-t border-border-muted/30":""}`,children:m.map((I,G)=>{const F=I.owner?p.get(I.owner):void 0,W=!!F,z=F?as(F):void 0;return r.jsxs("div",{onClick:W?()=>_(I):void 0,className:`flex items-center gap-2 py-0.5 text-xs ${W?"cursor-pointer hover:bg-bg-hover/30 rounded px-1 -mx-1":""} ${I.status==="in_progress"?"text-text-primary":I.status==="completed"?"text-text-tertiary":"text-text-secondary"}`,children:[r.jsx(aw,{status:I.status}),r.jsxs("span",{className:`truncate ${I.status==="completed"?"line-through":""}`,children:[G+1,". ",I.status==="in_progress"?I.activeForm||I.subject||i("todo.untitled"):I.subject||i("todo.untitled")]}),F&&r.jsxs("span",{className:"text-[10px] font-medium flex-shrink-0 ml-auto",style:{color:z},children:["@",I.owner]})]},I.id)})})]})]})})})}const cw=Ne((e,t)=>({traces:[],total:0,loading:!1,error:null,selectedTraceId:null,traceDetail:null,detailLoading:!1,selectedSpanId:null,workerPid:null,filterSessionId:null,fetchTraces:async()=>{e({loading:!0,error:null});try{const{workerPid:n,filterSessionId:i}=t(),s=new URLSearchParams;s.set("limit","100"),n&&s.set("worker_pid",n),i&&s.set("session_id",i);const l=await fetch(`/api/v1/traces?${s}`,{headers:se()});if(!l.ok)throw new Error(`HTTP ${l.status}`);const a=(await l.json()).data||{};e({traces:a.traces||[],total:a.total||0,loading:!1})}catch(n){e({error:n.message,loading:!1})}},fetchTraceDetail:async n=>{e({detailLoading:!0,selectedTraceId:n,selectedSpanId:null});try{const{workerPid:i}=t(),s=new URLSearchParams;i&&s.set("worker_pid",i);const l=s.toString()?`?${s}`:"",d=await fetch(`/api/v1/traces/${n}${l}`,{headers:se()});if(!d.ok)throw new Error(`HTTP ${d.status}`);const a=await d.json();e({traceDetail:a.data||null,detailLoading:!1})}catch{e({traceDetail:null,detailLoading:!1})}},selectTrace:n=>{n===t().selectedTraceId?e({selectedTraceId:null,traceDetail:null,selectedSpanId:null}):n?t().fetchTraceDetail(n):e({selectedTraceId:null,traceDetail:null,selectedSpanId:null})},selectSpan:n=>e({selectedSpanId:n}),setWorkerPid:n=>{e({workerPid:n,selectedTraceId:null,traceDetail:null,selectedSpanId:null}),t().fetchTraces()},setFilterSessionId:n=>{e({filterSessionId:n,selectedTraceId:null,traceDetail:null,selectedSpanId:null}),t().fetchTraces()},clearTraces:async()=>{try{const{workerPid:n}=t(),i=new URLSearchParams;n&&i.set("worker_pid",n);const s=i.toString()?`?${i}`:"";await fetch(`/api/v1/traces${s}`,{method:"DELETE",headers:se()}),e({traces:[],total:0,selectedTraceId:null,traceDetail:null,selectedSpanId:null})}catch{}}})),tt={agent:{light:"#3b82f6",dark:"#60a5fa"},generation:{light:"#8b5cf6",dark:"#a78bfa"},function:{light:"#10b981",dark:"#34d399"},tool:{light:"#10b981",dark:"#34d399"},handoff:{light:"#f59e0b",dark:"#fbbf24"},guardrail:{light:"#f97316",dark:"#fb923c"},response:{light:"#6366f1",dark:"#818cf8"},custom:{light:"#6b7280",dark:"#9ca3af"}},Zh={agent:ur,generation:kp,function:nn,tool:nn,handoff:cp,guardrail:Qg,response:vp,custom:Mn};function zr(e){const t=new Map,n=[];for(const l of e)t.set(l.spanId,{span:l,children:[],depth:0});for(const l of t.values())if(l.span.parentId&&l.span.parentId!==l.span.spanId&&t.has(l.span.parentId)){const d=t.get(l.span.parentId);d.children.push(l),l.depth=d.depth+1}else n.push(l);const i=new Set,s=[...n];for(;s.length;){const l=s.shift();if(!i.has(l.span.spanId)){i.add(l.span.spanId);for(const d of l.children)d.depth=l.depth+1,s.push(d)}}return n.length===0&&e.length>0?e.map(l=>({span:l,children:[],depth:0})):n}function gd(e,t){const n=[],i=new Set;function s(l){for(const d of l)i.has(d.span.spanId)||(i.add(d.span.spanId),n.push({span:d.span,depth:d.depth}),t!=null&&t.has(d.span.spanId)||s(d.children))}return s(e),n}function Vu(e,t){return t.some(n=>n.parentId===e)}function dw(){var W;const{t:e}=ne(),t=Ye(z=>z.resolved),{traces:n,loading:i,error:s,selectedTraceId:l,traceDetail:d,detailLoading:a,selectedSpanId:o,workerPid:c,filterSessionId:p,fetchTraces:h,selectSpan:b,setWorkerPid:y,setFilterSessionId:k,clearTraces:v,fetchTraceDetail:g}=cw(),{workers:m,fetchWorkers:u}=Ur(),{sessionId:f}=nt(),[x,E]=C.useState("list"),[_,S]=C.useState("timeline"),[w,A]=C.useState(!1);C.useEffect(()=>{h(),u()},[h,u]);const D=C.useCallback(z=>{g(z),E("detail")},[g]),R=C.useCallback(()=>{E("list"),b(null)},[b]),j=C.useCallback(()=>{x==="detail"&&l?g(l):h()},[x,l,h,g]),O=C.useMemo(()=>n.filter(z=>z.category!=="auxiliary"),[n]),H=C.useMemo(()=>n.filter(z=>z.category==="auxiliary"),[n]);if(x==="list")return r.jsxs("div",{className:"flex-1 overflow-auto p-4 md:p-6",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx(vp,{size:20,className:"text-text-secondary"}),r.jsx("h1",{className:"text-lg font-semibold text-text-primary",children:e("traces.title")}),r.jsx("div",{className:"flex-1"}),f&&r.jsxs("select",{value:p||"",onChange:z=>k(z.target.value||null),className:"px-2 py-1 rounded-md border border-border-default bg-bg-primary text-text-primary text-xs",children:[r.jsx("option",{value:"",children:e("traces.allSessions")}),r.jsxs("option",{value:f,children:[f.substring(0,8),"... (",e("traces.current"),")"]})]}),m.length>1&&r.jsx(bw,{workers:m,selectedPid:c,onSelect:y}),r.jsx(xi,{icon:qe,title:e("traces.refresh"),onClick:j,spin:i}),n.length>0&&r.jsx(xi,{icon:pn,title:e("traces.clear"),onClick:()=>{confirm(e("traces.clearConfirm"))&&v()},danger:!0})]}),s&&r.jsx("div",{className:"mb-4 px-3 py-2 rounded-lg bg-accent-red/10 text-accent-red text-sm",children:s}),!i&&!n.length&&!s&&r.jsx("div",{className:"text-center py-16 text-text-tertiary text-sm",children:e("traces.noData")}),r.jsx("div",{className:"space-y-1",children:O.map(z=>r.jsx(Ku,{trace:z,onClick:()=>D(z.traceId)},z.traceId))}),H.length>0&&r.jsxs("div",{className:"mt-4",children:[r.jsxs("button",{onClick:()=>A(!w),className:"flex items-center gap-1.5 text-xs text-text-tertiary hover:text-text-secondary mb-1",children:[w?r.jsx(rt,{size:12}):r.jsx(Ie,{size:12}),r.jsx("span",{children:e("traces.auxiliaryCount").replace("{count}",String(H.length))})]}),w&&r.jsx("div",{className:"space-y-1 opacity-70",children:H.map(z=>r.jsx(Ku,{trace:z,onClick:()=>D(z.traceId)},z.traceId))})]})]});const M=d;if(!M)return r.jsx("div",{className:"flex-1 flex flex-col items-center justify-center gap-4",children:a?r.jsx("div",{className:"text-text-tertiary text-sm",children:e("traces.loading")}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"text-text-tertiary text-sm",children:e("traces.noData")}),r.jsx("button",{onClick:R,className:"px-4 py-2 rounded-lg border border-border-default text-text-secondary text-sm hover:bg-bg-hover",children:e("traces.back")})]})});const U=M.trace,q=M.spans,V=U.modelInfo,T=xw(q),N=(V==null?void 0:V.totalInputTokens)||T.totalInputTokens,L=(V==null?void 0:V.totalOutputTokens)||T.totalOutputTokens,I=(W=V==null?void 0:V.models)!=null&&W.length?V.models:T.models,G=V!=null&&V.totalInputTokens&&V.totalCachedTokens?V.totalCachedTokens/V.totalInputTokens*100:T.cacheHitRate,F=(V==null?void 0:V.callCount)||T.generationCount;return r.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex-none border-b border-border-default bg-bg-primary px-4 py-2",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:R,className:"p-1 rounded hover:bg-bg-hover text-text-tertiary",children:r.jsx(cn,{size:16})}),r.jsx("span",{className:"font-medium text-text-primary truncate",children:U.prompt||U.name}),r.jsx("div",{className:"flex-1"}),r.jsx(fd,{color:Jh(U.status),children:e(Qh(U.status))}),r.jsx(xi,{icon:qe,title:e("traces.refresh"),onClick:j,spin:a})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1 mt-2 text-xs",children:[r.jsx(Mt,{label:e("traces.duration"),value:U.duration!=null?ct(U.duration):"--"}),r.jsx(Mt,{label:"Spans",value:String(U.spanCount||0)}),N+L>0&&r.jsx(Mt,{label:"Tokens",value:`${Cr(N)} in / ${Cr(L)} out`}),N>0&&r.jsx(Mt,{label:"Cache",value:`${G.toFixed(0)}%`,accent:G>0}),I.length>0&&r.jsx(Mt,{label:e("traces.spanDetail.model"),value:I.join(", ")}),T.toolCount>0&&r.jsx(Mt,{label:"Tools",value:`${T.toolCount}${T.errorCount>0?` (${T.errorCount} err)`:""}`}),F>0&&r.jsx(Mt,{label:"LLM",value:e("traces.llmCalls").replace("{count}",String(F))})]}),r.jsxs("div",{className:"flex items-center gap-1 mt-2 overflow-x-auto",children:[["timeline","tree","flame","graph"].map(z=>r.jsx("button",{onClick:()=>S(z),className:`px-3 py-1 rounded-md text-xs font-medium transition-colors whitespace-nowrap ${_===z?"bg-accent-brand/10 text-accent-brand":"text-text-tertiary hover:text-text-primary hover:bg-bg-hover"}`,children:e(`traces.tab.${z}`)},z)),r.jsx("div",{className:"flex-1"}),r.jsx("div",{className:"hidden md:flex",children:r.jsx(vw,{theme:t})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto",children:r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsxs("div",{className:"flex-1 overflow-auto p-2 md:p-4",children:[_==="timeline"&&r.jsx(pw,{detail:M,selectedSpanId:o,onSelectSpan:b,theme:t}),_==="tree"&&r.jsx(hw,{detail:M,selectedSpanId:o,onSelectSpan:b,theme:t}),_==="flame"&&r.jsx(mw,{detail:M,selectedSpanId:o,onSelectSpan:b,theme:t}),_==="graph"&&r.jsx(gw,{detail:M,selectedSpanId:o,onSelectSpan:b,theme:t})]}),o&&r.jsx(fw,{span:M.spans.find(z=>z.spanId===o)||null,onClose:()=>b(null)})]})})]})}function Ku({trace:e,onClick:t}){var a,o,c;const{t:n}=ne(),i=yw(e.status),s=e.prompt||e.name,l=_w(e.startedAt),d=e.category==="auxiliary";return r.jsxs("button",{onClick:t,className:"w-full flex items-start gap-3 px-3 py-2.5 rounded-lg border border-border-default text-left hover:bg-bg-hover transition-colors group",children:[r.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 mt-1.5 bg-${i}`}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[d&&r.jsx("span",{className:"shrink-0 text-[10px] px-1 py-0 rounded bg-bg-hover text-text-tertiary",children:n("traces.auto")}),r.jsx("span",{className:`font-medium text-sm truncate ${d?"text-text-secondary":"text-text-primary"}`,children:s}),r.jsx(fd,{color:Jh(e.status),children:n(Qh(e.status))})]}),r.jsxs("div",{className:"flex items-center gap-3 mt-0.5 text-xs text-text-tertiary",children:[r.jsx("span",{children:l}),r.jsx("span",{children:e.duration!=null?ct(e.duration):"--"}),r.jsxs("span",{children:[e.spanCount," spans"]}),e.totalTokens>0&&r.jsx("span",{children:Cr(e.totalTokens)}),(o=(a=e.modelInfo)==null?void 0:a.models)!=null&&o.length?r.jsx("span",{children:e.modelInfo.models.join(", ")}):null,(c=e.modelInfo)!=null&&c.callCount?r.jsx("span",{children:n("traces.llmCalls").replace("{count}",String(e.modelInfo.callCount))}):null,e.modelInfo&&e.modelInfo.totalCachedTokens>0&&e.modelInfo.totalInputTokens>0&&r.jsxs("span",{className:"text-accent-green",children:["Cache ",Math.round(e.modelInfo.totalCachedTokens/e.modelInfo.totalInputTokens*100),"%"]})]})]}),r.jsx(Ie,{size:14,className:"text-text-tertiary shrink-0 mt-1.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}const mt=28,sr=16,uw=2;function pw({detail:e,selectedSpanId:t,onSelectSpan:n,theme:i}){const{t:s}=ne(),l=i==="dark",[d,a]=C.useState(new Set),[o,c]=C.useState(""),p=C.useMemo(()=>zr(e.spans),[e.spans]),h=C.useMemo(()=>gd(p,d),[p,d]),b=o?h.filter(u=>{var f;return u.span.name.toLowerCase().includes(o.toLowerCase())||((f=u.span.toolName)==null?void 0:f.toLowerCase().includes(o.toLowerCase()))}):h,y=u=>a(f=>{const x=new Set(f);return x.has(u)?x.delete(u):x.add(u),x}),{minTime:k,totalRange:v}=C.useMemo(()=>{const u=e.spans.map(_=>new Date(_.startedAt).getTime()),f=e.spans.filter(_=>_.endedAt).map(_=>new Date(_.endedAt).getTime()),x=Math.min(...u),E=f.length?Math.max(...f):x+1e3;return{minTime:x,totalRange:E-x||1}},[e.spans]);if(!b.length)return r.jsx("div",{className:"text-sm text-text-tertiary py-8 text-center",children:s("traces.noSpans")});const g=220,m=5;return r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-xs",children:[r.jsx(at,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-text-tertiary"}),r.jsx("input",{value:o,onChange:u=>c(u.target.value),placeholder:s("traces.search"),className:"w-full pl-7 pr-2 py-1 text-xs rounded-md border border-border-default bg-bg-primary text-text-primary"})]}),r.jsx("button",{onClick:()=>a(new Set),className:"text-xs text-text-tertiary hover:text-text-primary",children:s("traces.expandAll")}),r.jsx("button",{onClick:()=>a(new Set(e.spans.filter(u=>Vu(u.spanId,e.spans)).map(u=>u.spanId))),className:"text-xs text-text-tertiary hover:text-text-primary",children:s("traces.collapseAll")})]}),r.jsxs("div",{className:"flex overflow-x-auto",children:[r.jsx("div",{className:"shrink-0",style:{width:g},children:b.map(u=>{const f=Vu(u.span.spanId,e.spans),x=d.has(u.span.spanId),E=t===u.span.spanId,_=tt[u.span.type]||tt.custom;return r.jsxs("div",{className:`flex items-center gap-1 cursor-pointer text-xs h-[${mt}px] ${E?"bg-accent-brand/5":"hover:bg-bg-hover"}`,style:{paddingLeft:4+u.depth*16,height:mt},onClick:()=>n(E?null:u.span.spanId),children:[f?r.jsx("button",{onClick:S=>{S.stopPropagation(),y(u.span.spanId)},className:"p-0.5",children:x?r.jsx(Ie,{size:12}):r.jsx(rt,{size:12})}):r.jsx("span",{className:"w-4"}),r.jsx("span",{className:"w-2 h-2 rounded-sm shrink-0",style:{backgroundColor:l?_.dark:_.light}}),r.jsx("span",{className:"truncate text-text-primary",children:u.span.name})]},u.span.spanId)})}),r.jsx("div",{className:"flex-1 min-w-[300px]",children:r.jsxs("svg",{width:"100%",viewBox:`0 0 900 ${b.length*mt+20}`,className:"block",children:[Array.from({length:m+1},(u,f)=>{const x=f/m*900;return r.jsx("line",{x1:x,y1:0,x2:x,y2:b.length*mt,stroke:l?"#374151":"#e5e7eb",strokeWidth:.5,strokeDasharray:f?"2,2":void 0},f)}),b.map((u,f)=>{var O;const x=f*mt,E=new Date(u.span.startedAt).getTime(),_=u.span.endedAt?new Date(u.span.endedAt).getTime():E+v,S=(E-k)/v*900,w=Math.max((_-E)/v*900,uw),A=tt[u.span.type]||tt.custom,D=l?A.dark:A.light,R=((O=e.bottleneck)==null?void 0:O.spanId)===u.span.spanId,j=t===u.span.spanId;return r.jsxs("g",{onClick:()=>n(j?null:u.span.spanId),style:{cursor:"pointer"},children:[j&&r.jsx("rect",{x:0,y:x,width:900,height:mt,fill:l?"#1e3a5f":"#dbeafe"}),r.jsx("rect",{x:S,y:x+(mt-sr)/2,width:w,height:sr,fill:D,rx:3,opacity:u.span.status==="running"?.5:.85}),R&&r.jsx("rect",{x:S-1,y:x+(mt-sr)/2-1,width:w+2,height:sr+2,fill:"none",stroke:"#f59e0b",strokeWidth:1.5,strokeDasharray:"4,2",rx:3}),w>36&&u.span.duration!=null&&r.jsx("text",{x:S+w/2,y:x+mt/2,dominantBaseline:"central",textAnchor:"middle",fontSize:9,fill:"#fff",fontFamily:"monospace",children:ct(u.span.duration)}),r.jsxs("title",{children:[u.span.name," — ",u.span.duration!=null?ct(u.span.duration):"running"]})]},u.span.spanId)}),Array.from({length:m+1},(u,f)=>r.jsx("text",{x:f/m*900,y:b.length*mt+14,textAnchor:"middle",fontSize:9,fill:l?"#9ca3af":"#6b7280",fontFamily:"monospace",children:ct(f/m*v)},`t${f}`))]})})]})]})}function hw({detail:e,selectedSpanId:t,onSelectSpan:n,theme:i}){const{t:s}=ne(),l=i==="dark",d=C.useMemo(()=>zr(e.spans),[e.spans]);function a(o,c,p){var f;const h=o.span,b=Zh[h.type]||Mn,y=tt[h.type]||tt.custom,k=t===h.spanId,v=((f=e.bottleneck)==null?void 0:f.spanId)===h.spanId,g=c?"└── ":"├── ",m=h.status==="error",u=h.error;return r.jsxs("div",{children:[r.jsxs("div",{className:`flex items-center gap-2 py-1 px-2 rounded cursor-pointer text-sm ${k?"bg-accent-brand/10":"hover:bg-bg-hover"} ${v?"ring-1 ring-accent-yellow":""} ${m?"bg-accent-red/5":""}`,onClick:()=>n(k?null:h.spanId),children:[o.depth>0&&r.jsxs("span",{className:"text-text-tertiary font-mono text-xs whitespace-pre",children:[p,g]}),r.jsx(b,{size:14,style:{color:m?void 0:l?y.dark:y.light},className:`shrink-0 ${m?"text-accent-red":""}`}),r.jsx("span",{className:`font-medium truncate ${m?"text-accent-red":"text-text-primary"}`,children:h.name}),h.duration!=null&&r.jsx("span",{className:"text-xs text-text-tertiary shrink-0",children:ct(h.duration)}),(h.type==="generation"||h.type==="response")&&(h.inputTokens||h.outputTokens)&&r.jsxs("span",{className:"text-xs text-accent-purple shrink-0",children:[h.inputTokens||0,"→",h.outputTokens||0," tok"]}),h.model&&r.jsxs("span",{className:"text-xs text-text-tertiary shrink-0",children:["(",h.model,")"]}),m&&r.jsx("span",{className:"text-xs font-medium text-accent-red shrink-0",children:"error"}),v&&r.jsx("span",{className:"text-xs text-accent-yellow shrink-0",children:s("traces.bottleneck")})]}),m&&u&&r.jsx("div",{className:"ml-8 px-2 py-1 text-xs text-accent-red bg-accent-red/5 rounded cursor-pointer",style:{paddingLeft:(o.depth>0?p.length*6+28:8)+24},onClick:()=>n(h.spanId),children:u.length>200?u.substring(0,200)+"...":u}),o.children.length>0&&r.jsx("div",{className:"ml-2",children:o.children.map((x,E)=>a(x,E===o.children.length-1,p+(c?" ":"│ ")))})]},h.spanId)}return d.length?r.jsx("div",{className:"space-y-0.5",children:d.map((o,c)=>a(o,c===d.length-1,""))}):r.jsx("div",{className:"text-sm text-text-tertiary py-8 text-center",children:s("traces.noSpans")})}function mw({detail:e,selectedSpanId:t,onSelectSpan:n,theme:i}){const{t:s}=ne(),l=i==="dark",d=C.useMemo(()=>gd(zr(e.spans)),[e.spans]),{minTime:a,totalRange:o}=C.useMemo(()=>{const k=e.spans.map(u=>new Date(u.startedAt).getTime()),v=e.spans.filter(u=>u.endedAt).map(u=>new Date(u.endedAt).getTime()),g=Math.min(...k),m=v.length?Math.max(...v):g+1e3;return{minTime:g,totalRange:m-g||1}},[e.spans]);if(!d.length)return r.jsx("div",{className:"text-sm text-text-tertiary py-8 text-center",children:s("traces.noSpans")});const c=Math.max(...d.map(k=>k.depth))+1,p=24,h=1,b=800,y=c*(p+h);return r.jsx("svg",{width:"100%",viewBox:`0 0 ${b} ${y}`,className:"block",style:{maxWidth:b},children:d.map(k=>{const v=k.span,g=new Date(v.startedAt).getTime(),m=v.endedAt?new Date(v.endedAt).getTime():g+o,u=(g-a)/o*b,f=Math.max((m-g)/o*b,1),x=k.depth*(p+h),E=tt[v.type]||tt.custom,_=l?E.dark:E.light,S=t===v.spanId;return r.jsxs("g",{onClick:()=>n(S?null:v.spanId),style:{cursor:"pointer"},children:[r.jsx("rect",{x:u,y:x,width:f,height:p,fill:_,rx:2,opacity:S?1:.8,stroke:S?l?"#60a5fa":"#3b82f6":"none",strokeWidth:S?1.5:0}),f>40&&r.jsx("text",{x:u+4,y:x+p/2,dominantBaseline:"central",fontSize:10,fill:"#fff",fontFamily:"monospace",children:v.name.length>f/6?v.name.slice(0,Math.floor(f/6)-1)+"…":v.name}),r.jsxs("title",{children:[v.name," — ",v.duration!=null?ct(v.duration):"running",v.model?` (${v.model})`:""]})]},v.spanId)})})}function gw({detail:e,selectedSpanId:t,onSelectSpan:n,theme:i}){const{t:s}=ne(),l=i==="dark",d=C.useRef(null),{groupNodes:a,groupEdges:o}=C.useMemo(()=>{const T=new Map,N=gd(zr(e.spans));for(const F of N){const W=F.span,z=`${W.parentId||"root"}::${W.type}::${W.name.split("(")[0].trim()}`,B=T.get(z);B?(B.count++,B.totalDuration+=W.duration||0,B.totalTokens+=(W.inputTokens||0)+(W.outputTokens||0),W.status==="error"&&(B.hasError=!0)):T.set(z,{id:z,type:W.type,name:W.name.split("(")[0].trim(),count:1,totalDuration:W.duration||0,totalTokens:(W.inputTokens||0)+(W.outputTokens||0),hasError:W.status==="error",parentId:W.parentId,depth:F.depth,representativeSpanId:W.spanId})}const L=Array.from(T.values()),I=[];for(const F of L)if(F.parentId){const W=e.spans.find(z=>z.spanId===F.parentId);if(W){const z=`${W.parentId||"root"}::${W.type}::${W.name.split("(")[0].trim()}`;T.has(z)&&z!==F.id&&I.push({from:z,to:F.id})}}const G=new Set(I.map(F=>`${F.from}\0${F.to}`));return{groupNodes:L,groupEdges:Array.from(G).map(F=>{const[W,z]=F.split("\0");return{from:W,to:z}})}},[e.spans]),c=180,p=60,h=70,b=28,{positions:y,svgW:k,svgH:v}=C.useMemo(()=>{const T=new Map;for(const W of a)T.has(W.depth)||T.set(W.depth,[]),T.get(W.depth).push(W);const N=Array.from(T.entries()).sort((W,z)=>W[0]-z[0]),L=Math.max(1,...N.map(([,W])=>W.length)),I=Math.max(L*(c+b)+b,400),G=N.length*(p+h)+20,F=new Map;for(const[W,z]of N){const B=z.length*c+(z.length-1)*b,$=(I-B)/2;z.forEach((Y,X)=>F.set(Y.id,{x:$+X*(c+b),y:W*(p+h)+10}))}return{positions:F,svgW:I,svgH:G}},[a,c,p,h,b]),[g,m]=C.useState({zoom:1,panX:0,panY:0}),[u,f]=C.useState(!1),x=C.useRef({x:0,y:0,panX:0,panY:0}),E=C.useCallback(()=>{const T=d.current;if(!T||k<=0||v<=0)return;const N=T.clientWidth,L=T.clientHeight;if(N<=0||L<=0)return;const I=Math.min(N/k,L/v,1.5)*.9;m({zoom:I,panX:(N-k*I)/2,panY:(L-v*I)/2})},[k,v]);C.useEffect(()=>{E()},[E,a.length]),C.useEffect(()=>{const T=d.current;if(!T)return;const N=L=>{L.preventDefault();const I=T.getBoundingClientRect(),G=L.clientX-I.left,F=L.clientY-I.top,W=L.deltaY<0?1.06:.94;m(z=>{const B=Math.max(.1,Math.min(5,z.zoom*W));return{zoom:B,panX:G-(G-z.panX)*(B/z.zoom),panY:F-(F-z.panY)*(B/z.zoom)}})};return T.addEventListener("wheel",N,{passive:!1}),()=>T.removeEventListener("wheel",N)},[]);const _=C.useRef(null),S=C.useCallback(T=>{if(T.touches.length===2){const N=T.touches[0].clientX-T.touches[1].clientX,L=T.touches[0].clientY-T.touches[1].clientY;_.current={dist:Math.hypot(N,L),cx:(T.touches[0].clientX+T.touches[1].clientX)/2,cy:(T.touches[0].clientY+T.touches[1].clientY)/2}}else T.touches.length===1&&(f(!0),x.current={x:T.touches[0].clientX,y:T.touches[0].clientY,panX:g.panX,panY:g.panY})},[g.panX,g.panY]),w=C.useCallback(T=>{if(T.touches.length===2&&_.current){T.preventDefault();const N=T.touches[0].clientX-T.touches[1].clientX,L=T.touches[0].clientY-T.touches[1].clientY,I=Math.hypot(N,L),G=I/_.current.dist,F=d.current;if(F){const W=F.getBoundingClientRect(),z=_.current.cx-W.left,B=_.current.cy-W.top;m($=>{const Y=Math.max(.1,Math.min(5,$.zoom*G));return{zoom:Y,panX:z-(z-$.panX)*(Y/$.zoom),panY:B-(B-$.panY)*(Y/$.zoom)}})}_.current.dist=I}else T.touches.length===1&&u&&m(N=>({...N,panX:x.current.panX+T.touches[0].clientX-x.current.x,panY:x.current.panY+T.touches[0].clientY-x.current.y}))},[u]),A=C.useCallback(()=>{f(!1),_.current=null},[]),D=C.useCallback(T=>{T.button===0&&(f(!0),x.current={x:T.clientX,y:T.clientY,panX:g.panX,panY:g.panY})},[g.panX,g.panY]),R=C.useCallback(T=>{u&&m(N=>({...N,panX:x.current.panX+T.clientX-x.current.x,panY:x.current.panY+T.clientY-x.current.y}))},[u]),j=C.useCallback(()=>f(!1),[]),O=C.useMemo(()=>{if(!t)return new Set;const T=a.find(z=>z.representativeSpanId===t);if(!T)return new Set;const N=new Set([T.id]),L=new Map;for(const z of o)L.set(z.to,z.from);let I=T.id;for(;L.has(I)&&(I=L.get(I),!N.has(I));)N.add(I);const G=new Map;for(const z of o)G.has(z.from)||G.set(z.from,[]),G.get(z.from).push(z.to);const F=[T.id],W=new Set([T.id]);for(;F.length;){const z=F.shift();for(const B of G.get(z)||[])W.has(B)||(W.add(B),N.add(B),F.push(B))}return N},[t,a,o]),H=C.useCallback((T,N)=>O.has(T)&&O.has(N),[O]);if(!a.length)return r.jsx("div",{className:"text-sm text-text-tertiary py-8 text-center",children:s("traces.noSpans")});const M=l?"#d1d5db":"#374151",U=l?"#9ca3af":"#6b7280",q=l?"#4b5563":"#d1d5db",V=l?"#60a5fa":"#3b82f6";return r.jsxs("div",{ref:d,className:"w-full h-full overflow-hidden relative touch-none",style:{cursor:u?"grabbing":"grab",minHeight:300},onMouseDown:D,onMouseMove:R,onMouseUp:j,onMouseLeave:j,onTouchStart:S,onTouchMove:w,onTouchEnd:A,children:[r.jsx("button",{onClick:E,className:"absolute top-2 right-2 z-10 px-2 py-1 rounded-md bg-bg-secondary border border-border-default text-text-tertiary hover:text-text-primary text-xs",style:{cursor:"pointer"},children:s("traces.fit")}),r.jsx("svg",{width:"100%",height:"100%",style:{position:"absolute",left:0,top:0},children:r.jsxs("g",{transform:`translate(${g.panX},${g.panY}) scale(${g.zoom})`,children:[o.map((T,N)=>{const L=y.get(T.from),I=y.get(T.to);if(!L||!I)return null;const G=L.x+c/2,F=L.y+p,W=I.x+c/2,z=I.y,B=H(T.from,T.to);return r.jsx("path",{d:`M${G},${F} C${G},${F+h/2} ${W},${z-h/2} ${W},${z}`,fill:"none",stroke:B?V:q,strokeWidth:B?2.5:1.5,opacity:O.size>0&&!B?.2:1},N)}),a.map(T=>{const N=y.get(T.id);if(!N)return null;const L=tt[T.type]||tt.custom,I=l?L.dark:L.light,G=t===T.representativeSpanId,F=O.has(T.id),W=O.size>0&&!F,z=T.count>1?`${T.name} x${T.count}`:T.name,B=ct(T.totalDuration),$=T.totalTokens>0?` · ${Cr(T.totalTokens)}`:"";return r.jsxs("g",{onClick:Y=>{Y.stopPropagation(),n(G?null:T.representativeSpanId)},style:{cursor:"pointer"},opacity:W?.25:1,children:[r.jsx("rect",{x:N.x,y:N.y,width:c,height:p,rx:8,fill:l?"#1f2937":"#fff",stroke:G?I:T.hasError?"#ef4444":F?V:q,strokeWidth:G?2.5:F?2:1}),r.jsx("rect",{x:N.x,y:N.y,width:6,height:p,rx:3,fill:I}),r.jsx("text",{x:N.x+16,y:N.y+24,fontSize:13,fill:M,fontWeight:T.count>1?600:500,fontFamily:"sans-serif",children:z.length>20?z.slice(0,19)+"…":z}),r.jsxs("text",{x:N.x+16,y:N.y+44,fontSize:11,fill:U,fontFamily:"monospace",children:[B,$]}),r.jsxs("title",{children:[z," — ",B,$]})]},T.id)})]})})]})}function fw({span:e,onClose:t}){const{t:n}=ne(),[i,s]=C.useState("overview");if(!e)return null;const l=Zh[e.type]||Mn,d=e.duration;return r.jsxs("div",{className:"flex-none border-t border-border-default bg-bg-primary max-h-[60%] md:max-h-[40%] overflow-auto",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 md:px-4 py-2 border-b border-border-default",children:[r.jsx(l,{size:14,className:"text-text-secondary shrink-0"}),r.jsx("span",{className:"font-medium text-text-primary text-sm truncate",children:e.name}),e.duration!=null&&r.jsx("span",{className:"text-xs text-text-tertiary",children:ct(e.duration)}),e.status==="error"&&r.jsx(fd,{color:"red",children:n("traces.status.error")}),r.jsx("div",{className:"flex-1"}),r.jsx("button",{onClick:t,className:"p-1 rounded hover:bg-bg-hover text-text-tertiary",children:r.jsx(Te,{size:14})})]}),r.jsx("div",{className:"flex gap-1 px-4 pt-2",children:["overview","io","attrs"].map(a=>r.jsx("button",{onClick:()=>s(a),className:`px-2 py-0.5 rounded text-xs ${i===a?"bg-bg-hover text-text-primary font-medium":"text-text-tertiary hover:text-text-primary"}`,children:n(a==="overview"?"traces.spanDetail.overview":a==="io"?"traces.spanDetail.io":"traces.spanDetail.attributes")},a))}),r.jsxs("div",{className:"px-3 md:px-4 py-3 text-xs",children:[i==="overview"&&r.jsxs("div",{children:[e.error&&r.jsxs("div",{className:"mb-3 px-3 py-2 rounded-md bg-accent-red/10 border border-accent-red/20",children:[r.jsx("div",{className:"font-medium text-accent-red mb-1",children:n("traces.spanDetail.error")}),r.jsx("pre",{className:"text-accent-red font-mono whitespace-pre-wrap break-all max-h-32 overflow-auto",children:e.error})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[r.jsx(vt,{label:n("traces.spanDetail.type"),value:e.type}),r.jsx(vt,{label:n("traces.spanDetail.duration"),value:e.duration!=null?ct(e.duration):"--"}),r.jsx(vt,{label:n("traces.selfTime"),value:d!=null?ct(d):"--"}),r.jsx(vt,{label:"Status",value:e.status}),e.model&&r.jsx(vt,{label:n("traces.spanDetail.model"),value:e.model}),(e.inputTokens!=null||e.outputTokens!=null)&&r.jsx(vt,{label:n("traces.spanDetail.tokens"),value:`${e.inputTokens||0} in / ${e.outputTokens||0} out`}),e.toolName&&r.jsx(vt,{label:"Tool",value:e.toolName}),e.fromAgent&&r.jsx(vt,{label:"From",value:e.fromAgent}),e.toAgent&&r.jsx(vt,{label:"To",value:e.toAgent})]})]}),i==="io"&&r.jsxs("div",{className:"space-y-3",children:[e.toolInput&&r.jsxs("div",{children:[r.jsx("div",{className:"text-text-tertiary mb-1",children:n("traces.spanDetail.input")}),r.jsx("pre",{className:"p-2 rounded bg-bg-secondary text-text-primary font-mono text-xs whitespace-pre-wrap break-all max-h-40 overflow-auto",children:e.toolInput})]}),e.toolOutput&&r.jsxs("div",{children:[r.jsx("div",{className:"text-text-tertiary mb-1",children:n("traces.spanDetail.output")}),r.jsx("pre",{className:"p-2 rounded bg-bg-secondary text-text-primary font-mono text-xs whitespace-pre-wrap break-all max-h-40 overflow-auto",children:e.toolOutput})]}),!e.toolInput&&!e.toolOutput&&r.jsx("div",{className:"text-text-tertiary",children:n("traces.noIO")})]}),i==="attrs"&&r.jsx("div",{className:"space-y-1",children:e.attributes&&Object.keys(e.attributes).length>0?Object.entries(e.attributes).map(([a,o])=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"shrink-0 text-text-tertiary w-32",children:a}),r.jsx("span",{className:"text-text-primary font-mono break-all",children:typeof o=="string"?o:JSON.stringify(o)})]},a)):r.jsx("div",{className:"text-text-tertiary",children:n("traces.noAttrs")})})]})]})}function bw({workers:e,selectedPid:t,onSelect:n}){var o;const{t:i}=ne(),s=(o=e.find(c=>c.isCurrent))==null?void 0:o.pid,l=e.find(c=>c.isCurrent),d=e.filter(c=>!c.isCurrent),a=t??(s!=null?String(s):"");return r.jsxs("select",{value:a,onChange:c=>{const p=c.target.value;n(p===String(s)?null:p||null)},className:"px-2 py-1 rounded-md border border-border-default bg-bg-primary text-text-primary text-xs",children:[r.jsx("option",{value:"all",children:i("traces.allInstances")}),l&&r.jsxs("option",{value:l.pid,children:["PID ",l.pid," — ",l.name||l.kind||"worker"," (",i("traces.current"),")"]}),d.map(c=>r.jsxs("option",{value:c.pid,children:["PID ",c.pid," — ",c.name||c.kind||"worker"]},c.pid))]})}function xi({icon:e,title:t,onClick:n,spin:i,danger:s}){return r.jsx("button",{onClick:n,className:`p-1.5 rounded-md text-text-tertiary hover:bg-bg-hover transition-colors ${s?"hover:text-accent-red":"hover:text-text-primary"}`,title:t,children:r.jsx(e,{size:16,className:i?"animate-spin":""})})}function fd({children:e,color:t}){const n=t==="red"?"text-accent-red bg-accent-red/10":t==="yellow"?"text-accent-yellow bg-accent-yellow/10":t==="grey"?"text-text-tertiary bg-bg-hover":"text-accent-green bg-accent-green/10";return r.jsx("span",{className:`shrink-0 text-xs px-1.5 py-0.5 rounded ${n}`,children:e})}function Jh(e){return e==="error"?"red":e==="running"?"yellow":e==="cancelled"?"grey":"green"}function yw(e){return e==="error"?"accent-red":e==="running"?"accent-yellow":e==="cancelled"?"text-tertiary":"accent-green"}function Qh(e){return e==="error"?"traces.status.error":e==="running"?"traces.status.running":e==="cancelled"?"traces.status.cancelled":"traces.status.ok"}function Mt({label:e,value:t,accent:n}){return r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsxs("span",{className:"text-text-tertiary",children:[e,":"]}),r.jsx("span",{className:`font-mono ${n?"text-accent-green font-medium":"text-text-primary"}`,children:t})]})}function xw(e){var c;let t=0,n=0,i=0;const s=new Set;let l=0,d=0,a=0;for(const p of e)p.status==="error"&&a++,(p.type==="generation"||p.type==="response")&&(d++,t+=p.inputTokens||0,n+=p.outputTokens||0,p.model&&s.add(p.model),(c=p.attributes)!=null&&c.cached_tokens&&(i+=Number(p.attributes.cached_tokens)||0)),(p.type==="function"||p.type==="tool")&&l++;const o=t>0?i/t*100:0;return{totalInputTokens:t,totalOutputTokens:n,cacheHitRate:o,models:Array.from(s),toolCount:l,generationCount:d,errorCount:a}}function vt({label:e,value:t,className:n}){return r.jsxs("div",{className:n,children:[r.jsx("div",{className:"text-text-tertiary mb-0.5",children:e}),r.jsx("div",{className:"text-text-primary font-mono",children:t})]})}function vw({theme:e}){const{t}=ne(),n=e==="dark",i=[["agent",t("traces.legend.agent")],["generation",t("traces.legend.generation")],["function",t("traces.legend.function")],["handoff",t("traces.legend.handoff")],["guardrail",t("traces.legend.guardrail")]];return r.jsx("div",{className:"flex items-center gap-3 text-xs text-text-tertiary",children:i.map(([s,l])=>{const d=tt[s]||tt.custom;return r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"w-2.5 h-2 rounded-sm",style:{backgroundColor:n?d.dark:d.light}}),r.jsx("span",{children:l})]},s)})})}function ct(e){return e<1?"<1ms":e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m${(e%6e4/1e3).toFixed(0)}s`}function Cr(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tok`:e>=1e3?`${(e/1e3).toFixed(1)}k tok`:`${e} tok`}function _w(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return""}}function Sw(e){try{const t=new URL(e),n=window.location.hostname;return t.hostname===n?e:(t.hostname=n,t.toString())}catch(t){return console.warn("Failed to resolve worker URL, using original:",e,t),e}}function kw({title:e,message:t,confirmLabel:n,cancelLabel:i,danger:s,onConfirm:l,onCancel:d}){const{t:a}=ne(),o=C.useRef(null);C.useEffect(()=>{var p;(p=o.current)==null||p.focus()},[]);const c=C.useCallback(p=>{p.key==="Escape"&&(p.preventDefault(),d())},[d]);return r.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center",onKeyDown:c,children:[r.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:d}),r.jsxs("div",{role:"alertdialog","aria-modal":"true","aria-labelledby":"confirm-title",className:"relative bg-bg-card border border-border-default rounded-xl shadow-2xl w-full max-w-[400px] mx-4 overflow-hidden",children:[r.jsxs("div",{className:"px-5 pt-5 pb-4",children:[s&&r.jsx("div",{className:"w-10 h-10 rounded-full bg-error-bg flex items-center justify-center mb-3",children:r.jsx(In,{size:20,className:"text-accent-red"})}),r.jsx("h3",{id:"confirm-title",className:"text-text-primary text-[15px] font-semibold mb-1",children:e}),t&&r.jsx("p",{className:"text-text-secondary text-[13px] leading-relaxed",children:t})]}),r.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 pb-4",children:[r.jsx("button",{onClick:d,className:"px-4 py-1.5 text-[13px] text-text-secondary hover:text-text-primary rounded-lg hover:bg-bg-hover transition-colors",children:i||a("app.cancel")}),r.jsx("button",{ref:o,onClick:l,className:["px-4 py-1.5 text-[13px] font-medium rounded-lg transition-colors",s?"bg-accent-red text-white hover:opacity-90":"bg-accent-brand text-bg-primary hover:opacity-90"].join(" "),children:n||a("app.confirm")})]})]})]})}const ww=1e4;function Ew(){const{t:e}=ne(),{workers:t,daemon:n,loading:i,error:s,fetchWorkers:l,fetchDaemonStatus:d,killWorker:a,startDaemon:o,stopDaemon:c,restartDaemon:p}=Ur();C.useEffect(()=>{l(),d();const m=setInterval(()=>{l(),d()},ww);return()=>clearInterval(m)},[l,d]);const h=C.useCallback(()=>{l(),d()},[l,d]),b=C.useCallback(m=>{window.location.hash=`#/logs?worker=${m.pid}`},[]),[y,k]=C.useState(null),v=C.useCallback(async m=>{k(m)},[]),g=C.useCallback(async()=>{y&&(await a(String(y.pid)),k(null))},[y,a]);return r.jsxs("div",{className:"flex-1 overflow-auto p-4 md:p-6",children:[y&&r.jsx(kw,{title:e("workers.action.kill.confirm"),danger:!0,onConfirm:g,onCancel:()=>k(null)}),r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Wt,{size:20,className:"text-accent-brand"}),r.jsx("h1",{className:"text-lg font-semibold text-text-primary",children:e("workers.title")})]}),r.jsxs("button",{onClick:h,className:`flex items-center gap-1.5 px-3 py-1.5 text-sm text-text-secondary
|
|
683
683
|
hover:text-text-primary hover:bg-bg-hover rounded-lg transition-colors`,title:e("workers.refresh"),children:[r.jsx(qe,{size:14,className:i?"animate-spin":""}),r.jsx("span",{children:e("workers.refresh")})]})]}),s&&r.jsx("div",{className:"mb-4 p-3 rounded-xl error-banner text-sm",children:s}),r.jsx(Cw,{daemon:n,onStart:()=>o(),onStop:c,onRestart:p}),r.jsx(Tw,{workers:t,onViewLogs:b,onKill:v})]})}function Cw({daemon:e,onStart:t,onStop:n,onRestart:i}){const{t:s}=ne(),l=(e==null?void 0:e.status)==="running",[d,a]=C.useState(null),o=C.useCallback(async(c,p)=>{a(c);try{await p()}finally{a(null)}},[]);return r.jsx("div",{className:`bg-bg-secondary rounded-xl p-4 md:p-5 border mb-6 transition-colors worker-card-hover ${l?"border-green-400/40 ring-1 ring-green-400/10":"border-border-default"}`,children:r.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(gr,{size:18,className:l?"text-green-500":"text-text-tertiary"}),r.jsx("span",{className:"text-base font-semibold text-text-primary",children:s("workers.daemon")}),(e==null?void 0:e.pid)&&r.jsxs("span",{className:"text-xs text-text-tertiary font-mono bg-bg-tertiary px-2 py-0.5 rounded-md ml-2 border border-border-default/50",children:["PID ",e.pid]})]}),r.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"relative flex h-2.5 w-2.5",children:[l&&r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),r.jsx("span",{className:`relative inline-flex rounded-full h-2.5 w-2.5 ${l?"bg-green-500":"bg-gray-400"}`})]}),r.jsx("span",{className:"text-sm font-medium text-text-secondary",children:s(l?"workers.daemon.running":"workers.daemon.stopped")})]}),(e==null?void 0:e.endpoint)&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"text-border-primary",children:"|"}),r.jsx(st,{size:14,className:"text-text-tertiary ml-1"}),r.jsx("a",{href:e.endpoint,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-accent-brand hover:underline",children:e.endpoint})]})]})]}),r.jsx("div",{className:"flex items-center gap-2 mt-2 md:mt-0",children:l?r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>o("stop",n),disabled:d!==null,className:`flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-lg border border-border-default
|
|
684
684
|
bg-bg-primary text-text-secondary daemon-stop-btn transition-all disabled:opacity-50`,children:[d==="stop"?r.jsx(we,{size:14,className:"animate-spin"}):r.jsx(ns,{size:14}),s("workers.daemon.stop")]}),r.jsxs("button",{onClick:()=>o("restart",i),disabled:d!==null,className:`flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-lg border border-border-default
|