linkshell-cli 0.5.35 → 0.5.36

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.
@@ -25,6 +25,7 @@ import { getValidToken, refreshAccessToken } from "../auth.js";
25
25
  import { AgentSessionProxy } from "./acp/agent-session.js";
26
26
  import { AgentWorkspaceProxy, makeAgentV2RemoteConversationId } from "./acp/agent-workspace.js";
27
27
  import { detectAvailableProviders, type AgentProvider } from "./acp/provider-resolver.js";
28
+ import { buildLinkShellHookCommand, shouldWriteProjectHooksJson } from "./hook-command.js";
28
29
 
29
30
  export interface BridgeSessionOptions {
30
31
  gatewayUrl: string;
@@ -83,6 +84,7 @@ const DEFAULT_TUNNEL_PORTS = [3000, 3001, 4321, 5173, 5174, 8080, 8000, 8081];
83
84
  const PERMISSION_REQUEST_TIMEOUT_MS = Number(
84
85
  process.env.LINKSHELL_PERMISSION_TIMEOUT_MS ?? 5 * 60_000,
85
86
  );
87
+ const HOOK_COMMAND_TIMEOUT_SEC = Math.ceil((PERMISSION_REQUEST_TIMEOUT_MS + 30_000) / 1000);
86
88
  const LINKSHELL_PERMISSION_GUARD_MARKER = "LINKSHELL_PERMISSION_GUARD";
87
89
 
88
90
  interface TerminalInstance {
@@ -1467,7 +1469,7 @@ export class BridgeSession {
1467
1469
  hookPort = result.port;
1468
1470
  hookConfigPaths.push(result.configPath);
1469
1471
  // Also set up hooks for other providers (curlCmd already has marker from setupHookServer)
1470
- const curlCmd = `curl -s --connect-timeout 1 --max-time ${Math.ceil((PERMISSION_REQUEST_TIMEOUT_MS + 30_000) / 1000)} -X POST "http://127.0.0.1:${result.port}/hook?m=${hookMarker}&lid=$LINKSHELL_ID" -H 'Content-Type: application/json' --data-binary @- || true`;
1472
+ const curlCmd = buildLinkShellHookCommand(result.port, hookMarker, HOOK_COMMAND_TIMEOUT_SEC);
1471
1473
  hookConfigPaths.push(this.setupCodexHooks(terminalId, curlCmd, hookMarker));
1472
1474
  hookConfigPaths.push(this.setupGeminiHooks(terminalId, curlCmd, hookMarker));
1473
1475
  hookConfigPaths.push(this.setupCopilotHooks(terminalId, curlCmd, hookMarker));
@@ -1586,8 +1588,8 @@ export class BridgeSession {
1586
1588
  const reqLid = reqUrl.searchParams.get("lid") ?? "";
1587
1589
  if (reqMarker !== marker || (reqLid !== "" && reqLid !== marker)) {
1588
1590
  this.log(`ignoring hook event: m=${reqMarker} lid=${reqLid} (expected ${marker})`);
1589
- res.writeHead(200);
1590
- res.end("ok");
1591
+ res.writeHead(200, { "Content-Type": "application/json" });
1592
+ res.end("{}");
1591
1593
  return;
1592
1594
  }
1593
1595
  let body = "";
@@ -1597,8 +1599,8 @@ export class BridgeSession {
1597
1599
  body += chunk.toString();
1598
1600
  if (Buffer.byteLength(body, "utf8") > HOOK_BODY_LIMIT) {
1599
1601
  bodyTooLarge = true;
1600
- res.writeHead(413);
1601
- res.end("payload too large");
1602
+ res.writeHead(413, { "Content-Type": "application/json" });
1603
+ res.end("{}");
1602
1604
  req.destroy();
1603
1605
  }
1604
1606
  });
@@ -1640,14 +1642,15 @@ export class BridgeSession {
1640
1642
  this.handleHookEvent(terminalId, event, provider, requestId);
1641
1643
  this.sendHookPermissionRequest(terminalId, event, requestId, provider);
1642
1644
  } else {
1643
- // All other hooks: respond immediately
1644
- res.writeHead(200);
1645
- res.end("ok");
1645
+ // All other hooks: respond immediately with valid JSON so clients
1646
+ // that parse stdout (Cursor) fail-open instead of blocking the tool.
1647
+ res.writeHead(200, { "Content-Type": "application/json" });
1648
+ res.end("{}");
1646
1649
  this.handleHookEvent(terminalId, event, provider);
1647
1650
  }
1648
1651
  } catch (e) {
1649
- res.writeHead(200);
1650
- res.end("ok");
1652
+ res.writeHead(200, { "Content-Type": "application/json" });
1653
+ res.end("{}");
1651
1654
  this.log(`hook parse error: ${e}`);
1652
1655
  }
1653
1656
  });
@@ -1663,7 +1666,7 @@ export class BridgeSession {
1663
1666
  });
1664
1667
  this.log(`hook server for ${terminalId} (${provider}) listening on port ${port}, marker=${marker}`);
1665
1668
 
1666
- const curlCmd = `curl -s --connect-timeout 1 --max-time ${Math.ceil((PERMISSION_REQUEST_TIMEOUT_MS + 30_000) / 1000)} -X POST "http://127.0.0.1:${port}/hook?m=${marker}&lid=$LINKSHELL_ID" -H 'Content-Type: application/json' --data-binary @- || true`;
1669
+ const curlCmd = buildLinkShellHookCommand(port, marker, HOOK_COMMAND_TIMEOUT_SEC);
1667
1670
  let configPath: string;
1668
1671
 
