cx-viewer 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +2 -2
- package/dist/assets/App-B_TIw8e4.js +41 -0
- package/dist/assets/{AppHeader-B3hrnZr-.css → AppHeader-BqUGBbBx.css} +2 -2
- package/dist/assets/{AppHeader.module-BMU2vyC4.js → AppHeader.module-Y8uZjbOm.js} +194 -190
- package/dist/assets/Mobile-BMOIr-Ox.js +10 -0
- package/dist/assets/{_baseUniq-CXWHShmB.js → _baseUniq-rFMjvMp9.js} +1 -1
- package/dist/assets/{arc-qbol0NJo.js → arc--Wq2RaH7.js} +1 -1
- package/dist/assets/{architectureDiagram-Q4EWVU46-COZebb1N.js → architectureDiagram-Q4EWVU46-BvEf2lP5.js} +1 -1
- package/dist/assets/{blockDiagram-DXYQGD6D-COCgzPKy.js → blockDiagram-DXYQGD6D-OPovcZG5.js} +1 -1
- package/dist/assets/{c4Diagram-AHTNJAMY-Bs5XvLEo.js → c4Diagram-AHTNJAMY-kgKyKOjo.js} +1 -1
- package/dist/assets/channel-73kvDnsL.js +1 -0
- package/dist/assets/{chunk-4BX2VUAB-CyGriz9d.js → chunk-4BX2VUAB-DzorV1it.js} +1 -1
- package/dist/assets/{chunk-4TB4RGXK-DlT_q-fl.js → chunk-4TB4RGXK-CqLZ1UMO.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-NHN99ZNC.js → chunk-55IACEB6-DSt0287z.js} +1 -1
- package/dist/assets/{chunk-EDXVE4YY-fK4f9Na9.js → chunk-EDXVE4YY-Ba5P02iy.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-DL-dQIq1.js → chunk-FMBD7UC4-B74A73-h.js} +1 -1
- package/dist/assets/{chunk-OYMX7WX6-6uruB4VY.js → chunk-OYMX7WX6-BAHzADpU.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-CCWIqLO8.js → chunk-QZHKN3VN-BD8A_1ir.js} +1 -1
- package/dist/assets/{chunk-YZCP3GAM-Cu84DMJo.js → chunk-YZCP3GAM-ClWecwcp.js} +1 -1
- package/dist/assets/classDiagram-6PBFFD2Q-eoMr9KbW.js +1 -0
- package/dist/assets/classDiagram-v2-HSJHXN6E-eoMr9KbW.js +1 -0
- package/dist/assets/clone-Dcc2YhiK.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-Dqi4iU3-.js → cose-bilkent-S5V4N54A-D_ghrbfg.js} +1 -1
- package/dist/assets/{dagre-KV5264BT-Dl-EJ9rb.js → dagre-KV5264BT-CB0vROfS.js} +1 -1
- package/dist/assets/{diagram-5BDNPKRD-BYtyzF0D.js → diagram-5BDNPKRD-BpcZ1UHM.js} +1 -1
- package/dist/assets/{diagram-G4DWMVQ6-BuETHFNU.js → diagram-G4DWMVQ6-BrFuDts4.js} +1 -1
- package/dist/assets/{diagram-MMDJMWI5-Z02oZp6I.js → diagram-MMDJMWI5-CsU-BG3D.js} +1 -1
- package/dist/assets/{diagram-TYMM5635-BpGlKv8l.js → diagram-TYMM5635-B1sb0AXF.js} +1 -1
- package/dist/assets/{erDiagram-SMLLAGMA-C4YngeQh.js → erDiagram-SMLLAGMA-CQyK2nOQ.js} +1 -1
- package/dist/assets/{flowDiagram-DWJPFMVM-BWddFffg.js → flowDiagram-DWJPFMVM-DZBShvn4.js} +1 -1
- package/dist/assets/{ganttDiagram-T4ZO3ILL-Bg0jOD4m.js → ganttDiagram-T4ZO3ILL-m6fTKdLL.js} +1 -1
- package/dist/assets/{gitGraphDiagram-UUTBAWPF-Bz-3sTXZ.js → gitGraphDiagram-UUTBAWPF-DkFErNFt.js} +1 -1
- package/dist/assets/{graph-XiH8DkIu.js → graph-bSi0W7jc.js} +1 -1
- package/dist/assets/{index-BuUsWKGZ.js → index-Br7dizB3.js} +2 -2
- package/dist/assets/{infoDiagram-42DDH7IO-DLo-lOCE.js → infoDiagram-42DDH7IO-CSm4RFl4.js} +1 -1
- package/dist/assets/{ishikawaDiagram-UXIWVN3A-BsIzT5eO.js → ishikawaDiagram-UXIWVN3A-Bwg4bCOs.js} +1 -1
- package/dist/assets/{journeyDiagram-VCZTEJTY-C3bOkKqv.js → journeyDiagram-VCZTEJTY-DPHJjuBf.js} +1 -1
- package/dist/assets/{kanban-definition-6JOO6SKY-D-rJRNbp.js → kanban-definition-6JOO6SKY-Cv9ev85o.js} +1 -1
- package/dist/assets/{layout-Bqp8Hh1c.js → layout-Ds0a2T6Q.js} +1 -1
- package/dist/assets/{linear-BWRSipGb.js → linear-Cp7l1b4X.js} +1 -1
- package/dist/assets/{mermaid.core-CJa7klhs.js → mermaid.core-CqjmsXPZ.js} +4 -4
- package/dist/assets/{min-CQ_VyzMd.js → min-Dt_Z0wyg.js} +1 -1
- package/dist/assets/{mindmap-definition-QFDTVHPH-Bnj7DDSx.js → mindmap-definition-QFDTVHPH-CX3dSqAw.js} +1 -1
- package/dist/assets/{pieDiagram-DEJITSTG-CC8a7Ylw.js → pieDiagram-DEJITSTG-Dx1Yb4B1.js} +1 -1
- package/dist/assets/{quadrantDiagram-34T5L4WZ-CrmL1WUV.js → quadrantDiagram-34T5L4WZ-DuVKMvkU.js} +1 -1
- package/dist/assets/{requirementDiagram-MS252O5E-TfkX4u_6.js → requirementDiagram-MS252O5E-D_k1MqxJ.js} +1 -1
- package/dist/assets/{sankeyDiagram-XADWPNL6-DMwBbND7.js → sankeyDiagram-XADWPNL6-Dd_dC8NM.js} +1 -1
- package/dist/assets/{sequenceDiagram-FGHM5R23-CFghMYsm.js → sequenceDiagram-FGHM5R23-zK876LNJ.js} +1 -1
- package/dist/assets/{stateDiagram-FHFEXIEX-1H6JIM7l.js → stateDiagram-FHFEXIEX-u5eiAg1J.js} +1 -1
- package/dist/assets/stateDiagram-v2-QKLJ7IA2-D0bdvVZJ.js +1 -0
- package/dist/assets/{timeline-definition-GMOUNBTQ-DnLMBlVa.js → timeline-definition-GMOUNBTQ-DR55BNQ6.js} +1 -1
- package/dist/assets/{vennDiagram-DHZGUBPP-DoIkY_KL.js → vennDiagram-DHZGUBPP-DYZc8vSs.js} +1 -1
- package/dist/assets/{wardley-RL74JXVD-3n5XmOD5.js → wardley-RL74JXVD-ofYR-6m2.js} +1 -1
- package/dist/assets/{wardleyDiagram-NUSXRM2D-UMOq3ofC.js → wardleyDiagram-NUSXRM2D-DnwarCdv.js} +1 -1
- package/dist/assets/{xychartDiagram-5P7HB3ND-CNDuQ5Cg.js → xychartDiagram-5P7HB3ND-1fCoOMAS.js} +1 -1
- package/dist/index.html +1 -1
- package/lib/appserver-bridge.js +108 -9
- package/lib/log-management.js +3 -1
- package/lib/plugin-loader.js +126 -6
- package/lib/sdk-manager.js +55 -0
- package/package.json +1 -1
- package/pty-manager.js +27 -3
- package/server.js +290 -25
- package/dist/assets/App-BzrN42Qt.js +0 -41
- package/dist/assets/Mobile-C9wxQTXV.js +0 -10
- package/dist/assets/channel-DvLUZ3Xf.js +0 -1
- package/dist/assets/classDiagram-6PBFFD2Q-ByKhp2Tk.js +0 -1
- package/dist/assets/classDiagram-v2-HSJHXN6E-ByKhp2Tk.js +0 -1
- package/dist/assets/clone-DZHpE494.js +0 -1
- package/dist/assets/stateDiagram-v2-QKLJ7IA2-CtXMaKcb.js +0 -1
package/cli.js
CHANGED
|
@@ -293,6 +293,7 @@ async function runCliMode(extraCodexArgs = [], cwd) {
|
|
|
293
293
|
});
|
|
294
294
|
|
|
295
295
|
const port = serverMod.getPort();
|
|
296
|
+
const protocol = serverMod.getProtocol();
|
|
296
297
|
|
|
297
298
|
// 标记工作区已启动(跳过前端工作区选择器)
|
|
298
299
|
serverMod.setWorkspaceLaunched(true);
|
|
@@ -301,7 +302,7 @@ async function runCliMode(extraCodexArgs = [], cwd) {
|
|
|
301
302
|
serverMod.initPostLaunch();
|
|
302
303
|
|
|
303
304
|
// 注入 OTel 配置到 config.toml(补充数据源)
|
|
304
|
-
const otelEndpoint =
|
|
305
|
+
const otelEndpoint = `${protocol}://127.0.0.1:${port}`;
|
|
305
306
|
const codexConfigPath = resolve(homedir(), '.codex', 'config.toml');
|
|
306
307
|
let _otelConfigInjected = false;
|
|
307
308
|
const OTEL_MARKER = '# >>> CX-Viewer OTel >>>';
|
|
@@ -349,7 +350,6 @@ async function runCliMode(extraCodexArgs = [], cwd) {
|
|
|
349
350
|
}
|
|
350
351
|
|
|
351
352
|
// 4. 自动打开浏览器
|
|
352
|
-
const protocol = serverMod.getProtocol();
|
|
353
353
|
const url = `${protocol}://127.0.0.1:${port}`;
|
|
354
354
|
try {
|
|
355
355
|
const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var Bs=Object.defineProperty;var Os=(n,s,t)=>s in n?Bs(n,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[s]=t;var B=(n,s,t)=>Os(n,typeof s!="symbol"?s+"":s,t);import{r as v,R as U,j as e,b as Ds}from"./index-Br7dizB3.js";import{g as Zt,r as $s,u as Re,V as dt,c as se,W as at,d as xt,X as es,Y as Fs,Z as Hs,$ as zs,a0 as Vs,a1 as qs,a2 as ts,a3 as Tt,a4 as Us,a5 as Ws,a6 as Ks,a7 as Gs,a8 as Js,a9 as Qs,aa as Xs,_ as le,ab as Ys,ac as vt,ad as _e,ae as Mt,af as mt,ag as Et,ah as Zs,ai as ea,aj as Rt,ak as ta,m as sa,al as aa,am as na,an as oa,ao as ia,ap as la,aq as ra,ar as It,C as wt,I as be,as as ca,at as ss,au as da,av as as,aw as ha,ax as ua,ay as ma,e as de,t as m,w as Je,x as pa,y as Te,j as ga,k as fa,l as xa,s as c,v as G,q as he,az as ns,aA as Ie,aB as K,P as Ae,aC as qe,n as va,aD as ya,o as Qe,aE as ja,aF as je,S as os,aG as Be,aH as Ca,aI as Ce,aJ as Lt,B as F,N as Me,aK as Ee,Q as ba,aL as is,aM as Ye,aN as Na,aO as Sa,L as nt,aP as Pt,M as yt,aQ as _a,O as ls,aR as wa,aS as ka,aT as Le,aU as At,aV as Ta,aW as Bt,aX as rs,aY as cs,aZ as De,a_ as $e,a$ as ds,b0 as pt,b1 as Ot,b2 as Dt,b3 as $t,b4 as Ma,b5 as Ea,A as Ra,b6 as Ze,b7 as Ft,b8 as Ia,D as La,z as R,E as Pa,b9 as Aa}from"./AppHeader.module-Y8uZjbOm.js";const et=(n,s,t,a,r)=>({background:n,border:`${Re(a.lineWidth)} ${a.lineType} ${s}`,[`${r}-icon`]:{color:t}}),Ba=n=>{const{componentCls:s,motionDurationSlow:t,marginXS:a,marginSM:r,fontSize:o,fontSizeLG:u,lineHeight:g,borderRadiusLG:i,motionEaseInOutCirc:h,withDescriptionIconSize:l,colorText:d,colorTextHeading:p,withDescriptionPadding:y,defaultPadding:x}=n;return{[s]:Object.assign(Object.assign({},$s(n)),{position:"relative",display:"flex",alignItems:"center",padding:x,wordWrap:"break-word",borderRadius:i,[`&${s}-rtl`]:{direction:"rtl"},[`${s}-content`]:{flex:1,minWidth:0},[`${s}-icon`]:{marginInlineEnd:a,lineHeight:0},"&-description":{display:"none",fontSize:o,lineHeight:g},"&-message":{color:p},[`&${s}-motion-leave`]:{overflow:"hidden",opacity:1,transition:`max-height ${t} ${h}, opacity ${t} ${h},
|
|
2
|
+
padding-top ${t} ${h}, padding-bottom ${t} ${h},
|
|
3
|
+
margin-bottom ${t} ${h}`},[`&${s}-motion-leave-active`]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0}}),[`${s}-with-description`]:{alignItems:"flex-start",padding:y,[`${s}-icon`]:{marginInlineEnd:r,fontSize:l,lineHeight:0},[`${s}-message`]:{display:"block",marginBottom:a,color:p,fontSize:u},[`${s}-description`]:{display:"block",color:d}},[`${s}-banner`]:{marginBottom:0,border:"0 !important",borderRadius:0}}},Oa=n=>{const{componentCls:s,colorSuccess:t,colorSuccessBorder:a,colorSuccessBg:r,colorWarning:o,colorWarningBorder:u,colorWarningBg:g,colorError:i,colorErrorBorder:h,colorErrorBg:l,colorInfo:d,colorInfoBorder:p,colorInfoBg:y}=n;return{[s]:{"&-success":et(r,a,t,n,s),"&-info":et(y,p,d,n,s),"&-warning":et(g,u,o,n,s),"&-error":Object.assign(Object.assign({},et(l,h,i,n,s)),{[`${s}-description > pre`]:{margin:0,padding:0}})}}},Da=n=>{const{componentCls:s,iconCls:t,motionDurationMid:a,marginXS:r,fontSizeIcon:o,colorIcon:u,colorIconHover:g}=n;return{[s]:{"&-action":{marginInlineStart:r},[`${s}-close-icon`]:{marginInlineStart:r,padding:0,overflow:"hidden",fontSize:o,lineHeight:Re(o),backgroundColor:"transparent",border:"none",outline:"none",cursor:"pointer",[`${t}-close`]:{color:u,transition:`color ${a}`,"&:hover":{color:g}}},"&-close-text":{color:u,transition:`color ${a}`,"&:hover":{color:g}}}}},$a=n=>({withDescriptionIconSize:n.fontSizeHeading3,defaultPadding:`${n.paddingContentVerticalSM}px 12px`,withDescriptionPadding:`${n.paddingMD}px ${n.paddingContentHorizontalLG}px`}),Fa=Zt("Alert",n=>[Ba(n),Oa(n),Da(n)],$a);var Ht=function(n,s){var t={};for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&s.indexOf(a)<0&&(t[a]=n[a]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(n);r<a.length;r++)s.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(n,a[r])&&(t[a[r]]=n[a[r]]);return t};const Ha={success:qs,info:Vs,error:zs,warning:Hs},za=n=>{const{icon:s,prefixCls:t,type:a}=n,r=Ha[a]||null;return s?Fs(s,v.createElement("span",{className:`${t}-icon`},s),()=>({className:se(`${t}-icon`,s.props.className)})):v.createElement(r,{className:`${t}-icon`})},Va=n=>{const{isClosable:s,prefixCls:t,closeIcon:a,handleClose:r,ariaProps:o}=n,u=a===!0||a===void 0?v.createElement(ts,null):a;return s?v.createElement("button",Object.assign({type:"button",onClick:r,className:`${t}-close-icon`,tabIndex:0},o),u):null},hs=v.forwardRef((n,s)=>{const{description:t,prefixCls:a,message:r,banner:o,className:u,rootClassName:g,style:i,onMouseEnter:h,onMouseLeave:l,onClick:d,afterClose:p,showIcon:y,closable:x,closeText:j,closeIcon:f,action:C,id:w}=n,S=Ht(n,["description","prefixCls","message","banner","className","rootClassName","style","onMouseEnter","onMouseLeave","onClick","afterClose","showIcon","closable","closeText","closeIcon","action","id"]),[M,_]=v.useState(!1),T=v.useRef(null);v.useImperativeHandle(s,()=>({nativeElement:T.current}));const{getPrefixCls:I,direction:L,closable:E,closeIcon:P,className:D,style:ae}=dt("alert"),H=I("alert",a),[A,J,re]=Fa(H),Y=ee=>{var b;_(!0),(b=n.onClose)===null||b===void 0||b.call(n,ee)},ue=v.useMemo(()=>n.type!==void 0?n.type:o?"warning":"info",[n.type,o]),oe=v.useMemo(()=>typeof x=="object"&&x.closeIcon||j?!0:typeof x=="boolean"?x:f!==!1&&f!==null&&f!==void 0?!0:!!E,[j,f,x,E]),ce=o&&y===void 0?!0:y,W=se(H,`${H}-${ue}`,{[`${H}-with-description`]:!!t,[`${H}-no-icon`]:!ce,[`${H}-banner`]:!!o,[`${H}-rtl`]:L==="rtl"},D,u,g,re,J),ge=at(S,{aria:!0,data:!0}),ne=v.useMemo(()=>typeof x=="object"&&x.closeIcon?x.closeIcon:j||(f!==void 0?f:typeof E=="object"&&E.closeIcon?E.closeIcon:P),[f,x,E,j,P]),ve=v.useMemo(()=>{const ee=x??E;if(typeof ee=="object"){const{closeIcon:b}=ee;return Ht(ee,["closeIcon"])}return{}},[x,E]);return A(v.createElement(xt,{visible:!M,motionName:`${H}-motion`,motionAppear:!1,motionEnter:!1,onLeaveStart:ee=>({maxHeight:ee.offsetHeight}),onLeaveEnd:p},({className:ee,style:b},Q)=>v.createElement("div",Object.assign({id:w,ref:es(T,Q),"data-show":!M,className:se(W,ee),style:Object.assign(Object.assign(Object.assign({},ae),i),b),onMouseEnter:h,onMouseLeave:l,onClick:d,role:"alert"},ge),ce?v.createElement(za,{description:t,icon:n.icon,prefixCls:H,type:ue}):null,v.createElement("div",{className:`${H}-content`},r?v.createElement("div",{className:`${H}-message`},r):null,t?v.createElement("div",{className:`${H}-description`},t):null),C?v.createElement("div",{className:`${H}-action`},C):null,v.createElement(Va,{isClosable:oe,prefixCls:H,closeIcon:ne,handleClose:Y,ariaProps:ve}))))});function qa(n,s,t){return s=Tt(s),Us(n,Ws()?Reflect.construct(s,t||[],Tt(n).constructor):s.apply(n,t))}let Ua=(function(n){function s(){var t;return Js(this,s),t=qa(this,s,arguments),t.state={error:void 0,info:{componentStack:""}},t}return Ks(s,n),Gs(s,[{key:"componentDidCatch",value:function(a,r){this.setState({error:a,info:r})}},{key:"render",value:function(){const{message:a,description:r,id:o,children:u}=this.props,{error:g,info:i}=this.state,h=(i==null?void 0:i.componentStack)||null,l=typeof a>"u"?(g||"").toString():a,d=typeof r>"u"?h:r;return g?v.createElement(hs,{id:o,type:"error",message:l,description:v.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},d)}):u}}])})(v.Component);const us=hs;us.ErrorBoundary=Ua;var zt=v.createContext(null),ms=v.createContext({}),Wa=["prefixCls","className","containerRef"],Ka=function(s){var t=s.prefixCls,a=s.className,r=s.containerRef,o=Qs(s,Wa),u=v.useContext(ms),g=u.panel,i=Xs(g,r);return v.createElement("div",le({className:se("".concat(t,"-content"),a),role:"dialog",ref:i},at(s,{aria:!0}),{"aria-modal":"true"},o))};function Vt(n){return typeof n=="string"&&String(Number(n))===n?(Ys(!1,"Invalid value type of `width` or `height` which should be number type instead."),Number(n)):n}var qt={width:0,height:0,overflow:"hidden",outline:"none",position:"absolute"};function Ga(n,s){var t,a,r,o=n.prefixCls,u=n.open,g=n.placement,i=n.inline,h=n.push,l=n.forceRender,d=n.autoFocus,p=n.keyboard,y=n.classNames,x=n.rootClassName,j=n.rootStyle,f=n.zIndex,C=n.className,w=n.id,S=n.style,M=n.motion,_=n.width,T=n.height,I=n.children,L=n.mask,E=n.maskClosable,P=n.maskMotion,D=n.maskClassName,ae=n.maskStyle,H=n.afterOpenChange,A=n.onClose,J=n.onMouseEnter,re=n.onMouseOver,Y=n.onMouseLeave,ue=n.onClick,oe=n.onKeyDown,ce=n.onKeyUp,W=n.styles,ge=n.drawerRender,ne=v.useRef(),ve=v.useRef(),ee=v.useRef();v.useImperativeHandle(s,function(){return ne.current});var b=function(xe){var He=xe.keyCode,ze=xe.shiftKey;switch(He){case mt.TAB:{if(He===mt.TAB){if(!ze&&document.activeElement===ee.current){var Ve;(Ve=ve.current)===null||Ve===void 0||Ve.focus({preventScroll:!0})}else if(ze&&document.activeElement===ve.current){var ut;(ut=ee.current)===null||ut===void 0||ut.focus({preventScroll:!0})}}break}case mt.ESC:{A&&p&&(xe.stopPropagation(),A(xe));break}}};v.useEffect(function(){if(u&&d){var Z;(Z=ne.current)===null||Z===void 0||Z.focus({preventScroll:!0})}},[u]);var Q=v.useState(!1),te=vt(Q,2),Ne=te[0],Se=te[1],q=v.useContext(zt),we;typeof h=="boolean"?we=h?{}:{distance:0}:we=h||{};var ye=(t=(a=(r=we)===null||r===void 0?void 0:r.distance)!==null&&a!==void 0?a:q==null?void 0:q.pushDistance)!==null&&t!==void 0?t:180,Xe=v.useMemo(function(){return{pushDistance:ye,push:function(){Se(!0)},pull:function(){Se(!1)}}},[ye]);v.useEffect(function(){if(u){var Z;q==null||(Z=q.push)===null||Z===void 0||Z.call(q)}else{var xe;q==null||(xe=q.pull)===null||xe===void 0||xe.call(q)}},[u]),v.useEffect(function(){return function(){var Z;q==null||(Z=q.pull)===null||Z===void 0||Z.call(q)}},[]);var fe=v.createElement(xt,le({key:"mask"},P,{visible:L&&u}),function(Z,xe){var He=Z.className,ze=Z.style;return v.createElement("div",{className:se("".concat(o,"-mask"),He,y==null?void 0:y.mask,D),style:_e(_e(_e({},ze),ae),W==null?void 0:W.mask),onClick:E&&u?A:void 0,ref:xe})}),ie=typeof M=="function"?M(g):M,$={};if(Ne&&ye)switch(g){case"top":$.transform="translateY(".concat(ye,"px)");break;case"bottom":$.transform="translateY(".concat(-ye,"px)");break;case"left":$.transform="translateX(".concat(ye,"px)");break;default:$.transform="translateX(".concat(-ye,"px)");break}g==="left"||g==="right"?$.width=Vt(_):$.height=Vt(T);var me={onMouseEnter:J,onMouseOver:re,onMouseLeave:Y,onClick:ue,onKeyDown:oe,onKeyUp:ce},ke=v.createElement(xt,le({key:"panel"},ie,{visible:u,forceRender:l,onVisibleChanged:function(xe){H==null||H(xe)},removeOnLeave:!1,leavedClassName:"".concat(o,"-content-wrapper-hidden")}),function(Z,xe){var He=Z.className,ze=Z.style,Ve=v.createElement(Ka,le({id:w,containerRef:xe,prefixCls:o,className:se(C,y==null?void 0:y.content),style:_e(_e({},S),W==null?void 0:W.content)},at(n,{aria:!0}),me),I);return v.createElement("div",le({className:se("".concat(o,"-content-wrapper"),y==null?void 0:y.wrapper,He),style:_e(_e(_e({},$),ze),W==null?void 0:W.wrapper)},at(n,{data:!0})),ge?ge(Ve):Ve)}),We=_e({},j);return f&&(We.zIndex=f),v.createElement(zt.Provider,{value:Xe},v.createElement("div",{className:se(o,"".concat(o,"-").concat(g),x,Mt(Mt({},"".concat(o,"-open"),u),"".concat(o,"-inline"),i)),style:We,tabIndex:-1,ref:ne,onKeyDown:b},fe,v.createElement("div",{tabIndex:0,ref:ve,style:qt,"aria-hidden":"true","data-sentinel":"start"}),ke,v.createElement("div",{tabIndex:0,ref:ee,style:qt,"aria-hidden":"true","data-sentinel":"end"})))}var Ja=v.forwardRef(Ga),Qa=function(s){var t=s.open,a=t===void 0?!1:t,r=s.prefixCls,o=r===void 0?"rc-drawer":r,u=s.placement,g=u===void 0?"right":u,i=s.autoFocus,h=i===void 0?!0:i,l=s.keyboard,d=l===void 0?!0:l,p=s.width,y=p===void 0?378:p,x=s.mask,j=x===void 0?!0:x,f=s.maskClosable,C=f===void 0?!0:f,w=s.getContainer,S=s.forceRender,M=s.afterOpenChange,_=s.destroyOnClose,T=s.onMouseEnter,I=s.onMouseOver,L=s.onMouseLeave,E=s.onClick,P=s.onKeyDown,D=s.onKeyUp,ae=s.panelRef,H=v.useState(!1),A=vt(H,2),J=A[0],re=A[1],Y=v.useState(!1),ue=vt(Y,2),oe=ue[0],ce=ue[1];Et(function(){ce(!0)},[]);var W=oe?a:!1,ge=v.useRef(),ne=v.useRef();Et(function(){W&&(ne.current=document.activeElement)},[W]);var ve=function(Ne){var Se;if(re(Ne),M==null||M(Ne),!Ne&&ne.current&&!((Se=ge.current)!==null&&Se!==void 0&&Se.contains(ne.current))){var q;(q=ne.current)===null||q===void 0||q.focus({preventScroll:!0})}},ee=v.useMemo(function(){return{panel:ae}},[ae]);if(!S&&!J&&!W&&_)return null;var b={onMouseEnter:T,onMouseOver:I,onMouseLeave:L,onClick:E,onKeyDown:P,onKeyUp:D},Q=_e(_e({},s),{},{open:W,prefixCls:o,placement:g,autoFocus:h,keyboard:d,width:y,mask:j,maskClosable:C,inline:w===!1,afterOpenChange:ve,ref:ge},b);return v.createElement(ms.Provider,{value:ee},v.createElement(Zs,{open:W||S||J,autoDestroy:!1,getContainer:w,autoLock:j&&(W||J)},v.createElement(Ja,Q)))};const ps=n=>{var s,t;const{prefixCls:a,ariaId:r,title:o,footer:u,extra:g,closable:i,loading:h,onClose:l,headerStyle:d,bodyStyle:p,footerStyle:y,children:x,classNames:j,styles:f}=n,C=dt("drawer");let w;i===!1?w=void 0:i===void 0||i===!0?w="start":w=(i==null?void 0:i.placement)==="end"?"end":"start";const S=v.useCallback(L=>v.createElement("button",{type:"button",onClick:l,className:se(`${a}-close`,{[`${a}-close-${w}`]:w==="end"})},L),[l,a,w]),[M,_]=ea(Rt(n),Rt(C),{closable:!0,closeIconRender:S}),T=()=>{var L,E;return!o&&!M?null:v.createElement("div",{style:Object.assign(Object.assign(Object.assign({},(L=C.styles)===null||L===void 0?void 0:L.header),d),f==null?void 0:f.header),className:se(`${a}-header`,{[`${a}-header-close-only`]:M&&!o&&!g},(E=C.classNames)===null||E===void 0?void 0:E.header,j==null?void 0:j.header)},v.createElement("div",{className:`${a}-header-title`},w==="start"&&_,o&&v.createElement("div",{className:`${a}-title`,id:r},o)),g&&v.createElement("div",{className:`${a}-extra`},g),w==="end"&&_)},I=()=>{var L,E;if(!u)return null;const P=`${a}-footer`;return v.createElement("div",{className:se(P,(L=C.classNames)===null||L===void 0?void 0:L.footer,j==null?void 0:j.footer),style:Object.assign(Object.assign(Object.assign({},(E=C.styles)===null||E===void 0?void 0:E.footer),y),f==null?void 0:f.footer)},u)};return v.createElement(v.Fragment,null,T(),v.createElement("div",{className:se(`${a}-body`,j==null?void 0:j.body,(s=C.classNames)===null||s===void 0?void 0:s.body),style:Object.assign(Object.assign(Object.assign({},(t=C.styles)===null||t===void 0?void 0:t.body),p),f==null?void 0:f.body)},h?v.createElement(ta,{active:!0,title:!1,paragraph:{rows:5},className:`${a}-body-skeleton`}):x),I())},Xa=n=>{const s="100%";return{left:`translateX(-${s})`,right:`translateX(${s})`,top:`translateY(-${s})`,bottom:`translateY(${s})`}[n]},gs=(n,s)=>({"&-enter, &-appear":Object.assign(Object.assign({},n),{"&-active":s}),"&-leave":Object.assign(Object.assign({},s),{"&-active":n})}),fs=(n,s)=>Object.assign({"&-enter, &-appear, &-leave":{"&-start":{transition:"none"},"&-active":{transition:`all ${s}`}}},gs({opacity:n},{opacity:1})),Ya=(n,s)=>[fs(.7,s),gs({transform:Xa(n)},{transform:"none"})],Za=n=>{const{componentCls:s,motionDurationSlow:t}=n;return{[s]:{[`${s}-mask-motion`]:fs(0,t),[`${s}-panel-motion`]:["left","right","top","bottom"].reduce((a,r)=>Object.assign(Object.assign({},a),{[`&-${r}`]:Ya(r,t)}),{})}}},en=n=>{const{borderRadiusSM:s,componentCls:t,zIndexPopup:a,colorBgMask:r,colorBgElevated:o,motionDurationSlow:u,motionDurationMid:g,paddingXS:i,padding:h,paddingLG:l,fontSizeLG:d,lineHeightLG:p,lineWidth:y,lineType:x,colorSplit:j,marginXS:f,colorIcon:C,colorIconHover:w,colorBgTextHover:S,colorBgTextActive:M,colorText:_,fontWeightStrong:T,footerPaddingBlock:I,footerPaddingInline:L,calc:E}=n,P=`${t}-content-wrapper`;return{[t]:{position:"fixed",inset:0,zIndex:a,pointerEvents:"none",color:_,"&-pure":{position:"relative",background:o,display:"flex",flexDirection:"column",[`&${t}-left`]:{boxShadow:n.boxShadowDrawerLeft},[`&${t}-right`]:{boxShadow:n.boxShadowDrawerRight},[`&${t}-top`]:{boxShadow:n.boxShadowDrawerUp},[`&${t}-bottom`]:{boxShadow:n.boxShadowDrawerDown}},"&-inline":{position:"absolute"},[`${t}-mask`]:{position:"absolute",inset:0,zIndex:a,background:r,pointerEvents:"auto"},[P]:{position:"absolute",zIndex:a,maxWidth:"100vw",transition:`all ${u}`,"&-hidden":{display:"none"}},[`&-left > ${P}`]:{top:0,bottom:0,left:{_skip_check_:!0,value:0},boxShadow:n.boxShadowDrawerLeft},[`&-right > ${P}`]:{top:0,right:{_skip_check_:!0,value:0},bottom:0,boxShadow:n.boxShadowDrawerRight},[`&-top > ${P}`]:{top:0,insetInline:0,boxShadow:n.boxShadowDrawerUp},[`&-bottom > ${P}`]:{bottom:0,insetInline:0,boxShadow:n.boxShadowDrawerDown},[`${t}-content`]:{display:"flex",flexDirection:"column",width:"100%",height:"100%",overflow:"auto",background:o,pointerEvents:"auto"},[`${t}-header`]:{display:"flex",flex:0,alignItems:"center",padding:`${Re(h)} ${Re(l)}`,fontSize:d,lineHeight:p,borderBottom:`${Re(y)} ${x} ${j}`,"&-title":{display:"flex",flex:1,alignItems:"center",minWidth:0,minHeight:0}},[`${t}-extra`]:{flex:"none"},[`${t}-close`]:Object.assign({display:"inline-flex",width:E(d).add(i).equal(),height:E(d).add(i).equal(),borderRadius:s,justifyContent:"center",alignItems:"center",color:C,fontWeight:T,fontSize:d,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",textDecoration:"none",background:"transparent",border:0,cursor:"pointer",transition:`all ${g}`,textRendering:"auto",[`&${t}-close-end`]:{marginInlineStart:f},[`&:not(${t}-close-end)`]:{marginInlineEnd:f},"&:hover":{color:w,backgroundColor:S,textDecoration:"none"},"&:active":{backgroundColor:M}},aa(n)),[`${t}-title`]:{flex:1,margin:0,fontWeight:n.fontWeightStrong,fontSize:d,lineHeight:p},[`${t}-body`]:{flex:1,minWidth:0,minHeight:0,padding:l,overflow:"auto",[`${t}-body-skeleton`]:{width:"100%",height:"100%",display:"flex",justifyContent:"center"}},[`${t}-footer`]:{flexShrink:0,padding:`${Re(I)} ${Re(L)}`,borderTop:`${Re(y)} ${x} ${j}`},"&-rtl":{direction:"rtl"}}}},tn=n=>({zIndexPopup:n.zIndexPopupBase,footerPaddingBlock:n.paddingXS,footerPaddingInline:n.padding}),xs=Zt("Drawer",n=>{const s=sa(n,{});return[en(s),Za(s)]},tn);var vs=function(n,s){var t={};for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&s.indexOf(a)<0&&(t[a]=n[a]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(n);r<a.length;r++)s.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(n,a[r])&&(t[a[r]]=n[a[r]]);return t};const sn={distance:180},tt=n=>{const{rootClassName:s,width:t,height:a,size:r="default",mask:o=!0,push:u=sn,open:g,afterOpenChange:i,onClose:h,prefixCls:l,getContainer:d,panelRef:p=null,style:y,className:x,"aria-labelledby":j,visible:f,afterVisibleChange:C,maskStyle:w,drawerStyle:S,contentWrapperStyle:M,destroyOnClose:_,destroyOnHidden:T}=n,I=vs(n,["rootClassName","width","height","size","mask","push","open","afterOpenChange","onClose","prefixCls","getContainer","panelRef","style","className","aria-labelledby","visible","afterVisibleChange","maskStyle","drawerStyle","contentWrapperStyle","destroyOnClose","destroyOnHidden"]),L=na(),E=I.title?L:void 0,{getPopupContainer:P,getPrefixCls:D,direction:ae,className:H,style:A,classNames:J,styles:re}=dt("drawer"),Y=D("drawer",l),[ue,oe,ce]=xs(Y),W=d===void 0&&P?()=>P(document.body):d,ge=se({"no-mask":!o,[`${Y}-rtl`]:ae==="rtl"},s,oe,ce),ne=v.useMemo(()=>t??(r==="large"?736:378),[t,r]),ve=v.useMemo(()=>a??(r==="large"?736:378),[a,r]),ee={motionName:It(Y,"mask-motion"),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500},b=ye=>({motionName:It(Y,`panel-motion-${ye}`),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500}),Q=oa(),te=es(p,Q),[Ne,Se]=ia("Drawer",I.zIndex),{classNames:q={},styles:we={}}=I;return ue(v.createElement(la,{form:!0,space:!0},v.createElement(ra.Provider,{value:Se},v.createElement(Qa,Object.assign({prefixCls:Y,onClose:h,maskMotion:ee,motion:b},I,{classNames:{mask:se(q.mask,J.mask),content:se(q.content,J.content),wrapper:se(q.wrapper,J.wrapper)},styles:{mask:Object.assign(Object.assign(Object.assign({},we.mask),w),re.mask),content:Object.assign(Object.assign(Object.assign({},we.content),S),re.content),wrapper:Object.assign(Object.assign(Object.assign({},we.wrapper),M),re.wrapper)},open:g??f,mask:o,push:u,width:ne,height:ve,style:Object.assign(Object.assign({},A),y),className:se(H,x),rootClassName:ge,getContainer:W,afterOpenChange:i??C,panelRef:te,zIndex:Ne,"aria-labelledby":j??E,destroyOnClose:T??_}),v.createElement(ps,Object.assign({prefixCls:Y},I,{ariaId:E,onClose:h}))))))},an=n=>{const{prefixCls:s,style:t,className:a,placement:r="right"}=n,o=vs(n,["prefixCls","style","className","placement"]),{getPrefixCls:u}=v.useContext(wt),g=u("drawer",s),[i,h,l]=xs(g),d=se(g,`${g}-pure`,`${g}-${r}`,h,l,a);return i(v.createElement("div",{className:d,style:t},v.createElement(ps,Object.assign({prefixCls:g},o))))};tt._InternalPanelDoNotUseOrYouWillBeFired=an;var nn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"},on=function(s,t){return v.createElement(be,le({},s,{ref:t,icon:nn}))},Ke=v.forwardRef(on),ln={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"swap",theme:"outlined"},rn=function(s,t){return v.createElement(be,le({},s,{ref:t,icon:ln}))},Ut=v.forwardRef(rn);function cn(n,s,t){return typeof t=="boolean"?t:n.length?!0:ca(s).some(r=>r.type===ss)}var ys=function(n,s){var t={};for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&s.indexOf(a)<0&&(t[a]=n[a]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(n);r<a.length;r++)s.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(n,a[r])&&(t[a[r]]=n[a[r]]);return t};function ht({suffixCls:n,tagName:s,displayName:t}){return a=>v.forwardRef((o,u)=>v.createElement(a,Object.assign({ref:u,suffixCls:n,tagName:s},o)))}const kt=v.forwardRef((n,s)=>{const{prefixCls:t,suffixCls:a,className:r,tagName:o}=n,u=ys(n,["prefixCls","suffixCls","className","tagName"]),{getPrefixCls:g}=v.useContext(wt),i=g("layout",t),[h,l,d]=as(i),p=a?`${i}-${a}`:i;return h(v.createElement(o,Object.assign({className:se(t||p,r,l,d),ref:s},u)))}),dn=v.forwardRef((n,s)=>{const{direction:t}=v.useContext(wt),[a,r]=v.useState([]),{prefixCls:o,className:u,rootClassName:g,children:i,hasSider:h,tagName:l,style:d}=n,p=ys(n,["prefixCls","className","rootClassName","children","hasSider","tagName","style"]),y=da(p,["suffixCls"]),{getPrefixCls:x,className:j,style:f}=dt("layout"),C=x("layout",o),w=cn(a,i,h),[S,M,_]=as(C),T=se(C,{[`${C}-has-sider`]:w,[`${C}-rtl`]:t==="rtl"},j,u,g,M,_),I=v.useMemo(()=>({siderHook:{addSider:L=>{r(E=>[].concat(ha(E),[L]))},removeSider:L=>{r(E=>E.filter(P=>P!==L))}}}),[]);return S(v.createElement(ua.Provider,{value:I},v.createElement(l,Object.assign({ref:s,className:T,style:Object.assign(Object.assign({},f),d)},y),i)))}),hn=ht({tagName:"div",displayName:"Layout"})(dn),un=ht({suffixCls:"header",tagName:"header",displayName:"Header"})(kt),mn=ht({suffixCls:"footer",tagName:"footer",displayName:"Footer"})(kt),pn=ht({suffixCls:"content",tagName:"main",displayName:"Content"})(kt),Pe=hn;Pe.Header=un;Pe.Footer=mn;Pe.Content=pn;Pe.Sider=ss;Pe._InternalSiderContext=ma;var gn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"},fn=function(s,t){return v.createElement(be,le({},s,{ref:t,icon:gn}))},Wt=v.forwardRef(fn),xn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-600-80h56c4.4 0 8-3.6 8-8V560c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V384c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v320c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V462c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v242c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v400c0 4.4 3.6 8 8 8z"}}]},name:"bar-chart",theme:"outlined"},vn=function(s,t){return v.createElement(be,le({},s,{ref:t,icon:xn}))},Kt=v.forwardRef(vn),yn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M624 706.3h-74.1V464c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v242.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.7a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9z"}},{tag:"path",attrs:{d:"M811.4 366.7C765.6 245.9 648.9 160 512.2 160S258.8 245.8 213 366.6C127.3 389.1 64 467.2 64 560c0 110.5 89.5 200 199.9 200H304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8h-40.1c-33.7 0-65.4-13.4-89-37.7-23.5-24.2-36-56.8-34.9-90.6.9-26.4 9.9-51.2 26.2-72.1 16.7-21.3 40.1-36.8 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10C846.1 454.5 884 503.8 884 560c0 33.1-12.9 64.3-36.3 87.7a123.07 123.07 0 01-87.6 36.3H720c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h40.1C870.5 760 960 670.5 960 560c0-92.7-63.1-170.7-148.6-193.3z"}}]},name:"cloud-download",theme:"outlined"},jn=function(s,t){return v.createElement(be,le({},s,{ref:t,icon:yn}))},Gt=v.forwardRef(jn),Cn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"},bn=function(s,t){return v.createElement(be,le({},s,{ref:t,icon:Cn}))},Ge=v.forwardRef(bn),Nn={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 385.6a446.7 446.7 0 00-96-142.4 446.7 446.7 0 00-142.4-96C631.1 123.8 572.5 112 512 112s-119.1 11.8-174.4 35.2a446.7 446.7 0 00-142.4 96 446.7 446.7 0 00-96 142.4C75.8 440.9 64 499.5 64 560c0 132.7 58.3 257.7 159.9 343.1l1.7 1.4c5.8 4.8 13.1 7.5 20.6 7.5h531.7c7.5 0 14.8-2.7 20.6-7.5l1.7-1.4C901.7 817.7 960 692.7 960 560c0-60.5-11.9-119.1-35.2-174.4zM761.4 836H262.6A371.12 371.12 0 01140 560c0-99.4 38.7-192.8 109-263 70.3-70.3 163.7-109 263-109 99.4 0 192.8 38.7 263 109 70.3 70.3 109 163.7 109 263 0 105.6-44.5 205.5-122.6 276zM623.5 421.5a8.03 8.03 0 00-11.3 0L527.7 506c-18.7-5-39.4-.2-54.1 14.5a55.95 55.95 0 000 79.2 55.95 55.95 0 0079.2 0 55.87 55.87 0 0014.5-54.1l84.5-84.5c3.1-3.1 3.1-8.2 0-11.3l-28.3-28.3zM490 320h44c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8h-44c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8zm260 218v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8zm12.7-197.2l-31.1-31.1a8.03 8.03 0 00-11.3 0l-56.6 56.6a8.03 8.03 0 000 11.3l31.1 31.1c3.1 3.1 8.2 3.1 11.3 0l56.6-56.6c3.1-3.1 3.1-8.2 0-11.3zm-458.6-31.1a8.03 8.03 0 00-11.3 0l-31.1 31.1a8.03 8.03 0 000 11.3l56.6 56.6c3.1 3.1 8.2 3.1 11.3 0l31.1-31.1c3.1-3.1 3.1-8.2 0-11.3l-56.6-56.6zM262 530h-80c-4.4 0-8 3.6-8 8v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8z"}}]},name:"dashboard",theme:"outlined"},Sn=function(s,t){return v.createElement(be,le({},s,{ref:t,icon:Nn}))},gt=v.forwardRef(Sn),_n={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"}}]},name:"export",theme:"outlined"},wn=function(s,t){return v.createElement(be,le({},s,{ref:t,icon:_n}))},kn=v.forwardRef(wn),Tn={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z"}}]},name:"import",theme:"outlined"},Mn=function(s,t){return v.createElement(be,le({},s,{ref:t,icon:Tn}))},Jt=v.forwardRef(Mn),En={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 512a48 48 0 1096 0 48 48 0 10-96 0zm200 0a48 48 0 1096 0 48 48 0 10-96 0zm-400 0a48 48 0 1096 0 48 48 0 10-96 0zm661.2-173.6c-22.6-53.7-55-101.9-96.3-143.3a444.35 444.35 0 00-143.3-96.3C630.6 75.7 572.2 64 512 64h-2c-60.6.3-119.3 12.3-174.5 35.9a445.35 445.35 0 00-142 96.5c-40.9 41.3-73 89.3-95.2 142.8-23 55.4-34.6 114.3-34.3 174.9A449.4 449.4 0 00112 714v152a46 46 0 0046 46h152.1A449.4 449.4 0 00510 960h2.1c59.9 0 118-11.6 172.7-34.3a444.48 444.48 0 00142.8-95.2c41.3-40.9 73.8-88.7 96.5-142 23.6-55.2 35.6-113.9 35.9-174.5.3-60.9-11.5-120-34.8-175.6zm-151.1 438C704 845.8 611 884 512 884h-1.7c-60.3-.3-120.2-15.3-173.1-43.5l-8.4-4.5H188V695.2l-4.5-8.4C155.3 633.9 140.3 574 140 513.7c-.4-99.7 37.7-193.3 107.6-263.8 69.8-70.5 163.1-109.5 262.8-109.9h1.7c50 0 98.5 9.7 144.2 28.9 44.6 18.7 84.6 45.6 119 80 34.3 34.3 61.3 74.4 80 119 19.4 46.2 29.1 95.2 28.9 145.8-.6 99.6-39.7 192.9-110.1 262.7z"}}]},name:"message",theme:"outlined"},Rn=function(s,t){return v.createElement(be,le({},s,{ref:t,icon:En}))},In=v.forwardRef(Rn),Ln={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},Pn=function(s,t){return v.createElement(be,le({},s,{ref:t,icon:Ln}))},Qt=v.forwardRef(Pn),An={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},Bn=function(s,t){return v.createElement(be,le({},s,{ref:t,icon:An}))},Xt=v.forwardRef(Bn),On=Object.defineProperty,ot=Object.getOwnPropertySymbols,js=Object.prototype.hasOwnProperty,Cs=Object.prototype.propertyIsEnumerable,Yt=(n,s,t)=>s in n?On(n,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[s]=t,jt=(n,s)=>{for(var t in s||(s={}))js.call(s,t)&&Yt(n,t,s[t]);if(ot)for(var t of ot(s))Cs.call(s,t)&&Yt(n,t,s[t]);return n},Ct=(n,s)=>{var t={};for(var a in n)js.call(n,a)&&s.indexOf(a)<0&&(t[a]=n[a]);if(n!=null&&ot)for(var a of ot(n))s.indexOf(a)<0&&Cs.call(n,a)&&(t[a]=n[a]);return t};/**
|
|
4
|
+
* @license QR Code generator library (TypeScript)
|
|
5
|
+
* Copyright (c) Project Nayuki.
|
|
6
|
+
* SPDX-License-Identifier: MIT
|
|
7
|
+
*/var Fe;(n=>{const s=class O{constructor(i,h,l,d){if(this.version=i,this.errorCorrectionLevel=h,this.modules=[],this.isFunction=[],i<O.MIN_VERSION||i>O.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let p=[];for(let x=0;x<this.size;x++)p.push(!1);for(let x=0;x<this.size;x++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const y=this.addEccAndInterleave(l);if(this.drawCodewords(y),d==-1){let x=1e9;for(let j=0;j<8;j++){this.applyMask(j),this.drawFormatBits(j);const f=this.getPenaltyScore();f<x&&(d=j,x=f),this.applyMask(j)}}r(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(i,h){const l=n.QrSegment.makeSegments(i);return O.encodeSegments(l,h)}static encodeBinary(i,h){const l=n.QrSegment.makeBytes(i);return O.encodeSegments([l],h)}static encodeSegments(i,h,l=1,d=40,p=-1,y=!0){if(!(O.MIN_VERSION<=l&&l<=d&&d<=O.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let x,j;for(x=l;;x++){const S=O.getNumDataCodewords(x,h)*8,M=u.getTotalBits(i,x);if(M<=S){j=M;break}if(x>=d)throw new RangeError("Data too long")}for(const S of[O.Ecc.MEDIUM,O.Ecc.QUARTILE,O.Ecc.HIGH])y&&j<=O.getNumDataCodewords(x,S)*8&&(h=S);let f=[];for(const S of i){t(S.mode.modeBits,4,f),t(S.numChars,S.mode.numCharCountBits(x),f);for(const M of S.getData())f.push(M)}r(f.length==j);const C=O.getNumDataCodewords(x,h)*8;r(f.length<=C),t(0,Math.min(4,C-f.length),f),t(0,(8-f.length%8)%8,f),r(f.length%8==0);for(let S=236;f.length<C;S^=253)t(S,8,f);let w=[];for(;w.length*8<f.length;)w.push(0);return f.forEach((S,M)=>w[M>>>3]|=S<<7-(M&7)),new O(x,h,w,p)}getModule(i,h){return 0<=i&&i<this.size&&0<=h&&h<this.size&&this.modules[h][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let l=0;l<this.size;l++)this.setFunctionModule(6,l,l%2==0),this.setFunctionModule(l,6,l%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),h=i.length;for(let l=0;l<h;l++)for(let d=0;d<h;d++)l==0&&d==0||l==0&&d==h-1||l==h-1&&d==0||this.drawAlignmentPattern(i[l],i[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const h=this.errorCorrectionLevel.formatBits<<3|i;let l=h;for(let p=0;p<10;p++)l=l<<1^(l>>>9)*1335;const d=(h<<10|l)^21522;r(d>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,a(d,p));this.setFunctionModule(8,7,a(d,6)),this.setFunctionModule(8,8,a(d,7)),this.setFunctionModule(7,8,a(d,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,a(d,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,a(d,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,a(d,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let l=0;l<12;l++)i=i<<1^(i>>>11)*7973;const h=this.version<<12|i;r(h>>>18==0);for(let l=0;l<18;l++){const d=a(h,l),p=this.size-11+l%3,y=Math.floor(l/3);this.setFunctionModule(p,y,d),this.setFunctionModule(y,p,d)}}drawFinderPattern(i,h){for(let l=-4;l<=4;l++)for(let d=-4;d<=4;d++){const p=Math.max(Math.abs(d),Math.abs(l)),y=i+d,x=h+l;0<=y&&y<this.size&&0<=x&&x<this.size&&this.setFunctionModule(y,x,p!=2&&p!=4)}}drawAlignmentPattern(i,h){for(let l=-2;l<=2;l++)for(let d=-2;d<=2;d++)this.setFunctionModule(i+d,h+l,Math.max(Math.abs(d),Math.abs(l))!=1)}setFunctionModule(i,h,l){this.modules[h][i]=l,this.isFunction[h][i]=!0}addEccAndInterleave(i){const h=this.version,l=this.errorCorrectionLevel;if(i.length!=O.getNumDataCodewords(h,l))throw new RangeError("Invalid argument");const d=O.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][h],p=O.ECC_CODEWORDS_PER_BLOCK[l.ordinal][h],y=Math.floor(O.getNumRawDataModules(h)/8),x=d-y%d,j=Math.floor(y/d);let f=[];const C=O.reedSolomonComputeDivisor(p);for(let S=0,M=0;S<d;S++){let _=i.slice(M,M+j-p+(S<x?0:1));M+=_.length;const T=O.reedSolomonComputeRemainder(_,C);S<x&&_.push(0),f.push(_.concat(T))}let w=[];for(let S=0;S<f[0].length;S++)f.forEach((M,_)=>{(S!=j-p||_>=x)&&w.push(M[S])});return r(w.length==y),w}drawCodewords(i){if(i.length!=Math.floor(O.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let h=0;for(let l=this.size-1;l>=1;l-=2){l==6&&(l=5);for(let d=0;d<this.size;d++)for(let p=0;p<2;p++){const y=l-p,j=(l+1&2)==0?this.size-1-d:d;!this.isFunction[j][y]&&h<i.length*8&&(this.modules[j][y]=a(i[h>>>3],7-(h&7)),h++)}}r(h==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let h=0;h<this.size;h++)for(let l=0;l<this.size;l++){let d;switch(i){case 0:d=(l+h)%2==0;break;case 1:d=h%2==0;break;case 2:d=l%3==0;break;case 3:d=(l+h)%3==0;break;case 4:d=(Math.floor(l/3)+Math.floor(h/2))%2==0;break;case 5:d=l*h%2+l*h%3==0;break;case 6:d=(l*h%2+l*h%3)%2==0;break;case 7:d=((l+h)%2+l*h%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[h][l]&&d&&(this.modules[h][l]=!this.modules[h][l])}}getPenaltyScore(){let i=0;for(let p=0;p<this.size;p++){let y=!1,x=0,j=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[p][f]==y?(x++,x==5?i+=O.PENALTY_N1:x>5&&i++):(this.finderPenaltyAddHistory(x,j),y||(i+=this.finderPenaltyCountPatterns(j)*O.PENALTY_N3),y=this.modules[p][f],x=1);i+=this.finderPenaltyTerminateAndCount(y,x,j)*O.PENALTY_N3}for(let p=0;p<this.size;p++){let y=!1,x=0,j=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[f][p]==y?(x++,x==5?i+=O.PENALTY_N1:x>5&&i++):(this.finderPenaltyAddHistory(x,j),y||(i+=this.finderPenaltyCountPatterns(j)*O.PENALTY_N3),y=this.modules[f][p],x=1);i+=this.finderPenaltyTerminateAndCount(y,x,j)*O.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let y=0;y<this.size-1;y++){const x=this.modules[p][y];x==this.modules[p][y+1]&&x==this.modules[p+1][y]&&x==this.modules[p+1][y+1]&&(i+=O.PENALTY_N2)}let h=0;for(const p of this.modules)h=p.reduce((y,x)=>y+(x?1:0),h);const l=this.size*this.size,d=Math.ceil(Math.abs(h*20-l*10)/l)-1;return r(0<=d&&d<=9),i+=d*O.PENALTY_N4,r(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,h=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let l=[6];for(let d=this.size-7;l.length<i;d-=h)l.splice(1,0,d);return l}}static getNumRawDataModules(i){if(i<O.MIN_VERSION||i>O.MAX_VERSION)throw new RangeError("Version number out of range");let h=(16*i+128)*i+64;if(i>=2){const l=Math.floor(i/7)+2;h-=(25*l-10)*l-55,i>=7&&(h-=36)}return r(208<=h&&h<=29648),h}static getNumDataCodewords(i,h){return Math.floor(O.getNumRawDataModules(i)/8)-O.ECC_CODEWORDS_PER_BLOCK[h.ordinal][i]*O.NUM_ERROR_CORRECTION_BLOCKS[h.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let h=[];for(let d=0;d<i-1;d++)h.push(0);h.push(1);let l=1;for(let d=0;d<i;d++){for(let p=0;p<h.length;p++)h[p]=O.reedSolomonMultiply(h[p],l),p+1<h.length&&(h[p]^=h[p+1]);l=O.reedSolomonMultiply(l,2)}return h}static reedSolomonComputeRemainder(i,h){let l=h.map(d=>0);for(const d of i){const p=d^l.shift();l.push(0),h.forEach((y,x)=>l[x]^=O.reedSolomonMultiply(y,p))}return l}static reedSolomonMultiply(i,h){if(i>>>8||h>>>8)throw new RangeError("Byte out of range");let l=0;for(let d=7;d>=0;d--)l=l<<1^(l>>>7)*285,l^=(h>>>d&1)*i;return r(l>>>8==0),l}finderPenaltyCountPatterns(i){const h=i[1];r(h<=this.size*3);const l=h>0&&i[2]==h&&i[3]==h*3&&i[4]==h&&i[5]==h;return(l&&i[0]>=h*4&&i[6]>=h?1:0)+(l&&i[6]>=h*4&&i[0]>=h?1:0)}finderPenaltyTerminateAndCount(i,h,l){return i&&(this.finderPenaltyAddHistory(h,l),h=0),h+=this.size,this.finderPenaltyAddHistory(h,l),this.finderPenaltyCountPatterns(l)}finderPenaltyAddHistory(i,h){h[0]==0&&(i+=this.size),h.pop(),h.unshift(i)}};s.MIN_VERSION=1,s.MAX_VERSION=40,s.PENALTY_N1=3,s.PENALTY_N2=3,s.PENALTY_N3=40,s.PENALTY_N4=10,s.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],s.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],n.QrCode=s;function t(g,i,h){if(i<0||i>31||g>>>i)throw new RangeError("Value out of range");for(let l=i-1;l>=0;l--)h.push(g>>>l&1)}function a(g,i){return(g>>>i&1)!=0}function r(g){if(!g)throw new Error("Assertion error")}const o=class X{constructor(i,h,l){if(this.mode=i,this.numChars=h,this.bitData=l,h<0)throw new RangeError("Invalid argument");this.bitData=l.slice()}static makeBytes(i){let h=[];for(const l of i)t(l,8,h);return new X(X.Mode.BYTE,i.length,h)}static makeNumeric(i){if(!X.isNumeric(i))throw new RangeError("String contains non-numeric characters");let h=[];for(let l=0;l<i.length;){const d=Math.min(i.length-l,3);t(parseInt(i.substring(l,l+d),10),d*3+1,h),l+=d}return new X(X.Mode.NUMERIC,i.length,h)}static makeAlphanumeric(i){if(!X.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let h=[],l;for(l=0;l+2<=i.length;l+=2){let d=X.ALPHANUMERIC_CHARSET.indexOf(i.charAt(l))*45;d+=X.ALPHANUMERIC_CHARSET.indexOf(i.charAt(l+1)),t(d,11,h)}return l<i.length&&t(X.ALPHANUMERIC_CHARSET.indexOf(i.charAt(l)),6,h),new X(X.Mode.ALPHANUMERIC,i.length,h)}static makeSegments(i){return i==""?[]:X.isNumeric(i)?[X.makeNumeric(i)]:X.isAlphanumeric(i)?[X.makeAlphanumeric(i)]:[X.makeBytes(X.toUtf8ByteArray(i))]}static makeEci(i){let h=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)t(i,8,h);else if(i<16384)t(2,2,h),t(i,14,h);else if(i<1e6)t(6,3,h),t(i,21,h);else throw new RangeError("ECI assignment value out of range");return new X(X.Mode.ECI,0,h)}static isNumeric(i){return X.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return X.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,h){let l=0;for(const d of i){const p=d.mode.numCharCountBits(h);if(d.numChars>=1<<p)return 1/0;l+=4+p+d.bitData.length}return l}static toUtf8ByteArray(i){i=encodeURI(i);let h=[];for(let l=0;l<i.length;l++)i.charAt(l)!="%"?h.push(i.charCodeAt(l)):(h.push(parseInt(i.substring(l+1,l+3),16)),l+=2);return h}};o.NUMERIC_REGEX=/^[0-9]*$/,o.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,o.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let u=o;n.QrSegment=o})(Fe||(Fe={}));(n=>{(s=>{const t=class{constructor(r,o){this.ordinal=r,this.formatBits=o}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),s.Ecc=t})(n.QrCode||(n.QrCode={}))})(Fe||(Fe={}));(n=>{(s=>{const t=class{constructor(r,o){this.modeBits=r,this.numBitsCharCount=o}numCharCountBits(r){return this.numBitsCharCount[Math.floor((r+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),s.Mode=t})(n.QrSegment||(n.QrSegment={}))})(Fe||(Fe={}));var Ue=Fe;/**
|
|
8
|
+
* @license qrcode.react
|
|
9
|
+
* Copyright (c) Paul O'Shannessy
|
|
10
|
+
* SPDX-License-Identifier: ISC
|
|
11
|
+
*/var Dn={L:Ue.QrCode.Ecc.LOW,M:Ue.QrCode.Ecc.MEDIUM,Q:Ue.QrCode.Ecc.QUARTILE,H:Ue.QrCode.Ecc.HIGH},bs=128,Ns="L",Ss="#FFFFFF",_s="#000000",ws=!1,ks=1,$n=4,Fn=0,Hn=.1;function Ts(n,s=0){const t=[];return n.forEach(function(a,r){let o=null;a.forEach(function(u,g){if(!u&&o!==null){t.push(`M${o+s} ${r+s}h${g-o}v1H${o+s}z`),o=null;return}if(g===a.length-1){if(!u)return;o===null?t.push(`M${g+s},${r+s} h1v1H${g+s}z`):t.push(`M${o+s},${r+s} h${g+1-o}v1H${o+s}z`);return}u&&o===null&&(o=g)})}),t.join("")}function Ms(n,s){return n.slice().map((t,a)=>a<s.y||a>=s.y+s.h?t:t.map((r,o)=>o<s.x||o>=s.x+s.w?r:!1))}function zn(n,s,t,a){if(a==null)return null;const r=n.length+t*2,o=Math.floor(s*Hn),u=r/s,g=(a.width||o)*u,i=(a.height||o)*u,h=a.x==null?n.length/2-g/2:a.x*u,l=a.y==null?n.length/2-i/2:a.y*u,d=a.opacity==null?1:a.opacity;let p=null;if(a.excavate){let x=Math.floor(h),j=Math.floor(l),f=Math.ceil(g+h-x),C=Math.ceil(i+l-j);p={x,y:j,w:f,h:C}}const y=a.crossOrigin;return{x:h,y:l,h:i,w:g,excavation:p,opacity:d,crossOrigin:y}}function Vn(n,s){return s!=null?Math.max(Math.floor(s),0):n?$n:Fn}function Es({value:n,level:s,minVersion:t,includeMargin:a,marginSize:r,imageSettings:o,size:u,boostLevel:g}){let i=U.useMemo(()=>{const x=(Array.isArray(n)?n:[n]).reduce((j,f)=>(j.push(...Ue.QrSegment.makeSegments(f)),j),[]);return Ue.QrCode.encodeSegments(x,Dn[s],t,void 0,void 0,g)},[n,s,t,g]);const{cells:h,margin:l,numCells:d,calculatedImageSettings:p}=U.useMemo(()=>{let y=i.getModules();const x=Vn(a,r),j=y.length+x*2,f=zn(y,u,x,o);return{cells:y,margin:x,numCells:j,calculatedImageSettings:f}},[i,u,o,a,r]);return{qrcode:i,margin:l,cells:h,numCells:d,calculatedImageSettings:p}}var qn=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),bt=U.forwardRef(function(s,t){const a=s,{value:r,size:o=bs,level:u=Ns,bgColor:g=Ss,fgColor:i=_s,includeMargin:h=ws,minVersion:l=ks,boostLevel:d,marginSize:p,imageSettings:y}=a,j=Ct(a,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:f}=j,C=Ct(j,["style"]),w=y==null?void 0:y.src,S=U.useRef(null),M=U.useRef(null),_=U.useCallback(A=>{S.current=A,typeof t=="function"?t(A):t&&(t.current=A)},[t]),[T,I]=U.useState(!1),{margin:L,cells:E,numCells:P,calculatedImageSettings:D}=Es({value:r,level:u,minVersion:l,boostLevel:d,includeMargin:h,marginSize:p,imageSettings:y,size:o});U.useEffect(()=>{if(S.current!=null){const A=S.current,J=A.getContext("2d");if(!J)return;let re=E;const Y=M.current,ue=D!=null&&Y!==null&&Y.complete&&Y.naturalHeight!==0&&Y.naturalWidth!==0;ue&&D.excavation!=null&&(re=Ms(E,D.excavation));const oe=window.devicePixelRatio||1;A.height=A.width=o*oe;const ce=o/P*oe;J.scale(ce,ce),J.fillStyle=g,J.fillRect(0,0,P,P),J.fillStyle=i,qn?J.fill(new Path2D(Ts(re,L))):E.forEach(function(W,ge){W.forEach(function(ne,ve){ne&&J.fillRect(ve+L,ge+L,1,1)})}),D&&(J.globalAlpha=D.opacity),ue&&J.drawImage(Y,D.x+L,D.y+L,D.w,D.h)}}),U.useEffect(()=>{I(!1)},[w]);const ae=jt({height:o,width:o},f);let H=null;return w!=null&&(H=U.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{I(!0)},ref:M,crossOrigin:D==null?void 0:D.crossOrigin})),U.createElement(U.Fragment,null,U.createElement("canvas",jt({style:ae,height:o,width:o,ref:_,role:"img"},C)),H)});bt.displayName="QRCodeCanvas";var Un=U.forwardRef(function(s,t){const a=s,{value:r,size:o=bs,level:u=Ns,bgColor:g=Ss,fgColor:i=_s,includeMargin:h=ws,minVersion:l=ks,boostLevel:d,title:p,marginSize:y,imageSettings:x}=a,j=Ct(a,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:f,cells:C,numCells:w,calculatedImageSettings:S}=Es({value:r,level:u,minVersion:l,boostLevel:d,includeMargin:h,marginSize:y,imageSettings:x,size:o});let M=C,_=null;x!=null&&S!=null&&(S.excavation!=null&&(M=Ms(C,S.excavation)),_=U.createElement("image",{href:x.src,height:S.h,width:S.w,x:S.x+f,y:S.y+f,preserveAspectRatio:"none",opacity:S.opacity,crossOrigin:S.crossOrigin}));const T=Ts(M,f);return U.createElement("svg",jt({height:o,width:o,viewBox:`0 0 ${w} ${w}`,ref:t,role:"img"},j),!!p&&U.createElement("title",null,p),U.createElement("path",{fill:g,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),U.createElement("path",{fill:i,d:T,shapeRendering:"crispEdges"}),_)});Un.displayName="QRCodeSVG";const Wn=[{label:"Auto",value:"auto"},{label:"Opus 4.6 (1M)",value:"opus-4.6-1m",tokens:1e6},{label:"Sonnet 4.6",value:"sonnet-4.6",tokens:2e5},{label:"GLM5",value:"glm5",tokens:2e5},{label:"Kimi K2.5",value:"kimi-k2.5",tokens:2e5},{label:"MiniMax 2.1",value:"minimax-2.1",tokens:2e5},{label:"Qwen 3.5",value:"Qwen 3.5",tokens:2e5}],Kn={calibrationModels:Wn},ft=Kn.calibrationModels,Gn=[{value:"zh",short:"zh",label:"简体中文"},{value:"en",short:"en",label:"English"},{value:"zh-TW",short:"zh-TW",label:"繁體中文"},{value:"ko",short:"ko",label:"한국어"},{value:"ja",short:"ja",label:"日本語"},{value:"de",short:"de",label:"Deutsch"},{value:"es",short:"es",label:"Español"},{value:"fr",short:"fr",label:"Français"},{value:"it",short:"it",label:"Italiano"},{value:"da",short:"da",label:"Dansk"},{value:"pl",short:"pl",label:"Polski"},{value:"ru",short:"ru",label:"Русский"},{value:"ar",short:"ar",label:"العربية"},{value:"no",short:"no",label:"Norsk"},{value:"pt-BR",short:"pt-BR",label:"Português (Brasil)"},{value:"th",short:"th",label:"ไทย"},{value:"tr",short:"tr",label:"Türkçe"},{value:"uk",short:"uk",label:"Українська"}],Jn=n=>{const s=t=>t.toUpperCase().split("").map(a=>String.fromCodePoint(127462+a.charCodeAt(0)-65)).join("");return!n||n.length!==2?s("CN"):s(n)},Oe=class Oe extends U.Component{constructor(t){super(t);B(this,"handleShowPrompts",()=>{this.setState({promptModalVisible:!0,promptData:this.extractUserPrompts()})});B(this,"handleExportPromptsTxt",()=>{const t=this.state.promptData;if(!t||t.length===0)return;const a=[];for(const g of t){const i=[],h=g.timestamp?new Date(g.timestamp).toLocaleString():"";h&&i.push(`${h}:
|
|
12
|
+
`);const l=(g.segments||[]).filter(d=>d.type==="text").map(d=>d.content);l.length>0&&i.push(l.join(`
|
|
13
|
+
`)),a.push(i.join(`
|
|
14
|
+
`))}if(a.length===0)return;const r=new Blob([a.join(`
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
`)],{type:"text/plain;charset=utf-8"}),o=URL.createObjectURL(r),u=document.createElement("a");u.href=o,u.download=`user-prompts-${new Date().toISOString().slice(0,10)}.txt`,u.click(),URL.revokeObjectURL(o)});B(this,"handleCalibrationModelChange",t=>{this.setState({calibrationModel:t}),localStorage.setItem("cxv_calibrationModel",t)});B(this,"handleShowProjectStats",()=>{this.setState({projectStatsVisible:!0,projectStatsLoading:!0}),fetch(de("/api/project-stats")).then(t=>{if(!t.ok)throw new Error("not found");return t.json()}).then(t=>this.setState({projectStats:t,projectStatsLoading:!1})).catch(()=>this.setState({projectStats:null,projectStatsLoading:!1}))});B(this,"fetchPlugins",()=>fetch(de("/api/plugins")).then(t=>{if(!t.ok)throw new Error(t.status);return t.json()}).then(t=>{this.setState({pluginsList:t.plugins||[],pluginsDir:t.pluginsDir||""}),this._emitPluginsChanged(t.plugins||[])}).catch(()=>{}));B(this,"_emitPluginsChanged",t=>{window.dispatchEvent(new CustomEvent("ccv-plugins-changed",{detail:{plugins:t}}))});B(this,"handleShowPlugins",()=>{this.setState({pluginModalVisible:!0}),this.fetchPlugins()});B(this,"handleTogglePlugin",(t,a)=>{fetch(de("/api/preferences")).then(r=>r.json()).then(r=>{let o=Array.isArray(r.disabledPlugins)?[...r.disabledPlugins]:[];return a?o=o.filter(u=>u!==t):o.includes(t)||o.push(t),fetch(de("/api/preferences"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({disabledPlugins:o})})}).then(()=>fetch(de("/api/plugins/reload"),{method:"POST"})).then(r=>{if(!r.ok)throw new Error(r.status);return r.json()}).then(r=>{this.setState({pluginsList:r.plugins||[],pluginsDir:r.pluginsDir||""}),this._emitPluginsChanged(r.plugins||[])}).catch(()=>{})});B(this,"handleDeletePlugin",(t,a)=>{this.setState({deleteConfirmVisible:!0,deleteTarget:{file:t,name:a}})});B(this,"handleDeletePluginConfirm",()=>{const{file:t}=this.state.deleteTarget||{};t&&(this.setState({deleteConfirmVisible:!1,deleteTarget:null}),fetch(de(`/api/plugins?file=${encodeURIComponent(t)}`),{method:"DELETE"}).then(a=>{if(!a.ok)throw new Error(a.status);return a.json()}).then(a=>{a.plugins&&(this.setState({pluginsList:a.plugins,pluginsDir:a.pluginsDir||""}),this._emitPluginsChanged(a.plugins))}).catch(()=>{}))});B(this,"handleReloadPlugins",()=>{fetch(de("/api/plugins/reload"),{method:"POST"}).then(t=>{if(!t.ok)throw new Error(t.status);return t.json()}).then(t=>{this.setState({pluginsList:t.plugins||[],pluginsDir:t.pluginsDir||""}),this._emitPluginsChanged(t.plugins||[])}).catch(()=>{})});B(this,"handleAddPlugin",()=>{const t=document.createElement("input");t.type="file",t.accept=".js,.mjs",t.multiple=!0,t.onchange=()=>{const a=t.files;if(!a||a.length===0)return;for(const o of a)if(!o.name.endsWith(".js")&&!o.name.endsWith(".mjs")){K.error(m("ui.plugins.invalidFile"));return}const r=Array.from(a).map(o=>new Promise((u,g)=>{const i=new FileReader;i.onload=()=>u({name:o.name,content:i.result}),i.onerror=()=>g(new Error(`Failed to read ${o.name}`)),i.readAsText(o)}));Promise.all(r).then(o=>fetch(de("/api/plugins/upload"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:o})})).then(o=>o.ok?o.json():o.text().then(u=>{try{return JSON.parse(u)}catch{throw new Error(m("ui.plugins.serverError",{status:o.status}))}})).then(o=>{o.error?K.error(m("ui.plugins.addFailed",{reason:o.error})):o.plugins&&(this.setState({pluginsList:o.plugins,pluginsDir:o.pluginsDir||""}),this._emitPluginsChanged(o.plugins),K.success(m("ui.plugins.addSuccess")))}).catch(o=>{K.error(o.message)})},t.click()});B(this,"handleShowCdnModal",()=>{this.setState({cdnModalVisible:!0,cdnUrl:"",cdnLoading:!1})});B(this,"handleCdnUrlChange",t=>{this.setState({cdnUrl:t.target.value})});B(this,"handleCdnInstall",()=>{const{cdnUrl:t}=this.state;if(!t.trim()){K.error(m("ui.plugins.cdnUrlRequired"));return}try{new URL(t)}catch{K.error(m("ui.plugins.cdnInvalidUrl"));return}this.setState({cdnLoading:!0}),fetch(de("/api/plugins/install-from-url"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:t.trim()})}).then(a=>a.json()).then(a=>{a.error?K.error(m("ui.plugins.cdnInstallFailed",{reason:a.error})):(K.success(m("ui.plugins.cdnInstallSuccess")),a.plugins&&(this.setState({pluginsList:a.plugins,pluginsDir:a.pluginsDir||""}),this._emitPluginsChanged(a.plugins)),this.setState({cdnModalVisible:!1,cdnUrl:""}))}).catch(a=>{K.error(m("ui.plugins.cdnInstallFailed",{reason:a.message||"Network error"}))}).finally(()=>{this.setState({cdnLoading:!1})})});B(this,"handleCdnCancel",()=>{this.setState({cdnModalVisible:!1,cdnUrl:"",cdnLoading:!1})});B(this,"fetchProcesses",()=>{this.setState({processLoading:!0}),fetch(de("/api/ccv-processes")).then(t=>t.json()).then(t=>{this.setState({processList:t.processes||[],processLoading:!1})}).catch(()=>{this.setState({processList:[],processLoading:!1})})});B(this,"handleShowProcesses",()=>{this.setState({processModalVisible:!0}),this.fetchProcesses()});B(this,"handleKillProcess",t=>{je.confirm({title:m("ui.processManagement.killConfirm"),onOk:()=>{fetch(de("/api/ccv-processes/kill"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pid:t})}).then(a=>a.json()).then(a=>{a.ok?(K.success(m("ui.processManagement.killed")),this.fetchProcesses()):K.error(a.error||m("ui.processManagement.killFailed"))}).catch(()=>{K.error(m("ui.processManagement.killFailed"))})}})});this.state={countdownText:"",countryFlag:null,countryInfo:null,promptModalVisible:!1,promptData:[],promptViewMode:"original",settingsDrawerVisible:!1,globalSettingsVisible:!1,projectStatsVisible:!1,projectStats:null,projectStatsLoading:!1,localUrl:"",httpUrl:"",httpsUrl:"",pluginModalVisible:!1,pluginsList:[],pluginsDir:"",deleteConfirmVisible:!1,deleteTarget:null,processModalVisible:!1,processList:[],processLoading:!1,logoDropdownOpen:!1,cacheHighlightIdx:null,cacheHighlightFading:!1,cdnModalVisible:!1,cdnUrl:"",cdnLoading:!1,calibrationModel:(a=>ft.some(r=>r.value===a)?a:"auto")(localStorage.getItem("cxv_calibrationModel")||"auto"),proxyModalVisible:!1,editingProxy:null,editForm:{name:"",baseURL:"",apiKey:"",models:"",activeModel:""},logDirDraft:null},this._rafId=null,this._expiredTimer=null,this.updateCountdown=this.updateCountdown.bind(this)}componentDidMount(){this.startCountdown(),fetch(de("/api/local-url")).then(t=>t.json()).then(t=>{this.setState({localUrl:t.url||"",httpUrl:t.httpUrl||"",httpsUrl:t.httpsUrl||""})}).catch(()=>{}),fetch(de("/api/codex-settings")).then(t=>t.json()).then(t=>{t.model&&this.setState({settingsModel:t.model})}).catch(()=>{}),fetch("https://ipinfo.io/json",{signal:AbortSignal.timeout(5e3)}).then(t=>t.json()).then(t=>{t.country&&this.setState({countryFlag:Jn(t.country),countryInfo:t})}).catch(()=>{})}componentDidUpdate(t){t.cacheExpireAt!==this.props.cacheExpireAt&&this.startCountdown()}shouldComponentUpdate(t,a){return t.requests!==this.props.requests||t.requestCount!==this.props.requestCount||t.viewMode!==this.props.viewMode||t.cacheExpireAt!==this.props.cacheExpireAt||t.cacheType!==this.props.cacheType||t.isLocalLog!==this.props.isLocalLog||t.projectName!==this.props.projectName||t.collapseToolResults!==this.props.collapseToolResults||t.expandThinking!==this.props.expandThinking||t.showFullToolContent!==this.props.showFullToolContent||t.expandDiff!==this.props.expandDiff||t.filterIrrelevant!==this.props.filterIrrelevant||t.logDir!==this.props.logDir||t.cliMode!==this.props.cliMode||t.contextWindow!==this.props.contextWindow||t.serverCachedContent!==this.props.serverCachedContent||t.resumeAutoChoice!==this.props.resumeAutoChoice||t.proxyProfiles!==this.props.proxyProfiles||t.activeProxyId!==this.props.activeProxyId||t.defaultConfig!==this.props.defaultConfig||a!==this.state}componentWillUnmount(){this._rafId&&cancelAnimationFrame(this._rafId),this._expiredTimer&&clearTimeout(this._expiredTimer),this._cacheFadeClearTimer&&clearTimeout(this._cacheFadeClearTimer),this._cacheScrollSettleTimer&&clearTimeout(this._cacheScrollSettleTimer),this._cacheAutoFadeTimer&&clearTimeout(this._cacheAutoFadeTimer),this._cacheHighlightDelayTimer&&clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade()}startCountdown(){if(this._rafId&&cancelAnimationFrame(this._rafId),this._expiredTimer&&clearTimeout(this._expiredTimer),!this.props.cacheExpireAt){this.state.countdownText!==""&&this.setState({countdownText:""});return}this._rafId=requestAnimationFrame(this.updateCountdown)}updateCountdown(){const{cacheExpireAt:t}=this.props;if(!t){this.state.countdownText!==""&&this.setState({countdownText:""});return}const a=Math.max(0,t-Date.now());if(a<=0){const u=m("ui.cacheExpired");this.state.countdownText!==u&&this.setState({countdownText:u}),this._expiredTimer=setTimeout(()=>{this.state.countdownText!==""&&this.setState({countdownText:""})},5e3);return}const r=Math.ceil(a/1e3);let o;if(r>=60){const u=Math.floor(r/60),g=r%60;o=m("ui.minuteSecond",{m:u,s:String(g).padStart(2,"0")})}else o=m("ui.second",{s:r});o!==this.state.countdownText&&this.setState({countdownText:o}),this._rafId=requestAnimationFrame(this.updateCountdown)}static parseSegments(t){const a=[],r=/<([a-zA-Z_][\w-]*)(?:\s[^>]*)?>[\s\S]*?<\/\1>/g;let o=0,u;for(;(u=r.exec(t))!==null;){const i=t.slice(o,u.index).trim();i&&a.push({type:"text",content:i});const h=u[1];if(o=u.index+u[0].length,Oe.COMMAND_TAGS.has(h))continue;const l=new RegExp(`^<${h}(?:\\s[^>]*)?>([\\s\\S]*)<\\/${h}>$`),d=u[0].match(l),p=d?d[1].trim():u[0].trim();a.push({type:"system",content:p,label:h})}const g=t.slice(o).trim();return g&&a.push({type:"text",content:g}),a}static extractUserTexts(t){const a=[],r=[];let o=null;for(const u of t)if(u.role==="user"){if(typeof u.content=="string"){const g=u.content.trim();if(!g)continue;if(!Je(g)){if(/Implement the following plan:/i.test(g))continue;a.push(g),r.push(g)}}else if(Array.isArray(u.content)){const{commands:g,textBlocks:i}=pa(u.content);g.length>0&&(o=g[g.length-1]);const h=[];for(const d of i)/Implement the following plan:/i.test((d.text||"").trim())||h.push(d.text.trim());const l=u.content.filter(d=>{var p;return d.type==="text"&&((p=d.text)==null?void 0:p.trim())}).map(d=>d.text.trim());h.length>0&&(a.push(h.join(`
|
|
19
|
+
`)),r.push(l.join(`
|
|
20
|
+
`)))}}return{userMsgs:a,fullTexts:r,slashCmd:o}}extractUserPrompts(){var g;const{requests:t=[]}=this.props,a=[],r=new Set;let o=null;const u=t.filter(i=>Te(i));for(let i=0;i<u.length;i++){const h=u[i],l=((g=h.body)==null?void 0:g.messages)||[],d=h.timestamp||"",{userMsgs:p,fullTexts:y,slashCmd:x}=Oe.extractUserTexts(l);x&&x!=="/compact"&&x!==o&&a.push({type:"prompt",segments:[{type:"text",content:x}],timestamp:d}),o=x;for(let j=0;j<p.length;j++){const f=p[j];if(r.has(f))continue;r.add(f);const C=y[j]||f;a.push({type:"prompt",segments:Oe.parseSegments(C),timestamp:d})}}return a}renderTokenStats(){const{requests:t=[]}=this.props,a=ga(t),r=Object.keys(a),o=fa(t),u=xa(t);if(r.length===0&&o.length===0)return e.jsx("div",{className:c.tokenStatsEmpty,children:"暂无 token 数据"});const g=e.jsx("div",{className:c.tokenStatsColumn,children:r.map(d=>{const p=a[d],y=p.input+p.cacheCreation+p.cacheRead,x=y>0?(p.cacheRead/y*100).toFixed(1):"0.0";return e.jsxs("div",{className:r.length>1?c.modelCardSpaced:c.modelCard,children:[e.jsx("div",{className:c.modelName,children:d}),e.jsx("table",{className:c.statsTable,children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{className:c.label,children:"Token"}),e.jsx("td",{className:c.th,children:"input"}),e.jsx("td",{className:c.th,children:"output"})]}),e.jsxs("tr",{className:c.rowBorder,children:[e.jsx("td",{className:c.label}),e.jsx("td",{className:c.td,children:G(y)}),e.jsx("td",{className:c.td,children:G(p.output)})]}),e.jsxs("tr",{children:[e.jsx("td",{className:c.label,children:"Cache"}),e.jsx("td",{className:c.th,children:"create"}),e.jsx("td",{className:c.th,children:"read"})]}),e.jsxs("tr",{className:c.rowBorder,children:[e.jsx("td",{className:c.label}),e.jsx("td",{className:c.td,children:G(p.cacheCreation)}),e.jsx("td",{className:c.td,children:G(p.cacheRead)})]}),e.jsxs("tr",{children:[e.jsx("td",{className:c.label,children:m("ui.hitRate")}),e.jsxs("td",{colSpan:2,className:c.td,children:[x,"%"]})]})]})})]},d)})}),i=this.renderCacheRebuildStats(),h=o.length>0?e.jsx("div",{className:c.toolStatsColumn,children:e.jsxs("div",{className:c.modelCard,children:[e.jsx("div",{className:c.modelName,children:m("ui.toolUsageStats")}),e.jsxs("table",{className:c.statsTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:`${c.th} ${c.thLeft}`,children:"Tool"}),e.jsx("td",{className:c.th,children:m("ui.cacheRebuild.count")})]})}),e.jsxs("tbody",{children:[o.map(([d,p])=>e.jsxs("tr",{className:c.rowBorder,children:[e.jsxs("td",{className:c.label,children:[d," ",e.jsx(he,{doc:`Tool-${d}`})]}),e.jsx("td",{className:c.td,children:p})]},d)),o.length>1&&e.jsxs("tr",{className:c.rebuildTotalRow,children:[e.jsx("td",{className:c.label,children:"Total"}),e.jsx("td",{className:c.td,children:o.reduce((d,p)=>d+p[1],0)})]})]})]})]})}):null,l=u.length>0?e.jsx("div",{className:c.toolStatsColumn,children:e.jsxs("div",{className:c.modelCard,children:[e.jsx("div",{className:c.modelName,children:m("ui.skillUsageStats")}),e.jsxs("table",{className:c.statsTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:`${c.th} ${c.thLeft}`,children:"Skill"}),e.jsx("td",{className:c.th,children:m("ui.cacheRebuild.count")})]})}),e.jsxs("tbody",{children:[u.map(([d,p])=>e.jsxs("tr",{className:c.rowBorder,children:[e.jsx("td",{className:c.label,children:d}),e.jsx("td",{className:c.td,children:p})]},d)),u.length>1&&e.jsxs("tr",{className:c.rebuildTotalRow,children:[e.jsx("td",{className:c.label,children:"Total"}),e.jsx("td",{className:c.td,children:u.reduce((d,p)=>d+p[1],0)})]})]})]})]})}):null;return e.jsxs("div",{className:c.tokenStatsContainer,children:[g,i,h,l]})}_cacheUnbindScrollFade(){this._cacheOnScrollFade&&this._cacheScrollEl&&(this._cacheScrollEl.removeEventListener("scroll",this._cacheOnScrollFade),this._cacheOnScrollFade=null)}_cacheBindScrollFade(){this._cacheUnbindScrollFade();const t=this._cacheScrollEl;t&&(this._cacheOnScrollFade=()=>{clearTimeout(this._cacheAutoFadeTimer),this.setState({cacheHighlightFading:!0}),this._cacheFadeClearTimer=setTimeout(()=>{this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1})},3e3),this._cacheUnbindScrollFade()},t.addEventListener("scroll",this._cacheOnScrollFade,{passive:!0}))}scrollToCacheMsg(t){if(this.props.viewMode==="raw"&&this.props.onNavigateCacheMsg&&this.props.onNavigateCacheMsg(t),(this.state._cacheSectionCollapsed||{}).messages){this.setState(i=>({_cacheSectionCollapsed:{...i._cacheSectionCollapsed||{},messages:!1}}),()=>this.scrollToCacheMsg(t));return}const a=this._cacheScrollEl;if(!a)return;const r=a.querySelector(`[data-msg-idx="${t}"]`);if(!r)return;clearTimeout(this._cacheScrollSettleTimer),clearTimeout(this._cacheFadeClearTimer),clearTimeout(this._cacheAutoFadeTimer),clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade(),this._cacheScrollEndHandler&&a.removeEventListener("scrollend",this._cacheScrollEndHandler),this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1});let o=!1,u=!1;const g=()=>{!o||!u||(this.setState({cacheHighlightIdx:t,cacheHighlightFading:!1}),this._cacheScrollSettleTimer=setTimeout(()=>this._cacheBindScrollFade(),200),this._cacheAutoFadeTimer=setTimeout(()=>{this.state.cacheHighlightIdx===t&&!this.state.cacheHighlightFading&&(this.setState({cacheHighlightFading:!0}),this._cacheFadeClearTimer=setTimeout(()=>{this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1})},3e3),this._cacheUnbindScrollFade())},3e3))};this._cacheScrollEndHandler=()=>{a.removeEventListener("scrollend",this._cacheScrollEndHandler),o=!0,g()},a.addEventListener("scrollend",this._cacheScrollEndHandler,{once:!0}),this._cacheScrollSettleTimer=setTimeout(()=>{a.removeEventListener("scrollend",this._cacheScrollEndHandler),o=!0,g()},800),this._cacheHighlightDelayTimer=setTimeout(()=>{u=!0,g()},500),r.scrollIntoView({behavior:"smooth",block:"center"})}renderCacheContentPopover(t){const{requests:a=[],serverCachedContent:r}=this.props,o=r||ns(a);if(o&&(o.cacheCreateTokens>0||o.cacheReadTokens>0)&&(this._lastCachedTokens={cacheCreateTokens:o.cacheCreateTokens,cacheReadTokens:o.cacheReadTokens}),t>0&&(this._lastContextPercent=t),!o||o.system.length===0&&o.messages.length===0&&o.tools.length===0)return e.jsx("div",{className:c.cachePopoverEmpty,children:m("ui.noCachedContent")});const u=(l,d,p,y)=>{if(d.length===0)return null;const x=l===m("ui.messages"),j=(this.state._cacheSectionCollapsed||{})[y],f=j!==void 0?!!j:!0,C=()=>this.setState(w=>({_cacheSectionCollapsed:{...w._cacheSectionCollapsed||{},[y]:!f}}));return e.jsxs("div",{className:c.cacheSection,children:[e.jsxs("button",{type:"button",className:c.cacheSectionTitle,onClick:C,"aria-expanded":!f,children:[e.jsx("span",{className:c.cacheSectionArrow,children:f?"▶":"▼"}),l," (",d.length,")"]}),!f&&d.map((w,S)=>{const M=x?{"data-msg-idx":S}:{};let _=p||c.cacheCodeBlock;const T=x&&S===this.state.cacheHighlightIdx;return T&&(_+=" "+(this.state.cacheHighlightFading?c.cacheBlockHighlightFading:c.cacheBlockHighlight)),e.jsxs("pre",{className:_,...M,style:T?{position:"relative"}:void 0,children:[T&&e.jsx("svg",{className:`${c.cacheBorderSvg}${this.state.cacheHighlightFading?" "+c.cacheBorderSvgFading:""}`,preserveAspectRatio:"none",children:e.jsx("rect",{x:"0.5",y:"0.5",width:"calc(100% - 1px)",height:"calc(100% - 1px)",rx:"4",ry:"4",fill:"none",stroke:"#1668dc",strokeWidth:"1",strokeDasharray:"6 4",className:c.cacheBorderRect})}),w]},S)})]})},g=()=>{const l=[];return o.tools.length>0&&(l.push(`=== ${m("ui.tools")} (${o.tools.length}) ===`),o.tools.forEach(d=>l.push(d))),o.system.length>0&&(l.push(`
|
|
21
|
+
=== ${m("ui.systemPrompt")} (${o.system.length}) ===`),o.system.forEach(d=>l.push(d))),o.messages.length>0&&(l.push(`
|
|
22
|
+
=== ${m("ui.messages")} (${o.messages.length}) ===`),o.messages.forEach(d=>l.push(d))),l.join(`
|
|
23
|
+
|
|
24
|
+
`)},i=o.messages.map((l,d)=>({text:l,msgIdx:d})).filter(({text:l})=>l.startsWith("[user]")).map(({text:l,msgIdx:d})=>{const p=l.replace(/^\[user\]\s*/,"").trim();return!p||Je(p)?{cleaned:"",msgIdx:d}:{cleaned:Oe.parseSegments(p).filter(j=>j.type==="text").map(j=>j.content.trim()).filter(j=>j&&!Je(j)).join(" ").trim(),msgIdx:d}}).filter(({cleaned:l})=>!(!l||/Implement the following plan:/i.test(l))),h=i.length>0?e.jsx("div",{className:c.cacheNavList,children:i.map(({cleaned:l,msgIdx:d})=>e.jsx("div",{className:c.cacheNavItem,onClick:()=>this.scrollToCacheMsg(d),children:l},d))}):null;return e.jsxs("div",{className:c.cachePopover,children:[e.jsx("div",{className:c.cachePopoverHeader,children:e.jsxs("div",{className:c.cachePopoverTitle,children:[m("ui.cachedContentTitle"),e.jsx(he,{doc:"KVCacheContent"}),e.jsx(Ie,{className:c.cacheCopyBtn,onClick:()=>{navigator.clipboard.writeText(g()).then(()=>{K.success(m("ui.copied"))}).catch(()=>{})}}),e.jsx("span",{className:c.cacheCalibrationLabel,children:m("ui.calibrationModelLabel")}),e.jsx(Ae,{size:"small",value:this.state.calibrationModel,onChange:this.handleCalibrationModelChange,options:ft,className:c.calibrationSelect,popupMatchSelectWidth:!1})]})}),(()=>{const d=o.cacheCreateTokens>0||o.cacheReadTokens>0?o:this._lastCachedTokens,p=t>0?t:this._lastContextPercent||0;return d||h?e.jsxs("div",{className:c.cacheTokenInfo,children:[d&&e.jsxs(e.Fragment,{children:[m("ui.tokens"),": ",e.jsxs("span",{className:c.cacheWriteToken,children:["write ",G(d.cacheCreateTokens)]})," / ",e.jsxs("span",{className:c.cacheReadToken,children:["read ",G(d.cacheReadTokens)]}),p>0&&e.jsxs("span",{className:c.cacheCtxPercent,children:["(ctx:",p,"%)"]})]}),h&&e.jsx(qe,{content:h,trigger:"hover",placement:"left",children:e.jsx("span",{className:c.cacheNavBtn,children:m("ui.userPromptNav")})})]}):null})(),e.jsxs("div",{className:c.cacheScrollArea,ref:l=>{this._cacheScrollEl=l,l&&!this._cacheScrollInited&&(this._cacheScrollInited=!0,requestAnimationFrame(()=>{l.scrollTop=l.scrollHeight}))},children:[u(m("ui.tools"),o.tools,void 0,"tools"),u(m("ui.systemPrompt"),o.system,c.cacheCodeBlockSystem,"system"),u(m("ui.messages"),o.messages,void 0,"messages")]})]})}renderCacheRebuildStats(){const{requests:t=[]}=this.props,a=va(t),r=["ttl","system_change","tools_change","model_change","msg_truncated","msg_modified","key_change"],o={ttl:"cacheLoss.ttl",system_change:"cacheLoss.systemChange",tools_change:"cacheLoss.toolsChange",model_change:"cacheLoss.modelChange",msg_truncated:"cacheLoss.msgTruncated",msg_modified:"cacheLoss.msgModified",key_change:"cacheLoss.keyChange"},u=r.filter(f=>a[f].count>0),g=u.reduce((f,C)=>f+a[C].count,0),i=u.reduce((f,C)=>f+a[C].cacheCreate,0);ya(t);const h={},l={};for(let f=0;f<t.length;f++){const C=Qe(t[f],t[f+1]);if(C.type==="SubAgent"){const w=C.subType||"Other";h[w]=(h[w]||0)+1}else if(C.type==="Teammate"){const w=C.subType||"Teammate";l[w]=(l[w]||0)+1}}const d=Object.entries(h).sort((f,C)=>C[1]-f[1]),p=Object.entries(l).sort((f,C)=>C[1]-f[1]),y=u.length>0,x=d.length>0,j=p.length>0;return!y&&!x&&!j?null:e.jsxs("div",{className:c.toolStatsColumn,children:[y&&e.jsxs("div",{className:x||j?c.modelCardSpaced:c.modelCard,children:[e.jsxs("div",{className:c.modelName,children:["MainAgent",e.jsx(he,{doc:"MainAgent"})," ",m("ui.cacheRebuildStats"),e.jsx(he,{doc:"CacheRebuild"})]}),e.jsxs("table",{className:c.statsTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:`${c.th} ${c.thLeft}`,children:m("ui.cacheRebuild.reason")}),e.jsx("td",{className:c.th,children:m("ui.cacheRebuild.count")}),e.jsx("td",{className:c.th,children:m("ui.cacheRebuild.cacheCreate")})]})}),e.jsxs("tbody",{children:[u.map(f=>e.jsxs("tr",{className:c.rowBorder,children:[e.jsx("td",{className:c.label,children:m(`ui.${o[f]}`)}),e.jsx("td",{className:c.td,children:a[f].count}),e.jsx("td",{className:c.td,children:G(a[f].cacheCreate)})]},f)),u.length>1&&e.jsxs("tr",{className:c.rebuildTotalRow,children:[e.jsx("td",{className:c.label,children:"Total"}),e.jsx("td",{className:c.td,children:g}),e.jsx("td",{className:c.td,children:G(i)})]})]})]})]}),x&&e.jsxs("div",{className:j?c.modelCardSpaced:c.modelCard,children:[e.jsx("div",{className:c.modelName,children:m("ui.subAgentStats")}),e.jsxs("table",{className:c.statsTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:`${c.th} ${c.thLeft}`,children:"SubAgent"}),e.jsx("td",{className:c.th,children:m("ui.cacheRebuild.count")})]})}),e.jsxs("tbody",{children:[d.map(([f,C])=>e.jsxs("tr",{className:c.rowBorder,children:[e.jsxs("td",{className:c.label,children:[f," ",e.jsx(he,{doc:`SubAgent-${f}`})]}),e.jsx("td",{className:c.td,children:C})]},f)),d.length>1&&e.jsxs("tr",{className:c.rebuildTotalRow,children:[e.jsx("td",{className:c.label,children:"Total"}),e.jsx("td",{className:c.td,children:d.reduce((f,C)=>f+C[1],0)})]})]})]})]}),j&&e.jsxs("div",{className:c.modelCard,children:[e.jsxs("div",{className:c.modelName,children:["Teammate",e.jsx(he,{doc:"Teammate"})]}),e.jsxs("table",{className:c.statsTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{className:`${c.th} ${c.thLeft}`,children:"Name"}),e.jsx("td",{className:c.th,children:m("ui.cacheRebuild.count")})]})}),e.jsxs("tbody",{children:[p.map(([f,C])=>e.jsxs("tr",{className:c.rowBorder,children:[e.jsx("td",{className:c.label,children:f}),e.jsx("td",{className:c.td,children:C})]},f)),p.length>1&&e.jsxs("tr",{className:c.rebuildTotalRow,children:[e.jsx("td",{className:c.label,children:"Total"}),e.jsx("td",{className:c.td,children:p.reduce((f,C)=>f+C[1],0)})]})]})]})]})]})}renderTextPrompt(t){return e.jsx("div",{className:c.textPromptCard,children:t.segments.map((a,r)=>a.type==="text"?e.jsx("pre",{className:c.preText,children:a.content},r):e.jsx(ja,{size:"small",className:c.systemCollapse,items:[{key:`sys-${r}`,label:e.jsx("span",{className:c.systemLabel,children:a.label}),children:e.jsx("pre",{className:c.preSys,children:a.content})}]},r))})}renderOriginalPrompt(t){const a=t.segments.filter(r=>r.type==="text");return a.length===0?null:e.jsx("div",{className:c.textPromptCard,children:a.map((r,o)=>e.jsx("pre",{className:c.preText,children:r.content},o))})}buildTextModeContent(){const{promptData:t}=this.state,a=[];for(const r of t){const o=(r.segments||[]).filter(u=>u.type==="text").map(u=>u.content);o.length>0&&a.push(o.join(`
|
|
25
|
+
`))}return a.join(`
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
`)}renderProjectStatsContent(){const{projectStats:t,projectStatsLoading:a}=this.state;if(a)return e.jsx("div",{className:c.projectStatsCenter,children:e.jsx(os,{})});if(!t)return e.jsx("div",{className:c.projectStatsEmpty,children:m("ui.projectStats.noData")});const{summary:r,models:o,updatedAt:u}=t;o&&Object.entries(o).sort((h,l)=>l[1]-h[1]);const g={};if(t.files){for(const h of Object.values(t.files))if(h.models)for(const[l,d]of Object.entries(h.models))g[l]||(g[l]={input:0,output:0,cacheRead:0,cacheCreation:0,count:0}),g[l].input+=d.input_tokens||0,g[l].output+=d.output_tokens||0,g[l].cacheRead+=d.cache_read_input_tokens||0,g[l].cacheCreation+=d.cache_creation_input_tokens||0,g[l].count+=d.count||0}const i=Object.entries(g).sort((h,l)=>l[1].count-h[1].count);return e.jsxs("div",{className:c.projectStatsContent,children:[u&&e.jsx("div",{className:c.projectStatsUpdated,children:m("ui.projectStats.updatedAt",{time:new Date(u).toLocaleString()})}),e.jsxs("div",{className:c.projectStatsSummary,children:[e.jsxs("div",{className:c.projectStatCard,children:[e.jsx("div",{className:c.projectStatValue,children:(r==null?void 0:r.requestCount)??0}),e.jsx("div",{className:c.projectStatLabel,children:m("ui.projectStats.totalRequests")})]}),e.jsxs("div",{className:c.projectStatCard,children:[e.jsx("div",{className:c.projectStatValue,children:(r==null?void 0:r.turnCount)??(r==null?void 0:r.sessionCount)??0}),e.jsx("div",{className:c.projectStatLabel,children:m("ui.projectStats.turnCount")})]}),e.jsxs("div",{className:c.projectStatCard,children:[e.jsx("div",{className:c.projectStatValue,children:(r==null?void 0:r.fileCount)??0}),e.jsx("div",{className:c.projectStatLabel,children:m("ui.projectStats.totalFiles")})]}),e.jsxs("div",{className:c.projectStatCard,children:[e.jsx("div",{className:c.projectStatValue,children:G(r==null?void 0:r.input_tokens)}),e.jsx("div",{className:c.projectStatLabel,children:"Input Tokens"})]}),e.jsxs("div",{className:c.projectStatCard,children:[e.jsx("div",{className:c.projectStatValue,children:G(r==null?void 0:r.output_tokens)}),e.jsx("div",{className:c.projectStatLabel,children:"Output Tokens"})]})]}),i.length>0&&e.jsxs("div",{className:c.projectStatsSection,children:[e.jsx("div",{className:c.projectStatsSectionTitle,children:m("ui.projectStats.modelUsage")}),i.map(([h,l])=>{const d=l.input+l.cacheRead+l.cacheCreation,p=d>0?(l.cacheRead/d*100).toFixed(1):"0.0";return e.jsxs("div",{className:c.projectStatsModelCard,children:[e.jsxs("div",{className:c.projectStatsModelHeader,children:[e.jsx("span",{className:c.projectStatsModelName,children:h}),e.jsxs("span",{className:c.projectStatsModelCount,children:[l.count," reqs"]})]}),e.jsx("table",{className:c.statsTable,children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{className:c.label,children:"Token"}),e.jsx("td",{className:c.th,children:"input"}),e.jsx("td",{className:c.th,children:"output"})]}),e.jsxs("tr",{className:c.rowBorder,children:[e.jsx("td",{className:c.label}),e.jsx("td",{className:c.td,children:G(d)}),e.jsx("td",{className:c.td,children:G(l.output)})]}),e.jsxs("tr",{children:[e.jsx("td",{className:c.label,children:"Cache"}),e.jsx("td",{className:c.th,children:"create"}),e.jsx("td",{className:c.th,children:"read"})]}),e.jsxs("tr",{className:c.rowBorder,children:[e.jsx("td",{className:c.label}),e.jsx("td",{className:c.td,children:G(l.cacheCreation)}),e.jsx("td",{className:c.td,children:G(l.cacheRead)})]}),e.jsxs("tr",{children:[e.jsx("td",{className:c.label,children:m("ui.hitRate")}),e.jsxs("td",{colSpan:2,className:c.td,children:[p,"%"]})]})]})})]},h)})]})]})}render(){var ee;const{requestCount:t,requests:a=[],viewMode:r,cacheType:o,onToggleViewMode:u,onImportLocalLogs:g,onLangChange:i,isLocalLog:h,localLogFile:l,projectName:d,collapseToolResults:p,onCollapseToolResultsChange:y,expandThinking:x,onExpandThinkingChange:j,showFullToolContent:f,onShowFullToolContentChange:C,expandDiff:w,onExpandDiffChange:S,filterIrrelevant:M,onFilterIrrelevantChange:_,logDir:T,onLogDirChange:I,updateInfo:L,onDismissUpdate:E,cliMode:P,terminalVisible:D,onToggleTerminal:ae,onReturnToWorkspaces:H,contextWindow:A,serverCachedContent:J,resumeAutoChoice:re,onResumeAutoChoiceToggle:Y,onResumeAutoChoiceChange:ue,themeColor:oe,onThemeColorChange:ce,autoApproveSeconds:W,onAutoApproveChange:ge}=this.props,{countdownText:ne}=this.state,ve=[{key:"import-local",icon:e.jsx(Jt,{}),label:m("ui.importLocalLogs"),onClick:g},{key:"export-prompts",icon:e.jsx(kn,{}),label:m("ui.exportPrompts"),onClick:this.handleShowPrompts},{key:"plugin-management",icon:e.jsx(Wt,{}),label:m("ui.pluginManagement"),onClick:this.handleShowPlugins},{key:"switch-workspace",icon:e.jsx(Jt,{className:c.iconMirror}),label:e.jsx("span",{className:c.disabledMenuItem,children:m("ui.switchWorkspace")}),disabled:!0},{key:"process-management",icon:e.jsx(gt,{}),label:m("ui.processManagement"),onClick:this.handleShowProcesses},{key:"proxy-switch",icon:e.jsx(Ut,{}),label:m("ui.proxySwitch"),onClick:()=>this.setState({proxyModalVisible:!0})},{type:"divider"},{key:"project-stats",icon:e.jsx(Kt,{}),label:m("ui.projectStats"),onClick:this.handleShowProjectStats},...r==="raw"?[{key:"global-settings",icon:e.jsx(Qt,{}),label:m("ui.globalSettings"),onClick:()=>this.setState({globalSettingsVisible:!0})}]:[],...r==="chat"?[{key:"display-settings",icon:e.jsx(Qt,{}),label:m("ui.settings"),onClick:()=>this.setState({settingsDrawerVisible:!0})}]:[]];return e.jsxs("div",{className:c.headerBar,children:[e.jsxs(Be,{size:"middle",children:[e.jsx(Ca,{menu:{items:ve,className:"logo-dropdown-menu"},trigger:["hover"],onOpenChange:b=>this.setState({logoDropdownOpen:b}),align:{offset:[-4,0]},children:e.jsx("span",{className:`${c.logoWrap}${this.state.logoDropdownOpen?` ${c.logoWrapActive}`:""}`,children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`${c.logoImage}${this.state.logoDropdownOpen?` ${c.logoImageActive}`:""}`,children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})})}),e.jsx(qe,{content:this.renderTokenStats(),trigger:"hover",placement:"bottomLeft",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 8px",maxHeight:"80vh",overflowY:"auto"},children:e.jsxs(Ce,{className:c.tokenStatsTag,children:[e.jsx(gt,{className:c.tokenStatsIcon}),m("ui.tokenStats")]})}),this.props.activeProxyId&&this.props.activeProxyId!=="max"&&(()=>{const b=(this.props.proxyProfiles||[]).find(Q=>Q.id===this.props.activeProxyId);return b?e.jsxs(Ce,{className:c.proxyProfileTag,onClick:()=>this.setState({proxyModalVisible:!0}),children:[e.jsx(Ut,{className:c.proxySwapIcon}),b.name,b.activeModel?` · ${b.activeModel}`:""]}):null})(),(()=>{var Se,q,we,ye,Xe;let b=0;const Q=ft.find(fe=>fe.value===this.state.calibrationModel),te=Q==null?void 0:Q.tokens;if(!h){if(te&&(A==null?void 0:A.used_percentage)!=null){const fe=$=>{var ke,We;const me=(We=(ke=$.response)==null?void 0:ke.body)==null?void 0:We.usage;return((me==null?void 0:me.input_tokens)||0)+((me==null?void 0:me.cache_creation_input_tokens)||0)+((me==null?void 0:me.cache_read_input_tokens)||0)};let ie=0;for(let $=a.length-1;$>=0;$--)if(Te(a[$])&&((q=(Se=a[$].response)==null?void 0:Se.body)!=null&&q.usage)){ie=fe(a[$]);break}if(ie>0){const $=te*.835;b=Math.min(100,Math.max(0,Math.round(ie/$*100)))}else{const $=A.context_window_size||2e5;b=Math.min(100,Math.max(0,Math.round(A.used_percentage*$/te/83.5*100)))}}else if((A==null?void 0:A.used_percentage)!=null){const fe=this.state.settingsModel?Lt(this.state.settingsModel):0,ie=A.context_window_size||2e5;fe&&fe!==ie?b=Math.min(100,Math.max(0,Math.round(A.used_percentage*ie/fe/83.5*100))):b=Math.min(100,Math.max(0,Math.round(A.used_percentage/83.5*100)))}else if(a.length>0){const fe=ie=>{var me,ke;const $=(ke=(me=ie.response)==null?void 0:me.body)==null?void 0:ke.usage;return(($==null?void 0:$.input_tokens)||0)+(($==null?void 0:$.cache_creation_input_tokens)||0)+(($==null?void 0:$.cache_read_input_tokens)||0)};for(let ie=a.length-1;ie>=0;ie--)if(Te(a[ie])&&((ye=(we=a[ie].response)==null?void 0:we.body)!=null&&ye.usage)){const $=fe(a[ie]),ke=(te||(A==null?void 0:A.context_window_size)||Lt(((Xe=a[ie].body)==null?void 0:Xe.model)||this.state.settingsModel))*.835;ke>0&&$>0&&(b=Math.min(100,Math.max(0,Math.round($/ke*100))));break}}}b===0&&this._lastContextPercent>0&&(b=this._lastContextPercent);const Ne=b>=80?"var(--color-error-light)":b>=60?"var(--color-warning-light)":"var(--color-success)";return h?e.jsx(Ce,{className:`${c.liveTag} ${c.liveTagHistory}`,children:e.jsx("span",{className:c.liveTagText,children:m("ui.historyLog",{file:l})})}):e.jsx(qe,{content:this.state._cachePopoverOpen?this.renderCacheContentPopover(b):e.jsx("div",{className:c.cachePopoverPlaceholder}),trigger:"hover",placement:"bottomLeft",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 8px"},onOpenChange:fe=>{this.setState({_cachePopoverOpen:fe}),fe||(this._cacheScrollInited=!1)},children:e.jsxs("span",{className:c.liveTag,style:{borderColor:Ne,color:Ne},children:[e.jsx("span",{className:c.liveTagFill,style:{width:`${b}%`,backgroundColor:Ne}}),e.jsx("span",{className:c.liveTagContent,children:e.jsxs("span",{className:c.liveTagText,children:[m("ui.liveMonitoring"),d?`:${d}`:""]})})]})})})(),L&&e.jsx(Ce,{color:L.type==="completed"?"green":"orange",closable:!0,onClose:()=>E&&E(),children:L.type==="completed"?m("ui.update.completed",{version:L.version}):m("ui.update.majorAvailable",{version:L.version})})]}),e.jsxs(Be,{size:"middle",children:[ne&&r==="raw"&&e.jsxs(Ce,{style:{background:"var(--bg-surface)",border:"1px solid var(--border-hover)",color:ne===m("ui.cacheExpired")?"var(--color-error-light)":"var(--text-secondary)"},children:[m("ui.cacheCountdown",{type:o?`(${o})`:""}),e.jsx("strong",{className:c.countdownStrong,children:ne})]}),r==="chat"&&P&&!h&&(this.state.localUrl||this.state.httpUrl||this.state.httpsUrl)&&e.jsxs(e.Fragment,{children:[this.state.countryFlag&&((ee=this.state.countryInfo)==null?void 0:ee.country)!=="CN"&&e.jsx(qe,{content:this.state.countryInfo?e.jsxs("div",{className:c.countryInfoPopover,children:[e.jsxs("div",{children:[this.state.countryFlag," ",this.state.countryInfo.country]}),this.state.countryInfo.region&&e.jsx("div",{children:this.state.countryInfo.region}),this.state.countryInfo.city&&e.jsx("div",{children:this.state.countryInfo.city}),this.state.countryInfo.org&&e.jsx("div",{className:c.countryInfoMeta,children:this.state.countryInfo.org}),this.state.countryInfo.ip&&e.jsx("div",{className:c.countryInfoMeta,children:this.state.countryInfo.ip})]}):null,trigger:"hover",placement:"bottomRight",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 12px"},children:e.jsx(F,{className:c.compactBtnNoBorder,icon:e.jsx("span",{className:c.countryFlagIcon,children:this.state.countryFlag})})}),e.jsx(Me,{checked:oe==="light",onChange:b=>ce&&ce(b?"light":"dark"),checkedChildren:"雪山白",unCheckedChildren:"曜石黑"}),e.jsx(qe,{content:e.jsxs("div",{className:c.qrcodePopover,children:[e.jsxs("div",{className:c.qrcodeTitle,children:[m("ui.scanToCoding")," ",e.jsx(he,{doc:"QRCode"})]}),e.jsxs("div",{className:c.qrcodeGrid,children:[this.state.httpUrl&&e.jsxs("div",{className:c.qrcodeSection,children:[e.jsx("div",{className:c.qrcodeSectionTitle,children:"HTTP"}),e.jsx(bt,{value:this.state.httpUrl,size:180,bgColor:oe==="light"?"#ffffff":"#141414",fgColor:oe==="light"?"#1a1a1a":"#d9d9d9",level:"M"}),e.jsx(Ee,{readOnly:!0,value:this.state.httpUrl,className:c.qrcodeUrlInput,suffix:e.jsx(Ie,{className:c.qrcodeUrlCopy,onClick:()=>{navigator.clipboard.writeText(this.state.httpUrl).then(()=>{K.success(m("ui.copied"))}).catch(()=>{})}})})]}),this.state.httpsUrl&&e.jsxs("div",{className:c.qrcodeSection,children:[e.jsx("div",{className:c.qrcodeSectionTitle,children:"HTTPS"}),e.jsx(bt,{value:this.state.httpsUrl,size:180,bgColor:oe==="light"?"#ffffff":"#141414",fgColor:oe==="light"?"#1a1a1a":"#d9d9d9",level:"M"}),e.jsx(Ee,{readOnly:!0,value:this.state.httpsUrl,className:c.qrcodeUrlInput,suffix:e.jsx(Ie,{className:c.qrcodeUrlCopy,onClick:()=>{navigator.clipboard.writeText(this.state.httpsUrl).then(()=>{K.success(m("ui.copied"))}).catch(()=>{})}})})]})]})]}),trigger:"hover",placement:"bottomRight",overlayInnerStyle:{background:"var(--bg-elevated)",border:"1px solid var(--border-hover)",borderRadius:8,padding:"8px 8px"},children:e.jsx(F,{className:c.compactBtnNoBorder,icon:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",style:{verticalAlign:"middle"},children:[e.jsx("rect",{x:"2",y:"2",width:"4",height:"4"}),e.jsx("rect",{x:"8",y:"2",width:"2",height:"2"}),e.jsx("rect",{x:"2",y:"8",width:"2",height:"2"}),e.jsx("rect",{x:"6",y:"2",width:"2",height:"2",fill:"none"}),e.jsx("rect",{x:"2",y:"6",width:"4",height:"2",fill:"none"}),e.jsx("path",{d:"M2 2h8v8H2V2zm2 2v4h4V4H4zM14 2h8v8h-8V2zm2 2v4h4V4h-4zM2 14h8v8H2v-8zm2 2v4h4v-4H4z"}),e.jsx("rect",{x:"14",y:"14",width:"2",height:"2"}),e.jsx("rect",{x:"18",y:"14",width:"4",height:"2"}),e.jsx("rect",{x:"14",y:"18",width:"2",height:"4"}),e.jsx("rect",{x:"18",y:"18",width:"2",height:"2"}),e.jsx("rect",{x:"20",y:"20",width:"2",height:"2"}),e.jsx("rect",{x:"12",y:"12",width:"2",height:"2"}),e.jsx("rect",{x:"12",y:"16",width:"2",height:"2"})]})})})]}),P&&r==="chat"&&!h&&e.jsx(F,{className:c.compactBtn,type:D?"primary":"default",ghost:D,icon:e.jsx(Ge,{}),onClick:ae,children:m("ui.terminal")}),e.jsx(F,{className:c.compactBtn,type:r==="raw"?"primary":"default",icon:r==="raw"?e.jsx(In,{}):e.jsx(Ke,{}),onClick:u,children:r==="raw"?m("ui.chatMode"):m("ui.rawMode")})]}),e.jsxs(je,{title:`${m("ui.userPrompt")} (${this.state.promptData.length}${m("ui.promptCountUnit")})`,open:this.state.promptModalVisible,onCancel:()=>this.setState({promptModalVisible:!1}),footer:null,width:700,children:[e.jsx("div",{className:c.promptExportBar,children:e.jsx(F,{icon:e.jsx(ba,{}),onClick:this.handleExportPromptsTxt,children:m("ui.exportPromptsTxt")})}),e.jsx(is,{activeKey:this.state.promptViewMode,onChange:b=>this.setState({promptViewMode:b}),size:"small",items:[{key:"original",label:m("ui.promptModeOriginal")},{key:"context",label:m("ui.promptModeContext")},{key:"text",label:m("ui.promptModeText")}]}),this.state.promptViewMode==="text"?e.jsx("textarea",{readOnly:!0,className:c.promptTextarea,value:this.buildTextModeContent()}):e.jsxs("div",{className:c.promptScrollArea,children:[this.state.promptData.length===0&&e.jsx("div",{className:c.promptEmpty,children:m("ui.noPrompt")}),this.state.promptData.map((b,Q)=>{const te=b.timestamp?new Date(b.timestamp).toLocaleString():m("ui.unknownTime");return e.jsxs("div",{children:[e.jsxs("div",{className:c.promptTimestamp,children:[te,":"]}),this.state.promptViewMode==="original"?this.renderOriginalPrompt(b):this.renderTextPrompt(b)]},Q)})]})]}),e.jsxs(tt,{title:m("ui.settings"),placement:"left",width:360,open:this.state.settingsDrawerVisible,onClose:()=>this.setState({settingsDrawerVisible:!1}),children:[e.jsxs("div",{className:c.settingsGroupBox,children:[e.jsx("div",{className:c.settingsGroupTitle,children:m("ui.chatDisplaySwitches")}),e.jsxs("div",{className:c.settingsItem,children:[e.jsx("span",{className:c.settingsLabel,children:m("ui.collapseToolResults")}),e.jsx(Me,{checked:!!p,onChange:b=>y&&y(b)})]}),e.jsxs("div",{className:c.settingsItem,children:[e.jsx("span",{className:c.settingsLabel,children:m("ui.expandThinking")}),e.jsx(Me,{checked:!!x,onChange:b=>j&&j(b)})]}),e.jsxs("div",{className:c.settingsItem,children:[e.jsx("span",{className:c.settingsLabel,children:m("ui.showFullToolContent")}),e.jsx(Me,{checked:!!f,onChange:b=>C&&C(b)})]})]}),e.jsxs("div",{className:c.settingsGroupBox,children:[e.jsx("div",{className:c.settingsGroupTitle,children:m("ui.userPreferences")}),e.jsxs("div",{className:c.settingsItem,children:[e.jsx("span",{className:c.settingsLabel,children:m("ui.resumeAutoChoice")}),e.jsx(Me,{checked:!!re,onChange:b=>Y&&Y(b)})]}),re&&e.jsx("div",{className:c.settingsItem,children:e.jsxs(Ye.Group,{value:re,onChange:b=>ue&&ue(b.target.value),size:"small",children:[e.jsx(Ye,{value:"continue",children:m("ui.resumeAutoChoice.continue")}),e.jsx(Ye,{value:"new",children:m("ui.resumeAutoChoice.new")})]})}),e.jsxs("div",{className:c.settingsItem,children:[e.jsx("span",{className:c.settingsLabel,children:m("ui.permission.autoApprove.setting")}),e.jsx(Ae,{size:"small",value:W||0,onChange:b=>ge&&ge(b),options:[{label:m("ui.permission.autoApprove.off"),value:0},{label:"3s",value:3},{label:"5s",value:5},{label:"10s",value:10},{label:"15s",value:15},{label:"20s",value:20},{label:"30s",value:30},{label:"60s",value:60}],style:{width:100}})]})]}),e.jsx("div",{className:c.settingsGroupBox,children:e.jsxs("div",{className:c.settingsItem,children:[e.jsx("span",{className:c.settingsLabel,children:m("ui.themeColor")}),e.jsx(Ae,{size:"small",value:oe||"dark",onChange:b=>ce&&ce(b),options:[{label:m("ui.themeColor.dark"),value:"dark"},{label:m("ui.themeColor.light"),value:"light"}],style:{width:140}})]})}),e.jsx("div",{className:c.settingsGroupBox,children:e.jsxs("div",{className:c.settingsItem,children:[e.jsx("span",{className:c.settingsLabel,children:m("ui.languageSettings")}),e.jsx(Ae,{size:"small",value:Sa(),onChange:b=>{Na(b),i&&i()},options:Gn.map(b=>({label:b.label,value:b.value})),style:{width:140}})]})})]}),e.jsxs(tt,{title:e.jsxs("span",{children:[m("ui.globalSettings")," ",e.jsx(he,{doc:"GlobalSettings"})]}),placement:"left",width:400,open:this.state.globalSettingsVisible,onClose:()=>this.setState({globalSettingsVisible:!1}),children:[e.jsxs("div",{className:c.settingsItem,children:[e.jsx("span",{className:c.settingsLabel,children:m("ui.filterIrrelevant")}),e.jsx(Me,{checked:!!M,onChange:b=>_&&_(b)})]}),e.jsxs("div",{className:c.settingsItem,children:[e.jsx("span",{className:c.settingsLabel,children:m("ui.expandDiff")}),e.jsx(Me,{checked:!!w,onChange:b=>S&&S(b)})]}),e.jsx("div",{className:c.settingsDivider}),e.jsx("div",{className:c.settingsLabel,children:m("ui.logDirTitle")}),e.jsx(Ee,{className:c.logDirInput,value:this.state.logDirDraft??T,onChange:b=>this.setState({logDirDraft:b.target.value}),onBlur:()=>{const b=this.state.logDirDraft;b!=null&&b!==T&&(I==null||I(b)),this.setState({logDirDraft:null})},onPressEnter:()=>{const b=this.state.logDirDraft;b!=null&&b!==T&&(I==null||I(b)),this.setState({logDirDraft:null})},placeholder:"~/.claude/cc-viewer"})]}),e.jsx(tt,{title:e.jsxs("span",{children:[e.jsx(Kt,{className:c.titleIcon}),m("ui.projectStats")]}),placement:"left",width:400,open:this.state.projectStatsVisible,onClose:()=>this.setState({projectStatsVisible:!1}),children:this.renderProjectStatsContent()}),e.jsxs(je,{title:e.jsxs("span",{children:[e.jsx(Wt,{className:c.titleIcon}),m("ui.pluginManagement")]}),open:this.state.pluginModalVisible,onCancel:()=>this.setState({pluginModalVisible:!1}),footer:e.jsxs("div",{className:c.pluginModalFooter,children:[e.jsxs("div",{className:c.pluginModalFooterLeft,children:[e.jsx(F,{icon:e.jsx(Pt,{}),onClick:this.handleAddPlugin,children:m("ui.plugins.add")}),e.jsx(F,{icon:e.jsx(Gt,{}),onClick:this.handleShowCdnModal,children:m("ui.plugins.cdnInstall")})]}),e.jsx(F,{icon:e.jsx(yt,{}),onClick:this.handleReloadPlugins,children:m("ui.plugins.reload")})]}),width:560,children:[this.state.pluginsDir&&e.jsxs("div",{className:c.pluginDirHint,children:[e.jsxs("span",{className:c.pluginDirLabel,children:[m("ui.plugins.pluginsDir"),":"]})," ",e.jsx("code",{className:c.pluginDirPath,onClick:()=>{navigator.clipboard.writeText(this.state.pluginsDir).then(()=>{K.success(m("ui.copied"))}).catch(()=>{})},children:this.state.pluginsDir})]}),this.state.pluginsList.length===0?e.jsxs("div",{className:c.pluginEmpty,children:[e.jsx("div",{className:c.pluginEmptyTitle,children:m("ui.plugins.empty")}),e.jsx("div",{className:c.pluginEmptyHint,children:m("ui.plugins.emptyHint")})]}):e.jsx("div",{className:c.pluginList,children:this.state.pluginsList.map(b=>{var Q;return e.jsxs("div",{className:c.pluginItem,children:[e.jsxs("div",{className:c.pluginInfo,children:[e.jsx("span",{className:c.pluginName,children:b.name}),e.jsx("span",{className:c.pluginFile,children:b.file}),b.hooks.length>0&&e.jsx("span",{className:c.pluginHooks,children:b.hooks.map(te=>e.jsx("span",{className:c.pluginHookTag,children:te},te))}),((Q=b.capabilities)==null?void 0:Q.length)>0&&e.jsx("span",{className:c.pluginHooks,children:b.capabilities.map(te=>e.jsx("span",{className:c.pluginCapabilityTag,children:te},te))}),b.loadError&&e.jsx("span",{className:c.pluginErrorText,children:m("ui.plugins.loadError",{reason:b.loadError})})]}),e.jsxs("div",{className:c.pluginActions,children:[e.jsx(Me,{size:"small",checked:b.enabled,onChange:te=>this.handleTogglePlugin(b.name,te)}),e.jsx(F,{type:"text",size:"small",danger:!0,icon:e.jsx(nt,{}),onClick:()=>this.handleDeletePlugin(b.file,b.name)})]})]},b.file)})})]}),e.jsx(je,{title:m("ui.plugins.delete"),open:this.state.deleteConfirmVisible,onCancel:()=>this.setState({deleteConfirmVisible:!1,deleteTarget:null}),onOk:this.handleDeletePluginConfirm,okType:"danger",okText:"OK",cancelText:"Cancel",children:e.jsx("p",{children:this.state.deleteTarget?m("ui.plugins.deleteConfirm",{name:this.state.deleteTarget.name}):""})}),e.jsx(je,{title:e.jsxs("span",{children:[e.jsx(Gt,{className:c.titleIcon}),m("ui.plugins.cdnInstall")]}),open:this.state.cdnModalVisible,onCancel:this.handleCdnCancel,onOk:this.handleCdnInstall,confirmLoading:this.state.cdnLoading,okText:m("ui.plugins.cdnInstallBtn"),cancelText:m("ui.cancel"),width:480,children:e.jsxs("div",{children:[e.jsx("div",{className:c.cdnUrlLabel,children:m("ui.plugins.cdnUrl")}),e.jsx(Ee,{placeholder:m("ui.plugins.cdnUrlPlaceholder"),value:this.state.cdnUrl,onChange:this.handleCdnUrlChange,onPressEnter:this.handleCdnInstall,className:c.cdnInput})]})}),e.jsx(je,{title:e.jsxs("span",{children:[e.jsx(gt,{className:c.titleIcon}),m("ui.processManagement")]}),open:this.state.processModalVisible,onCancel:()=>this.setState({processModalVisible:!1}),footer:e.jsx(F,{icon:e.jsx(yt,{}),onClick:this.fetchProcesses,loading:this.state.processLoading,children:m("ui.processManagement.refresh")}),width:780,children:e.jsx(_a,{dataSource:this.state.processList,rowKey:"pid",loading:this.state.processLoading,size:"middle",pagination:!1,columns:[{title:m("ui.processManagement.port"),dataIndex:"port",width:80,render:b=>b?e.jsx("a",{href:`${window.location.protocol}//127.0.0.1:${b}`,target:"_blank",rel:"noopener noreferrer",children:b}):""},{title:"PID",dataIndex:"pid",width:80},{title:m("ui.processManagement.command"),dataIndex:"command",ellipsis:!0},{title:m("ui.processManagement.startTime"),dataIndex:"startTime",width:200},{title:m("ui.processManagement.action"),width:100,render:(b,Q)=>Q.isCurrent?e.jsx(F,{size:"small",className:c.currentProcessBtn,children:m("ui.processManagement.current")}):e.jsx(F,{size:"small",danger:!0,onClick:()=>this.handleKillProcess(Q.pid),children:m("ui.processManagement.kill")})}]})}),e.jsx(je,{title:e.jsxs("span",{children:[e.jsx(ls,{apiEndpoint:de("/api/open-profile-dir"),title:m("ui.proxy.openConfigDir"),size:16})," ",m("ui.proxySwitch")," ",e.jsx(he,{doc:"ProxySwitch",zIndex:1100})]}),open:this.state.proxyModalVisible,onCancel:()=>this.setState({proxyModalVisible:!1,editingProxy:null}),footer:null,width:520,children:this.renderProxyProfileList()})]})}renderProxyProfileList(){const t=this.props.proxyProfiles||[],a=this.props.activeProxyId||"max",{editingProxy:r,editForm:o}=this.state;return e.jsxs("div",{children:[e.jsxs("div",{className:c.proxyWarning,children:["⚠️ ",m("ui.proxy.maxWarning")]}),e.jsx("div",{className:c.proxyList,children:t.map(u=>{var g;return e.jsxs("div",{className:`${c.proxyItem} ${u.id===a?c.proxyItemActive:""}`,children:[e.jsxs("div",{className:c.proxyItemMain,onClick:()=>{if(u.id!==a){const i={active:u.id,profiles:t};this.props.onProxyProfileChange(i)}},children:[e.jsx(Ye,{checked:u.id===a,style:{marginRight:8}}),e.jsxs("div",{className:c.proxyItemInfo,children:[e.jsxs("div",{className:c.proxyItemNameRow,children:[e.jsx("span",{className:c.proxyItemName,children:u.name}),u.id==="max"&&e.jsx(Ce,{className:c.proxyBuiltinTag,children:m("ui.proxy.builtin")})]}),u.id==="max"&&this.props.defaultConfig&&e.jsxs("div",{className:c.proxyItemDetail,children:[(()=>{try{return new URL(this.props.defaultConfig.origin).host}catch{return this.props.defaultConfig.origin}})(),this.props.defaultConfig.authType?` · ${this.props.defaultConfig.authType}`:"",this.props.defaultConfig.apiKey?` · ${this.props.defaultConfig.apiKey}`:"",this.props.defaultConfig.model?` · ${this.props.defaultConfig.model}`:""]}),u.id!=="max"&&u.baseURL&&e.jsxs("div",{className:c.proxyItemDetail,children:[(()=>{try{return new URL(u.baseURL).host}catch{return u.baseURL}})(),u.activeModel?` · ${u.activeModel}`:(g=u.models)!=null&&g.length?` · ${u.models[0]}`:""]})]})]}),u.id!=="max"&&e.jsxs("div",{className:c.proxyItemActions,children:[e.jsx(F,{type:"text",size:"small",icon:e.jsx(wa,{}),onClick:()=>this.setState({editingProxy:u.id,editForm:{name:u.name||"",baseURL:u.baseURL||"",apiKey:u.apiKey||"",models:(u.models||[]).join(", "),activeModel:u.activeModel||""}})}),e.jsx(F,{type:"text",size:"small",danger:!0,icon:e.jsx(nt,{}),onClick:()=>{je.confirm({title:m("ui.proxy.deleteProxy"),content:m("ui.proxy.deleteConfirm",{name:u.name}),okType:"danger",onOk:()=>{const i=t.filter(l=>l.id!==u.id),h=a===u.id?"max":a;this.props.onProxyProfileChange({active:h,profiles:i})}})}})]})]},u.id)})}),r&&e.jsxs("div",{className:c.proxyEditForm,children:[e.jsxs("div",{className:c.proxyEditRow,children:[e.jsxs("label",{children:[m("ui.proxy.name")," ",e.jsx("span",{className:c.proxyRequired,children:"*"})]}),e.jsx(Ee,{size:"small",value:o.name,onChange:u=>{const g=u.target.value;this.setState(i=>({editForm:{...i.editForm,name:g}}))}})]}),e.jsxs("div",{className:c.proxyEditRow,children:[e.jsxs("label",{children:[m("ui.proxy.baseURL")," ",e.jsx("span",{className:c.proxyRequired,children:"*"})]}),e.jsx(Ee,{size:"small",value:o.baseURL,onChange:u=>{const g=u.target.value;this.setState(i=>({editForm:{...i.editForm,baseURL:g}}))},placeholder:"https://api.example.com"})]}),e.jsxs("div",{className:c.proxyEditRow,children:[e.jsxs("label",{children:[m("ui.proxy.apiKey")," ",e.jsx("span",{className:c.proxyRequired,children:"*"})]}),e.jsx(Ee.Password,{size:"small",value:o.apiKey,onChange:u=>{const g=u.target.value;this.setState(i=>({editForm:{...i.editForm,apiKey:g}}))},placeholder:"sk-..."})]}),e.jsx("div",{className:c.proxyEditDivider}),e.jsxs("div",{className:c.proxyEditRow,children:[e.jsx("label",{children:m("ui.proxy.models")}),e.jsx(Ee,{size:"small",value:o.models,onChange:u=>{const g=u.target.value;this.setState(i=>({editForm:{...i.editForm,models:g}}))},placeholder:"model-1, model-2"})]}),e.jsxs("div",{className:c.proxyEditRow,children:[e.jsx("label",{children:m("ui.proxy.activeModel")}),e.jsx(Ae,{size:"small",className:c.fullWidthSelect,value:o.activeModel||void 0,onChange:u=>this.setState(g=>({editForm:{...g.editForm,activeModel:u}})),placeholder:m("ui.proxy.activeModel"),children:(o.models||"").split(",").map(u=>u.trim()).filter(Boolean).map(u=>e.jsx(Ae.Option,{value:u,children:u},u))})]}),e.jsxs("div",{className:c.proxyEditBtns,children:[e.jsx(F,{size:"small",icon:e.jsx(ka,{}),type:"primary",onClick:()=>{var h,l,d;if(!((h=o.name)!=null&&h.trim())||!((l=o.baseURL)!=null&&l.trim())||!((d=o.apiKey)!=null&&d.trim())){K.warning(m("ui.proxy.requiredFields"));return}const u=(o.models||"").split(",").map(p=>p.trim()).filter(Boolean),g={id:r==="__new__"?`proxy_${Date.now()}`:r,name:o.name.trim(),baseURL:o.baseURL.trim(),apiKey:o.apiKey.trim(),models:u,activeModel:o.activeModel||u[0]||""};let i;r==="__new__"?i=[...t,g]:i=t.map(p=>p.id===r?{...p,...g,id:p.id}:p),this.props.onProxyProfileChange({active:a,profiles:i}),this.setState({editingProxy:null})},children:m("ui.proxy.save")}),e.jsx(F,{size:"small",icon:e.jsx(ts,{}),onClick:()=>this.setState({editingProxy:null}),children:m("ui.proxy.cancel")})]})]}),!r&&e.jsx(F,{block:!0,type:"dashed",icon:e.jsx(Pt,{}),style:{marginTop:12},onClick:()=>this.setState({editingProxy:"__new__",editForm:{name:"",baseURL:"",apiKey:"",models:"",activeModel:""}}),children:m("ui.proxy.addProxy")})]})}};B(Oe,"COMMAND_TAGS",new Set(["command-name","command-message","command-args","local-command-caveat","local-command-stdout"]));let it=Oe;const Qn="_centerEmpty_midza_1",Xn="_scrollContainer_midza_8",Yn="_listItem_midza_15",Zn="_listItemActive_midza_29",eo="_itemContent_midza_46",to="_itemHeader_midza_51",so="_tagNoMargin_midza_59",ao="_modelName_midza_64",no="_modelNameMain_midza_69",oo="_time_midza_73",io="_detailRow_midza_79",lo="_urlText_midza_86",ro="_duration_midza_95",co="_statusOk_midza_100",ho="_statusErr_midza_106",uo="_statusDefault_midza_111",mo="_usageBox_midza_116",po="_cacheDot_midza_126",go="_cacheDotLoss_midza_135",fo="_cacheDotNormal_midza_140",xo="_tagMainAgent_midza_144",vo="_tagPlan_midza_150",yo="_tagMuted_midza_156",jo="_tooltipPreLine_midza_162",V={centerEmpty:Qn,scrollContainer:Xn,listItem:Yn,listItemActive:Zn,itemContent:eo,itemHeader:to,tagNoMargin:so,modelName:ao,modelNameMain:no,time:oo,detailRow:io,urlText:lo,duration:ro,statusOk:co,statusErr:ho,statusDefault:uo,usageBox:mo,cacheDot:po,cacheDotLoss:go,cacheDotNormal:fo,tagMainAgent:xo,tagPlan:vo,tagMuted:yo,tooltipPreLine:jo};class Co extends U.Component{constructor(t){super(t);B(this,"handleKeyDown",t=>{if(t.key!=="ArrowUp"&&t.key!=="ArrowDown")return;const{requests:a,selectedIndex:r,onSelect:o}=this.props;if(!a.length)return;t.preventDefault();const u=r??0,g=t.key==="ArrowUp"?Math.max(0,u-1):Math.min(a.length-1,u+1);g!==u&&o(g)});this.activeItemRef=U.createRef()}componentDidMount(){this.scrollToSelected(!0)}shouldComponentUpdate(t){return t.requests!==this.props.requests||t.selectedIndex!==this.props.selectedIndex||t.scrollCenter!==this.props.scrollCenter||t.cacheLossMap!==this.props.cacheLossMap}componentDidUpdate(t){this.props.scrollCenter&&t.selectedIndex!==this.props.selectedIndex?this.scrollToSelected(!0):t.selectedIndex!==this.props.selectedIndex&&(this.scrollToSelected(!1),this.activeItemRef.current&&this.activeItemRef.current.focus({preventScroll:!0}))}scrollToSelected(t){this.activeItemRef.current&&(this.activeItemRef.current.scrollIntoView({block:t?"center":"nearest",behavior:"instant"}),t&&this.props.onScrollDone&&this.props.onScrollDone())}render(){const{requests:t,selectedIndex:a,onSelect:r}=this.props;return t.length===0?e.jsx("div",{className:V.centerEmpty,children:e.jsx(Le,{description:m("ui.waitingRequests")})}):e.jsx("div",{className:V.scrollContainer,onKeyDown:this.handleKeyDown,children:e.jsx(At,{dataSource:t,size:"small",split:!1,renderItem:(o,u)=>{var _,T,I;const g=new Date(o.timestamp).toLocaleTimeString("zh-CN"),i=u===a,h=o.response&&o.response.status<400,l=o.response&&o.response.status>=400,d=Ta((_=o.body)==null?void 0:_.model),p=u+1<t.length?t[u+1]:null,{type:y,subType:x}=Qe(o,p),j=(I=(T=o.response)==null?void 0:T.body)==null?void 0:I.usage,f=j?(j.input_tokens||0)+(j.cache_read_input_tokens||0)+(j.cache_creation_input_tokens||0):null,C=(j==null?void 0:j.output_tokens)||null,w=(j==null?void 0:j.cache_read_input_tokens)||0,S=(j==null?void 0:j.cache_creation_input_tokens)||0;let M=o.url;try{const L=new URL(o.url);M=L.host+L.pathname}catch{}return e.jsx(At.Item,{ref:i?this.activeItemRef:void 0,tabIndex:0,onClick:()=>r(u),className:`${V.listItem} ${i?V.listItemActive:""}`,children:e.jsxs("div",{className:V.itemContent,children:[e.jsxs("div",{className:V.itemHeader,children:[y==="MainAgent"?e.jsx(Ce,{className:`${V.tagNoMargin} ${V.tagMainAgent}`,children:"MainAgent"}):y==="Plan"?e.jsx(Ce,{className:`${V.tagNoMargin} ${V.tagPlan}`,children:Bt(y,x)}):y==="Count"||y==="Preflight"?e.jsx(Ce,{className:`${V.tagNoMargin} ${V.tagMuted}`,children:y}):e.jsx(Ce,{className:V.tagNoMargin,children:Bt(y,x)}),d&&e.jsx("span",{className:`${V.modelName} ${y==="MainAgent"?V.modelNameMain:""}`,children:d}),e.jsx("span",{className:V.time,children:g})]}),e.jsxs("div",{className:V.detailRow,children:[e.jsx("span",{className:V.urlText,title:o.url,children:M}),o.duration&&e.jsxs("span",{className:V.duration,children:[o.duration,"ms"]}),o.response&&e.jsx("span",{className:h?V.statusOk:l?V.statusErr:V.statusDefault,children:o.response.status})]}),j&&e.jsxs("div",{className:V.usageBox,children:[e.jsxs("div",{children:["token: output:",G(C)||0,", input: ",G(f)||0]}),(w>0||S>0)&&e.jsx("div",{children:(()=>{var D;const L=(D=this.props.cacheLossMap)==null?void 0:D.get(u),E={ttl:"ui.cacheLoss.ttl",system_change:"ui.cacheLoss.systemChange",tools_change:"ui.cacheLoss.toolsChange",model_change:"ui.cacheLoss.modelChange",msg_truncated:"ui.cacheLoss.msgTruncated",msg_modified:"ui.cacheLoss.msgModified",key_change:"ui.cacheLoss.keyChange"};let P;if(L){const H=(L.reasons||[L.reason]).map(A=>m(E[A]||E.key_change)).join(`
|
|
29
|
+
`);P=e.jsx(rs,{title:e.jsx("span",{className:V.tooltipPreLine,children:H}),children:e.jsx("span",{className:`${V.cacheDot} ${V.cacheDotLoss}`})})}else P=e.jsx("span",{className:`${V.cacheDot} ${V.cacheDotNormal}`});return e.jsxs(e.Fragment,{children:["cache",P,": ",w>0?`read:${G(w)}`:"",w>0&&S>0?", ":"",S>0?`create:${G(S)}`:""]})})()})]})]})})}})})}}const bo=n=>typeof n=="boolean"||n instanceof Boolean,No=n=>typeof n=="number"||n instanceof Number,So=n=>typeof n=="bigint"||n instanceof BigInt,Rs=n=>!!n&&n instanceof Date,_o=n=>typeof n=="string"||n instanceof String,wo=n=>Array.isArray(n),Is=n=>typeof n=="object"&&n!==null,Ls=n=>!!n&&n instanceof Object&&typeof n=="function";function lt(n,s){return s===void 0&&(s=!1),!n||s?`"${n}"`:n}function ko(n,s,t){return t?JSON.stringify(n):s?`"${n}"`:n}function Ps(n){let{field:s,value:t,data:a,lastElement:r,openBracket:o,closeBracket:u,level:g,style:i,shouldExpandNode:h,clickToExpandNode:l,outerRef:d,beforeExpandChange:p}=n;const y=v.useRef(!1),[x,j]=v.useState(()=>h(g,t,s)),f=v.useRef(null);v.useEffect(()=>{y.current?j(h(g,t,s)):y.current=!0},[h]);const C=v.useId();if(a.length===0)return To({field:s,openBracket:o,closeBracket:u,lastElement:r,style:i});const w=x?i.collapseIcon:i.expandIcon,S=x?i.ariaLables.collapseJson:i.ariaLables.expandJson,M=g+1,_=a.length-1,T=E=>{x!==E&&(!p||p({level:g,value:t,field:s,newExpandValue:E}))&&j(E)},I=E=>{if(E.key==="ArrowRight"||E.key==="ArrowLeft")E.preventDefault(),T(E.key==="ArrowRight");else if(E.key==="ArrowUp"||E.key==="ArrowDown"){E.preventDefault();const P=E.key==="ArrowUp"?-1:1;if(!d.current)return;const D=d.current.querySelectorAll("[role=button]");let ae=-1;for(let A=0;A<D.length;A++)if(D[A].tabIndex===0){ae=A;break}if(ae<0)return;const H=(ae+P+D.length)%D.length;D[ae].tabIndex=-1,D[H].tabIndex=0,D[H].focus()}},L=()=>{var E;T(!x);const P=f.current;if(!P)return;const D=(E=d.current)===null||E===void 0?void 0:E.querySelector('[role=button][tabindex="0"]');D&&(D.tabIndex=-1),P.tabIndex=0,P.focus()};return v.createElement("div",{className:i.basicChildStyle,role:"treeitem","aria-expanded":x,"aria-selected":void 0},v.createElement("span",{className:w,onClick:L,onKeyDown:I,role:"button","aria-label":S,"aria-expanded":x,"aria-controls":x?C:void 0,ref:f,tabIndex:g===0?0:-1}),(s||s==="")&&(l?v.createElement("span",{className:i.clickableLabel,onClick:L,onKeyDown:I},lt(s,i.quotesForFieldNames),":"):v.createElement("span",{className:i.label},lt(s,i.quotesForFieldNames),":")),v.createElement("span",{className:i.punctuation},o),x?v.createElement("ul",{id:C,role:"group",className:i.childFieldsContainer},a.map((E,P)=>v.createElement(Nt,{key:E[0]||P,field:E[0],value:E[1],style:i,lastElement:P===_,level:M,shouldExpandNode:h,clickToExpandNode:l,beforeExpandChange:p,outerRef:d}))):v.createElement("span",{className:i.collapsedContent,onClick:L,onKeyDown:I}),v.createElement("span",{className:i.punctuation},u),!r&&v.createElement("span",{className:i.punctuation},","))}function To(n){let{field:s,openBracket:t,closeBracket:a,lastElement:r,style:o}=n;return v.createElement("div",{className:o.basicChildStyle,role:"treeitem","aria-selected":void 0},(s||s==="")&&v.createElement("span",{className:o.label},lt(s,o.quotesForFieldNames),":"),v.createElement("span",{className:o.punctuation},t),v.createElement("span",{className:o.punctuation},a),!r&&v.createElement("span",{className:o.punctuation},","))}function Mo(n){let{field:s,value:t,style:a,lastElement:r,shouldExpandNode:o,clickToExpandNode:u,level:g,outerRef:i,beforeExpandChange:h}=n;return Ps({field:s,value:t,lastElement:r||!1,level:g,openBracket:"{",closeBracket:"}",style:a,shouldExpandNode:o,clickToExpandNode:u,data:Object.keys(t).map(l=>[l,t[l]]),outerRef:i,beforeExpandChange:h})}function Eo(n){let{field:s,value:t,style:a,lastElement:r,level:o,shouldExpandNode:u,clickToExpandNode:g,outerRef:i,beforeExpandChange:h}=n;return Ps({field:s,value:t,lastElement:r||!1,level:o,openBracket:"[",closeBracket:"]",style:a,shouldExpandNode:u,clickToExpandNode:g,data:t.map(l=>[void 0,l]),outerRef:i,beforeExpandChange:h})}function Ro(n){let{field:s,value:t,style:a,lastElement:r}=n,o,u=a.otherValue;return t===null?(o="null",u=a.nullValue):t===void 0?(o="undefined",u=a.undefinedValue):_o(t)?(o=ko(t,!a.noQuotesForStringValues,a.stringifyStringValues),u=a.stringValue):bo(t)?(o=t?"true":"false",u=a.booleanValue):No(t)?(o=t.toString(),u=a.numberValue):So(t)?(o=`${t.toString()}n`,u=a.numberValue):Rs(t)?o=t.toISOString():Ls(t)?o="function() { }":o=t.toString(),v.createElement("div",{className:a.basicChildStyle,role:"treeitem","aria-selected":void 0},(s||s==="")&&v.createElement("span",{className:a.label},lt(s,a.quotesForFieldNames),":"),v.createElement("span",{className:u},o),!r&&v.createElement("span",{className:a.punctuation},","))}function Nt(n){const s=n.value;return wo(s)?v.createElement(Eo,Object.assign({},n)):Is(s)&&!Rs(s)&&!Ls(s)?v.createElement(Mo,Object.assign({},n)):v.createElement(Ro,Object.assign({},n))}var z={"container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","child-fields-container":"_1BXBN","label-light":"_1MGIk","clickable-label-light":"_2YKJg _1MGIk _1MFti","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti","container-dark":"_11RoI _GzYRV","expand-icon-dark":"_17H2C _f10Tu _1MFti _1UmXx","collapse-icon-dark":"_3QHg2 _f10Tu _1MFti _1LId0","collapsed-content-dark":"_3fDAz _1pNG9 _1MFti","label-dark":"_2bSDX","clickable-label-dark":"_1RQEj _2bSDX _1MFti","punctuation-dark":"_gsbQL _3eOF8","value-null-dark":"_LaAZe","value-undefined-dark":"_GTKgm","value-string-dark":"_Chy1W","value-number-dark":"_2bveF","value-boolean-dark":"_2vRm-","value-other-dark":"_1prJR"};const As={collapseJson:"collapse JSON",expandJson:"expand JSON"},st={container:z["container-light"],basicChildStyle:z["basic-element-style"],childFieldsContainer:z["child-fields-container"],label:z["label-light"],clickableLabel:z["clickable-label-light"],nullValue:z["value-null-light"],undefinedValue:z["value-undefined-light"],stringValue:z["value-string-light"],booleanValue:z["value-boolean-light"],numberValue:z["value-number-light"],otherValue:z["value-other-light"],punctuation:z["punctuation-light"],collapseIcon:z["collapse-icon-light"],expandIcon:z["expand-icon-light"],collapsedContent:z["collapsed-content-light"],noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:As,stringifyStringValues:!1},Io={container:z["container-dark"],basicChildStyle:z["basic-element-style"],childFieldsContainer:z["child-fields-container"],label:z["label-dark"],clickableLabel:z["clickable-label-dark"],nullValue:z["value-null-dark"],undefinedValue:z["value-undefined-dark"],stringValue:z["value-string-dark"],booleanValue:z["value-boolean-dark"],numberValue:z["value-number-dark"],otherValue:z["value-other-dark"],punctuation:z["punctuation-dark"],collapseIcon:z["collapse-icon-dark"],expandIcon:z["expand-icon-dark"],collapsedContent:z["collapsed-content-dark"],noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:As,stringifyStringValues:!1},Lo=()=>!0,Po=n=>{let{data:s,style:t=st,shouldExpandNode:a=Lo,clickToExpandNode:r=!1,beforeExpandChange:o,compactTopLevel:u,...g}=n;const i=v.useRef(null);return v.createElement("div",Object.assign({"aria-label":"JSON view"},g,{className:t.container,ref:i,role:"tree"}),u&&Is(s)?Object.entries(s).map(h=>{let[l,d]=h;return v.createElement(Nt,{key:l,field:l,value:d,style:{...st,...t},lastElement:!0,level:1,shouldExpandNode:a,clickToExpandNode:r,beforeExpandChange:o,outerRef:i})}):v.createElement(Nt,{value:s,style:{...st,...t},lastElement:!0,level:0,shouldExpandNode:a,clickToExpandNode:r,outerRef:i,beforeExpandChange:o}))},Ao="_container_qeuid_1",Bo={container:Ao};class rt extends U.Component{shouldComponentUpdate(s){return s.data!==this.props.data||s.defaultExpand!==this.props.defaultExpand||s.expandNode!==this.props.expandNode}render(){const{data:s,defaultExpand:t,expandNode:a}=this.props,o={...typeof document<"u"&&document.documentElement.getAttribute("data-theme")!=="light"?Io:st,container:"rjv-container"};if(s==null)return null;const u=typeof a=="function"?a:t==="all"?()=>!0:t==="root"?g=>g<2:g=>g<1;return e.jsx("div",{className:Bo.container,children:e.jsx(Po,{data:s,shouldExpandNode:u,style:o})})}}function Oo({currentId:n,visibleIds:s=[],key:t}){if(t!=="ArrowUp"&&t!=="ArrowDown")return null;const a=s.findIndex(o=>o===n),r=t==="ArrowUp"?-1:1;return a>=0?s[a+r]??null:null}const Do="_root_17dqd_1",$o="_sidebar_17dqd_9",Fo="_section_17dqd_18",Ho="_sectionHeader_17dqd_22",zo="_arrow_17dqd_48",Vo="_sectionTitle_17dqd_54",qo="_sectionCount_17dqd_62",Uo="_sectionBody_17dqd_71",Wo="_historyToggle_17dqd_76",Ko="_historyToggleLabel_17dqd_102",Go="_item_17dqd_107",Jo="_itemActive_17dqd_135",Qo="_itemContent_17dqd_142",Xo="_itemLabel_17dqd_148",Yo="_itemSublabel_17dqd_156",Zo="_itemTime_17dqd_165",ei="_content_17dqd_174",ti="_contentEmpty_17dqd_182",si="_contentInner_17dqd_189",ai="_emptyWrap_17dqd_193",ni="_roleHeader_17dqd_201",oi="_roleBadge_17dqd_209",ii="_role_user_17dqd_218",li="_role_assistant_17dqd_224",ri="_roleLabel_17dqd_230",ci="_contentTime_17dqd_237",di="_turnDivider_17dqd_245",hi="_textBlock_17dqd_252",ui="_textBlockBar_17dqd_259",mi="_textBlockBody_17dqd_268",pi="_textBlockCompact_17dqd_276",gi="_textBlockCompactFloat_17dqd_283",fi="_thinkingBlock_17dqd_290",xi="_thinkingHeader_17dqd_298",vi="_thinkingPreview_17dqd_313",yi="_thinkingBody_17dqd_323",ji="_toolBlock_17dqd_329",Ci="_toolBlockResult_17dqd_336",bi="_toolBlockError_17dqd_340",Ni="_toolBlockHeader_17dqd_344",Si="_toolBlockBody_17dqd_355",_i="_toolName_17dqd_360",wi="_toolId_17dqd_366",ki="_errorLabel_17dqd_373",Ti="_blockTag_17dqd_383",Mi="_blockTagText_17dqd_396",Ei="_blockTagThinking_17dqd_402",Ri="_blockTagResult_17dqd_408",Ii="_blockTagError_17dqd_414",Li="_jsonBlock_17dqd_421",Pi="_jsonBlockLabel_17dqd_428",Ai="_blockSeparator_17dqd_438",Bi="_markdownBody_17dqd_445",k={root:Do,sidebar:$o,section:Fo,sectionHeader:Ho,arrow:zo,sectionTitle:Vo,sectionCount:qo,sectionBody:Uo,historyToggle:Wo,historyToggleLabel:Ko,item:Go,itemActive:Jo,itemContent:Qo,itemLabel:Xo,itemSublabel:Yo,itemTime:Zo,content:ei,contentEmpty:ti,contentInner:si,emptyWrap:ai,roleHeader:ni,roleBadge:oi,role_user:ii,role_assistant:li,roleLabel:ri,contentTime:ci,turnDivider:di,textBlock:hi,textBlockBar:ui,textBlockBody:mi,textBlockCompact:pi,textBlockCompactFloat:gi,thinkingBlock:fi,thinkingHeader:xi,thinkingPreview:vi,thinkingBody:yi,toolBlock:ji,toolBlockResult:Ci,toolBlockError:bi,toolBlockHeader:Ni,toolBlockBody:Si,toolName:_i,toolId:wi,errorLabel:ki,blockTag:Ti,blockTagText:Mi,blockTagThinking:Ei,blockTagResult:Ri,blockTagError:Ii,jsonBlock:Li,jsonBlockLabel:Pi,blockSeparator:Ai,markdownBody:Bi},{Text:Oi}=cs;function St(n){if(n==null)return[];if(typeof n=="string"){const s=n.trim();return s?[{type:"markdown",text:s}]:[]}if(Array.isArray(n)){const s=[];for(const t of n)if(t)if(t.type==="text"){const a=(t.text||"").trim();a&&s.push({type:"markdown",text:a})}else if(t.type==="tool_use")s.push({type:"tool_use",name:t.name||"unknown",id:t.id||"",input:t.input??{}});else if(t.type==="tool_result"){const a=Di(t.content);s.push({type:"tool_result",tool_use_id:t.tool_use_id||"",is_error:t.is_error,content:a})}else if(t.type==="thinking"){const a=t.thinking||"";a.trim()&&s.push({type:"thinking",text:a})}else t.type==="image"?s.push({type:"json",label:"image",data:t}):s.push({type:"json",label:t.type||"block",data:t});return s}return[{type:"json",label:"content",data:n}]}function Di(n){if(n==null)return[];if(typeof n=="string"){const s=n.trim();return s?[{type:"markdown",text:s}]:[]}return Array.isArray(n)?n.flatMap(s=>{if(!s)return[];if(s.type==="text"){const t=(s.text||"").trim();return t?[{type:"markdown",text:t}]:[]}return[{type:"json",label:s.type||"block",data:s}]}):[{type:"json",label:"content",data:n}]}function $i(n){if(!n)return null;if(typeof n=="string")return[{type:"markdown",text:n}];if(Array.isArray(n)){const s=[];return n.forEach((t,a)=>{a>0&&s.push({type:"separator"}),t&&(typeof t=="string"?s.push({type:"markdown",text:t}):t.type==="text"?s.push({type:"markdown",text:t.text||""}):s.push({type:"json",label:t.type||"item",data:t}))}),s}return[{type:"json",label:"system",data:n}]}function Fi(n){const s=[],t=(n==null?void 0:n.name)||"unknown",a=(n==null?void 0:n.description)||"";let r=`### ${t}
|
|
30
|
+
|
|
31
|
+
`;a&&(r+=`${a}
|
|
32
|
+
|
|
33
|
+
`),s.push({type:"markdown",text:r});const o=(n==null?void 0:n.input_schema)||(n==null?void 0:n.parameters)||null;return o&&s.push({type:"json",label:"Parameters",data:o}),s}function Hi(n){var s;if(typeof n=="string")return n.slice(0,60).replace(/\n/g," ");if(Array.isArray(n)){for(const t of n)if((t==null?void 0:t.type)==="text"&&((s=t.text)!=null&&s.trim()))return t.text.trim().slice(0,60).replace(/\n/g," ")}return""}function zi(n){var a;const s=[];let t=0;for(;t<n.length;){const r=n[t];if((r==null?void 0:r.role)!=="user"){t++;continue}const o=((a=n[t+1])==null?void 0:a.role)==="assistant"?n[t+1]:null;s.push({id:`turn__${t}`,isTurn:!0,turnIndex:s.length,timestamp:r._timestamp||null,assistantTimestamp:(o==null?void 0:o._timestamp)||null,userBlocks:St(r==null?void 0:r.content),assistantBlocks:o?St(o.content):null,preview:Hi(r==null?void 0:r.content)}),t+=o?2:1}return s}function _t(n){try{return new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return null}}function Vi({text:n,compact:s}){const t=ds(n);return s?e.jsx("div",{className:k.textBlockCompact,children:e.jsx("div",{className:`chat-md ${k.markdownBody}`,dangerouslySetInnerHTML:{__html:t}})}):e.jsxs("div",{className:k.textBlock,children:[e.jsx("div",{className:k.textBlockBar,children:e.jsx("span",{className:`${k.blockTag} ${k.blockTagText}`,children:"text"})}),e.jsx("div",{className:`chat-md ${k.textBlockBody}`,dangerouslySetInnerHTML:{__html:t}})]})}function qi({block:n}){const[s,t]=v.useState(!0),a=n.text.length>60?n.text.slice(0,60).replace(/\n/g," ")+"…":n.text.replace(/\n/g," ");return e.jsxs("div",{className:k.thinkingBlock,children:[e.jsxs("div",{className:k.thinkingHeader,onClick:()=>t(r=>!r),children:[s?e.jsx(De,{className:k.arrow}):e.jsx($e,{className:k.arrow}),e.jsx("span",{className:`${k.blockTag} ${k.blockTagThinking}`,children:"thinking"}),!s&&e.jsx("span",{className:k.thinkingPreview,children:a})]}),s&&e.jsx("div",{className:k.thinkingBody,children:e.jsx("div",{className:`chat-md ${k.markdownBody}`,dangerouslySetInnerHTML:{__html:ds(n.text)}})})]})}function ct({blocks:n,compact:s}){return!n||n.length===0?null:e.jsx(e.Fragment,{children:n.map((t,a)=>e.jsx(Ui,{block:t,compact:s},a))})}function Ui({block:n,compact:s}){var t;return n.type==="separator"?e.jsx("hr",{className:k.blockSeparator}):n.type==="markdown"?(t=n.text)!=null&&t.trim()?e.jsx(Vi,{text:n.text,compact:s}):null:n.type==="thinking"?e.jsx(qi,{block:n}):n.type==="tool_use"?e.jsxs("div",{className:k.toolBlock,children:[e.jsxs("div",{className:k.toolBlockHeader,children:[e.jsx("span",{className:k.blockTag,children:"tool_use"}),e.jsx("span",{className:k.toolName,children:n.name}),n.id&&e.jsx("span",{className:k.toolId,children:n.id})]}),e.jsx("div",{className:k.toolBlockBody,children:e.jsx(rt,{data:n.input,defaultExpand:"root"})})]}):n.type==="tool_result"?e.jsxs("div",{className:`${k.toolBlock} ${n.is_error?k.toolBlockError:k.toolBlockResult}`,children:[e.jsxs("div",{className:k.toolBlockHeader,children:[e.jsx("span",{className:`${k.blockTag} ${n.is_error?k.blockTagError:k.blockTagResult}`,children:"tool_result"}),n.tool_use_id&&e.jsx("span",{className:k.toolId,children:n.tool_use_id}),n.is_error&&e.jsx("span",{className:k.errorLabel,children:"error"})]}),e.jsx("div",{className:k.toolBlockBody,children:e.jsx(ct,{blocks:n.content,compact:!0})})]}):n.type==="json"?e.jsxs("div",{className:k.jsonBlock,children:[n.label&&e.jsx("div",{className:k.jsonBlockLabel,children:n.label}),e.jsx(rt,{data:n.data,defaultExpand:"root"})]}):null}function Wi({turn:n}){const s=n.timestamp?_t(n.timestamp):null,t=n.assistantTimestamp?_t(n.assistantTimestamp):null;return e.jsxs("div",{children:[e.jsxs("div",{className:k.roleHeader,children:[e.jsx("span",{className:`${k.roleBadge} ${k.role_user}`,children:"user"}),e.jsx("span",{className:k.roleLabel,children:`Turn ${n.turnIndex+1}`}),s&&e.jsx("span",{className:k.contentTime,children:s})]}),e.jsx(ct,{blocks:n.userBlocks}),n.assistantBlocks&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:k.turnDivider}),e.jsxs("div",{className:k.roleHeader,children:[e.jsx("span",{className:`${k.roleBadge} ${k.role_assistant}`,children:"assistant"}),t&&e.jsx("span",{className:k.contentTime,children:t})]}),e.jsx(ct,{blocks:n.assistantBlocks})]})]})}function Ki({sectionKey:n,title:s,items:t,historyItems:a=[],onSelect:r,onSelectById:o,selectedId:u,sidebarRef:g}){const[i,h]=v.useState(n!=="tools"),[l,d]=v.useState(!1),p=t.length+a.length,y=`${n}__history_toggle`;function x(C){var S;const w=(S=g.current)==null?void 0:S.querySelector(`[data-context-sidebar-control="${C}"]`);w&&(w.focus(),w.scrollIntoView({block:"nearest"}))}function j(C,w){var _;const S=Array.from(((_=g.current)==null?void 0:_.querySelectorAll("[data-context-sidebar-control]"))||[]).map(T=>T.dataset.contextSidebarControl).filter(Boolean),M=Oo({currentId:w,visibleIds:S,key:C.key});M&&(C.preventDefault(),typeof window<"u"&&window.requestAnimationFrame(()=>{var I;x(M);const T=(I=g.current)==null?void 0:I.querySelector(`[data-context-sidebar-control="${M}"]`);(T==null?void 0:T.dataset.controlType)==="item"&&o(M)}))}function f(C){const w=u===C.id;return e.jsxs("button",{type:"button",className:`${k.item} ${w?k.itemActive:""}`,onClick:()=>r(C),onKeyDown:S=>j(S,C.id),"aria-current":w?"true":void 0,"data-context-sidebar-control":C.id,"data-control-type":"item",children:[e.jsxs("div",{className:k.itemContent,children:[e.jsx("span",{className:k.itemLabel,children:C.label}),C.sublabel&&!w&&e.jsx("div",{className:k.itemSublabel,children:C.sublabel})]}),C.time&&e.jsx("span",{className:k.itemTime,children:C.time})]},C.id)}return e.jsxs("div",{className:k.section,children:[e.jsxs("button",{type:"button",className:k.sectionHeader,onClick:()=>h(C=>!C),"aria-expanded":i,children:[i?e.jsx(De,{className:k.arrow}):e.jsx($e,{className:k.arrow}),e.jsx("span",{className:k.sectionTitle,children:s}),e.jsx("span",{className:k.sectionCount,children:p})]}),i&&e.jsxs("div",{className:k.sectionBody,children:[a.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:k.historyToggle,onClick:()=>d(C=>!C),onKeyDown:C=>j(C,y),"aria-expanded":l,"data-context-sidebar-control":y,"data-control-type":"toggle",children:[l?e.jsx(De,{className:k.arrow}):e.jsx($e,{className:k.arrow}),e.jsxs("span",{className:k.historyToggleLabel,children:[m("ui.context.history")," (",a.length,")"]})]}),l&&a.map(f)]}),t.map(f)]})]})}function Gi({body:n,response:s}){const[t,a]=v.useState(null),r=v.useRef(null),o=v.useMemo(()=>{if(!Array.isArray(n==null?void 0:n.messages))return[];const l=zi(n.messages);if(l.length===0)return l;const d=l[l.length-1],p=s!=null&&s.content?St(s.content):null;return[...l.slice(0,-1),{...d,assistantBlocks:p??d.assistantBlocks}]},[n,s]);if(v.useEffect(()=>{o.length>0?a(o[o.length-1]):a(null)},[n,s]),!n||typeof n!="object")return e.jsx("div",{className:k.emptyWrap,children:e.jsx(Le,{description:m("ui.context.noData")})});const u=[];Array.isArray(n.tools)&&n.tools.length>0&&u.push({key:"tools",title:e.jsxs(e.Fragment,{children:[m("ui.context.tools")," ",e.jsx(he,{doc:"ToolsFirst"})]}),items:n.tools.map((l,d)=>({id:`tool__${d}`,label:(l==null?void 0:l.name)||`Tool ${d}`,blocks:Fi(l)}))});const g=$i(n.system);if(g!=null&&u.push({key:"system",title:m("ui.context.systemPrompt"),items:[{id:"system__0",label:m("ui.context.systemPrompt"),blocks:g}]}),o.length>0){const l=x=>({...x,label:m("ui.context.historyTurnNoTime",{n:x.turnIndex+1}),time:x.timestamp?_t(x.timestamp):null,sublabel:x.preview||void 0}),d=x=>({...x,label:m("ui.context.currentTurn"),sublabel:x.preview||void 0}),p=o.slice(0,-1).map(l),y=d(o[o.length-1]);u.push({key:"messages",title:m("ui.context.messages"),historyItems:p.length>0?p:void 0,items:[y]})}if(u.length===0)return e.jsx("div",{className:k.emptyWrap,children:e.jsx(Le,{description:m("ui.context.noFields")})});const i=t!=null&&t.isTurn?o.find(l=>l.id===t.id)??null:t,h=new Map;return u.forEach(l=>{(l.historyItems||[]).forEach(d=>h.set(d.id,d)),l.items.forEach(d=>h.set(d.id,d))}),e.jsxs("div",{className:k.root,children:[e.jsx("div",{ref:r,className:k.sidebar,children:u.map(l=>e.jsx(Ki,{sectionKey:l.key,title:l.title,items:l.items,historyItems:l.historyItems,selectedId:i==null?void 0:i.id,onSelect:d=>a(d),onSelectById:d=>{const p=h.get(d);p&&a(p)},sidebarRef:r},l.key))}),e.jsx("div",{className:k.content,children:i==null?e.jsx("div",{className:k.contentEmpty,children:e.jsx(Oi,{type:"secondary",children:m("ui.context.selectPrompt")})}):e.jsx("div",{className:k.contentInner,children:i.isTurn?e.jsx(Wi,{turn:i}):e.jsxs(e.Fragment,{children:[i.role&&e.jsxs("div",{className:k.roleHeader,children:[e.jsx("span",{className:`${k.roleBadge} ${k[`role_${i.role}`]||""}`,children:i.role}),e.jsx("span",{className:k.roleLabel,children:i.label})]}),e.jsx(ct,{blocks:i.blocks})]})},i.id)})]})}const Ji="_container_rg6mx_1",Qi="_emptyState_rg6mx_10",Xi="_urlSection_rg6mx_17",Yi="_urlLeft_rg6mx_25",Zi="_tokenStatsBox_rg6mx_30",el="_tokenGrid_rg6mx_37",tl="_tokenRows_rg6mx_47",sl="_tokenRow_rg6mx_47",al="_tokenRowBorder_rg6mx_55",nl="_tokenLabel_rg6mx_59",ol="_tokenTd_rg6mx_66",il="_tokenHitRate_rg6mx_75",ll="_tokenHitRateLabel_rg6mx_88",rl="_urlText_rg6mx_98",cl="_metaText_rg6mx_105",dl="_headersContainer_rg6mx_109",hl="_headerRow_rg6mx_113",ul="_headerKey_rg6mx_119",ml="_headerValue_rg6mx_124",pl="_streamingBox_rg6mx_129",gl="_rawTextPre_rg6mx_142",fl="_tabContent_rg6mx_155",xl="_bodyLabel_rg6mx_167",vl="_bodyHeader_rg6mx_171",yl="_diffSection_rg6mx_178",jl="_diffToggle_rg6mx_182",Cl="_diffIcon_rg6mx_188",bl="_reminderSelect_rg6mx_214",Nl="_diffHeaderRow_rg6mx_233",Sl="_diffSpaceRight_rg6mx_239",_l="_reminderFilterWrapper_rg6mx_243",wl="_reminderLabel_rg6mx_249",kl="_cacheTabContent_rg6mx_255",Tl="_userPromptList_rg6mx_260",Ml="_userPromptItem_rg6mx_266",El="_userPromptNavBtn_rg6mx_277",Rl="_cacheContent_rg6mx_288",Il="_cacheTokenBar_rg6mx_295",Ll="_cacheTokenWrite_rg6mx_305",Pl="_cacheTokenRead_rg6mx_309",Al="_cacheCopyIcon_rg6mx_313",Bl="_cacheScrollArea_rg6mx_320",Ol="_cacheSectionBlock_rg6mx_326",Dl="_cacheSectionHeader_rg6mx_330",$l="_cacheCollapseArrow_rg6mx_342",Fl="_cachePre_rg6mx_348",Hl="_cacheHighlightSvg_rg6mx_362",zl="_cachePreSystem_rg6mx_371",N={container:Ji,emptyState:Qi,urlSection:Xi,urlLeft:Yi,tokenStatsBox:Zi,tokenGrid:el,tokenRows:tl,tokenRow:sl,tokenRowBorder:al,tokenLabel:nl,tokenTd:ol,tokenHitRate:il,tokenHitRateLabel:ll,urlText:rl,metaText:cl,headersContainer:dl,headerRow:hl,headerKey:ul,headerValue:ml,streamingBox:pl,rawTextPre:gl,tabContent:fl,bodyLabel:xl,bodyHeader:vl,diffSection:yl,diffToggle:jl,diffIcon:Cl,reminderSelect:bl,diffHeaderRow:Nl,diffSpaceRight:Sl,reminderFilterWrapper:_l,reminderLabel:wl,cacheTabContent:kl,userPromptList:Tl,userPromptItem:Ml,userPromptNavBtn:El,cacheContent:Rl,cacheTokenBar:Il,cacheTokenWrite:Ll,cacheTokenRead:Pl,cacheCopyIcon:Al,cacheScrollArea:Bl,cacheSectionBlock:Ol,cacheSectionHeader:Dl,cacheCollapseArrow:$l,cachePre:Fl,cacheHighlightSvg:Hl,cachePreSystem:zl},{Text:pe,Paragraph:Vl}=cs;class ql extends U.Component{constructor(s){super(s),this.state={bodyViewMode:{request:"json",response:"json",diff:"json",codexRaw:"json"},diffExpanded:!1,requestHeadersExpanded:!1,responseHeadersExpanded:!1,reminderFilters:null,cacheHighlightIdx:null,cacheHighlightFading:!1,cacheCollapsed:{tools:!1,system:!1,messages:!1}}}_cacheUnbindScrollFade(){this._cacheOnScrollFade&&this._cacheScrollEl&&(this._cacheScrollEl.removeEventListener("scroll",this._cacheOnScrollFade),this._cacheOnScrollFade=null)}_cacheClearAllTimers(){clearTimeout(this._cacheScrollSettleTimer),clearTimeout(this._cacheFadeClearTimer),clearTimeout(this._cacheAutoFadeTimer),clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade(),this._cacheScrollEndHandler&&this._cacheScrollEl&&(this._cacheScrollEl.removeEventListener("scrollend",this._cacheScrollEndHandler),this._cacheScrollEndHandler=null)}componentWillUnmount(){this._cacheClearAllTimers()}_cacheBindScrollFade(){this._cacheUnbindScrollFade();const s=this._cacheScrollEl;s&&(this._cacheOnScrollFade=()=>{clearTimeout(this._cacheAutoFadeTimer),this.setState({cacheHighlightFading:!0}),this._cacheFadeClearTimer=setTimeout(()=>{this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1})},3e3),this._cacheUnbindScrollFade()},s.addEventListener("scroll",this._cacheOnScrollFade,{passive:!0}))}scrollToCacheMsg(s){if(this.state.cacheCollapsed.messages){this.setState(g=>({cacheCollapsed:{...g.cacheCollapsed,messages:!1}}),()=>this.scrollToCacheMsg(s));return}const t=this._cacheScrollEl;if(!t)return;const a=t.querySelector(`[data-msg-idx="${s}"]`);if(!a)return;clearTimeout(this._cacheScrollSettleTimer),clearTimeout(this._cacheFadeClearTimer),clearTimeout(this._cacheAutoFadeTimer),clearTimeout(this._cacheHighlightDelayTimer),this._cacheUnbindScrollFade(),this._cacheScrollEndHandler&&t.removeEventListener("scrollend",this._cacheScrollEndHandler),this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1});let r=!1,o=!1;const u=()=>{!r||!o||(this.setState({cacheHighlightIdx:s,cacheHighlightFading:!1}),this._cacheScrollSettleTimer=setTimeout(()=>this._cacheBindScrollFade(),200),this._cacheAutoFadeTimer=setTimeout(()=>{this.state.cacheHighlightIdx===s&&!this.state.cacheHighlightFading&&(this.setState({cacheHighlightFading:!0}),this._cacheFadeClearTimer=setTimeout(()=>{this.setState({cacheHighlightIdx:null,cacheHighlightFading:!1})},3e3),this._cacheUnbindScrollFade())},3e3))};this._cacheScrollEndHandler=()=>{t.removeEventListener("scrollend",this._cacheScrollEndHandler),r=!0,u()},t.addEventListener("scrollend",this._cacheScrollEndHandler,{once:!0}),this._cacheScrollSettleTimer=setTimeout(()=>{t.removeEventListener("scrollend",this._cacheScrollEndHandler),r=!0,u()},800),this._cacheHighlightDelayTimer=setTimeout(()=>{o=!0,u()},500),a.scrollIntoView({behavior:"smooth",block:"center"})}shouldComponentUpdate(s,t){if(s.request!==this.props.request){const r=Te(s.request);this.setState({diffExpanded:r&&!!s.expandDiff,requestHeadersExpanded:!1,responseHeadersExpanded:!1,reminderFilters:null}),this._cacheClearAllTimers()}const a=s.currentTab==="kv-cache-text";return s.request!==this.props.request||s.currentTab!==this.props.currentTab||s.onTabChange!==this.props.onTabChange||s.selectedIndex!==this.props.selectedIndex||s.expandDiff!==this.props.expandDiff||s.pendingCacheHighlight!==this.props.pendingCacheHighlight||t.bodyViewMode!==this.state.bodyViewMode||a&&t.cacheHighlightIdx!==this.state.cacheHighlightIdx||a&&t.cacheHighlightFading!==this.state.cacheHighlightFading||t.diffExpanded!==this.state.diffExpanded||t.requestHeadersExpanded!==this.state.requestHeadersExpanded||t.responseHeadersExpanded!==this.state.responseHeadersExpanded||t.reminderFilters!==this.state.reminderFilters||a&&t.cacheCollapsed!==this.state.cacheCollapsed}componentDidUpdate(s){const t=this.props.pendingCacheHighlight;t&&t!==s.pendingCacheHighlight&&setTimeout(()=>{var a,r;this.scrollToCacheMsg(t.msgIdx),(r=(a=this.props).onCacheHighlightDone)==null||r.call(a)},150)}toggleBodyViewMode(s){this.setState(t=>({bodyViewMode:{...t.bodyViewMode,[s]:t.bodyViewMode[s]==="json"?"text":"json"}}))}copyBody(s){var u;const{request:t}=this.props;if(!t)return;let a;if(s==="diff"?a=this._lastDiffResult:s==="codexRaw"?a=t._codexRawRequest:a=s==="request"?t.body:(u=t.response)==null?void 0:u.body,a==null)return;const r=typeof a=="object"?pt(a):a,o=typeof r=="string"?r:JSON.stringify(r,null,2);navigator.clipboard.writeText(o).then(()=>K.success(m("ui.copySuccess")))}renderHeaders(s){return!s||Object.keys(s).length===0?e.jsx(pe,{type:"secondary",children:m("ui.noHeaders")}):e.jsx("div",{className:N.headersContainer,children:Object.entries(s).map(([t,a])=>e.jsxs("div",{className:N.headerRow,children:[e.jsx(pe,{code:!0,className:N.headerKey,children:t}),t==="authorization"&&e.jsx(he,{doc:"TranslateContextPollution"}),e.jsx(pe,{type:"secondary",className:N.headerValue,children:String(a)})]},t))})}getRequestExpandNode(s,t){if(t!=="request"||!s||typeof s!="object")return;const{request:a,requests:r,selectedIndex:o}=this.props;if(!a)return;const u=r&&o!=null?r[o+1]:null,{type:g}=Qe(a,u);let i=null;if(this.state.reminderFilters==="claudeMd"&&Array.isArray(s.messages)){i=new Set,i.add(s.messages);for(const d of s.messages){if(!d||typeof d!="object")continue;const p=d.content;if(typeof p=="string")Ot(p)&&i.add(d);else if(Array.isArray(p)){let y=!1;for(const x of p)x&&x.type==="text"&&Ot(x.text)&&(i.add(x),y=!0);y&&(i.add(d),i.add(p))}}}let h=null;if(this.state.reminderFilters==="skills"&&Array.isArray(s.messages)){h=new Set,h.add(s.messages);for(const d of s.messages){if(!d||typeof d!="object")continue;const p=d.content;if(typeof p=="string")Dt(p)&&h.add(d);else if(Array.isArray(p)){let y=!1;for(const x of p)x&&x.type==="text"&&Dt(x.text)&&(h.add(x),y=!0);y&&(h.add(d),h.add(p))}}}const l=i||h;if(g==="Preflight"){const d=new Set,p=y=>{y&&typeof y=="object"&&(d.add(y),Array.isArray(y)?y.forEach(p):Object.values(y).forEach(p))};return Array.isArray(s.messages)&&p(s.messages),Array.isArray(s.system)&&s.system.length>=3&&p(s.system[2]),(y,x,j)=>!!(y<2||d.has(x)||l&&l.has(x)||y===1&&j==="system")}if(g==="MainAgent"&&Array.isArray(s.messages)&&s.messages.length===1){const d=s.messages[0],p=d&&Array.isArray(d.content)?d.content:null,y=p&&p.length>0?p[p.length-1]:null,x=new Set,j=f=>{f&&typeof f=="object"&&(x.add(f),Array.isArray(f)?f.forEach(j):Object.values(f).forEach(j))};return y&&j(y),x.add(s.messages),d&&typeof d=="object"&&x.add(d),p&&x.add(p),(f,C,w)=>!!(f<2||x.has(C)||l&&l.has(C))}if(l)return(d,p,y)=>!!(d<2||l.has(p))}renderBody(s,t){const{bodyViewMode:a}=this.state;if(s==null)return e.jsx(pe,{type:"secondary",children:m("ui.noBody")});if(typeof s=="string"&&s.includes("Streaming Response"))return e.jsx("div",{className:N.streamingBox,children:e.jsx(pe,{type:"secondary",children:m("ui.streamingResponse")})});const r=typeof s=="object"?pt(s):s,o=a[t]==="json",u=this.getRequestExpandNode(r,t);return e.jsx("div",{children:o?e.jsx(rt,{data:r,defaultExpand:t==="response"?"all":"root",expandNode:u}):e.jsx("pre",{className:N.rawTextPre,children:typeof r=="string"?r:JSON.stringify(r,null,2)})})}getPrevMainAgentRequest(){const{requests:s,selectedIndex:t}=this.props;if(!s||t==null)return null;for(let a=t-1;a>=0;a--)if(Te(s[a])){const r=s[a];return r._slimmed?$t(r,this.props.allRequests||s):r}return null}computeDiff(s,t){if(s==null||t==null||typeof s!="object"||typeof t!="object")return null;const a={},r=new Set([...Object.keys(s),...Object.keys(t)]);for(const o of r)if(!o.startsWith("_"))if(!(o in s))a[o]=t[o];else if(o in t){const u=JSON.stringify(s[o]),g=JSON.stringify(t[o]);u!==g&&(o==="messages"&&Array.isArray(s[o])&&Array.isArray(t[o])&&t[o].length>s[o].length?a[o]=t[o].slice(s[o].length):a[o]=t[o])}else continue;return Object.keys(a).length?a:null}render(){var y,x,j;let{request:s,currentTab:t,onTabChange:a}=this.props;if(!s)return e.jsx("div",{className:N.emptyState,children:e.jsx(Le,{description:"选择一个请求查看详情"})});s._slimmed&&(s=$t(s,this.props.allRequests||this.props.requests));const r=new Date(s.timestamp).toLocaleString("zh-CN"),o=s.response&&s.response.status<400;let u=null;if(Te(s)){const f=this.getPrevMainAgentRequest();if(f){const C=JSON.stringify(s.body).length,w=JSON.stringify(f.body).length;if(C<w)u=e.jsxs("div",{className:N.diffSection,children:[e.jsxs(pe,{strong:!0,className:N.diffToggle,onClick:()=>this.setState(M=>({diffExpanded:!M.diffExpanded})),children:["Body Diff JSON ",e.jsx(he,{doc:"BodyDiffJSON"})," ",this.state.diffExpanded?e.jsx(De,{className:N.diffIcon}):e.jsx($e,{className:N.diffIcon})]}),this.state.diffExpanded&&e.jsx(pe,{type:"secondary",children:m("ui.diffSessionChanged")})]});else{const M=pt(this.computeDiff(f.body,s.body));M&&(this._lastDiffResult=M,u=e.jsxs("div",{className:N.diffSection,children:[e.jsxs("div",{className:N.diffHeaderRow,children:[e.jsxs(pe,{strong:!0,className:N.diffToggle,onClick:()=>this.setState(_=>({diffExpanded:!_.diffExpanded})),children:["Body Diff JSON ",e.jsx(he,{doc:"BodyDiffJSON"})," ",this.state.diffExpanded?e.jsx(De,{className:N.diffIcon}):e.jsx($e,{className:N.diffIcon})]}),this.state.diffExpanded&&e.jsxs(Be,{size:"small",className:N.diffSpaceRight,children:[e.jsx(F,{size:"small",icon:this.state.bodyViewMode.diff==="json"?e.jsx(Ke,{}):e.jsx(Ge,{}),onClick:()=>this.toggleBodyViewMode("diff"),children:this.state.bodyViewMode.diff==="json"?"Text":"JSON"}),e.jsx(F,{size:"small",icon:e.jsx(Ie,{}),onClick:()=>this.copyBody("diff"),children:m("ui.copy")})]})]}),this.state.diffExpanded&&e.jsx(e.Fragment,{children:this.state.bodyViewMode.diff==="json"?e.jsx(rt,{data:M,defaultExpand:"all"}):e.jsx("pre",{className:N.rawTextPre,children:JSON.stringify(M,null,2)})})]}))}}}const g=Ma(s.body),i=Ea(s.body),h=s._codexRawRequest,l=[{key:"request",label:"Request",children:e.jsxs("div",{className:N.tabContent,children:[e.jsxs("div",{className:N.diffSection,children:[e.jsxs(pe,{strong:!0,className:N.diffToggle,onClick:()=>this.setState(f=>({requestHeadersExpanded:!f.requestHeadersExpanded})),children:["Headers ",this.state.requestHeadersExpanded?e.jsx(De,{className:N.diffIcon}):e.jsx($e,{className:N.diffIcon})]}),this.state.requestHeadersExpanded&&this.renderHeaders(s.headers)]}),u,e.jsxs("div",{children:[e.jsxs("div",{className:N.bodyHeader,children:[e.jsxs(pe,{strong:!0,className:N.bodyLabel,children:["Body",e.jsx(he,{doc:"BodyFields"})]}),e.jsxs(Be,{size:"small",children:[(g||i)&&e.jsxs("span",{className:N.reminderFilterWrapper,children:[e.jsx("span",{className:N.reminderLabel,children:"system-reminder:"}),e.jsx(Ae,{size:"small",className:N.reminderSelect,placeholder:"filter",value:this.state.reminderFilters||void 0,onChange:f=>this.setState({reminderFilters:f||null}),options:[{label:"CLAUDE.md",value:"claudeMd",disabled:!g},{label:"Skills",value:"skills",disabled:!i}],popupMatchSelectWidth:!1,allowClear:!0})]}),e.jsx(F,{size:"small",icon:this.state.bodyViewMode.request==="json"?e.jsx(Ke,{}):e.jsx(Ge,{}),onClick:()=>this.toggleBodyViewMode("request"),children:this.state.bodyViewMode.request==="json"?"Text":"JSON"}),e.jsx(F,{size:"small",icon:e.jsx(Ie,{}),onClick:()=>this.copyBody("request"),children:m("ui.copy")})]})]}),this.renderBody(s.body,"request")]})]})},{key:"response",label:"Response",children:e.jsx("div",{className:N.tabContent,children:s.response?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:N.diffSection,children:[e.jsxs(pe,{strong:!0,className:N.diffToggle,onClick:()=>this.setState(f=>({responseHeadersExpanded:!f.responseHeadersExpanded})),children:["Headers ",this.state.responseHeadersExpanded?e.jsx(De,{className:N.diffIcon}):e.jsx($e,{className:N.diffIcon})]}),this.state.responseHeadersExpanded&&this.renderHeaders(s.response.headers)]}),e.jsxs("div",{children:[e.jsxs("div",{className:N.bodyHeader,children:[e.jsxs(pe,{strong:!0,className:N.bodyLabel,children:["Body",e.jsx(he,{doc:"ResponseFields"})]}),e.jsxs(Be,{size:"small",children:[e.jsx(F,{size:"small",icon:this.state.bodyViewMode.response==="json"?e.jsx(Ke,{}):e.jsx(Ge,{}),onClick:()=>this.toggleBodyViewMode("response"),children:this.state.bodyViewMode.response==="json"?"Text":"JSON"}),e.jsx(F,{size:"small",icon:e.jsx(Ie,{}),onClick:()=>this.copyBody("response"),children:m("ui.copy")})]})]}),this.renderBody(s.response.body,"response")]})]}):e.jsx(Le,{description:m("ui.responseNotCaptured")})})},{key:"codex-raw",label:"Codex Raw",children:e.jsx("div",{className:N.tabContent,children:e.jsxs("div",{children:[e.jsxs("div",{className:N.bodyHeader,children:[e.jsx(pe,{strong:!0,className:N.bodyLabel,children:"Body"}),e.jsxs(Be,{size:"small",children:[e.jsx(F,{size:"small",icon:this.state.bodyViewMode.codexRaw==="json"?e.jsx(Ke,{}):e.jsx(Ge,{}),onClick:()=>this.toggleBodyViewMode("codexRaw"),children:this.state.bodyViewMode.codexRaw==="json"?"Text":"JSON"}),e.jsx(F,{size:"small",icon:e.jsx(Ie,{}),onClick:()=>this.copyBody("codexRaw"),disabled:!h,children:m("ui.copy")})]})]}),h&&Object.keys(h).length>0?this.renderBody(h,"codexRaw"):e.jsx(Le,{description:"No raw Codex request captured"})]})})},{key:"kv-cache-text",label:e.jsxs("span",{children:["KV-Cache-Text ",e.jsx(he,{doc:"KVCacheContent"})]}),children:e.jsx("div",{className:`${N.tabContent} ${N.cacheTabContent}`,children:(()=>{const f=ns([s]),C=s.timestamp+"|"+s.url;if(f&&(f.cacheCreateTokens>0||f.cacheReadTokens>0)&&(this._lastCachedTokensKey=C,this._lastCachedTokens={cacheCreateTokens:f.cacheCreateTokens,cacheReadTokens:f.cacheReadTokens}),!f||f.system.length===0&&f.messages.length===0&&f.tools.length===0)return e.jsx(Le,{description:m("ui.noCachedContent"),image:Le.PRESENTED_IMAGE_SIMPLE});const w=()=>{const _=[];return f.tools.length>0&&(_.push(`=== ${m("ui.tools")} ===`),f.tools.forEach(T=>_.push(T))),f.system.length>0&&(_.push(`
|
|
34
|
+
=== ${m("ui.systemPrompt")} ===`),f.system.forEach(T=>_.push(T))),f.messages.length>0&&(_.push(`
|
|
35
|
+
=== ${m("ui.messages")} ===`),f.messages.forEach(T=>_.push(T))),_.join(`
|
|
36
|
+
|
|
37
|
+
`)},S=f.messages.map((_,T)=>({text:_,msgIdx:T})).filter(({text:_})=>_.startsWith("[user]")).map(({text:_,msgIdx:T})=>{const I=_.replace(/^\[user\]\s*/,"").trim();return!I||Je(I)?{cleaned:"",msgIdx:T}:{cleaned:it.parseSegments(I).filter(P=>P.type==="text").map(P=>P.content.trim()).filter(P=>P&&!Je(P)).join(" ").trim(),msgIdx:T}}).filter(({cleaned:_})=>!(!_||/Implement the following plan:/i.test(_))),M=S.length>0?e.jsx("div",{className:N.userPromptList,children:S.map(({cleaned:_,msgIdx:T})=>e.jsx("div",{className:N.userPromptItem,onMouseEnter:I=>{I.currentTarget.style.background="var(--color-primary-bg-lighter)",I.currentTarget.style.color="var(--text-white)"},onMouseLeave:I=>{I.currentTarget.style.background="",I.currentTarget.style.color="var(--text-secondary)"},onClick:()=>this.scrollToCacheMsg(T),children:_},T))}):null;return e.jsxs("div",{className:N.cacheContent,children:[(()=>{const T=f.cacheCreateTokens>0||f.cacheReadTokens>0?f:this._lastCachedTokensKey===C?this._lastCachedTokens:null;return T||M?e.jsxs("div",{className:N.cacheTokenBar,children:[T&&e.jsxs(e.Fragment,{children:[m("ui.tokens"),": ",e.jsxs("span",{className:N.cacheTokenWrite,children:["write ",G(T.cacheCreateTokens)]})," / ",e.jsxs("span",{className:N.cacheTokenRead,children:["read ",G(T.cacheReadTokens)]}),e.jsx(rs,{title:m("ui.copyAllCacheText"),children:e.jsx(Ie,{className:N.cacheCopyIcon,onClick:()=>{navigator.clipboard.writeText(w()).then(()=>{K.success(m("ui.copied"))}).catch(()=>{})}})})]}),M&&e.jsx(qe,{content:M,trigger:"hover",placement:"left",children:e.jsx("span",{className:N.userPromptNavBtn,children:m("ui.userPromptNav")})})]}):null})(),e.jsxs("div",{className:N.cacheScrollArea,ref:_=>{this._cacheScrollEl=_},children:[f.tools.length>0&&e.jsxs("div",{className:N.cacheSectionBlock,children:[e.jsxs("div",{className:N.cacheSectionHeader,onClick:()=>this.setState(_=>({cacheCollapsed:{..._.cacheCollapsed,tools:!_.cacheCollapsed.tools}})),children:[e.jsx("span",{className:N.cacheCollapseArrow,style:{transform:this.state.cacheCollapsed.tools?"rotate(-90deg)":"rotate(0deg)"},children:"▼"}),m("ui.tools")," (",f.tools.length,")"]}),!this.state.cacheCollapsed.tools&&f.tools.map((_,T)=>e.jsx("pre",{className:N.cachePre,children:_},T))]}),f.system.length>0&&e.jsxs("div",{className:N.cacheSectionBlock,children:[e.jsxs("div",{className:N.cacheSectionHeader,onClick:()=>this.setState(_=>({cacheCollapsed:{..._.cacheCollapsed,system:!_.cacheCollapsed.system}})),children:[e.jsx("span",{className:N.cacheCollapseArrow,style:{transform:this.state.cacheCollapsed.system?"rotate(-90deg)":"rotate(0deg)"},children:"▼"}),m("ui.systemPrompt")," (",f.system.length,")"]}),!this.state.cacheCollapsed.system&&f.system.map((_,T)=>e.jsx("pre",{className:N.cachePreSystem,children:_},T))]}),f.messages.length>0&&e.jsxs("div",{className:N.cacheSectionBlock,children:[e.jsxs("div",{className:N.cacheSectionHeader,onClick:()=>this.setState(_=>({cacheCollapsed:{..._.cacheCollapsed,messages:!_.cacheCollapsed.messages}})),children:[e.jsx("span",{className:N.cacheCollapseArrow,style:{transform:this.state.cacheCollapsed.messages?"rotate(-90deg)":"rotate(0deg)"},children:"▼"}),m("ui.messages")," (",f.messages.length,")"]}),!this.state.cacheCollapsed.messages&&f.messages.map((_,T)=>{const I=T===this.state.cacheHighlightIdx,L=I?this.state.cacheHighlightFading?{boxShadow:"0 0 10px rgba(22,104,220,0)",transition:"box-shadow 3s ease-out",position:"relative"}:{boxShadow:"0 0 10px rgba(22,104,220,0.6)",transition:"box-shadow 0.2s ease-in",position:"relative"}:{};return e.jsxs("pre",{"data-msg-idx":T,className:N.cachePre,style:L,children:[I&&e.jsx("svg",{className:N.cacheHighlightSvg,style:{opacity:this.state.cacheHighlightFading?0:1,transition:this.state.cacheHighlightFading?"opacity 3s ease-out":void 0},preserveAspectRatio:"none",children:e.jsx("rect",{x:"0.5",y:"0.5",width:"calc(100% - 1px)",height:"calc(100% - 1px)",rx:"4",ry:"4",fill:"none",stroke:"#1668dc",strokeWidth:"1",strokeDasharray:"6 4",children:e.jsx("animate",{attributeName:"stroke-dashoffset",from:"0",to:"-100",dur:"4s",repeatCount:"indefinite"})})}),_]},T)})]})]})]})})()})},{key:"context",label:"Context",children:e.jsx("div",{className:`${N.tabContent} ${N.cacheTabContent}`,children:e.jsx(Gi,{body:s.body,response:(y=s.response)==null?void 0:y.body})})}],d=(j=(x=s.response)==null?void 0:x.body)==null?void 0:j.usage,p=d?(()=>{const f=d.input_tokens||0,C=d.output_tokens||0,w=d.cache_creation_input_tokens||0,S=d.cache_read_input_tokens||0,M=f+w+S,_=M>0?(S/M*100).toFixed(1):"0.0";return{input:f,output:C,cacheCreate:w,cacheRead:S,hitRate:_}})():null;return e.jsxs("div",{className:N.container,children:[e.jsxs("div",{className:N.urlSection,children:[e.jsxs("div",{className:N.urlLeft,children:[e.jsx(Vl,{className:N.urlText,ellipsis:{rows:2,expandable:!0},children:s.url}),e.jsxs(Be,{size:"small",wrap:!0,children:[e.jsx(Ce,{color:s.method==="POST"?"blue":"green",children:s.method}),e.jsxs(pe,{type:"secondary",className:N.metaText,children:["🕐 ",r]}),s.duration&&e.jsxs(pe,{type:"secondary",className:N.metaText,children:["⏱️ ",s.duration,"ms"]}),s.response&&e.jsxs(Ce,{color:o?"success":"error",children:["HTTP ",s.response.status]})]})]}),p&&e.jsx("div",{className:N.tokenStatsBox,children:e.jsxs("div",{className:N.tokenGrid,children:[e.jsxs("div",{className:N.tokenRows,children:[e.jsxs("div",{className:N.tokenRow,children:[e.jsx("span",{className:N.tokenLabel,children:"Token"}),e.jsxs("span",{className:N.tokenTd,children:["input: ",G(p.input)]}),e.jsxs("span",{className:N.tokenTd,children:["output: ",G(p.output)]})]}),e.jsxs("div",{className:`${N.tokenRow} ${N.tokenRowBorder}`,children:[e.jsx("span",{className:N.tokenLabel,children:"Cache"}),e.jsxs("span",{className:N.tokenTd,children:["create: ",G(p.cacheCreate)]}),e.jsxs("span",{className:N.tokenTd,children:["read: ",G(p.cacheRead)]})]})]}),e.jsxs("div",{className:N.tokenHitRate,children:[e.jsxs("div",{children:[p.hitRate,"%"]}),e.jsx("div",{className:N.tokenHitRateLabel,children:m("ui.hitRate")})]})]})})]}),e.jsx(is,{activeKey:t,onChange:a,items:l,size:"small"})]})}}const Ul="_resizer_pzn4b_1",Wl={resizer:Ul};class Kl extends U.Component{constructor(s){super(s),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this)}handleMouseDown(s){s.preventDefault(),document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}handleMouseMove(s){this.props.onResize&&this.props.onResize(s.clientX)}handleMouseUp(){document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}componentWillUnmount(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}render(){return e.jsx("div",{onMouseDown:this.handleMouseDown,className:Wl.resizer})}}class Zl extends Ra{constructor(t){super(t);B(this,"handleClearRequests",()=>{je.confirm({title:m("ui.clearRequests"),content:m("ui.clearRequestsConfirm"),okText:m("ui.confirm"),cancelText:m("ui.cancel"),okButtonProps:{danger:!0},onOk:()=>{fetch(de("/api/clear-current-log"),{method:"POST"}).catch(()=>{}),this.setState({requests:[],selectedIndex:null,mainAgentSessions:[],sessionIndex:[]}),this._requestIndexMap.clear(),this._cacheLossMap=new Map,this._cacheLossProcessedCount=0,this._cacheLossLastMainAgent=null,this._lastKvCacheContent=null,this._sseSlimmer=null,this._sseReconstructor=null}})});B(this,"handleViewRequest",t=>{this.setState({viewMode:"raw",selectedIndex:t,scrollCenter:!0})});B(this,"handleViewInChat",()=>{this.setState(t=>{const r=(t.showAll?t.requests:Ze(t.requests))[t.selectedIndex];if(!r)return null;let o=null;if(Te(r)&&r.timestamp)o=r.timestamp;else{const u=Qe(r);if((u.type==="SubAgent"||u.type==="Teammate")&&r.timestamp)o=r.timestamp;else{const g=t.requests.indexOf(r);g>=0&&(o=Ft(t.requests,g))}o||K.info(m("ui.cannotMap"))}return{viewMode:"chat",chatScrollToTs:o}})});B(this,"handleToggleViewMode",()=>{this.setState(t=>{const a=t.viewMode==="raw"?"chat":"raw";if(a==="raw"){if(t.selectedIndex===null){const u=t.showAll?t.requests:Ze(t.requests);return{viewMode:a,selectedIndex:u.length>0?u.length-1:null,scrollCenter:!0}}return{viewMode:a,scrollCenter:!0}}const r=t.showAll?t.requests:Ze(t.requests),o=t.selectedIndex!=null?r[t.selectedIndex]:null;if(o){let u=null;if(Te(o)&&o.timestamp)u=o.timestamp;else{const g=Qe(o);if((g.type==="SubAgent"||g.type==="Teammate")&&o.timestamp)u=o.timestamp;else{const i=t.requests.indexOf(o);i>=0&&(u=Ft(t.requests,i)),u||K.info(m("ui.cannotMap"))}}return{viewMode:a,chatScrollToTs:u}}return{viewMode:a,chatScrollToTs:null}},()=>{this.state.viewMode==="chat"&&this.state.terminalVisible&&this.state.cliMode&&!Ds&&requestAnimationFrame(()=>{const t=document.querySelector(".xterm-helper-textarea");t&&t.focus()})})});B(this,"handleTabChange",t=>{this.setState({currentTab:t})});B(this,"handleCacheHighlightDone",()=>{this.setState({pendingCacheHighlight:null})});B(this,"handleNavigateCacheMsg",t=>{const a=this.state.showAll?this.state.requests:Ze(this.state.requests);let r=-1;for(let o=a.length-1;o>=0;o--)if(Te(a[o])){r=o;break}r<0||this.setState({selectedIndex:r,scrollCenter:!0,currentTab:"kv-cache-text",pendingCacheHighlight:{msgIdx:t,key:Date.now()}})});B(this,"handleResize",t=>{const a=this.mainContainerRef.current;if(!a)return;const r=a.getBoundingClientRect(),o=t-r.left;o>=250&&o<=800&&this.setState({leftPanelWidth:o})});B(this,"handleLoadLocalJsonlFile",()=>{const t=document.createElement("input");t.type="file",t.accept=".jsonl",t.multiple=!0,t.onchange=a=>{const r=Array.from(a.target.files);if(r.length===0)return;if(r.reduce((h,l)=>h+l.size,0)>500*1024*1024){K.error(m("ui.fileTooLarge"));return}this.setState({fileLoading:!0,fileLoadingCount:0});let u=0;const g=[],i=[];r.forEach(h=>{const l=new FileReader;l.onload=d=>{try{const y=d.target.result.split(`
|
|
38
|
+
---
|
|
39
|
+
`).filter(x=>x.trim()).map(x=>{try{return JSON.parse(x)}catch{return null}}).filter(Boolean);g.push(...y),i.push(h.name)}catch{}u++,u===r.length&&this._finishLocalLoad(g,i)},l.readAsText(h)})},t.click()});B(this,"_processJsonlFiles",t=>{if(!t||t.length===0)return;if(t.reduce((g,i)=>g+i.size,0)>500*1024*1024){K.error(m("ui.fileTooLarge"));return}this.setState({fileLoading:!0,fileLoadingCount:0});let r=0;const o=[],u=[];t.forEach(g=>{const i=new FileReader;i.onload=h=>{try{const d=h.target.result.split(`
|
|
40
|
+
---
|
|
41
|
+
`).filter(p=>p.trim()).map(p=>{try{return JSON.parse(p)}catch{return null}}).filter(Boolean);o.push(...d),u.push(g.name)}catch{}r++,r===t.length&&this._finishLocalLoad(o,u)},i.readAsText(g)})});B(this,"_isInternalDrag",t=>t.dataTransfer.types.includes("text/x-preset-reorder"));B(this,"_onDragOver",t=>{if(t.preventDefault(),this._isInternalDrag(t))return;if(t.target.closest&&t.target.closest("[data-file-explorer]")){this.state.isDragging&&this.setState({isDragging:!1});return}this.state.isDragging||this.setState({isDragging:!0})});B(this,"_onDragLeave",t=>{const a=this._layoutRef.current;a&&!a.contains(t.relatedTarget)&&this.setState({isDragging:!1})});B(this,"_onDrop",t=>{if(t.preventDefault(),this._isInternalDrag(t))return;this.setState({isDragging:!1});const a=Array.from(t.dataTransfer.files);a.length&&Promise.all(a.map(r=>Ia(r).then(o=>({name:r.name,path:o})).catch(o=>(K.error(`${r.name}: ${o.message}`),null)))).then(r=>{const o=r.filter(Boolean).map(u=>`"${u.path}"`);o.length>0&&this.setState(u=>({pendingUploadPaths:[...u.pendingUploadPaths||[],...o]}))})});B(this,"handleUploadPathsConsumed",()=>{this.setState({pendingUploadPaths:[]})});Object.assign(this.state,{leftPanelWidth:380,terminalVisible:!0,currentTab:"context",pendingCacheHighlight:null})}render(){const{filteredRequests:t,selectedRequest:a,fileLoading:r,fileLoadingCount:o,mainAgentSessions:u,viewMode:g}=this.renderPrepare(),{selectedIndex:i,leftPanelWidth:h,currentTab:l}=this.state;return this.state.workspaceMode?this.renderWorkspaceMode():e.jsxs(La,{theme:this.themeConfig,children:[r&&e.jsx("div",{className:R.loadingOverlay,children:e.jsxs("div",{className:R.loadingText,children:["Loading...(",o,")"]})}),this.state.isDragging&&e.jsx("div",{className:R.dragOverlay,children:e.jsxs("div",{className:R.dragOverlayContent,children:[e.jsx(Xt,{className:R.dragIcon}),e.jsx("p",{children:m("ui.dragDropHint")})]})}),e.jsxs(Pe,{className:R.layout,ref:this._layoutRef,onDragOver:this._onDragOver,onDragLeave:this._onDragLeave,onDrop:this._onDrop,children:[e.jsx(Pe.Header,{className:R.header,children:e.jsx(it,{requestCount:t.length,requests:t,viewMode:g,cacheExpireAt:this.state.cacheExpireAt,cacheType:this.state.cacheType,onToggleViewMode:this.handleToggleViewMode,onLangChange:this.handleLangChange,onImportLocalLogs:this.handleImportLocalLogs,isLocalLog:!!this._isLocalLog,localLogFile:this._localLogFile,projectName:this.state.projectName,collapseToolResults:this.state.collapseToolResults,onCollapseToolResultsChange:this.handleCollapseToolResultsChange,expandThinking:this.state.expandThinking,onExpandThinkingChange:this.handleExpandThinkingChange,showFullToolContent:this.state.showFullToolContent,onShowFullToolContentChange:this.handleShowFullToolContentChange,expandDiff:this.state.expandDiff,onExpandDiffChange:this.handleExpandDiffChange,filterIrrelevant:!this.state.showAll,onFilterIrrelevantChange:this.handleFilterIrrelevantChange,logDir:this.state.logDir,onLogDirChange:this.handleLogDirChange,updateInfo:this.state.updateInfo,onDismissUpdate:()=>this.setState({updateInfo:null}),cliMode:this.state.cliMode,sdkMode:this.state.sdkMode,terminalVisible:this.state.sdkMode?!1:this.state.terminalVisible,onToggleTerminal:()=>this.setState(d=>({terminalVisible:!d.terminalVisible})),onReturnToWorkspaces:this.state.cliMode?this.handleReturnToWorkspaces:null,contextWindow:this.state.contextWindow,onNavigateCacheMsg:this.handleNavigateCacheMsg,serverCachedContent:this.state.serverCachedContent||this._lastKvCacheContent,resumeAutoChoice:this.state.resumeAutoChoice,onResumeAutoChoiceToggle:this.handleResumeAutoChoiceToggle,onResumeAutoChoiceChange:this.handleResumeAutoChoiceChange,themeColor:this.state.themeColor,onThemeColorChange:this.handleThemeColorChange,autoApproveSeconds:this.state.autoApproveSeconds,onAutoApproveChange:this.handleAutoApproveChange,proxyProfiles:this.state.proxyProfiles,activeProxyId:this.state.activeProxyId,defaultConfig:this.state.defaultConfig,onProxyProfileChange:this.handleProxyProfileChange})}),this.state.codexMissing&&e.jsx(us,{type:"warning",showIcon:!0,banner:!0,message:m("ui.codexMissing.title"),description:e.jsxs("span",{children:[m("ui.codexMissing.desc"),e.jsx("br",{}),e.jsx("code",{style:{background:"var(--bg-code)",padding:"2px 6px",borderRadius:3},children:"npm install -g codex"})," ",e.jsx("span",{style:{color:"var(--text-muted)",margin:"0 4px"},children:m("ui.codexMissing.or")})," ",e.jsx("a",{href:"https://openai.com/codex",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--color-primary-light)"},children:m("ui.codexMissing.native")})]})}),e.jsxs(Pe.Content,{className:R.content,children:[g==="raw"&&(t.length===0?e.jsx("div",{className:R.guideContainer,children:e.jsxs("div",{className:R.guideContent,children:[e.jsx("h2",{className:R.guideTitle,children:m("ui.guide.title")}),e.jsxs("div",{className:R.guideStep,children:[e.jsx("div",{className:R.guideStepNum,children:"1"}),e.jsxs("div",{className:R.guideStepBody,children:[e.jsx("p",{className:R.guideText,children:m("ui.guide.step1")}),e.jsx("code",{className:R.guideCode,children:m("ui.guide.exampleQuestion")})]})]}),e.jsxs("div",{className:R.guideStep,children:[e.jsx("div",{className:R.guideStepNum,children:"2"}),e.jsxs("div",{className:R.guideStepBody,children:[e.jsx("p",{className:R.guideText,children:m("ui.guide.step2")}),e.jsx("code",{className:R.guideCode,children:m("ui.guide.troubleshootCmd")})]})]}),e.jsxs("div",{className:R.guideStep,children:[e.jsx("div",{className:R.guideStepNum,children:"3"}),e.jsxs("div",{className:R.guideStepBody,children:[e.jsx("p",{className:R.guideText,children:m("ui.guide.step3")}),e.jsx("code",{className:R.guideCode,children:"npm install -g codex"})]})]})]})}):e.jsxs("div",{ref:this.mainContainerRef,className:R.mainContainer,children:[e.jsxs("div",{className:R.leftPanel,style:{width:h},children:[e.jsxs("div",{className:R.leftPanelHeader,children:[e.jsx("span",{children:m("ui.requestList")}),e.jsx("span",{className:R.leftPanelCount,children:m("ui.totalRequests",{count:t.length})}),e.jsx(nt,{className:R.leftPanelClear,title:m("ui.clearRequests"),onClick:this.handleClearRequests})]}),e.jsx("div",{className:R.leftPanelBody,children:e.jsx(Co,{requests:t,selectedIndex:i,scrollCenter:this.state.scrollCenter,onSelect:this.handleSelectRequest,onScrollDone:this.handleScrollDone,cacheLossMap:this._cacheLossMap})})]}),e.jsx(Kl,{onResize:this.handleResize}),e.jsx("div",{className:R.rightPanel,children:e.jsx(ql,{request:a,requests:t,allRequests:this.state.requests,selectedIndex:i,currentTab:l,onTabChange:this.handleTabChange,onViewInChat:this.handleViewInChat,expandDiff:this.state.expandDiff,pendingCacheHighlight:this.state.pendingCacheHighlight,onCacheHighlightDone:this.handleCacheHighlightDone})})]})),e.jsx("div",{className:R.chatViewWrapper,style:{display:g==="chat"?"flex":"none"},children:e.jsx(Pa,{requests:this.state.requests,mainAgentSessions:u,userProfile:this.state.userProfile,collapseToolResults:this.state.collapseToolResults,expandThinking:this.state.expandThinking,showFullToolContent:this.state.showFullToolContent,showThinkingSummaries:this.state.showThinkingSummaries,onViewRequest:this.handleViewRequest,scrollToTimestamp:this.state.chatScrollToTs,onScrollTsDone:this.handleScrollTsDone,cliMode:this._isLocalLog?!1:this.state.cliMode,sdkMode:this._isLocalLog?!1:this.state.sdkMode,chatVisible:g==="chat",terminalVisible:this._isLocalLog||this.state.sdkMode?!1:this.state.terminalVisible,onToggleTerminal:()=>this.setState(d=>({terminalVisible:!d.terminalVisible})),pendingUploadPaths:this.state.pendingUploadPaths,onUploadPathsConsumed:this.handleUploadPathsConsumed,fileLoading:this.state.fileLoading,isStreaming:this.state.isStreaming,hasMoreHistory:this.state.hasMoreHistory,loadingMore:this.state.loadingMore,onLoadMoreHistory:()=>this.loadMoreHistory(),loadingSessionId:this.state.loadingSessionId,onLoadSession:d=>this.loadSession(d),lang:this.state.lang,autoApproveSeconds:this.state.autoApproveSeconds,onAutoApproveChange:this.handleAutoApproveChange})})]}),e.jsx("div",{className:R.footer,children:e.jsxs("div",{className:R.footerRight,children:[e.jsxs("a",{href:"https://github.com/weiesky/cc-viewer",target:"_blank",rel:"noopener noreferrer",className:R.footerLink,children:[e.jsx("svg",{className:R.footerIcon,viewBox:"0 0 16 16",fill:"currentColor",children:e.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"})}),"GitHub",this.state.githubStars!=null?` ★ ${this.state.githubStars}`:""]}),e.jsx("span",{className:R.footerSep,children:"|"}),e.jsxs("span",{className:`${R.footerVersion}${this.state.updateInfo?` ${R.footerVersionNew}`:""}`,onClick:()=>this.setState({updateModalVisible:!0}),style:{cursor:"pointer"},children:["v","1.0.1",this.state.updateInfo&&e.jsxs("svg",{className:R.newBadge,width:"28",height:"12",viewBox:"0 0 28 12",children:[e.jsx("rect",{width:"28",height:"12",rx:"3",fill:"currentColor",opacity:"0.25"}),e.jsx("text",{x:"14",y:"9",textAnchor:"middle",fill:"currentColor",fontSize:"8",fontWeight:"600",fontFamily:"system-ui",children:"NEW"})]})]})]})})]}),e.jsx(je,{title:m("ui.update.title"),open:this.state.updateModalVisible,onCancel:()=>this.setState({updateModalVisible:!1}),footer:null,width:480,children:e.jsxs("div",{style:{lineHeight:1.8},children:[e.jsxs("p",{children:[e.jsxs("strong",{children:[m("ui.update.current"),":"]})," v","1.0.1"]}),this.state.updateInfo&&e.jsxs("p",{children:[e.jsxs("strong",{children:[m("ui.update.latest"),":"]})," v",this.state.updateInfo.version]}),e.jsx("p",{style:{marginTop:12},children:e.jsx("strong",{children:m("ui.update.npm")})}),e.jsx("code",{style:{display:"block",background:"var(--bg-code)",padding:"8px 12px",borderRadius:6,fontSize:13},children:"npm update -g cc-viewer"}),typeof window<"u"&&window.electronAPI&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{marginTop:16},children:e.jsx("strong",{children:m("ui.update.electron")})}),e.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:13},children:m("ui.update.electronDesc")}),e.jsxs("ol",{style:{color:"var(--text-tertiary)",fontSize:13,paddingLeft:20,margin:"6px 0"},children:[e.jsx("li",{children:m("ui.update.step1")}),e.jsx("li",{children:m("ui.update.step2")}),e.jsx("li",{children:m("ui.update.step3")})]})]}),e.jsx("div",{style:{marginTop:16,textAlign:"right"},children:e.jsx(F,{type:"primary",href:"https://github.com/weiesky/cc-viewer/releases",target:"_blank",rel:"noopener noreferrer",children:m("ui.update.goReleases")})})]})}),e.jsx(je,{title:m("ui.resume.title"),open:this.state.resumeModalVisible,closable:!1,maskClosable:!1,keyboard:!1,footer:e.jsxs("div",{children:[e.jsxs("div",{className:R.resumeFooterRight,children:[e.jsx(F,{type:"primary",onClick:()=>this.handleResumeChoice("continue"),className:R.btnMarginRight,children:m("ui.resume.continue")},"continue"),e.jsx(F,{onClick:()=>this.handleResumeChoice("new"),children:m("ui.resume.new")},"new")]}),e.jsx("div",{className:R.resumeFooterLeft,children:e.jsx(Aa,{checked:this.state.resumeRememberChoice,onChange:d=>this.setState({resumeRememberChoice:d.target.checked}),className:R.resumeCheckboxOpacity,children:e.jsx("span",{className:R.resumeCheckboxOpacity,children:m("ui.resume.remember")})})})]}),children:e.jsx("p",{children:m("ui.resume.message",{file:this.state.resumeFileName})})}),e.jsxs(je,{title:e.jsxs("span",{className:R.modalTitleInline,children:[e.jsx(ls,{apiEndpoint:de("/api/open-log-dir"),title:m("ui.openLogDir"),size:16}),m("ui.importLocalLogs")]}),open:this.state.importModalVisible,onCancel:this.handleCloseImportModal,footer:null,width:1e3,styles:{body:{overflow:"hidden"}},children:[e.jsxs("div",{className:R.modalActions,children:[this.renderLogProjectSelector(!1),e.jsx(F,{icon:e.jsx(Xt,{}),onClick:this.handleLoadLocalJsonlFile,children:m("ui.loadLocalJsonl")}),e.jsx(F,{size:"small",type:this.state.selectedLogs.size>1?"primary":"default",disabled:this.state.selectedLogs.size<2,onClick:this.handleMergeLogs,className:R.btnMarginLeft,children:m("ui.mergeLogs")}),e.jsx(F,{size:"small",danger:!0,icon:e.jsx(nt,{}),disabled:this.state.selectedLogs.size===0,onClick:this.handleDeleteLogs,className:R.btnMarginLeft,children:m("ui.deleteLogs")}),e.jsx(F,{size:"small",icon:e.jsx(yt,{spin:this.state.refreshingStats}),loading:this.state.refreshingStats,onClick:this.handleRefreshStats,className:R.btnMarginLeft,children:m("ui.refreshStats")})]}),this.state.localLogsLoading?e.jsx("div",{className:R.spinCenter,children:e.jsx(os,{})}):(()=>{const d=this.state.localLogs[this.state.currentProject];return!d||d.length===0?e.jsx("div",{className:R.emptyCenter,children:m("ui.noLogs")}):e.jsx("div",{className:R.logListContainer,children:this.renderLogTable(d,!1)})})()]})]})}}export{Zl as default};
|