1669
1672
  if (provider === "codex") {
@@ -1684,7 +1687,7 @@ export class BridgeSession {
1684
1687
  const term = this.terminals.get(DEFAULT_TERMINAL_ID);
1685
1688
  if (!term?.hookPort) return;
1686
1689
  const marker = term.hookMarker;
1687
- const curlCmd = `curl -s --connect-timeout 1 --max-time ${Math.ceil((PERMISSION_REQUEST_TIMEOUT_MS + 30_000) / 1000)} -X POST "http://127.0.0.1:${term.hookPort}/hook?m=${marker}&lid=$LINKSHELL_ID" -H 'Content-Type: application/json' --data-binary @- || true`;
1690
+ const curlCmd = buildLinkShellHookCommand(term.hookPort, marker, HOOK_COMMAND_TIMEOUT_SEC);
1688
1691
  const providers = resolveAgentWorkspaceProviders(this.options);
1689
1692
  try {
1690
1693
  for (const provider of providers) {
@@ -1717,7 +1720,7 @@ export class BridgeSession {
1717
1720
  hooks: [{
1718
1721
  type: "command",
1719
1722
  command: curlCmd,
1720
- timeout: Math.ceil((PERMISSION_REQUEST_TIMEOUT_MS + 30_000) / 1000),
1723
+ timeout: HOOK_COMMAND_TIMEOUT_SEC,
1721
1724
  }],
1722
1725
  };
1723
1726
 
@@ -1780,7 +1783,7 @@ export class BridgeSession {
1780
1783
  hooks: [{
1781
1784
  type: "command",
1782
1785
  command: curlCmd,
1783
- timeout: Math.ceil((PERMISSION_REQUEST_TIMEOUT_MS + 30_000) / 1000),
1786
+ timeout: HOOK_COMMAND_TIMEOUT_SEC,
1784
1787
  }],
1785
1788
  };
1786
1789
  const hookEvents: Record<string, typeof hookEntry | typeof permissionEntry> = {
@@ -1839,9 +1842,25 @@ export class BridgeSession {
1839
1842
  }
1840
1843
 
1841
1844
  private setupCopilotHooks(terminalId: string, curlCmd: string, marker: string): string {
1842
- // Copilot loads hooks from CWD as hooks.json
1845
+ // Copilot loads hooks from CWD as hooks.json. Cursor's coding agent also
1846
+ // reads that file when the folder is a Cursor project — writing it here
1847
+ // freezes every IDE tool call the moment the hook server is down or
1848
+ // returns non-JSON.
1843
1849
  const cwd = this.terminals.get(terminalId)?.cwd ?? this.defaultCwd;
1844
1850
  const hooksPath = join(cwd, "hooks.json");
1851
+ if (!shouldWriteProjectHooksJson(cwd)) {
1852
+ this.sweepLinkShellHookEntries(hooksPath);
1853
+ try {
1854
+ if (existsSync(hooksPath)) {
1855
+ const raw = JSON.parse(readFileSync(hooksPath, "utf8")) as { hooks?: unknown };
1856
+ if (!raw.hooks || (typeof raw.hooks === "object" && Object.keys(raw.hooks as object).length === 0)) {
1857
+ unlinkSync(hooksPath);
1858
+ }
1859
+ }
1860
+ } catch { /* leave whatever is on disk */ }
1861
+ this.log(`skip writing ${hooksPath}: Cursor project would inherit it and freeze the IDE agent`);
1862
+ return hooksPath;
1863
+ }
1845
1864
  const mkHook = () => ({
1846
1865
  type: "command",
1847
1866
  bash: curlCmd,
@@ -0,0 +1,35 @@
1
+ import { existsSync } from "node:fs";
2
+ import { join } from "node:path";
3
+
4
+ /**
5
+ * Shell command written into Claude / Codex / Copilot / Gemini hook configs.
6
+ *
7
+ * Cursor (and some other clients) parse hook stdout as JSON and *block the
8
+ * tool* when the body is empty, "ok", or otherwise invalid. A bare
9
+ * `curl … || true` is not enough: a down server still prints nothing, and
10
+ * our own observe-path used to print the word `ok`.
11
+ *
12
+ * Always emit a JSON object. Forward the server body only when it looks like
13
+ * one (permission decisions). Otherwise fail-open with `{}`.
14
+ *
15
+ * Cursor's own coding agent also reads a project `hooks.json`. If this command
16
+ * ever runs inside Cursor, skip the network hop entirely so a LinkShell
17
+ * session cannot freeze the IDE agent.
18
+ */
19
+ export function buildLinkShellHookCommand(port: number, marker: string, timeoutSec: number): string {
20
+ const url = `http://127.0.0.1:${port}/hook?m=${marker}&lid=$LINKSHELL_ID`;
21
+ return [
22
+ `if [ -n "\${CURSOR_TRACE_ID:-}" ] || [ -n "\${CURSOR_PROJECT_DIR:-}" ]; then printf '%s\\n' '{}'; exit 0; fi`,
23
+ `body=$(curl -s --connect-timeout 1 --max-time ${timeoutSec} -X POST "${url}" -H 'Content-Type: application/json' --data-binary @- 2>/dev/null) || true`,
24
+ `case "$body" in '{'*) printf '%s\\n' "$body" ;; *) printf '%s\\n' '{}' ;; esac`,
25
+ ].join("; ");
26
+ }
27
+
28
+ /** Copilot loads CWD `hooks.json`. Cursor's coding agent also reads that file
29
+ * when the folder is a Cursor project, so writing it there freezes the IDE. */
30
+ export function shouldWriteProjectHooksJson(
31
+ cwd: string,
32
+ exists: (path: string) => boolean = existsSync,
33
+ ): boolean {
34
+ return !exists(join(cwd, ".cursor"));
35
+ }
@@ -1,2 +1,2 @@
1
- import{r as n,j as e}from"./vendor-react-0zU5oKmd.js";import{k as b,a as w,l as k,h as C,m as z}from"./index-6vyVf_xQ.js";import"./vendor-highlight-Cus7zBI4.js";function I({store:x,initialPath:d,onClose:j}){const[c,u]=n.useState(d||"."),[y,N]=n.useState([]),[o,l]=n.useState(!1),[f,r]=n.useState(null),[i,p]=n.useState(null),a=n.useCallback(async t=>{l(!0),r(null),p(null);try{const s=await x.browse(t,!0);s.error?r(s.error):(u(s.path),N([...s.entries].sort((m,h)=>m.isDirectory!==h.isDirectory?m.isDirectory?-1:1:m.name.localeCompare(h.name))))}catch(s){r(s.message||"浏览失败")}finally{l(!1)}},[x]);n.useEffect(()=>{a(d||".")},[a,d]);const g=async t=>{l(!0),r(null);try{const s=await x.readFile(t.path);s.error?r(s.error):p({path:s.path,content:s.content,truncated:s.truncated})}catch(s){r(s.message||"读取失败")}finally{l(!1)}},v=c.replace(/\/+$/,"").split("/").slice(0,-1).join("/")||"/";return e.jsxs("div",{className:"flex h-full flex-col bg-surface",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[e.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-2xs text-content-secondary",children:[e.jsx(b,{size:13,className:"text-content-faint"})," 文件"]}),e.jsx("button",{onClick:j,className:"codex-btn-ghost px-2 py-1.5","aria-label":"关闭文件面板",children:e.jsx(w,{size:15})})]}),e.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-2 py-1.5",children:[e.jsx("button",{onClick:()=>a(v),disabled:o,className:"cursor-pointer rounded-md p-1.5 text-content-muted transition-colors hover:bg-surface-overlay hover:text-accent",title:"上级目录","aria-label":"上级目录",children:e.jsx(k,{size:14})}),e.jsx("input",{value:c,onChange:t=>u(t.target.value),onKeyDown:t=>t.key==="Enter"&&a(c),className:"flex-1 bg-transparent font-mono text-2xs text-content-primary outline-none"}),e.jsx("button",{onClick:()=>a(c),disabled:o,className:"cursor-pointer rounded-md p-1.5 text-content-muted transition-colors hover:bg-surface-overlay hover:text-accent",title:"刷新","aria-label":"刷新",children:e.jsx(C,{size:14})})]}),f&&e.jsx("p",{className:"px-3 py-1.5 text-2xs text-danger",children:f}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[o&&e.jsx("p",{className:"px-3 py-2 text-2xs text-content-muted",children:"加载中…"}),!o&&i?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-1.5",children:[e.jsx("span",{className:"truncate font-mono text-2xs text-content-secondary",children:i.path}),e.jsx("button",{onClick:()=>p(null),className:"codex-btn-ghost text-2xs",children:"返回"})]}),e.jsxs("pre",{className:"whitespace-pre-wrap px-3 py-2 font-mono text-2xs leading-relaxed text-content-secondary",children:[i.content,i.truncated&&e.jsx("span",{className:"text-warning",children:`
1
+ import{r as n,j as e}from"./vendor-react-M7xG3qiw.js";import{k as b,a as w,l as k,h as C,m as z}from"./index-ClZzQ4ba.js";import"./vendor-highlight-NXWAAyIv.js";function I({store:x,initialPath:d,onClose:j}){const[c,u]=n.useState(d||"."),[y,N]=n.useState([]),[o,l]=n.useState(!1),[f,r]=n.useState(null),[i,p]=n.useState(null),a=n.useCallback(async t=>{l(!0),r(null),p(null);try{const s=await x.browse(t,!0);s.error?r(s.error):(u(s.path),N([...s.entries].sort((m,h)=>m.isDirectory!==h.isDirectory?m.isDirectory?-1:1:m.name.localeCompare(h.name))))}catch(s){r(s.message||"浏览失败")}finally{l(!1)}},[x]);n.useEffect(()=>{a(d||".")},[a,d]);const g=async t=>{l(!0),r(null);try{const s=await x.readFile(t.path);s.error?r(s.error):p({path:s.path,content:s.content,truncated:s.truncated})}catch(s){r(s.message||"读取失败")}finally{l(!1)}},v=c.replace(/\/+$/,"").split("/").slice(0,-1).join("/")||"/";return e.jsxs("div",{className:"flex h-full flex-col bg-surface",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[e.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-2xs text-content-secondary",children:[e.jsx(b,{size:13,className:"text-content-faint"})," 文件"]}),e.jsx("button",{onClick:j,className:"codex-btn-ghost px-2 py-1.5","aria-label":"关闭文件面板",children:e.jsx(w,{size:15})})]}),e.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-2 py-1.5",children:[e.jsx("button",{onClick:()=>a(v),disabled:o,className:"cursor-pointer rounded-md p-1.5 text-content-muted transition-colors hover:bg-surface-overlay hover:text-accent",title:"上级目录","aria-label":"上级目录",children:e.jsx(k,{size:14})}),e.jsx("input",{value:c,onChange:t=>u(t.target.value),onKeyDown:t=>t.key==="Enter"&&a(c),className:"flex-1 bg-transparent font-mono text-2xs text-content-primary outline-none"}),e.jsx("button",{onClick:()=>a(c),disabled:o,className:"cursor-pointer rounded-md p-1.5 text-content-muted transition-colors hover:bg-surface-overlay hover:text-accent",title:"刷新","aria-label":"刷新",children:e.jsx(C,{size:14})})]}),f&&e.jsx("p",{className:"px-3 py-1.5 text-2xs text-danger",children:f}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[o&&e.jsx("p",{className:"px-3 py-2 text-2xs text-content-muted",children:"加载中…"}),!o&&i?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-1.5",children:[e.jsx("span",{className:"truncate font-mono text-2xs text-content-secondary",children:i.path}),e.jsx("button",{onClick:()=>p(null),className:"codex-btn-ghost text-2xs",children:"返回"})]}),e.jsxs("pre",{className:"whitespace-pre-wrap px-3 py-2 font-mono text-2xs leading-relaxed text-content-secondary",children:[i.content,i.truncated&&e.jsx("span",{className:"text-warning",children:`
2
2
  …(已截断)`})]})]}):!o&&y.map(t=>e.jsxs("button",{onClick:()=>t.isDirectory?a(t.path):g(t),className:"flex w-full cursor-pointer items-center gap-2 px-3 py-1 text-left transition-colors hover:bg-surface-overlay",children:[t.isDirectory?e.jsx(b,{size:13,className:"shrink-0 text-content-faint"}):e.jsx(z,{size:13,className:"shrink-0 text-content-faint"}),e.jsx("span",{className:"truncate font-mono text-2xs text-content-primary",children:t.name}),!t.isDirectory&&t.size!=null&&e.jsxs("span",{className:"ml-auto font-mono text-2xs text-content-faint",children:[t.size,"B"]})]},t.path))]})]})}export{I as FileBrowser};
@@ -1,2 +1,2 @@
1
- import{r,j as e}from"./vendor-react-0zU5oKmd.js";import{e as me,g as he,a as be,c as ge,d as ve,f as je,h as ye,i as Ne,j as ke}from"./index-6vyVf_xQ.js";import"./vendor-highlight-Cus7zBI4.js";const Z=[{cssProp:"color",label:"文本颜色"},{cssProp:"background-color",label:"背景"},{cssProp:"font-size",label:"字号"},{cssProp:"font-weight",label:"字重"},{cssProp:"padding",label:"内边距"},{cssProp:"border-radius",label:"圆角"}];function we(d){var i;const c=(i=d.ownerDocument.defaultView)==null?void 0:i.getComputedStyle(d),o={};for(const{cssProp:f}of Z)o[f]=(c==null?void 0:c.getPropertyValue(f).trim())??"";return o}function $e(d){const c=/^\s*(\d{1,5})(.*)$/.exec(d);if(!c)return null;const o=c[1];if(Number(o)<1||Number(o)>65535)return null;let i=c[2]||"/";return i.startsWith("/")||(i=`/${i}`),{port:o,path:i}}function Ce(d){if(d.id)return`#${CSS.escape(d.id)}`;const c=[];let o=d,i=0;for(;o&&o.nodeType===1&&i<4;){let f=o.tagName.toLowerCase();const P=(o.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,2).map(m=>`.${CSS.escape(m)}`).join("");f+=P;const h=o.parentElement;if(h){const m=[...h.children].filter(y=>y.tagName===o.tagName);m.length>1&&(f+=`:nth-of-type(${m.indexOf(o)+1})`)}if(c.unshift(f),o.id){c[0]=`#${CSS.escape(o.id)}`;break}o=h,i+=1}return c.join(" > ")}function Me({gatewayUrl:d,sessionId:c,initialAuthToken:o,defaultPort:i,isMobile:f,onClose:P,onAnnotate:h}){const[m,y]=r.useState(i||"3000"),[u,ee]=r.useState(null),[R,te]=r.useState(o??null),[E,T]=r.useState(!1),[M,H]=r.useState("desktop"),[ne,U]=r.useState(0),[I,N]=r.useState(!1),[K,z]=r.useState(null),[v,j]=r.useState(null),[l,L]=r.useState(null),[W,k]=r.useState(""),[w,B]=r.useState(!1),[$,D]=r.useState({}),[C,S]=r.useState({}),A=r.useRef(null),V=r.useRef(null),O=r.useMemo(()=>me(),[]);r.useEffect(()=>{let t=!1;return T(!1),he().then(n=>{t||te((n==null?void 0:n.accessToken)??null)}).finally(()=>{t||T(!0)}),()=>{t=!0}},[o]);const b=r.useMemo(()=>{if(!u||o&&!E)return null;const t=`${d.replace(/\/+$/,"")}/tunnel/${encodeURIComponent(c)}/${u.port}${u.path}`,n=[];if(O&&n.push(`token=${encodeURIComponent(O)}`),R&&n.push(`auth_token=${encodeURIComponent(R)}`),n.length===0)return t;const s=u.path.includes("?")?"&":"?";return`${t}${s}${n.join("&")}`},[u,d,c,O,R,E]),_=()=>{const t=$e(m);t&&(ee(t),U(n=>n+1))},se=()=>U(t=>t+1),oe=()=>{var t;if(u)try{const n=(t=A.current)==null?void 0:t.contentWindow;if(!n)return;const s=`/tunnel/${encodeURIComponent(c)}/${u.port}`;let x=n.location.pathname;x.startsWith(s)&&(x=x.slice(s.length)||"/");const p=new URLSearchParams(n.location.search);p.delete("token"),p.delete("auth_token");const g=p.toString();y(`${u.port}${x}${g?`?${g}`:""}`)}catch{}},F=(t,n)=>{const s=A.current,x=s==null?void 0:s.contentDocument;if(!s||!x)return null;const p=s.getBoundingClientRect();return x.elementFromPoint(t-p.left,n-p.top)},X=t=>{const n=t.getBoundingClientRect();return{top:n.top,left:n.left,width:n.width,height:n.height}},re=t=>{try{const n=F(t.clientX,t.clientY);j(n?X(n):null)}catch{j(null),z("此页面跨域,无法读取元素(生产环境同源可用)"),N(!1)}},le=t=>{t.preventDefault();try{const n=F(t.clientX,t.clientY);if(!n||!("style"in n))return;const s=n;L({el:s,selector:Ce(s),text:(s.textContent||"").replace(/\s+/g," ").trim().slice(0,120),rect:X(s)}),D(we(s)),S({}),k("")}catch{z("此页面跨域,无法读取元素(生产环境同源可用)"),N(!1)}},ce=(t,n)=>{if(l){try{l.el.style.setProperty(t,n)}catch{}S(s=>({...s,[t]:n}))}},ae=()=>Object.entries(C).filter(([t,n])=>n!==($[t]??"")).map(([t,n])=>({cssProp:t,from:$[t]??"",to:n})),Y=()=>{if(!l)return;const t=ae(),n=["关于预览页面中的这个元素:",`- 选择器: \`${l.selector}\``,l.text?`- 文本: "${l.text}"`:"",`- 路径: localhost:${m}`,W.trim()?`- 批注: ${W.trim()}`:""];if(t.length>0){n.push("- 请把以下样式改动应用到源码:");for(const s of t)n.push(` - ${s.cssProp}: ${s.from||"(默认)"} → ${s.to}`)}h==null||h(n.filter(Boolean).join(`
1
+ import{r,j as e}from"./vendor-react-M7xG3qiw.js";import{e as me,g as he,a as be,c as ge,d as ve,f as je,h as ye,i as Ne,j as ke}from"./index-ClZzQ4ba.js";import"./vendor-highlight-NXWAAyIv.js";const Z=[{cssProp:"color",label:"文本颜色"},{cssProp:"background-color",label:"背景"},{cssProp:"font-size",label:"字号"},{cssProp:"font-weight",label:"字重"},{cssProp:"padding",label:"内边距"},{cssProp:"border-radius",label:"圆角"}];function we(d){var i;const c=(i=d.ownerDocument.defaultView)==null?void 0:i.getComputedStyle(d),o={};for(const{cssProp:f}of Z)o[f]=(c==null?void 0:c.getPropertyValue(f).trim())??"";return o}function $e(d){const c=/^\s*(\d{1,5})(.*)$/.exec(d);if(!c)return null;const o=c[1];if(Number(o)<1||Number(o)>65535)return null;let i=c[2]||"/";return i.startsWith("/")||(i=`/${i}`),{port:o,path:i}}function Ce(d){if(d.id)return`#${CSS.escape(d.id)}`;const c=[];let o=d,i=0;for(;o&&o.nodeType===1&&i<4;){let f=o.tagName.toLowerCase();const P=(o.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,2).map(m=>`.${CSS.escape(m)}`).join("");f+=P;const h=o.parentElement;if(h){const m=[...h.children].filter(y=>y.tagName===o.tagName);m.length>1&&(f+=`:nth-of-type(${m.indexOf(o)+1})`)}if(c.unshift(f),o.id){c[0]=`#${CSS.escape(o.id)}`;break}o=h,i+=1}return c.join(" > ")}function Me({gatewayUrl:d,sessionId:c,initialAuthToken:o,defaultPort:i,isMobile:f,onClose:P,onAnnotate:h}){const[m,y]=r.useState(i||"3000"),[u,ee]=r.useState(null),[R,te]=r.useState(o??null),[E,T]=r.useState(!1),[M,H]=r.useState("desktop"),[ne,U]=r.useState(0),[I,N]=r.useState(!1),[K,z]=r.useState(null),[v,j]=r.useState(null),[l,L]=r.useState(null),[W,k]=r.useState(""),[w,B]=r.useState(!1),[$,D]=r.useState({}),[C,S]=r.useState({}),A=r.useRef(null),V=r.useRef(null),O=r.useMemo(()=>me(),[]);r.useEffect(()=>{let t=!1;return T(!1),he().then(n=>{t||te((n==null?void 0:n.accessToken)??null)}).finally(()=>{t||T(!0)}),()=>{t=!0}},[o]);const b=r.useMemo(()=>{if(!u||o&&!E)return null;const t=`${d.replace(/\/+$/,"")}/tunnel/${encodeURIComponent(c)}/${u.port}${u.path}`,n=[];if(O&&n.push(`token=${encodeURIComponent(O)}`),R&&n.push(`auth_token=${encodeURIComponent(R)}`),n.length===0)return t;const s=u.path.includes("?")?"&":"?";return`${t}${s}${n.join("&")}`},[u,d,c,O,R,E]),_=()=>{const t=$e(m);t&&(ee(t),U(n=>n+1))},se=()=>U(t=>t+1),oe=()=>{var t;if(u)try{const n=(t=A.current)==null?void 0:t.contentWindow;if(!n)return;const s=`/tunnel/${encodeURIComponent(c)}/${u.port}`;let x=n.location.pathname;x.startsWith(s)&&(x=x.slice(s.length)||"/");const p=new URLSearchParams(n.location.search);p.delete("token"),p.delete("auth_token");const g=p.toString();y(`${u.port}${x}${g?`?${g}`:""}`)}catch{}},F=(t,n)=>{const s=A.current,x=s==null?void 0:s.contentDocument;if(!s||!x)return null;const p=s.getBoundingClientRect();return x.elementFromPoint(t-p.left,n-p.top)},X=t=>{const n=t.getBoundingClientRect();return{top:n.top,left:n.left,width:n.width,height:n.height}},re=t=>{try{const n=F(t.clientX,t.clientY);j(n?X(n):null)}catch{j(null),z("此页面跨域,无法读取元素(生产环境同源可用)"),N(!1)}},le=t=>{t.preventDefault();try{const n=F(t.clientX,t.clientY);if(!n||!("style"in n))return;const s=n;L({el:s,selector:Ce(s),text:(s.textContent||"").replace(/\s+/g," ").trim().slice(0,120),rect:X(s)}),D(we(s)),S({}),k("")}catch{z("此页面跨域,无法读取元素(生产环境同源可用)"),N(!1)}},ce=(t,n)=>{if(l){try{l.el.style.setProperty(t,n)}catch{}S(s=>({...s,[t]:n}))}},ae=()=>Object.entries(C).filter(([t,n])=>n!==($[t]??"")).map(([t,n])=>({cssProp:t,from:$[t]??"",to:n})),Y=()=>{if(!l)return;const t=ae(),n=["关于预览页面中的这个元素:",`- 选择器: \`${l.selector}\``,l.text?`- 文本: "${l.text}"`:"",`- 路径: localhost:${m}`,W.trim()?`- 批注: ${W.trim()}`:""];if(t.length>0){n.push("- 请把以下样式改动应用到源码:");for(const s of t)n.push(` - ${s.cssProp}: ${s.from||"(默认)"} → ${s.to}`)}h==null||h(n.filter(Boolean).join(`
2
2
  `)),L(null),k(""),D({}),S({}),B(!1),j(null),N(!1)},q=()=>{L(null),k(""),D({}),S({}),B(!1)},ie=()=>{z(null),q(),j(null),N(t=>!t)};return e.jsxs("div",{className:"flex h-full flex-col bg-canvas",children:[e.jsxs("div",{className:"flex items-center gap-1.5 border-b border-border bg-surface px-2 py-1.5",children:[f&&e.jsx("button",{onClick:P,className:"codex-btn-ghost px-2 py-1.5","aria-label":"关闭预览",children:e.jsx(be,{size:15})}),e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 rounded-lg border border-border bg-surface-raised px-2 py-1",children:[e.jsx("span",{className:"shrink-0 font-mono text-2xs text-content-faint",children:"localhost:"}),e.jsx("input",{value:m,onChange:t=>y(t.target.value),onKeyDown:t=>t.key==="Enter"&&_(),placeholder:"3000",spellCheck:!1,className:"min-w-0 flex-1 bg-transparent font-mono text-2xs text-content-primary outline-none","aria-label":"端口与路径"}),e.jsx("button",{onClick:_,className:"shrink-0 cursor-pointer rounded bg-accent-dim px-2 py-0.5 text-2xs font-medium text-white transition-colors hover:bg-accent",children:"前往"})]}),e.jsx("button",{onClick:ie,disabled:!u,className:`shrink-0 cursor-pointer rounded-md p-1.5 transition-colors disabled:opacity-40 ${I?"bg-accent-dim text-white":"text-content-muted hover:bg-surface-overlay hover:text-accent"}`,title:"标注元素","aria-label":"标注元素",children:e.jsx(ge,{size:14})}),e.jsxs("div",{className:"flex shrink-0 items-center rounded-lg border border-border bg-surface-raised p-0.5",children:[e.jsx("button",{onClick:()=>H("desktop"),className:`cursor-pointer rounded p-1 transition-colors ${M==="desktop"?"bg-surface-overlay text-content-primary":"text-content-muted hover:text-content-primary"}`,title:"桌面视口","aria-label":"桌面视口",children:e.jsx(ve,{size:13})}),e.jsx("button",{onClick:()=>H("mobile"),className:`cursor-pointer rounded p-1 transition-colors ${M==="mobile"?"bg-surface-overlay text-content-primary":"text-content-muted hover:text-content-primary"}`,title:"移动视口","aria-label":"移动视口",children:e.jsx(je,{size:13})})]}),e.jsx("button",{onClick:se,disabled:!u,className:"shrink-0 cursor-pointer rounded-md p-1.5 text-content-muted transition-colors hover:bg-surface-overlay hover:text-accent disabled:opacity-40",title:"刷新","aria-label":"刷新",children:e.jsx(ye,{size:14})}),e.jsx("button",{onClick:()=>b&&window.open(b,"_blank","noopener,noreferrer"),disabled:!b,className:"shrink-0 cursor-pointer rounded-md p-1.5 text-content-muted transition-colors hover:bg-surface-overlay hover:text-accent disabled:opacity-40",title:"在新窗口打开","aria-label":"在新窗口打开",children:e.jsx(Ne,{size:14})})]}),K&&e.jsx("p",{className:"border-b border-border bg-warning/10 px-3 py-1.5 text-2xs text-warning",children:K}),I&&!l&&e.jsx("p",{className:"border-b border-border bg-accent/10 px-3 py-1.5 text-2xs text-accent",children:"标注模式:移动鼠标高亮元素,点击选择并添加批注。"}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto bg-surface-raised",children:b?e.jsx("div",{className:M==="mobile"?"mx-auto h-full w-[390px] max-w-full border-x border-border":"h-full w-full",children:e.jsxs("div",{className:"relative h-full w-full",children:[e.jsx("iframe",{ref:A,src:b,title:"端口预览",onLoad:oe,className:"h-full w-full bg-white"},`${b}-${ne}`),I&&e.jsx("div",{className:"absolute inset-0 cursor-crosshair",onMouseMove:re,onMouseLeave:()=>j(null),onClick:le,children:v&&!l&&e.jsx("div",{className:"pointer-events-none absolute border-2 border-accent bg-accent/10",style:{top:v.top,left:v.left,width:v.width,height:v.height}})}),l&&(()=>{var J,Q;const s=((J=V.current)==null?void 0:J.clientHeight)??600,x=l.rect.top+l.rect.height+8,p=l.rect.top-8,g=w?340:140,G=x+g>s&&p-g>0?Math.max(4,p-g):x,de=Math.max(4,Math.min(l.rect.left,(((Q=V.current)==null?void 0:Q.clientWidth)??800)-280-4));return e.jsxs("div",{className:"absolute z-20 flex flex-col gap-2 rounded-xl border border-accent-dim/40 bg-surface-raised px-3 py-2.5 shadow-2xl animate-fade-in",style:{top:G,left:de,width:280,maxHeight:s-G-8},children:[e.jsx("p",{className:"truncate font-mono text-2xs text-content-faint",title:l.selector,children:l.selector}),l.text&&e.jsxs("p",{className:"-mt-1 truncate text-2xs text-content-muted",children:['"',l.text,'"']}),e.jsx("input",{value:W,onChange:a=>k(a.target.value),onKeyDown:a=>a.key==="Enter"&&Y(),autoFocus:!0,placeholder:"添加批注…",className:"w-full rounded-lg border border-border bg-surface px-2.5 py-1.5 text-xs text-content-primary placeholder-content-muted outline-none focus:border-accent-dim"}),e.jsxs("button",{onClick:()=>B(a=>!a),className:`flex cursor-pointer items-center gap-1 self-start rounded-md px-1.5 py-0.5 text-2xs transition-colors ${w?"text-accent":"text-content-muted hover:text-content-secondary"}`,children:[e.jsx("svg",{width:10,height:10,viewBox:"0 0 10 10",className:`shrink-0 transition-transform ${w?"rotate-180":""}`,children:e.jsx("path",{d:"M2 3.5 L5 6.5 L8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),"调整样式"]}),w&&e.jsx("div",{className:"grid grid-cols-2 gap-x-2 gap-y-1.5 animate-fade-in",children:Z.map(({cssProp:a,label:ue})=>{const xe=C[a]??$[a]??"",pe=a in C&&C[a]!==($[a]??"");return e.jsxs("label",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:`text-2xs ${pe?"text-accent":"text-content-faint"}`,children:ue}),e.jsx("input",{value:xe,onChange:fe=>ce(a,fe.target.value),spellCheck:!1,className:"w-full rounded-md border border-border bg-surface px-2 py-1 font-mono text-2xs text-content-primary outline-none focus:border-accent-dim"})]},a)})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:q,className:"codex-btn-ghost flex-1 text-2xs",children:"取消"}),e.jsx("button",{onClick:Y,className:"codex-btn-primary flex-1 text-2xs",children:"发送给 Agent"})]})]})})()]})}):e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 px-6 text-center",children:[e.jsx(ke,{size:34,className:"text-content-faint"}),e.jsx("p",{className:"text-sm leading-6 text-content-muted",children:u&&!E?"正在准备预览认证...":"输入主机上服务的端口号,预览远程本地服务"})]})})]})}export{Me as PortPreview};
@@ -1 +1 @@
1
- import{r as l,j as i}from"./vendor-react-0zU5oKmd.js";import{x as w,a as C}from"./vendor-xterm-D15THcI4.js";import{I as T,a as A,b as B}from"./index-6vyVf_xQ.js";import"./vendor-highlight-Cus7zBI4.js";function x(e,t){const r=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return r?`rgb(${r})`:t}function $(e,t,r){const u=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return u?`rgb(${u} / ${t})`:r}function E(){return{background:x("--c-canvas","#0b0d0f"),foreground:x("--c-content-primary","#e6e8eb"),cursor:x("--c-accent","#2dd4bf"),selectionBackground:$("--c-accent",.22,"rgba(45,212,191,0.25)"),black:x("--c-content-faint","#4e535a"),brightBlack:x("--c-content-muted","#70767e"),white:x("--c-content-secondary","#9ea5ad"),brightWhite:x("--c-content-primary","#e9ebee")}}function F(e,t){const r=l.useRef(null),u=l.useRef(null),h=l.useRef(null);return l.useEffect(()=>{if(!r.current||!e)return;const n=new w.Terminal({fontFamily:"JetBrains Mono, ui-monospace, monospace",fontSize:13,cursorBlink:!0,theme:E(),scrollback:5e3}),f=new C.FitAddon;n.loadAddon(f),n.open(r.current),f.fit(),u.current=n,h.current=f;const p=e.terminalBuffer(t);p&&n.write(p);const v=n.onData(c=>e.sendInput(t,c)),b=n.onResize(({cols:c,rows:o})=>e.sendResize(t,c,o)),k=e.onEvent(c=>{if(c.type==="terminal.reset"&&c.terminalId===t){n.reset();return}c.type==="terminal.output"&&c.terminalId===t&&n.write(c.data)}),y=new ResizeObserver(()=>{try{f.fit(),e.sendResize(t,n.cols,n.rows)}catch{}});y.observe(r.current);const s=new MutationObserver(()=>{n.options.theme=E()});return s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),e.sendResize(t,n.cols,n.rows),()=>{v.dispose(),b.dispose(),k(),y.disconnect(),s.disconnect(),n.dispose(),u.current=null,h.current=null}},[e,t]),{containerRef:r}}function I(e,t){return e==="default"?"默认":t||e.slice(0,8)}const z=e=>`linkshell:web:lastTerminal:${e}`;function L(e){if(!e)return null;try{return localStorage.getItem(z(e))}catch{return null}}function P(e,t){if(e)try{localStorage.setItem(z(e),t)}catch{}}function O(e,t){if(e.length===0)return null;if(t&&e.includes(t))return t;const r=e.filter(u=>u!=="default");return r.length>0?r[r.length-1]:e[0]}function V({bridge:e,terminalId:t}){const{containerRef:r}=F(e,t);return i.jsx("div",{ref:r,className:"xterm-host min-h-0 flex-1 bg-canvas p-2"})}function N({bridge:e,onNewTerminal:t}){const r=e==null?void 0:e.sessionId,[u,h]=l.useState([]),[n,f]=l.useState("default"),p=l.useRef(!1),v=l.useRef(!1),b=l.useCallback((s,c)=>{h(o=>o.some(m=>m.id===s)?o:[...o,{id:s,label:I(s,c)}])},[]);l.useEffect(()=>{if(!e)return;p.current=!1,v.current=!1;const s=L(r);return e.requestTerminalList(),e.onEvent(o=>{if(o.type==="terminal.output"){b(o.terminalId);return}if(o.type==="terminal.list"){const m=o.envelope,a=m.payload;if(m.type==="terminal.spawned"){const R=a==null?void 0:a.terminalId;R&&(b(R,a==null?void 0:a.projectName),f(R));return}if(m.type==="terminal.list"){const j=(Array.isArray(a==null?void 0:a.terminals)?a.terminals:[]).filter(d=>typeof d.terminalId=="string"&&d.status!=="exited").map(d=>({id:d.terminalId,label:I(d.terminalId,d.projectName)}));if(h(j),!p.current){p.current=!0;const d=j.map(S=>S.id),g=O(d,s);g?f(g):v.current||(v.current=!0,t==null||t())}}}})},[e,b,t]),l.useEffect(()=>{p.current&&n&&P(r,n)},[r,n]);const k=()=>t==null?void 0:t(),y=s=>{e==null||e.killTerminal(s),h(c=>{var m;const o=c.filter(a=>a.id!==s);return s===n&&f(((m=o[o.length-1])==null?void 0:m.id)??"default"),o})};return i.jsxs("div",{className:"flex h-full flex-col bg-canvas",children:[i.jsxs("div",{className:"flex items-center gap-0.5 border-b border-border bg-surface-raised px-1.5 py-1",children:[i.jsx(T,{size:13,className:"mx-1 shrink-0 text-content-faint"}),i.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto",children:u.map(s=>i.jsxs("div",{className:`group flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-2xs transition-colors ${s.id===n?"bg-surface-overlay text-content-primary":"text-content-muted hover:bg-surface-overlay/60"}`,children:[i.jsx("button",{onClick:()=>f(s.id),className:"cursor-pointer font-mono",children:s.label}),u.length>1&&i.jsx("button",{onClick:()=>y(s.id),className:"cursor-pointer rounded text-content-faint opacity-0 transition hover:text-danger group-hover:opacity-100","aria-label":"关闭终端",children:i.jsx(A,{size:11})})]},s.id))}),i.jsx("button",{onClick:k,className:"ml-1 shrink-0 cursor-pointer rounded-md p-1 text-content-muted transition-colors hover:bg-surface-overlay hover:text-accent",title:"新建终端","aria-label":"新建终端",children:i.jsx(B,{size:14})})]}),i.jsx(V,{bridge:e,terminalId:n},n)]})}export{N as TerminalPanel};
1
+ import{r as l,j as i}from"./vendor-react-M7xG3qiw.js";import{x as w,a as C}from"./vendor-xterm-D15THcI4.js";import{I as T,a as A,b as B}from"./index-ClZzQ4ba.js";import"./vendor-highlight-NXWAAyIv.js";function x(e,t){const r=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return r?`rgb(${r})`:t}function $(e,t,r){const u=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return u?`rgb(${u} / ${t})`:r}function E(){return{background:x("--c-canvas","#0b0d0f"),foreground:x("--c-content-primary","#e6e8eb"),cursor:x("--c-accent","#2dd4bf"),selectionBackground:$("--c-accent",.22,"rgba(45,212,191,0.25)"),black:x("--c-content-faint","#4e535a"),brightBlack:x("--c-content-muted","#70767e"),white:x("--c-content-secondary","#9ea5ad"),brightWhite:x("--c-content-primary","#e9ebee")}}function F(e,t){const r=l.useRef(null),u=l.useRef(null),h=l.useRef(null);return l.useEffect(()=>{if(!r.current||!e)return;const n=new w.Terminal({fontFamily:"JetBrains Mono, ui-monospace, monospace",fontSize:13,cursorBlink:!0,theme:E(),scrollback:5e3}),f=new C.FitAddon;n.loadAddon(f),n.open(r.current),f.fit(),u.current=n,h.current=f;const p=e.terminalBuffer(t);p&&n.write(p);const v=n.onData(c=>e.sendInput(t,c)),b=n.onResize(({cols:c,rows:o})=>e.sendResize(t,c,o)),k=e.onEvent(c=>{if(c.type==="terminal.reset"&&c.terminalId===t){n.reset();return}c.type==="terminal.output"&&c.terminalId===t&&n.write(c.data)}),y=new ResizeObserver(()=>{try{f.fit(),e.sendResize(t,n.cols,n.rows)}catch{}});y.observe(r.current);const s=new MutationObserver(()=>{n.options.theme=E()});return s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),e.sendResize(t,n.cols,n.rows),()=>{v.dispose(),b.dispose(),k(),y.disconnect(),s.disconnect(),n.dispose(),u.current=null,h.current=null}},[e,t]),{containerRef:r}}function I(e,t){return e==="default"?"默认":t||e.slice(0,8)}const z=e=>`linkshell:web:lastTerminal:${e}`;function L(e){if(!e)return null;try{return localStorage.getItem(z(e))}catch{return null}}function P(e,t){if(e)try{localStorage.setItem(z(e),t)}catch{}}function O(e,t){if(e.length===0)return null;if(t&&e.includes(t))return t;const r=e.filter(u=>u!=="default");return r.length>0?r[r.length-1]:e[0]}function V({bridge:e,terminalId:t}){const{containerRef:r}=F(e,t);return i.jsx("div",{ref:r,className:"xterm-host min-h-0 flex-1 bg-canvas p-2"})}function N({bridge:e,onNewTerminal:t}){const r=e==null?void 0:e.sessionId,[u,h]=l.useState([]),[n,f]=l.useState("default"),p=l.useRef(!1),v=l.useRef(!1),b=l.useCallback((s,c)=>{h(o=>o.some(m=>m.id===s)?o:[...o,{id:s,label:I(s,c)}])},[]);l.useEffect(()=>{if(!e)return;p.current=!1,v.current=!1;const s=L(r);return e.requestTerminalList(),e.onEvent(o=>{if(o.type==="terminal.output"){b(o.terminalId);return}if(o.type==="terminal.list"){const m=o.envelope,a=m.payload;if(m.type==="terminal.spawned"){const R=a==null?void 0:a.terminalId;R&&(b(R,a==null?void 0:a.projectName),f(R));return}if(m.type==="terminal.list"){const j=(Array.isArray(a==null?void 0:a.terminals)?a.terminals:[]).filter(d=>typeof d.terminalId=="string"&&d.status!=="exited").map(d=>({id:d.terminalId,label:I(d.terminalId,d.projectName)}));if(h(j),!p.current){p.current=!0;const d=j.map(S=>S.id),g=O(d,s);g?f(g):v.current||(v.current=!0,t==null||t())}}}})},[e,b,t]),l.useEffect(()=>{p.current&&n&&P(r,n)},[r,n]);const k=()=>t==null?void 0:t(),y=s=>{e==null||e.killTerminal(s),h(c=>{var m;const o=c.filter(a=>a.id!==s);return s===n&&f(((m=o[o.length-1])==null?void 0:m.id)??"default"),o})};return i.jsxs("div",{className:"flex h-full flex-col bg-canvas",children:[i.jsxs("div",{className:"flex items-center gap-0.5 border-b border-border bg-surface-raised px-1.5 py-1",children:[i.jsx(T,{size:13,className:"mx-1 shrink-0 text-content-faint"}),i.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto",children:u.map(s=>i.jsxs("div",{className:`group flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-2xs transition-colors ${s.id===n?"bg-surface-overlay text-content-primary":"text-content-muted hover:bg-surface-overlay/60"}`,children:[i.jsx("button",{onClick:()=>f(s.id),className:"cursor-pointer font-mono",children:s.label}),u.length>1&&i.jsx("button",{onClick:()=>y(s.id),className:"cursor-pointer rounded text-content-faint opacity-0 transition hover:text-danger group-hover:opacity-100","aria-label":"关闭终端",children:i.jsx(A,{size:11})})]},s.id))}),i.jsx("button",{onClick:k,className:"ml-1 shrink-0 cursor-pointer rounded-md p-1 text-content-muted transition-colors hover:bg-surface-overlay hover:text-accent",title:"新建终端","aria-label":"新建终端",children:i.jsx(B,{size:14})})]}),i.jsx(V,{bridge:e,terminalId:n},n)]})}export{N as TerminalPanel};
@@ -1 +1 @@
1
- import{j as e,r as T}from"./vendor-react-0zU5oKmd.js";import{a as $}from"./index-6vyVf_xQ.js";import"./vendor-highlight-Cus7zBI4.js";function h(t){return t>=1e8?(t/1e8).toFixed(1)+"亿":t>=1e4?(t/1e4).toFixed(1)+"万":String(Math.round(t))}function S(t){const a=Math.round(t/6e4),n=Math.floor(a/60),l=a%60;return n>0?`${n}小时${l}分`:`${l}分`}const C=53,j=864e5;function k(t){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function E(t,a){const n=new Map;for(const o of t)n.set(o.key,o.totalTokens);const l=new Date;l.setHours(12,0,0,0);const s=new Date(l.getTime()-(C*7-1)*j);s.setDate(s.getDate()-s.getDay());const r=new Map;if(a==="weekly")for(const[o,d]of n){const i=new Date(o+"T12:00:00");i.setDate(i.getDate()-i.getDay());const x=k(i);r.set(x,(r.get(x)??0)+d)}const c=[],u=[];let N=0,w=0,D=-1;for(let o=new Date(s);o<=l;w++){const d=[];for(let x=0;x<7;x++){const p=new Date(o.getTime()+x*j),M=k(p),y=n.get(M)??0;a==="cumulative"&&(N+=y);let g=y;if(a==="weekly"){const f=new Date(p);f.setDate(f.getDate()-f.getDay()),g=r.get(k(f))??0}else a==="cumulative"&&(g=N);d.push({date:p,key:M,value:g,daily:y})}const i=d[0].date.getMonth();i!==D&&(u.push({col:w,label:`${i+1}月`}),D=i),c.push(d),o=new Date(o.getTime()+7*j)}let b=0;for(const o of c)for(const d of o)b=Math.max(b,d.value);return{weeks:c,max:b,monthLabels:u}}function F(t,a){if(t<=0||a<=0)return{className:"bg-surface-raised"};const n=t/a;return{className:"",style:{backgroundColor:`rgba(96,165,250,${n>.66?1:n>.33?.72:n>.1?.48:.28})`}}}function m({value:t,label:a}){return e.jsxs("div",{className:"flex flex-col items-center justify-center gap-1 px-4 py-3",children:[e.jsx("span",{className:"whitespace-nowrap font-mono text-xl font-semibold text-content-primary tabular-nums",children:t}),e.jsx("span",{className:"text-2xs text-content-muted",children:a})]})}function v({title:t,buckets:a}){const n=a.slice(0,6),l=n.reduce((s,r)=>Math.max(s,r.totalTokens),0);return n.length===0?null:e.jsxs("div",{className:"rounded-xl border border-border bg-surface p-4",children:[e.jsx("p",{className:"mb-3 text-2xs font-semibold uppercase tracking-wider text-content-faint",children:t}),e.jsx("div",{className:"space-y-2",children:n.map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-28 shrink-0 truncate text-xs text-content-secondary",title:s.key,children:s.key}),e.jsx("div",{className:"relative h-2 flex-1 overflow-hidden rounded-full bg-surface-raised",children:e.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${l>0?s.totalTokens/l*100:0}%`,backgroundColor:"rgba(96,165,250,0.7)"}})}),e.jsx("span",{className:"w-14 shrink-0 text-right font-mono text-2xs tabular-nums text-content-muted",children:h(s.totalTokens)})]},s.key))})]})}function z({report:t}){const[a,n]=T.useState("daily"),l=T.useMemo(()=>t?E(t.byDay,a):null,[t,a]);return t?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border rounded-2xl border border-border bg-surface sm:grid-cols-5",children:[e.jsx(m,{value:h(t.totals.totalTokens),label:"累计 Token 数"}),e.jsx(m,{value:h(t.peakDayTokens),label:"峰值 Token 数"}),e.jsx(m,{value:S(t.longestTaskMs),label:"最长任务时长"}),e.jsx(m,{value:`${t.currentStreakDays} 天`,label:"当前连续天数"}),e.jsx(m,{value:`${t.longestStreakDays} 天`,label:"最长连续天数"})]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-surface p-5",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold text-content-primary",children:"Token 活动"}),e.jsx("div",{className:"flex items-center gap-1 text-2xs",children:[["daily","每日"],["weekly","每周"],["cumulative","累计"]].map(([s,r])=>e.jsx("button",{onClick:()=>n(s),className:`rounded-md px-2 py-1 transition-colors ${a===s?"bg-surface-overlay text-content-primary":"text-content-muted hover:text-content-secondary"}`,children:r},s))})]}),l&&e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("div",{className:"inline-flex flex-col gap-1",children:[e.jsx("div",{className:"flex gap-1",children:l.weeks.map((s,r)=>e.jsx("div",{className:"flex flex-col gap-1",children:s.map(c=>{const u=F(c.value,l.max);return e.jsx("div",{className:`h-3 w-3 rounded-[3px] ${u.className}`,style:u.style,title:`${c.key} · ${h(c.daily)} tokens`},c.key)})},r))}),e.jsx("div",{className:"relative mt-1.5 h-4 text-2xs text-content-faint",children:l.monthLabels.map(s=>e.jsx("span",{className:"absolute",style:{left:`${s.col*16}px`},children:s.label},s.col))})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[e.jsx(v,{title:"工具分布",buckets:t.byTool}),e.jsx(v,{title:"模型分布",buckets:t.byModel}),e.jsx(v,{title:"项目分布",buckets:t.byProject})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-content-muted",children:[e.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-content-faint border-t-accent"}),e.jsx("p",{className:"text-sm",children:"正在扫描本机会话记录…"})]})}function L({report:t,onClose:a}){return e.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-canvas/95 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-5 py-3",children:[e.jsx("h2",{className:"text-base font-semibold text-content-primary",children:"用量统计"}),e.jsx("button",{onClick:a,className:"codex-btn-ghost px-2 py-1.5","aria-label":"关闭",children:e.jsx($,{size:16})})]}),e.jsx("div",{className:"mx-auto w-full max-w-5xl flex-1 overflow-y-auto px-5 py-6",children:e.jsx(z,{report:t})})]})}export{L as UsageDashboard,z as UsageDashboardContent};
1
+ import{j as e,r as T}from"./vendor-react-M7xG3qiw.js";import{a as $}from"./index-ClZzQ4ba.js";import"./vendor-highlight-NXWAAyIv.js";function h(t){return t>=1e8?(t/1e8).toFixed(1)+"亿":t>=1e4?(t/1e4).toFixed(1)+"万":String(Math.round(t))}function S(t){const a=Math.round(t/6e4),n=Math.floor(a/60),l=a%60;return n>0?`${n}小时${l}分`:`${l}分`}const C=53,j=864e5;function k(t){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function E(t,a){const n=new Map;for(const o of t)n.set(o.key,o.totalTokens);const l=new Date;l.setHours(12,0,0,0);const s=new Date(l.getTime()-(C*7-1)*j);s.setDate(s.getDate()-s.getDay());const r=new Map;if(a==="weekly")for(const[o,d]of n){const i=new Date(o+"T12:00:00");i.setDate(i.getDate()-i.getDay());const x=k(i);r.set(x,(r.get(x)??0)+d)}const c=[],u=[];let N=0,w=0,D=-1;for(let o=new Date(s);o<=l;w++){const d=[];for(let x=0;x<7;x++){const p=new Date(o.getTime()+x*j),M=k(p),y=n.get(M)??0;a==="cumulative"&&(N+=y);let g=y;if(a==="weekly"){const f=new Date(p);f.setDate(f.getDate()-f.getDay()),g=r.get(k(f))??0}else a==="cumulative"&&(g=N);d.push({date:p,key:M,value:g,daily:y})}const i=d[0].date.getMonth();i!==D&&(u.push({col:w,label:`${i+1}月`}),D=i),c.push(d),o=new Date(o.getTime()+7*j)}let b=0;for(const o of c)for(const d of o)b=Math.max(b,d.value);return{weeks:c,max:b,monthLabels:u}}function F(t,a){if(t<=0||a<=0)return{className:"bg-surface-raised"};const n=t/a;return{className:"",style:{backgroundColor:`rgba(96,165,250,${n>.66?1:n>.33?.72:n>.1?.48:.28})`}}}function m({value:t,label:a}){return e.jsxs("div",{className:"flex flex-col items-center justify-center gap-1 px-4 py-3",children:[e.jsx("span",{className:"whitespace-nowrap font-mono text-xl font-semibold text-content-primary tabular-nums",children:t}),e.jsx("span",{className:"text-2xs text-content-muted",children:a})]})}function v({title:t,buckets:a}){const n=a.slice(0,6),l=n.reduce((s,r)=>Math.max(s,r.totalTokens),0);return n.length===0?null:e.jsxs("div",{className:"rounded-xl border border-border bg-surface p-4",children:[e.jsx("p",{className:"mb-3 text-2xs font-semibold uppercase tracking-wider text-content-faint",children:t}),e.jsx("div",{className:"space-y-2",children:n.map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-28 shrink-0 truncate text-xs text-content-secondary",title:s.key,children:s.key}),e.jsx("div",{className:"relative h-2 flex-1 overflow-hidden rounded-full bg-surface-raised",children:e.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${l>0?s.totalTokens/l*100:0}%`,backgroundColor:"rgba(96,165,250,0.7)"}})}),e.jsx("span",{className:"w-14 shrink-0 text-right font-mono text-2xs tabular-nums text-content-muted",children:h(s.totalTokens)})]},s.key))})]})}function z({report:t}){const[a,n]=T.useState("daily"),l=T.useMemo(()=>t?E(t.byDay,a):null,[t,a]);return t?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border rounded-2xl border border-border bg-surface sm:grid-cols-5",children:[e.jsx(m,{value:h(t.totals.totalTokens),label:"累计 Token 数"}),e.jsx(m,{value:h(t.peakDayTokens),label:"峰值 Token 数"}),e.jsx(m,{value:S(t.longestTaskMs),label:"最长任务时长"}),e.jsx(m,{value:`${t.currentStreakDays} 天`,label:"当前连续天数"}),e.jsx(m,{value:`${t.longestStreakDays} 天`,label:"最长连续天数"})]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-surface p-5",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold text-content-primary",children:"Token 活动"}),e.jsx("div",{className:"flex items-center gap-1 text-2xs",children:[["daily","每日"],["weekly","每周"],["cumulative","累计"]].map(([s,r])=>e.jsx("button",{onClick:()=>n(s),className:`rounded-md px-2 py-1 transition-colors ${a===s?"bg-surface-overlay text-content-primary":"text-content-muted hover:text-content-secondary"}`,children:r},s))})]}),l&&e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("div",{className:"inline-flex flex-col gap-1",children:[e.jsx("div",{className:"flex gap-1",children:l.weeks.map((s,r)=>e.jsx("div",{className:"flex flex-col gap-1",children:s.map(c=>{const u=F(c.value,l.max);return e.jsx("div",{className:`h-3 w-3 rounded-[3px] ${u.className}`,style:u.style,title:`${c.key} · ${h(c.daily)} tokens`},c.key)})},r))}),e.jsx("div",{className:"relative mt-1.5 h-4 text-2xs text-content-faint",children:l.monthLabels.map(s=>e.jsx("span",{className:"absolute",style:{left:`${s.col*16}px`},children:s.label},s.col))})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[e.jsx(v,{title:"工具分布",buckets:t.byTool}),e.jsx(v,{title:"模型分布",buckets:t.byModel}),e.jsx(v,{title:"项目分布",buckets:t.byProject})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-content-muted",children:[e.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-content-faint border-t-accent"}),e.jsx("p",{className:"text-sm",children:"正在扫描本机会话记录…"})]})}function L({report:t,onClose:a}){return e.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-canvas/95 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-5 py-3",children:[e.jsx("h2",{className:"text-base font-semibold text-content-primary",children:"用量统计"}),e.jsx("button",{onClick:a,className:"codex-btn-ghost px-2 py-1.5","aria-label":"关闭",children:e.jsx($,{size:16})})]}),e.jsx("div",{className:"mx-auto w-full max-w-5xl flex-1 overflow-y-auto px-5 py-6",children:e.jsx(z,{report:t})})]})}export{L as UsageDashboard,z as UsageDashboardContent};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright (c) 2014 The xterm.js authors. All rights reserved.
3
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
4
+ * https://github.com/chjj/term.js
5
+ * @license MIT
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ * Originally forked from (with the author's permission):
26
+ * Fabrice Bellard's javascript vt100 for jslinux:
27
+ * http://bellard.org/jslinux/
28
+ * Copyright (c) 2011 Fabrice Bellard
29
+ * The original design remains. The terminal itself
30
+ * has been extended to include xterm CSI codes, among
31
+ * other features.
32
+ */.xterm{cursor:text;position:relative;-moz-user-select:none;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::-moz-selection{color:transparent}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{-webkit-user-select:text;-moz-user-select:text;user-select:text;white-space:pre}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:double underline;text-decoration:double underline}.xterm-underline-3{-webkit-text-decoration:wavy underline;text-decoration:wavy underline}.xterm-underline-4{-webkit-text-decoration:dotted underline;text-decoration:dotted underline}.xterm-underline-5{-webkit-text-decoration:dashed underline;text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com
33
+ */*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,PingFang SC,Microsoft YaHei,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,Liberation Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root,[data-theme=dark]{color-scheme:dark;--c-canvas: 11 13 15;--c-surface: 22 24 28;--c-surface-raised: 28 31 36;--c-surface-overlay: 35 38 44;--c-border: 42 46 53;--c-border-strong: 56 62 70;--c-content-primary: 233 235 238;--c-content-secondary: 158 165 173;--c-content-muted: 112 118 126;--c-content-faint: 78 83 90;--c-brand: 59 107 97;--c-brand-light: 78 138 126;--c-brand-dark: 42 79 71;--c-accent: 45 212 191;--c-accent-dim: 31 148 136;--c-diff-add: 31 61 43;--c-diff-add-text: 95 211 138;--c-diff-remove: 61 31 36;--c-diff-remove-text: 240 112 127;--c-success: 16 185 129;--c-warning: 245 158 11;--c-danger: 239 68 68;--glass-bg: 18 20 23;--body-wash-1: rgba(45, 212, 191, .05);--body-wash-2: rgba(59, 107, 97, .04)}[data-theme=light]{color-scheme:light;--c-canvas: 255 255 255;--c-surface: 255 255 255;--c-surface-raised: 248 248 247;--c-surface-overlay: 241 241 239;--c-border: 229 229 226;--c-border-strong: 212 212 208;--c-content-primary: 33 33 33;--c-content-secondary: 90 90 88;--c-content-muted: 130 130 126;--c-content-faint: 168 168 163;--c-brand: 47 92 83;--c-brand-light: 62 120 109;--c-brand-dark: 36 70 63;--c-accent: 17 122 110;--c-accent-dim: 15 105 95;--c-diff-add: 230 246 235;--c-diff-add-text: 30 120 78;--c-diff-remove: 252 230 232;--c-diff-remove-text: 188 50 64;--c-success: 22 128 84;--c-warning: 176 110 20;--c-danger: 196 48 48;--glass-bg: 255 255 255;--body-wash-1: transparent;--body-wash-2: transparent}html,body,#root{height:100%}body{--tw-bg-opacity: 1;background-color:rgb(var(--c-canvas) / var(--tw-bg-opacity, 1));font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,PingFang SC,Microsoft YaHei,sans-serif;--tw-text-opacity: 1;color:rgb(var(--c-content-primary) / var(--tw-text-opacity, 1));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-image:radial-gradient(120% 80% at 50% -10%,var(--body-wash-1),transparent 60%),radial-gradient(100% 60% at 100% 100%,var(--body-wash-2),transparent 55%);background-attachment:fixed}::-moz-selection{background:rgb(var(--c-accent) / .25)}::selection{background:rgb(var(--c-accent) / .25)}*{scrollbar-width:thin;scrollbar-color:rgb(var(--c-border-strong)) transparent}*::-webkit-scrollbar{width:8px;height:8px}*::-webkit-scrollbar-thumb{background:rgb(var(--c-border-strong));border-radius:9999px;border:2px solid transparent;background-clip:content-box}*::-webkit-scrollbar-thumb:hover{background:rgb(var(--c-content-faint));background-clip:content-box}*::-webkit-scrollbar-track{background:transparent}.container{width:100%}@media(min-width:640px){.container{max-width:640px}}@media(min-width:768px){.container{max-width:768px}}@media(min-width:1024px){.container{max-width:1024px}}@media(min-width:1280px){.container{max-width:1280px}}@media(min-width:1536px){.container{max-width:1536px}}.codex-card{border-radius:.75rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(var(--c-border) / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(var(--c-surface) / var(--tw-bg-opacity, 1));box-shadow:0 1px rgb(var(--c-content-primary) / .03) inset,0 1px 2px #0000002e}.codex-card-raised{border-radius:.75rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(var(--c-border) / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(var(--c-surface-raised) / var(--tw-bg-opacity, 1));box-shadow:0 1px rgb(var(--c-content-primary) / .04) inset,0 8px 28px -8px #00000047}.glass-bar{background:rgb(var(--glass-bg) / .6);backdrop-filter:saturate(140%) blur(12px);-webkit-backdrop-filter:saturate(140%) blur(12px)}.codex-input{width:100%;border-radius:.75rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(var(--c-border) / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(var(--c-surface-raised) / var(--tw-bg-opacity, 1));padding:.625rem .875rem;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(var(--c-content-primary) / var(--tw-text-opacity, 1))}.codex-input::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(var(--c-content-muted) / var(--tw-placeholder-opacity, 1))}.codex-input::placeholder{--tw-placeholder-opacity: 1;color:rgb(var(--c-content-muted) / var(--tw-placeholder-opacity, 1))}.codex-input{outline:2px solid transparent;outline-offset:2px;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.codex-input:focus{--tw-border-opacity: 1;border-color:rgb(var(--c-accent-dim) / var(--tw-border-opacity, 1));--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-color: rgb(var(--c-accent) / .2)}.codex-btn-primary{display:inline-flex;height:2.25rem;cursor:pointer;align-items:center;justify-content:center;gap:.375rem;border-radius:.5rem;padding-left:.875rem;padding-right:.875rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.codex-btn-primary:focus-visible{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-color: rgb(var(--c-accent) / .4)}.codex-btn-primary:disabled{pointer-events:none;opacity:.4}.codex-btn-primary{--tw-bg-opacity: 1;background-color:rgb(var(--c-accent-dim) / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.codex-btn-primary:hover{--tw-bg-opacity: 1;background-color:rgb(var(--c-accent) / var(--tw-bg-opacity, 1))}.codex-btn-primary{box-shadow:0 1px 2px #0000001f}.codex-btn-ghost{display:inline-flex;height:2.25rem;cursor:pointer;align-items:center;justify-content:center;gap:.375rem;border-radius:.5rem;padding-left:.875rem;padding-right:.875rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.codex-btn-ghost:focus-visible{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-color: rgb(var(--c-accent) / .4)}.codex-btn-ghost:disabled{pointer-events:none;opacity:.4}.codex-btn-ghost{--tw-text-opacity: 1;color:rgb(var(--c-content-secondary) / var(--tw-text-opacity, 1))}.codex-btn-ghost:hover{--tw-bg-opacity: 1;background-color:rgb(var(--c-surface-overlay) / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(var(--c-content-primary) / var(--tw-text-opacity, 1))}.codex-btn-outline{display:inline-flex;height:2.25rem;cursor:pointer;align-items:center;justify-content:center;gap:.375rem;border-radius:.5rem;padding-left:.875rem;padding-right:.875rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.codex-btn-outline:focus-visible{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-color: rgb(var(--c-accent) / .4)}.codex-btn-outline:disabled{pointer-events:none;opacity:.4}.codex-btn-outline{border-width:1px;--tw-border-opacity: 1;border-color:rgb(var(--c-border) / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(var(--c-surface) / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(var(--c-content-secondary) / var(--tw-text-opacity, 1))}.codex-btn-outline:hover{--tw-border-opacity: 1;border-color:rgb(var(--c-border-strong) / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(var(--c-surface-overlay) / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(var(--c-content-primary) / var(--tw-text-opacity, 1))}.tree-row{display:flex;width:100%;cursor:pointer;align-items:center;gap:.625rem;border-radius:.5rem;padding:.5rem .75rem;text-align:left;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.tree-row:hover{--tw-bg-opacity: 1;background-color:rgb(var(--c-surface-overlay) / var(--tw-bg-opacity, 1))}.tree-row-active{--tw-bg-opacity: 1;background-color:rgb(var(--c-surface-overlay) / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(var(--c-content-primary) / var(--tw-text-opacity, 1))}.codex-chip{display:inline-flex;align-items:center;gap:.25rem;border-radius:9999px;border-width:1px;--tw-border-opacity: 1;border-color:rgb(var(--c-border) / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(var(--c-surface-raised) / var(--tw-bg-opacity, 1));padding:.125rem .5rem;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,Liberation Mono,monospace;font-size:.6875rem;line-height:1rem;--tw-text-opacity: 1;color:rgb(var(--c-content-secondary) / var(--tw-text-opacity, 1))}.xterm-host,.xterm-host .xterm,.xterm-host .xterm-viewport{height:100%;width:100%}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.\!sticky{position:sticky!important}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.-right-1\.5{right:-.375rem}.-top-1\.5{top:-.375rem}.bottom-2{bottom:.5rem}.left-0{left:0}.left-3{left:.75rem}.right-0{right:0}.right-1\.5{right:.375rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.top-0{top:0}.top-1\.5{top:.375rem}.top-16{top:4rem}.top-2{top:.5rem}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[60\]{z-index:60}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.-mt-1{margin-top:-.25rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-2\.5{margin-top:.625rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-0{height:0px}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\[100dvh\]{height:100dvh}.h-full{height:100%}.h-px{height:1px}.max-h-32{max-height:8rem}.max-h-40{max-height:10rem}.max-h-48{max-height:12rem}.max-h-60{max-height:15rem}.max-h-72{max-height:18rem}.max-h-\[50vh\]{max-height:50vh}.max-h-\[85dvh\]{max-height:85dvh}.min-h-0{min-height:0px}.min-h-11{min-height:2.75rem}.min-h-14{min-height:3.5rem}.min-h-screen{min-height:100vh}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-2\.5{width:.625rem}.w-28{width:7rem}.w-3{width:.75rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[390px\]{width:390px}.w-\[82\%\]{width:82%}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-3xl{max-width:48rem}.max-w-5xl{max-width:64rem}.max-w-\[200px\]{max-width:200px}.max-w-\[46rem\]{max-width:46rem}.max-w-\[7rem\]{max-width:7rem}.max-w-\[85\%\]{max-width:85%}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.basis-full{flex-basis:100%}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes drawer-in{0%{transform:translate(-100%)}to{transform:translate(0)}}.animate-drawer-in{animation:drawer-in .24s cubic-bezier(.16,1,.3,1)}@keyframes fade-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.animate-fade-in{animation:fade-in .2s ease-out}@keyframes panel-in-right{0%{opacity:0;transform:translate(30px)}to{opacity:1;transform:translate(0)}}.animate-panel-in-right{animation:panel-in-right .22s cubic-bezier(.16,1,.3,1) both}@keyframes panel-in-up{0%{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}.animate-panel-in-up{animation:panel-in-up .24s cubic-bezier(.16,1,.3,1) both}@keyframes panel-out-down{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(100%)}}.animate-panel-out-down{animation:panel-out-down .24s cubic-bezier(.16,1,.3,1) both}@keyframes panel-out-right{0%{opacity:1;transform:translate(0)}to{opacity:0;transform:translate(30px)}}.animate-panel-out-right{animation:panel-out-right .22s cubic-bezier(.16,1,.3,1) both}@keyframes pulse-dot{0%,to{opacity:.4}50%{opacity:1}}.animate-pulse-dot{animation:pulse-dot 1.2s ease-in-out infinite}@keyframes slide-in{0%{opacity:0;transform:translate(8px)}to{opacity:1;transform:translate(0)}}.animate-slide-in{animation:slide-in .22s cubic-bezier(.16,1,.3,1)}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-col-resize{cursor:col-resize}.cursor-crosshair{cursor:crosshair}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.cursor-row-resize{cursor:row-resize}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-y-1\.5{row-gap:.375rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-x>:not([hidden])~:not([hidden]){--tw-divide-x-reverse: 0;border-right-width:calc(1px * var(--tw-divide-x-reverse));border-left-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}.divide-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(var(--c-border) / var(--tw-divide-opacity, 1))}.self-start{align-self:flex-start}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[3px\]{border-radius:3px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.rounded-xl{border-radius:.75rem}.rounded-t-2xl{border-top-left-radius:1rem;border-top-right-radius:1rem}.border{border-width:1px}.border-2{border-width:2px}.border-x{border-left-width:1px;border-right-width:1px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-accent{--tw-border-opacity: 1;border-color:rgb(var(--c-accent) / var(--tw-border-opacity, 1))}.border-accent-dim\/40{border-color:rgb(var(--c-accent-dim) / .4)}.border-accent\/25{border-color:rgb(var(--c-accent) / .25)}.border-accent\/30{border-color:rgb(var(--c-accent) / .3)}.border-border{--tw-border-opacity: 1;border-color:rgb(var(--c-border) / var(--tw-border-opacity, 1))}.border-border-strong{--tw-border-opacity: 1;border-color:rgb(var(--c-border-strong) / var(--tw-border-opacity, 1))}.border-content-faint{--tw-border-opacity: 1;border-color:rgb(var(--c-content-faint) / var(--tw-border-opacity, 1))}.border-danger\/25{border-color:rgb(var(--c-danger) / .25)}.border-danger\/30{border-color:rgb(var(--c-danger) / .3)}.border-danger\/40{border-color:rgb(var(--c-danger) / .4)}.border-danger\/60{border-color:rgb(var(--c-danger) / .6)}.border-success\/30{border-color:rgb(var(--c-success) / .3)}.border-warning\/30{border-color:rgb(var(--c-warning) / .3)}.border-warning\/40{border-color:rgb(var(--c-warning) / .4)}.border-t-accent{--tw-border-opacity: 1;border-top-color:rgb(var(--c-accent) / var(--tw-border-opacity, 1))}.bg-accent{--tw-bg-opacity: 1;background-color:rgb(var(--c-accent) / var(--tw-bg-opacity, 1))}.bg-accent-dim{--tw-bg-opacity: 1;background-color:rgb(var(--c-accent-dim) / var(--tw-bg-opacity, 1))}.bg-accent-dim\/20{background-color:rgb(var(--c-accent-dim) / .2)}.bg-accent\/10{background-color:rgb(var(--c-accent) / .1)}.bg-black\/60{background-color:#0009}.bg-border{--tw-bg-opacity: 1;background-color:rgb(var(--c-border) / var(--tw-bg-opacity, 1))}.bg-canvas{--tw-bg-opacity: 1;background-color:rgb(var(--c-canvas) / var(--tw-bg-opacity, 1))}.bg-canvas\/60{background-color:rgb(var(--c-canvas) / .6)}.bg-canvas\/80{background-color:rgb(var(--c-canvas) / .8)}.bg-canvas\/95{background-color:rgb(var(--c-canvas) / .95)}.bg-content-faint{--tw-bg-opacity: 1;background-color:rgb(var(--c-content-faint) / var(--tw-bg-opacity, 1))}.bg-current{background-color:currentColor}.bg-danger{--tw-bg-opacity: 1;background-color:rgb(var(--c-danger) / var(--tw-bg-opacity, 1))}.bg-danger\/10{background-color:rgb(var(--c-danger) / .1)}.bg-diff-add{--tw-bg-opacity: 1;background-color:rgb(var(--c-diff-add) / var(--tw-bg-opacity, 1))}.bg-diff-remove{--tw-bg-opacity: 1;background-color:rgb(var(--c-diff-remove) / var(--tw-bg-opacity, 1))}.bg-success{--tw-bg-opacity: 1;background-color:rgb(var(--c-success) / var(--tw-bg-opacity, 1))}.bg-success\/10{background-color:rgb(var(--c-success) / .1)}.bg-surface{--tw-bg-opacity: 1;background-color:rgb(var(--c-surface) / var(--tw-bg-opacity, 1))}.bg-surface-overlay{--tw-bg-opacity: 1;background-color:rgb(var(--c-surface-overlay) / var(--tw-bg-opacity, 1))}.bg-surface-raised{--tw-bg-opacity: 1;background-color:rgb(var(--c-surface-raised) / var(--tw-bg-opacity, 1))}.bg-surface-raised\/60{background-color:rgb(var(--c-surface-raised) / .6)}.bg-transparent{background-color:transparent}.bg-warning{--tw-bg-opacity: 1;background-color:rgb(var(--c-warning) / var(--tw-bg-opacity, 1))}.bg-warning\/10{background-color:rgb(var(--c-warning) / .1)}.bg-warning\/15{background-color:rgb(var(--c-warning) / .15)}.bg-warning\/30{background-color:rgb(var(--c-warning) / .3)}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.px-0{padding-left:0;padding-right:0}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-\[max\(0\.75rem\,env\(safe-area-inset-bottom\)\)\]{padding-bottom:max(.75rem,env(safe-area-inset-bottom))}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-5{padding-left:1.25rem}.pl-7{padding-left:1.75rem}.pr-1{padding-right:.25rem}.pr-3{padding-right:.75rem}.pr-9{padding-right:2.25rem}.pt-1\.5{padding-top:.375rem}.pt-2{padding-top:.5rem}.pt-2\.5{padding-top:.625rem}.pt-\[8vh\]{padding-top:8vh}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,Liberation Mono,monospace}.text-2xs{font-size:.6875rem;line-height:1rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.text-\[15px\]{font-size:15px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-6{line-height:1.5rem}.leading-7{line-height:1.75rem}.leading-\[1\.6\]{line-height:1.6}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent{--tw-text-opacity: 1;color:rgb(var(--c-accent) / var(--tw-text-opacity, 1))}.text-accent-dim{--tw-text-opacity: 1;color:rgb(var(--c-accent-dim) / var(--tw-text-opacity, 1))}.text-content-faint{--tw-text-opacity: 1;color:rgb(var(--c-content-faint) / var(--tw-text-opacity, 1))}.text-content-muted{--tw-text-opacity: 1;color:rgb(var(--c-content-muted) / var(--tw-text-opacity, 1))}.text-content-primary{--tw-text-opacity: 1;color:rgb(var(--c-content-primary) / var(--tw-text-opacity, 1))}.text-content-secondary{--tw-text-opacity: 1;color:rgb(var(--c-content-secondary) / var(--tw-text-opacity, 1))}.text-danger{--tw-text-opacity: 1;color:rgb(var(--c-danger) / var(--tw-text-opacity, 1))}.text-diff-addText{--tw-text-opacity: 1;color:rgb(var(--c-diff-add-text) / var(--tw-text-opacity, 1))}.text-diff-removeText{--tw-text-opacity: 1;color:rgb(var(--c-diff-remove-text) / var(--tw-text-opacity, 1))}.text-success{--tw-text-opacity: 1;color:rgb(var(--c-success) / var(--tw-text-opacity, 1))}.text-warning{--tw-text-opacity: 1;color:rgb(var(--c-warning) / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.line-through{text-decoration-line:line-through}.underline-offset-2{text-underline-offset:2px}.placeholder-content-muted::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(var(--c-content-muted) / var(--tw-placeholder-opacity, 1))}.placeholder-content-muted::placeholder{--tw-placeholder-opacity: 1;color:rgb(var(--c-content-muted) / var(--tw-placeholder-opacity, 1))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-150{transition-duration:.15s}.\[-ms-overflow-style\:none\]{-ms-overflow-style:none}.\[scrollbar-width\:none\]{scrollbar-width:none}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}@media(hover:none)and (pointer:coarse){[class*="group-hover:opacity-100"]{opacity:1!important}}.focus-within\:border-border-strong:focus-within{--tw-border-opacity: 1;border-color:rgb(var(--c-border-strong) / var(--tw-border-opacity, 1))}.hover\:border-border-strong:hover{--tw-border-opacity: 1;border-color:rgb(var(--c-border-strong) / var(--tw-border-opacity, 1))}.hover\:bg-accent:hover{--tw-bg-opacity: 1;background-color:rgb(var(--c-accent) / var(--tw-bg-opacity, 1))}.hover\:bg-accent-dim\/50:hover{background-color:rgb(var(--c-accent-dim) / .5)}.hover\:bg-accent\/10:hover{background-color:rgb(var(--c-accent) / .1)}.hover\:bg-danger\/10:hover{background-color:rgb(var(--c-danger) / .1)}.hover\:bg-surface-overlay:hover{--tw-bg-opacity: 1;background-color:rgb(var(--c-surface-overlay) / var(--tw-bg-opacity, 1))}.hover\:bg-surface-overlay\/60:hover{background-color:rgb(var(--c-surface-overlay) / .6)}.hover\:bg-surface-raised:hover{--tw-bg-opacity: 1;background-color:rgb(var(--c-surface-raised) / var(--tw-bg-opacity, 1))}.hover\:text-accent:hover{--tw-text-opacity: 1;color:rgb(var(--c-accent) / var(--tw-text-opacity, 1))}.hover\:text-content-muted:hover{--tw-text-opacity: 1;color:rgb(var(--c-content-muted) / var(--tw-text-opacity, 1))}.hover\:text-content-primary:hover{--tw-text-opacity: 1;color:rgb(var(--c-content-primary) / var(--tw-text-opacity, 1))}.hover\:text-content-secondary:hover{--tw-text-opacity: 1;color:rgb(var(--c-content-secondary) / var(--tw-text-opacity, 1))}.hover\:text-danger:hover{--tw-text-opacity: 1;color:rgb(var(--c-danger) / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.focus\:border-accent-dim:focus{--tw-border-opacity: 1;border-color:rgb(var(--c-accent-dim) / var(--tw-border-opacity, 1))}.disabled\:cursor-default:disabled{cursor:default}.disabled\:bg-surface-overlay:disabled{--tw-bg-opacity: 1;background-color:rgb(var(--c-surface-overlay) / var(--tw-bg-opacity, 1))}.disabled\:text-content-faint:disabled{--tw-text-opacity: 1;color:rgb(var(--c-content-faint) / var(--tw-text-opacity, 1))}.disabled\:opacity-40:disabled{opacity:.4}.group\/code:hover .group-hover\/code\:opacity-100,.group\/out:hover .group-hover\/out\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}@media(min-width:640px){.sm\:inline{display:inline}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:gap-3{gap:.75rem}.sm\:rounded-xl{border-radius:.75rem}.sm\:p-4{padding:1rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-10{padding-top:2.5rem;padding-bottom:2.5rem}.sm\:pb-3{padding-bottom:.75rem}.sm\:pt-\[12vh\]{padding-top:12vh}}@media(min-width:768px){.md\:right-4{right:1rem}.md\:px-4{padding-left:1rem;padding-right:1rem}.md\:py-2{padding-top:.5rem;padding-bottom:.5rem}.md\:py-8{padding-top:2rem;padding-bottom:2rem}.md\:pb-4{padding-bottom:1rem}.md\:text-\[15px\]{font-size:15px}}.\[\&\:\:-webkit-scrollbar\]\:hidden::-webkit-scrollbar{display:none}